Heal% stat

This commit is contained in:
hppeng 2022-07-18 22:23:16 -07:00
parent 67efec4c3d
commit aa185ce022
5 changed files with 10 additions and 3 deletions

View file

@ -76,6 +76,7 @@ stat_scaling: {
"slider": bool,
"slider_name": Optional[str],
"slider_step": Optional[float],
round: Optional[bool] // Control floor behavior. True for stats and false for slider by default
slider_behavior: Optional[str] // One of: "merge", "modify". default: merge
// merge: add if exist, make new part if not exist
// modify: change existing part. do nothing if not exist
@ -751,7 +752,9 @@ const atree_stats = new (class extends ComputeNode {
if (effect.slider) {
if ('output' in effect) { // sometimes nodes will modify slider without having effect.
const slider_val = slider_map.get(effect.slider_name).slider.value;
let total = Math.floor(round_near(parseInt(slider_val) * effect.scaling[0]));
const {round = true} = effect;
let total = parseInt(slider_val) * effect.scaling[0];
if (round) { total = Math.floor(round_near(total)); }
if ('max' in effect && total > effect.max) { total = effect.max; }
if (Array.isArray(effect.output)) {
for (const output of effect.output) {
@ -770,9 +773,11 @@ const atree_stats = new (class extends ComputeNode {
else {
// TODO: type: prop?
let total = 0;
const {round = true} = effect;
for (const [scaling, input] of zip2(effect.scaling, effect.inputs)) {
total += scaling * item_stats.get(input.name);
}
if (round) { total = Math.floor(round_near(total)); }
if (total < 0) { total = 0; } // Normal stat scaling will not go negative.
if ('max' in effect && total > effect.max) { total = effect.max; }
// TODO: output (list...)

View file

@ -5007,6 +5007,7 @@ const atrees = {
"effects": [{
"type": "stat_scaling",
"slider": false,
"round": false,
"inputs": [
{
"type": "stat",

File diff suppressed because one or more lines are too long

View file

@ -129,6 +129,7 @@ class Build{
}
statMap.set("poisonPct", 100);
statMap.set("critDamPct", 100);
statMap.set("healPct", 100);
// The stuff relevant for damage calculation!!! @ferricles
statMap.set("atkSpd", this.weapon.statMap.get("atkSpd"));

View file

@ -576,7 +576,7 @@ class SpellDamageCalcNode extends ComputeNode {
}
} else if ('power' in part) {
// TODO: wynn2 formula
let _heal_amount = (part.power * getDefenseStats(stats)[0] * Math.max(0.5,Math.min(1.75, 1 + 0.5 * stats.get("wDamPct")/100)));
let _heal_amount = (part.power * getDefenseStats(stats)[0] * (stats.get('healPct')/100));
spell_result = {
type: "heal",
heal_amount: _heal_amount