Skip to content

Commit

Permalink
Add Father Winter's Timepiece bonus power
Browse files Browse the repository at this point in the history
  • Loading branch information
hymccord committed Sep 7, 2023
1 parent f8fef19 commit 44d806e
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
9 changes: 8 additions & 1 deletion cre.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ <h1>Catch Rate Estimator</h1>
</td>
</tr>

<tr id="father-timepiece-bonus-power" style="display:none">
<td>Acolyte Catches:</td>
<td>
<input id="acolyteCatches" type="number" min="0" max="100" step="1" value="0">
</td>
</tr>

<tr>
<td>Base:</td>
<td>
Expand Down Expand Up @@ -469,7 +476,7 @@ <h1>Catch Rate Estimator</h1>
<br>Placeholder ARs: Wardens, Paragons, & Richard
</td>
</tr>

<tr class="display-location display-sky-palace">
<td>Comments:</td>
<td class="locationComment">
Expand Down
11 changes: 11 additions & 0 deletions src/bookmarklet/bm-cre.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,17 @@
});
}

if (urlParams["weapon"] === "Father Winter's Timepiece Trap") {
document
.querySelectorAll(".campPage-trap-trapStat-mathRow-name")
.forEach(el => {
if (el.textContent.indexOf("(Acolyte Catches") >= 0)
urlParams["acolyteCatches"] = +el.textContent
.split("(Acolyte Catches: ")[1]
.split(")")[0];
});
}

// Golem Guardian skin module check
if (urlParams["weapon"].indexOf("Golem Guardian") >= 0) {
urlParams["weapon"] =
Expand Down
11 changes: 11 additions & 0 deletions src/bookmarklet/bm-setup-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,17 @@
});
}

if (urlParams["weapon"] === "Father Winter's Timepiece Trap") {
document
.querySelectorAll(".campPage-trap-trapStat-mathRow-name")
.forEach(el => {
if (el.textContent.indexOf("(Acolyte Catches") >= 0)
urlParams["acolyteCatches"] = +el.textContent
.split("(Acolyte Catches: ")[1]
.split(")")[0];
});
}

// Golem Guardian skin module check
if (urlParams["weapon"].indexOf("Golem Guardian") >= 0) {
urlParams["weapon"] =
Expand Down
6 changes: 6 additions & 0 deletions src/main/cre.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ window.onload = function() {
document.getElementById("umbraFloor").onchange = umbraChanged;
document.getElementById("riftstalker").onchange = riftstalkerChange;
document.getElementById("rank").onchange = rankChange;
document.getElementById("acolyteCatches").onchange = acolytesChanged

document.getElementById("cheeseCost").onchange = function() {
cheeseCost = parseInt(document.getElementById("cheeseCost").value);
Expand Down Expand Up @@ -828,6 +829,11 @@ function weaponChanged() {
default:
}
}

$("#father-timepiece-bonus-power").hide();
if (weaponName.indexOf("Father Winter's Timepiece") >= 0) {
$("#father-timepiece-bonus-power").show(500);
}
}

function icebergPhase() {
Expand Down
17 changes: 16 additions & 1 deletion src/main/shared-cre-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ var gsLuck = 7,
subtotalPowerBonus = 0,
tauntBonus = 0,
saltLevel = 0,
umbraFloor = 0;
umbraFloor = 0,
acolyteCatches = 0;

// Total trap stats
var trapPower = 0,
Expand Down Expand Up @@ -290,6 +291,10 @@ function calculateTrapSetup(skipDisp) {
charmName === "Dark Chocolate Charm"
) {
shownPowerBonus += 20;
} else if (
weaponName === "Father Winter's Timepiece Trap"
) {
specialPower += acolyteCatches * 2000;
}

determineRiftBonus(riftStalkerCodex);
Expand Down Expand Up @@ -772,6 +777,10 @@ function golemParamCheck() {
}
}

function fatherWinterParamCheck() {
updateInputFromParameter("acolyteCatches", acolytesChanged);
}

// Update and validate changes in golem charge inputs
function golemChargeChange(type, value) {
if (typeof value === "string") {
Expand Down Expand Up @@ -967,6 +976,11 @@ function umbraChanged() {
genericOnChange();
}

function acolytesChanged() {
acolyteCatches = document.getElementById("acolyteCatches").value;
genericOnChange();
}

function getIcebergBase() {
var autoBase = "";
if (contains(phaseName, "Magnet")) {
Expand Down Expand Up @@ -1488,6 +1502,7 @@ function checkLoadState(type) {
valourRiftParamCheck();
rankParamCheck();
golemParamCheck();
fatherWinterParamCheck();

// Calculate bonuses after param checks are done
calculateBonusPower();
Expand Down

0 comments on commit 44d806e

Please sign in to comment.