Skip to content

Commit

Permalink
Add experimental profit save check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignose committed Oct 18, 2023
1 parent a7b2a8e commit d2a6ad2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
9 changes: 9 additions & 0 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,3 +621,12 @@ export const generalStoreXpEffect: Effect = {
Mysticality: $effect`Glittering Eyelashes`,
Moxie: $effect`Butt-Rock Hair`,
}[mainStatStr];

export function checkLocketAvailable(): number {
const locketAvailable =
(get("instant_saveLocketRedSkeleton", false) ? 1 : 0) +
(get("instant_saveLocketWitchessKing", false) ? 1 : 0) +
(get("instant_saveLocketFactoryWorker", false) ? 1 : 0);

return locketAvailable;
}
4 changes: 4 additions & 0 deletions src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ const otherResources: Resource[] = [
"instant_skipBorrowedTime",
"Do not use borrowed time. Level to 5 using trainset, and eat pizzas to get coil adventures. Make sure you know what you're doing before using this."
),
new Resource(
"instant_maximizeProfit",
"Check the opportunity cost of every resource spent, before spending it. If the opportunity cost is higher than turnsave * MPA, skip it."
),
];

const allResources = [
Expand Down
26 changes: 9 additions & 17 deletions src/tasks/boozedrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
CommunityService,
DaylightShavings,
get,
getSaleValue,
have,
TrainSet,
uneffect,
Expand All @@ -53,26 +54,13 @@ import {
setConfiguration,
Station,
} from "libram/dist/resources/2022/TrainSet";
import { fuelUp, logTestSetup, tryAcquiringEffect, wishFor } from "../lib";
import { checkLocketAvailable, fuelUp, logTestSetup, tryAcquiringEffect, wishFor } from "../lib";
import { chooseFamiliar, sugarItemsAboutToBreak } from "../engine/outfit";
import { CombatStrategy } from "grimoire-kolmafia";
import Macro from "../combat";
import { forbiddenEffects } from "../resources";
import { drive } from "libram/dist/resources/2017/AsdonMartin";

function checkLocketAvailable(): boolean {
const locketAvailable =
(get("instant_saveLocketRedSkeleton", false) ? 1 : 0) +
(get("instant_saveLocketWitchessKing", false) ? 1 : 0) +
(get("instant_saveLocketFactoryWorker", false) ? 1 : 0);

if (locketAvailable >= 2) {
return true;
} else {
return false;
}
}

export const BoozeDropQuest: Quest = {
name: "Booze Drop",
completed: () => CommunityService.BoozeDrop.isDone(),
Expand Down Expand Up @@ -122,7 +110,9 @@ export const BoozeDropQuest: Quest = {
completed: () =>
have($item`cyclops eyedrops`) ||
have($effect`One Very Clear Eye`) ||
get("instant_skipCyclopsEyedrops", false),
get("instant_skipCyclopsEyedrops", false) ||
(get("instant_maximizeProfit", false) &&
getSaleValue($item`11-leaf clover`) > get("valueOfAdventure") * 3),
do: (): void => {
if (!have($effect`Lucky!`)) use($item`11-leaf clover`);
if (!have($item`cyclops eyedrops`)) adv1($location`The Limerick Dungeon`, -1);
Expand Down Expand Up @@ -152,7 +142,7 @@ export const BoozeDropQuest: Quest = {
name: "Fax Ungulith",
completed: () => have($item`corrupted marrow`) || have($effect`Cowrruption`),
do: (): void => {
if (checkLocketAvailable()) {
if (checkLocketAvailable() >= 2) {
CombatLoversLocket.reminisce($monster`ungulith`);
} else {
cliExecute("chat");
Expand Down Expand Up @@ -248,7 +238,9 @@ export const BoozeDropQuest: Quest = {
completed: () =>
!have($item`potted power plant`) ||
(itemAmount($item`battery (AAA)`) < 5 && !have($item`battery (lantern)`)) ||
get("instant_savePowerSeed", false),
get("instant_savePowerSeed", false) ||
(get("instant_maximizeProfit", false) &&
getSaleValue($item`battery (AAA)`) * 5 > get("valueOfAdventure") * 4),
do: (): void => {
if (itemAmount($item`battery (AAA)`) >= 5) create($item`battery (lantern)`, 1);
use($item`battery (lantern)`, 1);
Expand Down
7 changes: 6 additions & 1 deletion src/tasks/leveling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import {
abstractionXpEffect,
abstractionXpItem,
burnLibram,
checkLocketAvailable,
chooseLibram,
fuelUp,
generalStoreXpEffect,
Expand Down Expand Up @@ -1566,7 +1567,11 @@ export const LevelingQuest: Quest = {
have($item`dented scepter`) ||
get("_witchessFights") >= 5 ||
!Witchess.have() ||
get("instant_saveWitchess", false),
get("instant_saveWitchess", false) ||
(get("instant_maximizeProfit", false) &&
checkLocketAvailable() === 3 &&
get("valueOfAdventure", 3750) * get("embezzlerMultiplier", 2.5) >
get("valueOfAdventure", 3750) * 2),
do: () => Witchess.fightPiece($monster`Witchess King`),
combat: new CombatStrategy().macro(Macro.default(useCinch)),
outfit: baseOutfit,
Expand Down

0 comments on commit d2a6ad2

Please sign in to comment.