diff --git a/src/lib.ts b/src/lib.ts index 07ed790..bf39aa1 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -512,15 +512,16 @@ export function computeBoozeDrop(): number { return Math.max(1, Math.floor(60 - (all + addWish) / 15)); } -const famJacksValue = have($familiar`Comma Chameleon`) && !have($skill`Summon Clip Art`) ? 21 : 0; -const greatWolfs = Math.min(2, computeWeaponDamage(false) - 1) + 2; +const famJacksValue = () => + have($familiar`Comma Chameleon`) && !have($skill`Summon Clip Art`) ? 21 : 0; +const greatWolfs = () => Math.min(2, computeWeaponDamage(false) - 1) + 2; const stickKnife = myPrimestat() === $stat`muscle` ? Math.min(5, computeWeaponDamage(false) - 1) + 4 : 0; -const staff = have($skill`Spirit of Rigatoni`) ? 4 : 0; -const tobikoSoda = have($skill`Summon Alice's Army Cards`) ? 0 : 3; -const meteorite = Math.min(8, computeWeaponDamage(false) - 1) + 4; -const slippers = Math.min(4, 1 + ((-1 * computeCombatFrequency(false)) / 5) * 3); -const chlamys = Math.min(3, ((-1 * computeCombatFrequency(false)) / 5) * 3); +const staff = () => (have($skill`Spirit of Rigatoni`) ? 4 : 0); +const tobikoSoda = () => (have($skill`Summon Alice's Army Cards`) ? 0 : 3); +const meteorite = () => Math.min(8, computeWeaponDamage(false) - 1) + 4; +const slippers = () => Math.min(4, 1 + ((-1 * computeCombatFrequency(false)) / 5) * 3); +const chlamys = () => Math.min(3, ((-1 * computeCombatFrequency(false)) / 5) * 3); type valuePull = { item: Item; @@ -530,7 +531,7 @@ type valuePull = { export const pullValue: valuePull[] = [ { item: $item`box of Familiar Jacks`, - value: famJacksValue, + value: famJacksValue(), }, { item: $item`Stick-Knife of Loathing`, @@ -538,7 +539,7 @@ export const pullValue: valuePull[] = [ }, { item: $item`Staff of Simmering Hatred`, - value: staff, + value: staff(), }, { item: $item`Buddy Bjorn`, @@ -546,11 +547,11 @@ export const pullValue: valuePull[] = [ }, { item: $item`meteorite necklace`, - value: meteorite, + value: meteorite(), }, { item: $item`Great Wolf's beastly trousers`, - value: greatWolfs, + value: greatWolfs(), }, { item: $item`repaid diaper`, @@ -558,15 +559,15 @@ export const pullValue: valuePull[] = [ }, { item: $item`tobiko marble soda`, - value: tobikoSoda, + value: tobikoSoda(), }, { item: $item`chalk chlamys`, - value: chlamys, + value: chlamys(), }, { item: $item`Fuzzy Slippers of Hatred`, - value: slippers, + value: slippers(), }, ]; @@ -1363,7 +1364,7 @@ export function useLoathingIdol(): void { ); } -export const haveLoathingIdol = +export const haveLoathingIdol = () => have($item`Loathing Idol Microphone`) || have($item`Loathing Idol Microphone (75% charged)`) || have($item`Loathing Idol Microphone (50% charged)`) || diff --git a/src/tasks/leveling.ts b/src/tasks/leveling.ts index 41869cd..1bfe450 100644 --- a/src/tasks/leveling.ts +++ b/src/tasks/leveling.ts @@ -135,10 +135,10 @@ import { Station, } from "libram/dist/resources/2022/TrainSet"; -const useCinch = args.savecinch < 100 - get("_cinchUsed"); +const useCinch = () => args.savecinch < 100 - get("_cinchUsed"); const baseBoozes = $items`bottle of rum, boxed wine, bottle of gin, bottle of vodka, bottle of tequila, bottle of whiskey`; const freeFightMonsters: Monster[] = $monsters`Witchess Bishop, Witchess King, Witchess Witch, sausage goblin, Eldritch Tentacle`; -const godLobsterChoice = have($item`God Lobster's Ring`) ? 2 : 3; +const godLobsterChoice = () => (have($item`God Lobster's Ring`) ? 2 : 3); const godLobsterSave = computeCombatFrequency(false) === -95; export function restoreMPEfficiently(): string { @@ -1324,7 +1324,7 @@ export const LevelingQuest: Quest = { Array.from(getBanishedMonsters().values()).includes($monster`fluffy bunny`)), Macro.trySkill($skill`Recall Facts: Monster Habitats`) ) - .default(useCinch) + .default(useCinch()) ), outfit: baseOutfit, post: (): void => { @@ -1351,7 +1351,7 @@ export const LevelingQuest: Quest = { myBasestat(myPrimestat()) >= 190, // no longer need to back up Witchess Kings do: $location`The Dire Warren`, combat: new CombatStrategy().macro( - Macro.trySkill($skill`Back-Up to your Last Enemy`).default(useCinch) + Macro.trySkill($skill`Back-Up to your Last Enemy`).default(useCinch()) ), outfit: () => ({ ...baseOutfit(), @@ -1390,7 +1390,7 @@ export const LevelingQuest: Quest = { (haveFreeBanish() || Array.from(getBanishedMonsters().values()).includes($monster`fluffy bunny`)), Macro.trySkill($skill`Recall Facts: Monster Habitats`) - ).default(useCinch) + ).default(useCinch()) ), post: (): void => { sendAutumnaton(); @@ -1518,8 +1518,8 @@ export const LevelingQuest: Quest = { !have($familiar`God Lobster`) || (get("_godLobsterFights") >= 2 && godLobsterSave), do: () => visitUrl("main.php?fightgodlobster=1"), - combat: new CombatStrategy().macro(Macro.default(useCinch)), - choices: { 1310: godLobsterChoice }, // Get xp on last fight + combat: new CombatStrategy().macro(Macro.default(useCinch())), + choices: { 1310: godLobsterChoice() }, // Get xp on last fight outfit: () => ({ ...baseOutfit(), famequip: $items`God Lobster's Ring, God Lobster's Scepter`, @@ -1548,7 +1548,7 @@ export const LevelingQuest: Quest = { sendAutumnaton(); sellMiscellaneousItems(); }, - combat: new CombatStrategy().macro(Macro.default(useCinch)), + combat: new CombatStrategy().macro(Macro.default(useCinch())), outfit: baseOutfit, limit: { tries: 1 }, }, @@ -1573,7 +1573,7 @@ export const LevelingQuest: Quest = { (haveFreeBanish() || Array.from(getBanishedMonsters().values()).includes($monster`fluffy bunny`)), Macro.trySkill($skill`Recall Facts: Monster Habitats`) - ).default(useCinch) + ).default(useCinch()) ), outfit: baseOutfit, post: (): void => { @@ -1594,7 +1594,7 @@ export const LevelingQuest: Quest = { }, completed: () => get("_machineTunnelsAdv") >= 5 || !have($familiar`Machine Elf`), do: $location`The Deep Machine Tunnels`, - combat: new CombatStrategy().macro(Macro.default(useCinch)), + combat: new CombatStrategy().macro(Macro.default(useCinch())), outfit: () => ({ ...baseOutfit(), familiar: $familiar`Machine Elf`, @@ -1647,7 +1647,7 @@ export const LevelingQuest: Quest = { .trySkill($skill`Feel Pride`) .trySkill($skill`Cincho: Confetti Extravaganza`) .trySkill($skill`Recall Facts: %phylum Circadian Rhythms`) - .default(useCinch) + .default(useCinch()) ), post: (): void => { if (have($item`SMOOCH coffee cup`)) chew($item`SMOOCH coffee cup`, 1); @@ -1701,7 +1701,7 @@ export const LevelingQuest: Quest = { .trySkill($skill`Chest X-Ray`) .trySkill($skill`Shattering Punch`) .trySkill($skill`Gingerbread Mob Hit`) - .default(useCinch) + .default(useCinch()) ), post: (): void => { if (have($item`SMOOCH coffee cup`)) chew($item`SMOOCH coffee cup`, 1); @@ -1750,7 +1750,7 @@ export const LevelingQuest: Quest = { args.witchess || args.skipking, do: () => Witchess.fightPiece($monster`Witchess King`), - combat: new CombatStrategy().macro(Macro.default(useCinch)), + combat: new CombatStrategy().macro(Macro.default(useCinch())), outfit: baseOutfit, post: (): void => { sendAutumnaton(); @@ -1861,7 +1861,7 @@ export const LevelingQuest: Quest = { (haveFreeBanish() || Array.from(getBanishedMonsters().values()).includes($monster`fluffy bunny`)), Macro.trySkill($skill`Recall Facts: Monster Habitats`) - ).default(useCinch) + ).default(useCinch()) ), outfit: baseOutfit, post: (): void => { @@ -1915,7 +1915,7 @@ export const LevelingQuest: Quest = { .trySkill($skill`Chest X-Ray`) .trySkill($skill`Shattering Punch`) .trySkill($skill`Gingerbread Mob Hit`) - .default(useCinch) + .default(useCinch()) ), choices: { 1094: 5, diff --git a/src/tasks/stat.ts b/src/tasks/stat.ts index 77b5e9e..5eddf5c 100644 --- a/src/tasks/stat.ts +++ b/src/tasks/stat.ts @@ -283,7 +283,7 @@ export const MoxieQuest: Quest = { !have($item`2002 Mr. Store Catalog`) || CommunityService.Moxie.isDone(), do: (): void => { - if (!haveLoathingIdol) { + if (!haveLoathingIdol()) { buy($coinmaster`Mr. Store 2002`, 1, $item`Loathing Idol Microphone`); } withChoice(1505, 1, () => useLoathingIdol()); diff --git a/src/tasks/weapondamage.ts b/src/tasks/weapondamage.ts index a883e1c..6a470a5 100644 --- a/src/tasks/weapondamage.ts +++ b/src/tasks/weapondamage.ts @@ -55,7 +55,7 @@ import { import { args } from "../args"; const canesword = have($item`candy cane sword cane`); -const stickknife = +const stickknife = () => have($item`Stick-Knife of Loathing`) && (myPrimestat() === $stat`Muscle` || myClass() === $class`Pastamancer`); @@ -296,7 +296,7 @@ export const WeaponDamageQuest: Quest = { }, outfit: { weapon: canesword ? $item`candy cane sword cane` : undefined, - offhand: stickknife ? $item`Stick-Knife of Loathing` : undefined, + offhand: stickknife() ? $item`Stick-Knife of Loathing` : undefined, modifier: "weapon dmg, weapon dmg percent, switch disembodied hand, -switch left-hand man", }, post: () => shrugAT(), diff --git a/yarn.lock b/yarn.lock index 5795855..e445c90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2271,9 +2271,9 @@ levn@^0.4.1: type-check "~0.4.0" libram@^0.8.23: - version "0.8.26" - resolved "https://registry.yarnpkg.com/libram/-/libram-0.8.26.tgz#5c2b317c24d403f0ce1d4523209224f36feafb80" - integrity sha512-yScf3r+WaEr39jhLM10wlM9Kqic7WZEdAW8YcvKX4fBtpm5nxU3QBSSKK3wB047c2KESpZumiRXpnPdEickjbA== + version "0.8.27" + resolved "https://registry.yarnpkg.com/libram/-/libram-0.8.27.tgz#cd672fdc4e7455311e1605fb23fccdb2aaf9986a" + integrity sha512-Xw043wV31pTSGMOep163g+4zHX/R7iwKxjvntvPvA0CbcQQtNii/4YtqVwatUOqLHuze/fta1m5EKwkCbsU63w== dependencies: html-entities "^2.4.0"