diff --git a/js/builder_graph.js b/js/builder_graph.js index b8b4833..b371052 100644 --- a/js/builder_graph.js +++ b/js/builder_graph.js @@ -592,7 +592,7 @@ class SpellDamageCalcNode extends ComputeNode { } } else if ('power' in part) { // TODO: wynn2 formula - let _heal_amount = (part.strength * getDefenseStats(stats)[0] * Math.max(0.5,Math.min(1.75, 1 + 0.5 * stats.get("wDamPct")/100))).toFixed(2); + let _heal_amount = (part.power * getDefenseStats(stats)[0] * Math.max(0.5,Math.min(1.75, 1 + 0.5 * stats.get("wDamPct")/100))); spell_result = { type: "heal", heal_amount: _heal_amount @@ -604,7 +604,8 @@ class SpellDamageCalcNode extends ComputeNode { normal_total: [0, 0], crit_min: [0, 0, 0, 0, 0, 0], crit_max: [0, 0, 0, 0, 0, 0], - crit_total: [0, 0] + crit_total: [0, 0], + heal_amount: 0 } const dam_res_keys = ['normal_min', 'normal_max', 'normal_total', 'crit_min', 'crit_max', 'crit_total']; for (const [subpart_name, hits] of Object.entries(part.hits)) { @@ -1111,7 +1112,7 @@ function builder_graph_init() { // Also do something similar for skill points - //for (let i = 0; i < 4; ++i) { + //for (let i = 0; i < 4; ++i) { TODO: testing code for (let i = 0; i < 1; ++i) { let spell_node = new SpellSelectNode(i); spell_node.link_to(build_node, 'build'); diff --git a/js/damage_calc.js b/js/damage_calc.js index 2710ec4..9a18fbd 100644 --- a/js/damage_calc.js +++ b/js/damage_calc.js @@ -246,6 +246,16 @@ const default_spells = { scaling: "melee", use_atkspd: false, display: "Melee", parts: [{ name: "Melee", multipliers: [100, 0, 0, 0, 0, 0] }] + }, { + name: "Heal", // TODO: name for melee attacks? + display_text: "Heal spell!", + base_spell: 1, + display: "Total Heal", + parts: [ + { name: "First Pulse", power: 0.12 }, + { name: "Second and Third Pulses", power: 0.06 }, + { name: "Total Heal", hits: { "First Pulse": 1, "Second and Third Pulses": 2 } } + ] }], spear: [{ name: "Melee", // TODO: name for melee attacks? diff --git a/js/display.js b/js/display.js index e4114ed..6f01d41 100644 --- a/js/display.js +++ b/js/display.js @@ -1627,6 +1627,18 @@ function displaySpellDamage(parent_elem, overallparent_elem, stats, spell, spell let part_divavg = document.createElement("p"); overallparent_elem.append(part_divavg); + function _summary(text, val, fmt) { + let overallaverageLabel = document.createElement("p"); + let first = document.createElement("span"); + let second = document.createElement("span"); + first.textContent = text; + second.textContent = val.toFixed(2); + overallaverageLabel.appendChild(first); + overallaverageLabel.appendChild(second); + second.classList.add(fmt); + part_divavg.append(overallaverageLabel); + } + for (let i = 0; i < spell_results.length; ++i) { const damage_info = spell_results[i]; @@ -1652,15 +1664,7 @@ function displaySpellDamage(parent_elem, overallparent_elem, stats, spell, spell if (damage_info.name === spell.display) { - let overallaverageLabel = document.createElement("p"); - let first = document.createElement("span"); - let second = document.createElement("span"); - first.textContent = damage_info.name+ " Average: "; - second.textContent = averageDamage.toFixed(2); - overallaverageLabel.appendChild(first); - overallaverageLabel.appendChild(second); - second.classList.add("Damage"); - part_divavg.append(overallaverageLabel); + _summary(damage_info.name+ " Average: ", averageDamage, "Damage"); } function _damage_display(label_text, average, dmg_min, dmg_max) { @@ -1686,42 +1690,8 @@ function displaySpellDamage(parent_elem, overallparent_elem, stats, spell, spell // healLabel.classList.add("damagep"); part_div.append(healLabel); if (damage_info.name === spell.display) { - let overallhealLabel = document.createElement("p"); - let first = document.createElement("span"); - let second = document.createElement("span"); - first.textContent = damage_info.name+ ": "; - second.textContent = heal_amount; - overallhealLabel.appendChild(first); - second.classList.add("Set"); - overallhealLabel.appendChild(second); - part_divavg.append(overallhealLabel); + _summary(damage_info.name+ ": ", heal_amount, "Set"); } -// } else if (part.type === "total") { -// let total_damage = 0; -// for (let i in part.factors) { -// total_damage += save_damages[i] * part.factors[i]; -// } -// -// let dmgarr = part.factors.slice(); -// dmgarr = dmgarr.map(x => "(" + x + " * " + save_damages[dmgarr.indexOf(x)].toFixed(2) + ")"); -// -// -// let averageLabel = document.createElement("p"); -// averageLabel.textContent = "Average: "+total_damage.toFixed(2); -// averageLabel.classList.add("damageSubtitle"); -// part_div.append(averageLabel); -// -// let overallaverageLabel = document.createElement("p"); -// let overallaverageLabelFirst = document.createElement("span"); -// let overallaverageLabelSecond = document.createElement("span"); -// overallaverageLabelFirst.textContent = "Average: "; -// overallaverageLabelSecond.textContent = total_damage.toFixed(2); -// overallaverageLabelSecond.classList.add("Damage"); -// -// -// overallaverageLabel.appendChild(overallaverageLabelFirst); -// overallaverageLabel.appendChild(overallaverageLabelSecond); -// part_divavg.append(overallaverageLabel); } }