Fix echo and bamboozle crash

and fix modify to work a bit better... TODO need actual dependency resolution for spell modification
This commit is contained in:
hppeng 2023-03-04 23:15:46 -08:00
parent 39c8357c5d
commit 645f3145f0
4 changed files with 11 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -844,19 +844,22 @@ const atree_collect_spells = new (class extends ComputeNode {
continue;
case 'add_spell_prop': {
const { base_spell, target_part = null, cost = 0, behavior = 'merge'} = effect;
const ret_spell = ret_spells.get(base_spell);
// TODO: unjankify this...
if ('cost' in ret_spell) { ret_spell.cost += cost; }
if (target_part === null) {
if (target_part === null) {
continue;
}
if (!ret_spells.has(base_spell)) {
continue;
}
const ret_spell = ret_spells.get(base_spell);
let found_part = false;
for (let part of ret_spell.parts) { // TODO: replace with Map? to avoid this linear search... idk prolly good since its not more verbose to type in json
if (part.name !== target_part) {
continue;
}
// we found the part. merge or modify it!
if ('cost' in ret_spell) { ret_spell.cost += cost; }
if ('multipliers' in effect) {
for (const [idx, v] of effect.multipliers.entries()) { // python: enumerate()

View file

@ -8578,6 +8578,7 @@ const atrees = {
{
"type": "add_spell_prop",
"base_spell": 8,
"behavior": "modify",
"target_part": "Slash Damage",
"multipliers": [ 690, 0, 0, 110, 0, 0 ]
}

File diff suppressed because one or more lines are too long