Skip to content

Commit

Permalink
Rely on mafia reporting NC forcing being active, use fiesta exits
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Nov 30, 2023
1 parent 4f3977d commit 9745ce4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 37 deletions.
21 changes: 1 addition & 20 deletions src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ export class ChronerStrategy extends CombatStrategy {
}
}

function countAvailableNcForces() {
return (get("_claraBellUsed") ? 0 : 1) + (5 - get("_spikolodonSpikeUses"));
}

let ncForced = false;
export function resetNcForced() {
printd("Reset NC forcing");
ncForced = false;
}
CrownOfThrones.createRiderMode("default", {});
const chooseRider = () => CrownOfThrones.pickRider("default");
export class ChronerEngine extends Engine<never, ChronerTask> {
Expand All @@ -55,7 +46,7 @@ export class ChronerEngine extends Engine<never, ChronerTask> {
(!sober() && task.sobriety === "drunk");

if (task.forced) {
return sobriety && ncForced && super.available(task);
return sobriety && get("noncombatForcerActive") && super.available(task);
}
return sobriety && super.available(task);
}
Expand All @@ -72,16 +63,6 @@ export class ChronerEngine extends Engine<never, ChronerTask> {
return outfit;
}

execute(task: ChronerTask): void {
const ncBefore = countAvailableNcForces();
super.execute(task);
const ncAfter = countAvailableNcForces();

if (ncBefore > ncAfter) {
ncForced = true;
}
}

setChoices(task: ChronerTask, manager: PropertiesManager): void {
super.setChoices(task, manager);
if (equippedAmount($item`June cleaver`) > 0) {
Expand Down
35 changes: 18 additions & 17 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
adv1,
canAdventure,
cliExecute,
getLocationMonsters,
myAdventures,
myClass,
myTurncount,
totalTurnsPlayed,
use,
useSkill,
visitUrl,
} from "kolmafia";
import {
Expand All @@ -20,6 +20,7 @@ import {
$monsters,
$skill,
AsdonMartin,
CinchoDeMayo,
Counter,
get,
have,
Expand All @@ -34,9 +35,8 @@ import {
ChronerQuest,
ChronerStrategy,
ChronerTask,
resetNcForced,
} from "./engine";
import { args, printd, printh } from "./lib";
import { args, printh } from "./lib";
import Macro from "./macro";
import { chooseQuestOutfit } from "./outfit";
import { rose } from "./rose";
Expand Down Expand Up @@ -114,6 +114,19 @@ export function main(command?: string) {
},
sobriety: "either",
},
{
name: "Fiesta Exit",
completed: () =>
CinchoDeMayo.totalAvailableCinch() > 60 &&
!get("noncombatForcerActive"),
do: () => {
while (CinchoDeMayo.currentCinch() < 60) {
cliExecute("rest");
}
useSkill(1, $skill`Cincho: Fiesta Exit`);
},
sobriety: "either",
},
{
name: "Proton Ghost",
ready: () =>
Expand Down Expand Up @@ -206,20 +219,8 @@ export function main(command?: string) {
name: "Time Capsule",
do: () => {
adv1($location`The Cave Before Time`, 0, "");
if (get("lastEncounter") === "Time Cave. Period.") {
printd("Forced noncombat!");
resetNcForced();
} else {
printd("Uh oh, we didn't force the NC");
const possibleEncouters = Object.keys(
getLocationMonsters($location`The Cave Before Time`),
);
if (possibleEncouters.includes(get("lastEncounter"))) {
printd("We hit a normal monster, so reset the noncombat forcing");
resetNcForced();
} else {
printd("We hit something else, so keep trying for the noncombat");
}
if (get("lastEncounter") !== "Time Cave. Period.") {
throw "We expeted to force the NC";
}
},
forced: true,
Expand Down

0 comments on commit 9745ce4

Please sign in to comment.