Add base spell cost

This commit is contained in:
b 2021-09-13 12:29:15 -07:00
parent 2c79378544
commit 70e73e8b54
2 changed files with 6 additions and 5 deletions

View file

@ -388,13 +388,14 @@ class Build{
/* Getters */ /* Getters */
/* Get total health for build.
*/
getSpellCost(spellIdx, cost) { getSpellCost(spellIdx, cost) {
return Math.max(1, this.getBaseSpellCost(spellIdx, cost);
}
getBaseSpellCost(spellIdx, cost) {
cost = Math.ceil(cost * (1 - skillPointsToPercentage(this.total_skillpoints[2]))); cost = Math.ceil(cost * (1 - skillPointsToPercentage(this.total_skillpoints[2])));
cost += this.statMap.get("spRaw"+spellIdx); cost += this.statMap.get("spRaw"+spellIdx);
return Math.max(1, Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100))); return Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100));
} }

View file

@ -2019,7 +2019,7 @@ function displaySpellDamage(parent_elem, overallparent_elem, build, spell, spell
let third = document.createElement("b"); let third = document.createElement("b");
third.textContent = ")"; third.textContent = ") [Base: " + build.getSpellCost(spellIdx, spell.cost) + " ]";
title_elem.appendChild(third.cloneNode(true)); title_elem.appendChild(third.cloneNode(true));
title_elemavg.appendChild(third); title_elemavg.appendChild(third);
} }