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; }
// 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;
case 'raw_stat':
@ -661,12 +673,7 @@ const atree_stats = new (class extends ComputeNode {
const { type, name, abil = "", value } = bonus;
// TODO: prop
if (type === "stat") {
if (ret_effects.has(name)) {
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); }
merge_stat(ret_effects, name, value);
}
}
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;
}
})().link_to(atree_merge, 'atree-merged');

View file

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

File diff suppressed because one or more lines are too long

View file

@ -300,3 +300,16 @@ function idRound(id){
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()) {
if (output_stats.has(k2)) {
// TODO: ugly AF
if (k2 === 'damageMultiplier' || k2 === 'defMultiplier') {
output_stats.set(k2, v2 * output_stats.get(k2));
}
else {
output_stats.set(k2, v2 + output_stats.get(k2));
}
merge_stat(output_stats, k2, v2);
}
else {
output_stats.set(k2, v2);