Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shrine gaze #7

Merged
merged 5 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Args } from "grimoire-kolmafia";
import {
descToItem,
haveEquipped,
inebrietyLimit,
isDarkMode,
Item,
Expand All @@ -20,12 +21,15 @@ import {
$location,
$monster,
Counter,
CrystalBall,
flat,
get,
have,
SourceTerminal,
} from "libram";

import * as OrbManager from "./orbmanager";

export function shouldRedigitize(): boolean {
const digitizesLeft = SourceTerminal.getDigitizeUsesRemaining();
const monsterCount = SourceTerminal.getDigitizeMonsterCount() + 1;
Expand Down Expand Up @@ -306,6 +310,6 @@ export function digitizedMonstersRemaining(): number {
);
}

export function toasterGazeIfNecessary(): void {
// nope
export function shrineGazeIfNecessary(): void {
if (getOrbTarget() && !haveEquipped(CrystalBall.orb)) OrbManager.shrineGaze();
}
38 changes: 21 additions & 17 deletions src/orbmanager.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {
canAdventure,
equip,
Location,
Monster,
retrieveItem,
print,
runChoice,
toUrl,
visitUrl,
} from "kolmafia";
import { $item, $location, CrystalBall, have } from "libram";

import { printd, printh } from "./lib";
import { $location, CrystalBall, get } from "libram";

let currentPonder = CrystalBall.ponder();
let ponderIsValid = true;
Expand All @@ -27,21 +26,26 @@ export function invalidate(): void {
ponderIsValid = false;
}

export function toasterGaze(): void {
const shore = $location`The Shore, Inc. Travel Agency`;
const pass = $item`Desert Bus pass`;
if (!canAdventure(shore) && !have(pass)) {
retrieveItem(pass);
}
export function shrineGaze(): void {
if (get("hiddenBowlingAlleyProgress") !== 8) return;

const shrine = $location`An Overgrown Shrine (Southeast)`;

if (!canAdventure(shrine)) return;

try {
const store = visitUrl(toUrl(shore));
if (!store.includes("Check out the gift shop")) {
printh("Unable to stare longingly at toast");
print("Gazing at a shrine to reset the orb prediction");
equip(CrystalBall.orb);
const encounter = visitUrl(toUrl(shrine));
if (!encounter.includes("Fire When Ready")) {
print("Unable to stare longingly at a shrine ball cradle");
}
runChoice(4);
// Walk away
runChoice(6);
} catch (e) {
printd(`We ran into an issue when gazing at toast: ${e}.`);
} finally {
visitUrl("main.php");
print(
`We ran into an issue when gazing at a shrine for balls: ${e}.`,
"red"
);
}
}
4 changes: 2 additions & 2 deletions src/zones/armory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toSkill } from "kolmafia";
import { $effects, $location, have } from "libram";

import { CrimboQuest, CrimboStrategy } from "../engine";
import { toasterGazeIfNecessary } from "../lib";
import { shrineGazeIfNecessary } from "../lib";
import Macro from "../macro";
import { affiliationSpec, chooseQuestOutfit, drunkSpec, orbSpec } from "../outfit";

Expand All @@ -27,7 +27,7 @@ const armory: CrimboQuest = {
$effects`Blood Bond, Empathy, Leash of Linguini`.filter((effect) => have(toSkill(effect))),
combat: new CrimboStrategy(() => Macro.standardCombat()),
sobriety: "either",
post: toasterGazeIfNecessary,
post: shrineGazeIfNecessary,
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/zones/bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toSkill } from "kolmafia";
import { $effects, $location, have } from "libram";

import { CrimboQuest, CrimboStrategy } from "../engine";
import { toasterGazeIfNecessary } from "../lib";
import { shrineGazeIfNecessary } from "../lib";
import Macro from "../macro";
import { affiliationSpec, chooseQuestOutfit, drunkSpec, orbSpec } from "../outfit";

Expand All @@ -27,7 +27,7 @@ const bar: CrimboQuest = {
$effects`Blood Bond, Empathy, Leash of Linguini`.filter((effect) => have(toSkill(effect))),
combat: new CrimboStrategy(() => Macro.standardCombat()),
sobriety: "either",
post: toasterGazeIfNecessary,
post: shrineGazeIfNecessary,
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/zones/cafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toSkill } from "kolmafia";
import { $effects, $location, have } from "libram";

import { CrimboQuest, CrimboStrategy } from "../engine";
import { toasterGazeIfNecessary } from "../lib";
import { shrineGazeIfNecessary } from "../lib";
import Macro from "../macro";
import { affiliationSpec, chooseQuestOutfit, drunkSpec, orbSpec } from "../outfit";

Expand All @@ -27,7 +27,7 @@ const cafe: CrimboQuest = {
$effects`Blood Bond, Empathy, Leash of Linguini`.filter((effect) => have(toSkill(effect))),
combat: new CrimboStrategy(() => Macro.standardCombat()),
sobriety: "either",
post: toasterGazeIfNecessary,
post: shrineGazeIfNecessary,
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/zones/cottage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toSkill } from "kolmafia";
import { $effects, $location, have } from "libram";

import { CrimboQuest, CrimboStrategy } from "../engine";
import { toasterGazeIfNecessary } from "../lib";
import { shrineGazeIfNecessary } from "../lib";
import Macro from "../macro";
import { affiliationSpec, chooseQuestOutfit, drunkSpec, orbSpec } from "../outfit";

Expand All @@ -27,7 +27,7 @@ const cottage: CrimboQuest = {
$effects`Blood Bond, Empathy, Leash of Linguini`.filter((effect) => have(toSkill(effect))),
combat: new CrimboStrategy(() => Macro.standardCombat()),
sobriety: "either",
post: toasterGazeIfNecessary,
post: shrineGazeIfNecessary,
},
],
};
Expand Down
4 changes: 2 additions & 2 deletions src/zones/foundry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { toSkill } from "kolmafia";
import { $effects, $location, have } from "libram";

import { CrimboQuest, CrimboStrategy } from "../engine";
import { toasterGazeIfNecessary } from "../lib";
import { shrineGazeIfNecessary } from "../lib";
import Macro from "../macro";
import { affiliationSpec, chooseQuestOutfit, drunkSpec, orbSpec } from "../outfit";

Expand All @@ -27,7 +27,7 @@ const foundry: CrimboQuest = {
$effects`Blood Bond, Empathy, Leash of Linguini`.filter((effect) => have(toSkill(effect))),
combat: new CrimboStrategy(() => Macro.standardCombat()),
sobriety: "either",
post: toasterGazeIfNecessary,
post: shrineGazeIfNecessary,
},
],
};
Expand Down