Skip to content

Commit

Permalink
Implement proper Printing Press Base checking & filtering
Browse files Browse the repository at this point in the history
- shared-cre-setup: if not in FoFo, subtract paper bonuses
- Added 'Printing Press Filter' checkbox to Best Setup tool
- Removed Paperless variants
- Auto-add PPB variants in bm-setup-items
- Removed deprecated Boiling Cauldron event location effect
  • Loading branch information
tsitu committed Apr 23, 2024
1 parent 094a9eb commit cafb8b8
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 44 deletions.
2 changes: 0 additions & 2 deletions data/arrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,6 @@ var basesArray = {
"Festive Winter Hunt Base": [100, 0, 15, 10, "Very Fresh"],
"Firecracker Base": [300, 5, 5, 4, "Stale"],
"Fissure Base": [450, 15, 5, 12, "Stale"],
"Folklore Printing Press Base (Paperless)": [500, 15, 0, 10, "Fresh"],
"Folklore Printing Press Base": [4500, 35, 35, 57, "Fresh"],
"Forecaster Base": [400, 12, 10, 10, "Very Fresh"],
"Fracture Base": [200, 10, 0, 10, "Fresh"],
Expand Down Expand Up @@ -501,7 +500,6 @@ var basesArray = {
"Molten Shrapnel Base": [350, 12, 5, 8, "Extremely Stale"],
"Monkey Jade Base": [350, 12, 10, 10, "Stale"],
"Monolith Base": [500, 12, 0, 0, "No Effect"],
"Naughty List Printing Press Base (Paperless)": [500, 15, 0, 10, "Fresh"],
"Naughty List Printing Press Base": [4500, 35, 35, 57, "Fresh"],
"Overgrown Ember Stone Base": [450, 10, 18, 12, "Ultimately Stale"],
"Ox Jade Base": [375, 12, 10, 10, "Stale"],
Expand Down
7 changes: 7 additions & 0 deletions setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@
</td>
</tr>

<tr>
<td>Printing Press Filter:</td>
<td>
<input type="checkbox" id="printingFilter">
</td>
</tr>

<tr>
<td>Sample Size Score: </td>
<td>
Expand Down
10 changes: 7 additions & 3 deletions src/bookmarklet/bm-setup-items.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,25 @@
bases.push("Signature Series Denture Base (Toothless)");
}

// Auto-add Naughty List Printing Press Base variants
// Auto-add Printing Press Base variants
if (bases.indexOf("Naughty List Printing Press Base") >= 0) {
bases.push("Naughty List Printing Press Base (Paperless)");
}

if (bases.indexOf("Folklore Printing Press Base") >= 0) {
bases.push("Folklore Printing Press Base (Paperless)");
}

var weapons = arr
.filter(function(el) {
return el.classification === "weapon" && el.quantity > 0;
})
.map(function(el) {
// Weapon edge cases
// if (el.name === "Ambush Trap") {
// return "Ambush";
// return "Ambush";
// } else if (el.name === "School of Sharks Trap") {
// return "School of Sharks";
// return "School of Sharks";
// }
return el.name;
});
Expand Down
12 changes: 12 additions & 0 deletions src/main/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ $(window).load(function() {
document.getElementById("umbraFloor").onchange = umbraChanged;
document.getElementById("riftstalker").onchange = riftstalkerChange;
document.getElementById("dentureFilter").onchange = dentureFilterChange;
document.getElementById("printingFilter").onchange = printingFilterChange;
document.getElementById("rank").onchange = rankChange;

$("#save_setup_button").click(saveSetupStorage);
Expand Down Expand Up @@ -698,6 +699,17 @@ function printCombinations(micePopulation, headerHtml) {
return true;
}

// Skip Printing Press Base variants if filter is checked
var isPrintingFiltered = localStorage.getItem(
"best-setup-printing-filter"
);
if (
isPrintingFiltered === "true" &&
baseName.indexOf("Printing Press Base") >= 0
) {
return true;
}

baseChanged();
buildOverallCR(
micePopulation,
Expand Down
144 changes: 105 additions & 39 deletions src/main/shared-cre-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ function getRiftCount(weapon, base, charm) {
function calculateTrapSetup(skipDisp) {
var specialPower = 0, // bonus flat power
specialLuck = 0, // bonus flat luck
specialAtt = 0, // bonus AR (initially created for Printing Press Paperless scale-down)
shownPowerBonus = 0, // able to be parsed from user.trap_power_bonus
hiddenPowerBonus = 0; // implicit, unable to be parsed

Expand Down Expand Up @@ -291,9 +292,7 @@ function calculateTrapSetup(skipDisp) {
charmName === "Dark Chocolate Charm"
) {
shownPowerBonus += 20;
} else if (
weaponName === "Father Winter's Timepiece Trap"
) {
} else if (weaponName === "Father Winter's Timepiece Trap") {
specialPower += acolyteCatches * 2000;
}

Expand All @@ -311,7 +310,7 @@ function calculateTrapSetup(skipDisp) {
pourLuck +
specialLuck;
trapLuck = Math.floor(totalLuck * Math.min(1, getAmpBonus()));
trapAtt = Math.min(weaponAtt + baseAtt + charmAtt, 100);
trapAtt = Math.min(weaponAtt + baseAtt + charmAtt + specialAtt, 100);
trapEff = weaponEff + baseEff + charmEff;
trapEff = trapEff > 6 ? 6 : trapEff;
trapEff = trapEff < -6 ? -6 : trapEff;
Expand All @@ -334,6 +333,16 @@ function calculateTrapSetup(skipDisp) {
);
}

function isFolkloreArea(location) {
return (
location === "Foreword Farm" ||
location === "Prologue Pond" ||
location === "Table of Contents" ||
location === "Bountiful Beanstalk" ||
location === "School of Sorcery"
);
}

if (locationName === "Claw Shot City") {
if (
(weaponName === "S.L.A.C." || weaponName === "S.L.A.C. II") &&
Expand Down Expand Up @@ -474,27 +483,30 @@ function calculateTrapSetup(skipDisp) {
}
} else if (
locationName === "Floating Islands" ||
locationName === "Sky Palace") {
locationName === "Sky Palace"
) {
if (cheeseName === "Extra Rich Cloud Cheesecake") {
shownPowerBonus += 20;
specialLuck += 5;
}
} else if (
locationName === "Event" &&
phaseName === "Halloween" &&
weaponName === "Boiling Cauldron Trap"){
basePower += 1000;
weaponBonus += 10;
trapLuck += 5;
trapAtt += 15;
}
}

if (
cheeseName.indexOf("Fusion Fondue") >= 0 &&
charmName === "EMP400 Charm"
) {
specialPower += 25000;
}

if (!isFolkloreArea(locationName)) {
// Not in FoFo, so force Paperless stats
if (baseName.indexOf("Printing Press Base") >= 0) {
specialPower -= 4000;
shownPowerBonus -= 20;
specialAtt -= 35;
specialLuck -= 47;
}
}
}

function getTotalTrapPower() {
Expand Down Expand Up @@ -617,9 +629,9 @@ function minLuck(effectiveness, mousePower) {
// If, due to floating-point errors, the candidate minluck is not
// actually enough, add one. (This is described further in the README.)
if (calcCR(effectiveness, 0, candidateMinluck, mousePower) < 1) {
return candidateMinluck + 1
return candidateMinluck + 1;
}
return candidateMinluck
return candidateMinluck;
}

/**
Expand Down Expand Up @@ -673,7 +685,7 @@ function getCheeseAttraction() {
*/
function gsParamCheck() {
var gsParameter = getURLParameter("gs");
document.getElementById("gs").checked = ('No' === gsParameter ) ? false : true;
document.getElementById("gs").checked = "No" === gsParameter ? false : true;
gsChanged();
}

Expand Down Expand Up @@ -714,6 +726,24 @@ function dentureFilterChange() {
genericOnChange();
}

function printingFilterParamCheck() {
var printingFilterParam =
getURLParameter("printingFilter") !== NULL_URL_PARAM;
var printingFilterChecked =
printingFilterParam ||
localStorage.getItem("best-setup-printing-filter") === "true";
$("#printingFilter").prop("checked", printingFilterChecked);
printingFilterChange();
}

function printingFilterChange() {
localStorage.setItem(
"best-setup-printing-filter",
$("#printingFilter").prop("checked")
);
genericOnChange();
}

function fortRoxParamCheck() {
updateInputFromParameter("ballistaLevel", genericOnChange);
updateInputFromParameter("cannonLevel", genericOnChange);
Expand Down Expand Up @@ -1307,71 +1337,92 @@ function calcCREffects(catchRate, mouseName, eff, mousePower) {
weaponLuckDelta -= 0.05;
}
} else if (contains(mouseName, "Mystic")) {
if (weaponName === "Obvious Ambush Trap") {
if (weaponName === "Obvious Ambush Trap") {
weaponPowerDelta -= 2400;
weaponLuckDelta -= 9;
} else if (weaponName === "Blackstone Pass Trap") {
weaponPowerDelta += 1800;
weaponLuckDelta += 6;
}
} else if (contains(mouseName, "Technic")) {
if (weaponName === "Obvious Ambush Trap") {
weaponPowerDelta += 1800;
weaponLuckDelta += 6;
if (weaponName === "Obvious Ambush Trap") {
weaponPowerDelta += 1800;
weaponLuckDelta += 6;
} else if (weaponName === "Blackstone Pass Trap") {
weaponPowerDelta -= 2400;
weaponLuckDelta -= 9;
}
} if (contains(mouseName, "Rook") && charmName === "Rook Crumble Charm") {
}
if (contains(mouseName, "Rook") && charmName === "Rook Crumble Charm") {
charmBonusDelta += 300;
}
} if (charmName === "Dragonbane Charm" && contains(dragons, mouseName)) {
}
if (charmName === "Dragonbane Charm" && contains(dragons, mouseName)) {
charmBonusDelta += 300;
} if (
charmName === "Super Dragonbane Charm" && contains(dragons, mouseName)) {
}
if (charmName === "Super Dragonbane Charm" && contains(dragons, mouseName)) {
charmBonusDelta += 600;
} if (
charmName === "Extreme Dragonbane Charm" && contains(dragons, mouseName)) {
}
if (
charmName === "Extreme Dragonbane Charm" &&
contains(dragons, mouseName)
) {
charmBonusDelta += 900;
} if (
charmName === "Ultimate Dragonbane Charm" && contains(dragons, mouseName)) {
}
if (
charmName === "Ultimate Dragonbane Charm" &&
contains(dragons, mouseName)
) {
charmBonusDelta += 1200;
} if (charmName === "Taunting Charm" && contains(tauntings, mouseName)) {
}
if (charmName === "Taunting Charm" && contains(tauntings, mouseName)) {
var riftCount = getRiftCount(weaponName, baseName, charmName);
if (riftCount >= 1) tauntBonusDelta += 1;
} if (locationName === "Fiery Warpath") {
}
if (locationName === "Fiery Warpath") {
if (charmName.indexOf("Super Warpath Archer Charm") >= 0) {
var warpathArcher = ["Desert Archer", "Flame Archer", "Crimson Ranger"];
if (contains(warpathArcher, mouseName)) {
charmBonusDelta += 50;
}
} if (charmName.indexOf("Super Warpath Warrior Charm") >= 0) {
}
if (charmName.indexOf("Super Warpath Warrior Charm") >= 0) {
var warpathWarrior = ["Desert Soldier", "Flame Warrior", "Crimson Titan"];
if (contains(warpathWarrior, mouseName)) {
charmBonusDelta += 50;
}
} if (charmName.indexOf("Super Warpath Scout Charm") >= 0) {
}
if (charmName.indexOf("Super Warpath Scout Charm") >= 0) {
var warpathScout = ["Vanguard", "Sentinel", "Crimson Watch"];
if (contains(warpathScout, mouseName)) {
charmBonusDelta += 50;
}
} if (charmName.indexOf("Super Warpath Cavalry Charm") >= 0) {
}
if (charmName.indexOf("Super Warpath Cavalry Charm") >= 0) {
var warpathCavalry = ["Sand Cavalry", "Sandwing Cavalry"];
if (contains(warpathCavalry, mouseName)) {
charmBonusDelta += 50;
}
} if (charmName.indexOf("Super Warpath Mage Charm") >= 0) {
}
if (charmName.indexOf("Super Warpath Mage Charm") >= 0) {
var warpathMage = ["Inferno Mage", "Magmarage"];
if (contains(warpathMage, mouseName)) {
charmBonusDelta += 50;
}
} if (charmName.indexOf("Super Warpath Commander's Charm") >= 0) {
}
if (charmName.indexOf("Super Warpath Commander's Charm") >= 0) {
if (mouseName === "Crimson Commander") {
charmBonusDelta += 50;
}
}
}
if (weaponPowerDelta !== 0 || weaponBonusDelta !== 0 || charmBonusDelta !== 0 || tauntBonusDelta !== 0 || weaponLuckDelta !== 0) {
if (
weaponPowerDelta !== 0 ||
weaponBonusDelta !== 0 ||
charmBonusDelta !== 0 ||
tauntBonusDelta !== 0 ||
weaponLuckDelta !== 0
) {
weaponPower += weaponPowerDelta;
weaponBonus += weaponBonusDelta;
weaponLuck += weaponLuckDelta;
Expand Down Expand Up @@ -1502,6 +1553,7 @@ function checkLoadState(type) {
baseName = getURLParameter("base");
baseChanged();
dentureFilterParamCheck();
printingFilterParamCheck();
}

gsParamCheck();
Expand Down Expand Up @@ -1687,7 +1739,7 @@ function calcSaltedPower(type, mousePower) {
var saltVal = parseInt(saltLevel, 10) || 0;

if (saltVal === 0) {
return mousePower
return mousePower;
}

var saltedPower = mousePower;
Expand All @@ -1696,7 +1748,21 @@ function calcSaltedPower(type, mousePower) {
if (type === "Grub") {
// Many different thresholds for KG, see Scarab for easier understanding
saltThresholds = [0, 6, 7, 10, 14, 18, 23, 24, 27, 34, 44, 48, 50];
saltCoefficients = [50000, 40000, 20000, 10000, 5000, 2500, 1000, 1500, 1000, 500, 1000, 2000, 0];
saltCoefficients = [
50000,
40000,
20000,
10000,
5000,
2500,
1000,
1500,
1000,
500,
1000,
2000,
0
];
} else if (type === "Scarab") {
// 25k MP decrements for up to 30 salt, -12500 from 31 to 40 salt, -6500 to 50 salt
saltThresholds = [0, 30, 40, 50];
Expand Down

0 comments on commit cafb8b8

Please sign in to comment.