implemented next cost intel needed feature
This commit is contained in:
parent
8754b060be
commit
e4068912b1
4 changed files with 20 additions and 8 deletions
2
build.js
2
build.js
|
@ -160,7 +160,7 @@ class Build{
|
||||||
getSpellCost(spellIdx, cost) {
|
getSpellCost(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.max(1, Math.floor(cost * (1 + this.statMap.get("spPct"+spellIdx) / 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ console.log(url_tag);
|
||||||
* END testing section
|
* END testing section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const BUILD_VERSION = "6.9.1";
|
const BUILD_VERSION = "6.9.2";
|
||||||
|
|
||||||
function setTitle() {
|
function setTitle() {
|
||||||
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
document.getElementById("header").textContent = "WynnBuilder version "+BUILD_VERSION+" (db version "+DB_VERSION+")";
|
||||||
|
|
18
display.js
18
display.js
|
@ -558,7 +558,6 @@ function displayExpandedItem(item, parent_id){
|
||||||
|
|
||||||
function displayNextCosts(parent_id, build) {
|
function displayNextCosts(parent_id, build) {
|
||||||
let p_elem = document.getElementById(parent_id);
|
let p_elem = document.getElementById(parent_id);
|
||||||
let stats = build.statMap;
|
|
||||||
let int = build.total_skillpoints[2];
|
let int = build.total_skillpoints[2];
|
||||||
let spells = spell_table[build.weapon.get("type")];
|
let spells = spell_table[build.weapon.get("type")];
|
||||||
|
|
||||||
|
@ -589,10 +588,23 @@ function displayNextCosts(parent_id, build) {
|
||||||
let arrow = document.createElement("b");
|
let arrow = document.createElement("b");
|
||||||
arrow.textContent = "\u279C";
|
arrow.textContent = "\u279C";
|
||||||
let next_cost = document.createElement("b");
|
let next_cost = document.createElement("b");
|
||||||
next_cost.textContent = (build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) == 1 ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1);
|
next_cost.textContent = (init_cost.textContent === "1" ? 1 : build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1);
|
||||||
next_cost.classList.add("Mana");
|
next_cost.classList.add("Mana");
|
||||||
let int_needed = document.createElement("b");
|
let int_needed = document.createElement("b");
|
||||||
int_needed.textContent = ": " + (0) + " int"; //DO MATH
|
if (init_cost.textContent === "1") {
|
||||||
|
int_needed.textContent = ": n/a (+0)";
|
||||||
|
}else { //do math
|
||||||
|
let target = build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) - 1;
|
||||||
|
let needed = int;
|
||||||
|
//forgive me... I couldn't inverse ceil, floor, and max.
|
||||||
|
while (build.getSpellCost(spells.indexOf(spell) + 1, spell.cost) != target) {
|
||||||
|
needed++;
|
||||||
|
build.total_skillpoints[2] = needed;
|
||||||
|
}
|
||||||
|
let missing = needed - int;
|
||||||
|
build.total_skillpoints[2] = int;//forgive me pt 2
|
||||||
|
int_needed.textContent = ": " + needed + " int (+" + missing + ")";
|
||||||
|
}
|
||||||
|
|
||||||
row.appendChild(init_cost);
|
row.appendChild(init_cost);
|
||||||
row.appendChild(arrow);
|
row.appendChild(arrow);
|
||||||
|
|
|
@ -551,10 +551,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="misc">
|
<div class="misc">
|
||||||
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1;visibility:visible;">
|
<div class = "center set-info" id = "set-info-div" style = "grid-column:1;grid-row:1;visibility:hidden;">
|
||||||
<div class = "center" id = "set-info">Set info</div>
|
<div class = "center" id = "set-info">Set info</div>
|
||||||
</div>
|
</div>
|
||||||
<div class = "center int-info" id = "int-info-div" style = "grid-column:4;grid-row:1;visibility:hidden;">
|
<div class = "center int-info" id = "int-info-div" style = "grid-column:4;grid-row:1;visibility:visible;">
|
||||||
<div class = "center" id = "int-info">Next Spell Costs</div>
|
<div class = "center" id = "int-info">Next Spell Costs</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue