Working scaling abils, sliders not hooked up yet

also fixed burning heart scaling
This commit is contained in:
hppeng 2022-07-07 19:44:57 -07:00
parent a28c75e177
commit 5b6c957e76
5 changed files with 32 additions and 14 deletions

View file

@ -653,6 +653,18 @@ const atree_stats = new (class extends ComputeNode {
} }
if (total > cap) { total = cap; } if (total > cap) { total = cap; }
// TODO: output (list...) // TODO: output (list...)
if (Array.isArray(effect.output)) {
for (const output of effect.output) {
if (output.type === 'stat') {
merge_stat(ret_effects, output.name, total);
}
}
}
else {
if (effect.output.type === 'stat') {
merge_stat(ret_effects, effect.output.name, total);
}
}
} }
continue; continue;
case 'raw_stat': case 'raw_stat':
@ -661,12 +673,7 @@ const atree_stats = new (class extends ComputeNode {
const { type, name, abil = "", value } = bonus; const { type, name, abil = "", value } = bonus;
// TODO: prop // TODO: prop
if (type === "stat") { if (type === "stat") {
if (ret_effects.has(name)) { merge_stat(ret_effects, name, value);
if (name === 'damageMultiplier' || name === 'defMultiplier') {
ret_effects.set(name, ret_effects.get(name) * value);
}
else { ret_effects.set(name, ret_effects.get(name) + value); }
else { ret_effects.set(name, value); }
} }
} }
continue; continue;
@ -683,6 +690,9 @@ const atree_stats = new (class extends ComputeNode {
} }
} }
} }
if (ret_effects.has('baseResist')) {
merge_stat(ret_effects, "defMultiplier", 1 - (ret_effects.get('baseResist') / 100));
}
return ret_effects; return ret_effects;
} }
})().link_to(atree_merge, 'atree-merged'); })().link_to(atree_merge, 'atree-merged');

View file

@ -3186,7 +3186,7 @@ const atrees = {
"type": "stat", "type": "stat",
"name": "fDamPct" "name": "fDamPct"
}, },
"scaling": [2], "scaling": [0.02],
"max": 100 "max": 100
} }
] ]

File diff suppressed because one or more lines are too long

View file

@ -300,3 +300,16 @@ function idRound(id){
return rounded; return rounded;
} }
} }
/**
* stupid stupid multiplicative stats
*/
function merge_stat(stats, name, value) {
if (stats.has(name)) {
if (name === 'damageMultiplier' || name === 'defMultiplier') {
stats.set(name, stats.get(name) * value);
}
else { stats.set(name, stats.get(name) + value); }
}
else { stats.set(name, value); }
}

View file

@ -843,12 +843,7 @@ class AggregateStatsNode extends ComputeNode {
for (const [k2, v2] of v.entries()) { for (const [k2, v2] of v.entries()) {
if (output_stats.has(k2)) { if (output_stats.has(k2)) {
// TODO: ugly AF // TODO: ugly AF
if (k2 === 'damageMultiplier' || k2 === 'defMultiplier') { merge_stat(output_stats, k2, v2);
output_stats.set(k2, v2 * output_stats.get(k2));
}
else {
output_stats.set(k2, v2 + output_stats.get(k2));
}
} }
else { else {
output_stats.set(k2, v2); output_stats.set(k2, v2);