Last active
June 9, 2018 10:48
-
-
Save Babbie/5fe527c8cea195f7219ac56296a241d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAXGP = 800; | |
const MAXSECONDS = 3600; | |
const CORDIALGP = 300, HQCORDIALGP = 350, HICORDIALGP = 400; | |
const CORDIALCD = 240, HQCORDIALCD = 216, HICORDIALCD = 180; | |
function fullGP (potGP, potMaxCD) { | |
var seconds = 0; | |
var potCD = 0; | |
var potsUsed = 0; | |
var gp = 800; | |
var collected = 0; | |
while (seconds < MAXSECONDS) { | |
if (gp == 800) { | |
// GP is maxed, so collect | |
seconds += 30; | |
potCD -= 30; | |
gp = 0; | |
collected += 3; | |
} else if (800 - gp >= potGP && potCD == 0) { | |
// Potion is off cooldown and nothing will be wasted, use it | |
gp += potGP; | |
potCD = potMaxCD; | |
potsUsed += 1; | |
} else { | |
// Nothing happens, tick | |
gp += 6; | |
seconds += 3; | |
potCD -= 3; | |
} | |
if (potCD < 0) { | |
potCD = 0; | |
} | |
if (gp > MAXGP) { | |
gp = MAXGP; | |
} | |
} | |
console.log("%ds: %d collected, %d pots used", seconds, collected, potsUsed); | |
} | |
function partGP (potGP, potMaxCD) { | |
var seconds = 0; | |
var potCD = 0; | |
var potsUsed = 0; | |
var gp = 800; | |
var collected = 0; | |
while (seconds < MAXSECONDS) { | |
if (gp >= 600) { | |
// GP is 600 or higher, collect | |
seconds += 30; | |
potCD -= 30; | |
gp -= 600; | |
collected += 2; | |
} else if (800 - gp >= potGP && potCD == 0) { | |
// Potion is off cooldown and nothing will be wasted, use it | |
gp += potGP; | |
potCD = potMaxCD; | |
potsUsed += 1; | |
} else { | |
// Nothing happens, tick | |
gp += 6; | |
seconds += 3; | |
potCD -= 3; | |
} | |
if (potCD < 0) { | |
potCD = 0; | |
} | |
if (gp > MAXGP) { | |
gp = MAXGP; | |
} | |
} | |
console.log("%ds: %d collected, %d pots used", seconds, collected, potsUsed); | |
} | |
console.log("800 GP, NQ Cordials:"); | |
fullGP(CORDIALGP, CORDIALCD); | |
console.log("800 GP, HQ Cordials:"); | |
fullGP(HQCORDIALGP, HQCORDIALCD); | |
console.log("800 GP, Hi-Cordials:"); | |
fullGP(HICORDIALGP, HICORDIALCD); | |
console.log("600 GP, NQ Cordials:"); | |
partGP(CORDIALGP, CORDIALCD); | |
console.log("600 GP, HQ Cordials:"); | |
partGP(HQCORDIALGP, HQCORDIALCD); | |
console.log("600 GP, Hi-Cordials:"); | |
partGP(HICORDIALGP, HICORDIALCD); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
800 GP, NQ Cordials: | |
3600s: 39 collected, 13 pots used | |
800 GP, HQ Cordials: | |
3600s: 45 collected, 14 pots used | |
800 GP, Hi-Cordials: | |
3600s: 48 collected, 16 pots used | |
600 GP, NQ Cordials: | |
3621s: 38 collected, 15 pots used | |
600 GP, HQ Cordials: | |
3600s: 40 collected, 16 pots used | |
600 GP, Hi-Cordials: | |
3600s: 46 collected, 18 pots used |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment