Archer atree

This commit is contained in:
hppeng 2022-07-01 01:23:06 -07:00
parent 4632bba69a
commit fac2c54da9
5 changed files with 834 additions and 5997 deletions

View file

@ -55,7 +55,8 @@ convert_spell_conv: {
} }
raw_stat: { raw_stat: {
type: "raw_stat" type: "raw_stat"
toggle: Optional[bool] // default: false toggle: Optional[bool | str] // default: false; true means create anon. toggle,
// string value means bind to (or create) named button
bonuses: List[stat_bonus] bonuses: List[stat_bonus]
} }
stat_bonus: { stat_bonus: {
@ -443,24 +444,25 @@ const atree_collect_spells = new (class extends ComputeNode {
for (const [abil_id, abil] of atree_merged.entries()) { for (const [abil_id, abil] of atree_merged.entries()) {
// TODO: Possibly, make a better way for detecting "spell abilities"? // TODO: Possibly, make a better way for detecting "spell abilities"?
if (abil.effects.length == 0) { continue; } if (abil.effects.length == 0) { continue; }
let ret_spell = deepcopy(abil.effects[0]); // NOTE: do not mutate results of previous steps!
let has_spell_def = false; let has_spell_def = false;
for (const effect of abil.effects) { for (const effect of abil.effects) {
if (effect.type === 'replace_spell') { if (effect.type === 'replace_spell') {
has_spell_def = true; has_spell_def = true;
break;
}
}
if (!has_spell_def) { continue; }
let ret_spell = deepcopy(abil.effects[0]); // NOTE: do not mutate results of previous steps!
const base_spell_id = ret_spell.base_spell;
for (const effect of abil.effects) {
switch (effect.type) {
case 'replace_spell':
// replace_spell just replaces all (defined) aspects. // replace_spell just replaces all (defined) aspects.
for (const key in effect) { for (const key in effect) {
ret_spell[key] = effect[key]; ret_spell[key] = effect[key];
} }
}
}
if (!has_spell_def) { continue; }
const base_spell_id = ret_spell.base_spell;
for (const effect of abil.effects) {
switch (effect.type) {
case 'replace_spell':
// Already handled above.
continue; continue;
case 'add_spell_prop': { case 'add_spell_prop': {
const { base_spell, target_part = null, cost = 0} = effect; const { base_spell, target_part = null, cost = 0} = effect;

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -180,9 +180,8 @@ function calculateSpellDamage(stats, weapon, conversions, use_spell_damage, igno
Spell schema: Spell schema:
spell: { spell: {
name: str internal string name for the spell. Unique identifier name: str internal string name for the spell. Unique identifier, also display
cost: Optional[int] ignored for spells that are not id 1-4 cost: Optional[int] ignored for spells that are not id 1-4
display_text: str short description of the spell, ex. Bash, Meteor, Arrow Shield
base_spell: int spell index. 0-4 are reserved (0 is melee, 1-4 is common 4 spells) base_spell: int spell index. 0-4 are reserved (0 is melee, 1-4 is common 4 spells)
spell_type: str [TODO: DEPRECATED/REMOVE] "healing" or "damage" spell_type: str [TODO: DEPRECATED/REMOVE] "healing" or "damage"
scaling: Optional[str] [DEFAULT: "spell"] "melee" or "spell" scaling: Optional[str] [DEFAULT: "spell"] "melee" or "spell"
@ -242,14 +241,12 @@ const default_spells = {
wand: [{ wand: [{
type: "replace_spell", // not needed but makes this usable as an "abil part" type: "replace_spell", // not needed but makes this usable as an "abil part"
name: "Wand Melee", // TODO: name for melee attacks? name: "Wand Melee", // TODO: name for melee attacks?
display_text: "Mage basic attack",
base_spell: 0, base_spell: 0,
scaling: "melee", use_atkspd: false, scaling: "melee", use_atkspd: false,
display: "Melee", display: "Melee",
parts: [{ name: "Melee", multipliers: [100, 0, 0, 0, 0, 0] }] parts: [{ name: "Melee", multipliers: [100, 0, 0, 0, 0, 0] }]
}, { }, {
name: "Heal", // TODO: name for melee attacks? // JUST FOR TESTING... name: "Heal", // TODO: name for melee attacks? // JUST FOR TESTING...
display_text: "Heal spell!",
base_spell: 1, base_spell: 1,
display: "Total Heal", display: "Total Heal",
parts: [ parts: [
@ -261,7 +258,6 @@ const default_spells = {
spear: [{ spear: [{
type: "replace_spell", // not needed but makes this usable as an "abil part" type: "replace_spell", // not needed but makes this usable as an "abil part"
name: "Melee", // TODO: name for melee attacks? name: "Melee", // TODO: name for melee attacks?
display_text: "Warrior basic attack",
base_spell: 0, base_spell: 0,
scaling: "melee", use_atkspd: false, scaling: "melee", use_atkspd: false,
display: "Melee", display: "Melee",
@ -270,16 +266,14 @@ const default_spells = {
bow: [{ bow: [{
type: "replace_spell", // not needed but makes this usable as an "abil part" type: "replace_spell", // not needed but makes this usable as an "abil part"
name: "Bow Shot", // TODO: name for melee attacks? name: "Bow Shot", // TODO: name for melee attacks?
display_text: "Archer basic attack",
base_spell: 0, base_spell: 0,
scaling: "melee", use_atkspd: false, scaling: "melee", use_atkspd: false,
display: "Melee", display: "Single Shot",
parts: [{ name: "Melee", multipliers: [100, 0, 0, 0, 0, 0] }] parts: [{ name: "Single Shot", multipliers: [100, 0, 0, 0, 0, 0] }]
}], }],
dagger: [{ dagger: [{
type: "replace_spell", // not needed but makes this usable as an "abil part" type: "replace_spell", // not needed but makes this usable as an "abil part"
name: "Melee", // TODO: name for melee attacks? name: "Melee", // TODO: name for melee attacks?
display_text: "Assassin basic attack",
base_spell: 0, base_spell: 0,
scaling: "melee", use_atkspd: false, scaling: "melee", use_atkspd: false,
display: "Melee", display: "Melee",
@ -288,7 +282,6 @@ const default_spells = {
relik: [{ relik: [{
type: "replace_spell", // not needed but makes this usable as an "abil part" type: "replace_spell", // not needed but makes this usable as an "abil part"
name: "Relik Melee", // TODO: name for melee attacks? name: "Relik Melee", // TODO: name for melee attacks?
display_text: "Shaman basic attack",
base_spell: 0, base_spell: 0,
spell_type: "damage", spell_type: "damage",
scaling: "melee", use_atkspd: false, scaling: "melee", use_atkspd: false,

View file

@ -1664,7 +1664,7 @@ function displaySpellDamage(parent_elem, overallparent_elem, stats, spell, spell
if (spell_info.name === spell.display) { if (spell_info.name === spell.display) {
_summary(spell_info.name+ " Average: ", averageDamage, "Damage"); _summary(spell_info.name+ ": ", averageDamage, "Damage");
} }
function _damage_display(label_text, average, dmg_min, dmg_max) { function _damage_display(label_text, average, dmg_min, dmg_max) {