diff --git a/src/engine/engine.ts b/src/engine/engine.ts index 17b21104..16494da4 100644 --- a/src/engine/engine.ts +++ b/src/engine/engine.ts @@ -309,6 +309,12 @@ export class Engine extends BaseEngine { if (task.combat !== undefined && myHp() < myMaxhp() * 0.9) useSkill($skill`Cannelloni Cocoon`); } + markAttempt(task: Task): void { + if (!(task.name in this.attempts)) this.attempts[task.name] = 0; + if (!task.attempted || task.attempted()) this.attempts[task.name]++; + else set("lastEncounter", ""); + } + initPropertiesManager(manager: PropertiesManager): void { super.initPropertiesManager(manager); const bannedAutoRestorers = [ diff --git a/src/engine/task.ts b/src/engine/task.ts index aeb1ba87..991fc3aa 100644 --- a/src/engine/task.ts +++ b/src/engine/task.ts @@ -1,4 +1,6 @@ import { Quest as BaseQuest, Task as BaseTask } from "grimoire-kolmafia"; export type Quest = BaseQuest; -export type Task = BaseTask; +export type Task = BaseTask & { + attempted?: () => boolean; +}; diff --git a/src/tasks/runstart.ts b/src/tasks/runstart.ts index 1db900c4..7a298937 100644 --- a/src/tasks/runstart.ts +++ b/src/tasks/runstart.ts @@ -966,6 +966,7 @@ export const RunStartQuest: Quest = { completed: () => mainStat === $stat`Moxie` || !have($item`Peridot of Peril`) || have($item`cherry`), do: $location`The Skeleton Store`, + choices: { 1060: 5 }, combat: new CombatStrategy().macro( Macro.if_($monster`time cop`, Macro.default()) .if_( @@ -991,6 +992,10 @@ export const RunStartQuest: Quest = { use($item`MayDay™ supply package`, 1); if (have($item`space blanket`)) autosell($item`space blanket`, 1); }, + attempted: () => + !["Skeletons In Store", "Temporarily Out of Skeletons", "time cop"].includes( + get("lastEncounter"), + ), limit: { tries: 2 }, }, { @@ -1047,6 +1052,10 @@ export const RunStartQuest: Quest = { use($item`MayDay™ supply package`, 1); if (have($item`space blanket`)) autosell($item`space blanket`, 1); }, + attempted: () => + !["Skeletons In Store", "Temporarily Out of Skeletons", "time cop"].includes( + get("lastEncounter"), + ), limit: { tries: 2 }, }, { @@ -1068,16 +1077,18 @@ export const RunStartQuest: Quest = { completedSkeletonBanishes() || !haveFreeSkeletonBanish())), do: $location`The Skeleton Store`, + choices: { 1060: 5 }, combat: new CombatStrategy().macro(() => - Macro.if_( - "!haseffect Everything Looks Yellow", - Macro.if_( - $monster`novelty tropical skeleton`, - Macro.externalIf(useParkaSpit, Macro.trySkill($skill`Spit jurassic acid`)) - .trySkill($skill`Blow the Yellow Candle!`) - .tryItem($item`yellow rocket`), - ), - ) + Macro.if_($monster`time cop`, Macro.default()) + .if_( + "!haseffect Everything Looks Yellow", + Macro.if_( + $monster`novelty tropical skeleton`, + Macro.externalIf(useParkaSpit, Macro.trySkill($skill`Spit jurassic acid`)) + .trySkill($skill`Blow the Yellow Candle!`) + .tryItem($item`yellow rocket`), + ), + ) .externalIf( !Array.from(getBanishedMonsters().keys()).includes($skill`Bowl a Curveball`), Macro.trySkill($skill`Bowl a Curveball`), @@ -1114,6 +1125,10 @@ export const RunStartQuest: Quest = { use($item`MayDay™ supply package`, 1); if (have($item`space blanket`)) autosell($item`space blanket`, 1); }, + attempted: () => + !["Skeletons In Store", "Temporarily Out of Skeletons", "time cop"].includes( + get("lastEncounter"), + ), limit: { tries: 4 }, }, {