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

Change routing to facilitate feeling lost #28

Merged
merged 1 commit into from
Nov 11, 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
6 changes: 0 additions & 6 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -717,12 +717,6 @@ export function saveLeafyBoys(): boolean {
return false;
}

export function shouldFeelLost(): boolean {
if (have($familiar`Machine Elf`)) return false;
if (!have($skill`Feel Lost`)) return false;
return true;
}

export function checkTurnSave(test: string, ef: Effect): number {
switch (test) {
case "BoozeDrop":
Expand Down
11 changes: 6 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import {
} from "kolmafia";
import {
compareTestCompletion,
computeCombatFrequency,
convertMilliseconds,
logTestCompletion,
simpleDateDiff,
} from "./lib";
import { $item, $stat, CommunityService, get, have, set, sinceKolmafiaRevision } from "libram";
import { $item, $stat, get, have, set, sinceKolmafiaRevision } from "libram";
import { Engine } from "./engine/engine";
import { Args, getTasks } from "grimoire-kolmafia";
import { Task } from "./engine/task";
Expand Down Expand Up @@ -70,7 +71,7 @@ export function main(command?: string): void {

const swapMainStatTest = have($item`Deck of Every Card`) && myPrimestat === $stat`Muscle`;

const nonComSwapOrder = CommunityService.FamiliarWeight.prediction >= 14;
const swapFamAndNCTests = computeCombatFrequency() <= -95;

const tasks: Task[] = getTasks([
RunStartQuest,
Expand All @@ -82,11 +83,11 @@ export function main(command?: string): void {
swapMainStatTest ? MuscleQuest : MysticalityQuest,
swapMainStatTest ? HPQuest : MoxieQuest,
HotResQuest,
nonComSwapOrder ? FamiliarWeightQuest : NoncombatQuest,
nonComSwapOrder ? NoncombatQuest : FamiliarWeightQuest,
BoozeDropQuest,
WeaponDamageQuest,
SpellDamageQuest,
swapFamAndNCTests ? FamiliarWeightQuest : NoncombatQuest,
swapFamAndNCTests ? NoncombatQuest : FamiliarWeightQuest,
BoozeDropQuest,
DonateQuest,
]);
const engine = new Engine(tasks);
Expand Down
90 changes: 6 additions & 84 deletions src/tasks/boozedrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import {
drink,
Effect,
equip,
faxbot,
hermit,
inebrietyLimit,
itemAmount,
myClass,
myInebriety,
myMaxhp,
myMeat,
Expand All @@ -34,30 +32,24 @@ import {
$familiar,
$item,
$location,
$monster,
$skill,
$slot,
clamp,
CombatLoversLocket,
CommunityService,
DaylightShavings,
get,
have,
uneffect,
withChoice,
} from "libram";
import {
checkLocketAvailable,
checkTurnSave,
checkValue,
forbiddenEffects,
fuelUp,
logTestSetup,
shouldFeelLost,
tryAcquiringEffect,
wishFor,
} from "../lib";
import { chooseFamiliar, sugarItemsAboutToBreak } from "../engine/outfit";
import { CombatStrategy } from "grimoire-kolmafia";
import Macro, { haveFreeBanish } from "../combat";
import { drive } from "libram/dist/resources/2017/AsdonMartin";
Expand Down Expand Up @@ -130,88 +122,29 @@ export const BoozeDropQuest: Quest = {
limit: { tries: 1 },
},
{
name: "Item Buff if Feeling Lost",
ready: () => shouldFeelLost(),
name: "Item Buff",
prepare: (): void => {
restoreHp(clamp(1000, myMaxhp() / 2, myMaxhp()));
restoreMp(50);
},
completed: () =>
(!have($familiar`Ghost of Crimbo Carols`) &&
!have($item`cosmic bowling ball`) &&
!have($item`vampyric cloake`)) ||
(!have($item`cosmic bowling ball`) && !have($item`vampyric cloake`)) ||
!haveFreeBanish() ||
$effects`Cosmic Ball in the Air, Do You Crush What I Crush?, Bat-Adjacent Form`.some((ef) =>
have(ef)
),
$effects`Cosmic Ball in the Air, Bat-Adjacent Form`.some((ef) => have(ef)),
do: $location`The Dire Warren`,
combat: new CombatStrategy().macro(
Macro.trySkill($skill`Bowl Straight Up`)
.trySkill($skill`Become a Bat`)
.trySkill($skill`Use the Force`)
.banish()
.abort()
),
outfit: {
offhand: $item`latte lovers member's mug`,
acc1: $item`Kremlin's Greatest Briefcase`,
acc2: $item`Lil' Doctor™ bag`,
familiar: $familiar`Ghost of Crimbo Carols`,
famequip: $item.none,
},
limit: { tries: 5 },
},
{
name: "Fax Ungulith",
completed: () =>
have($item`corrupted marrow`) || have($effect`Cowrruption`) || shouldFeelLost(),
do: (): void => {
const monsterCow =
myClass().toString() === "Seal Clubber" &&
CombatLoversLocket.unlockedLocketMonsters().includes($monster`furious cow`)
? $monster`furious cow`
: $monster`ungulith`;
if (checkLocketAvailable() >= 2) {
CombatLoversLocket.reminisce(monsterCow);
} else {
cliExecute("chat");
if (have($item`photocopied monster`) && get("photocopyMonster") !== monsterCow) {
cliExecute("fax send");
}
if (
(have($item`photocopied monster`) || faxbot(monsterCow)) &&
get("photocopyMonster") === monsterCow
) {
use($item`photocopied monster`);
}
}
},
outfit: () => ({
hat:
DaylightShavings.nextBuff() === $effect`Musician's Musician's Moustache` &&
!DaylightShavings.hasBuff() &&
have($item`Daylight Shavings Helmet`)
? $item`Daylight Shavings Helmet`
: undefined,
back: $item`vampyric cloake`,
weapon: $item`Fourth of May Cosplay Saber`,
offhand: have($skill`Double-Fisted Skull Smashing`)
? $item`industrial fire extinguisher`
: undefined,
familiar: chooseFamiliar(false),
modifier: "myst",
avoid: sugarItemsAboutToBreak(),
}),
choices: { 1387: 3 },
combat: new CombatStrategy().macro(
Macro.trySkill($skill`Bowl Straight Up`)
.trySkill($skill`Become a Bat`)
.trySkill($skill`Fire Extinguisher: Polar Vortex`)
.trySkill($skill`Use the Force`)
.default()
),
limit: { tries: 5 },
},
{
name: "Drink Sacramento Wine",
completed: () =>
Expand Down Expand Up @@ -300,8 +233,7 @@ export const BoozeDropQuest: Quest = {
},
{
name: "Feeling Lost",
ready: () => shouldFeelLost(),
completed: () => have($effect`Feeling Lost`),
completed: () => have($effect`Feeling Lost`) || !have($skill`Feel Lost`),
do: () => useSkill($skill`Feel Lost`),
limit: { tries: 1 },
},
Expand Down Expand Up @@ -354,21 +286,11 @@ export const BoozeDropQuest: Quest = {
sweetSynthesis($item`sugar shank`, $item`sugar sheet`);
}

if (
checkValue("August Scepter", checkTurnSave("BoozeDrop", $effect`Incredibly Well Lit`)) ||
(CommunityService.WeaponDamage.isDone() &&
checkTurnSave("BoozeDrop", $effect`Incredibly Well Lit`) > 1)
)
if (checkTurnSave("BoozeDrop", $effect`Incredibly Well Lit`) > 1)
tryAcquiringEffect($effect`Incredibly Well Lit`);

if (
checkValue(
$item`battery (lantern)`,
checkTurnSave("BoozeDrop", $effect`Lantern-Charged`) +
(!CommunityService.SpellDamage.isDone()
? checkTurnSave("SpellDamage", $effect`Lantern-Charged`)
: 0)
)
checkValue($item`battery (lantern)`, checkTurnSave("BoozeDrop", $effect`Lantern-Charged`))
) {
if (itemAmount($item`battery (AAA)`) >= 5) create($item`battery (lantern)`, 1);
use($item`battery (lantern)`, 1);
Expand Down
40 changes: 0 additions & 40 deletions src/tasks/spelldamage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
checkValue,
forbiddenEffects,
logTestSetup,
shouldFeelLost,
shrugAT,
startingClan,
tryAcquiringEffect,
Expand All @@ -53,8 +52,6 @@ import { args } from "../args";

let triedDeepDark = false;

const barrels: string[] = [`00`, `01`, `02`, `10`, `11`, `12`, `20`, `21`, `22`];

export const SpellDamageQuest: Quest = {
name: "Spell Damage",
completed: () => CommunityService.SpellDamage.isDone(),
Expand Down Expand Up @@ -89,7 +86,6 @@ export const SpellDamageQuest: Quest = {
},
{
name: "Stand-Alone Carol Ghost Buff",
ready: () => !shouldFeelLost(),
prepare: (): void => {
restoreHp(clamp(1000, myMaxhp() / 2, myMaxhp()));
restoreMp(50);
Expand Down Expand Up @@ -142,7 +138,6 @@ export const SpellDamageQuest: Quest = {
},
{
name: "Meteor Shower",
ready: () => !shouldFeelLost(),
completed: () =>
have($effect`Meteor Showered`) ||
!have($item`Fourth of May Cosplay Saber`) ||
Expand Down Expand Up @@ -170,41 +165,6 @@ export const SpellDamageQuest: Quest = {
choices: { 1387: 3 },
limit: { tries: 1 },
},
{
name: "Meteor Shower Feeling Lost",
ready: () => shouldFeelLost(),
completed: () =>
have($effect`Meteor Showered`) ||
!have($item`Fourth of May Cosplay Saber`) ||
!have($skill`Meteor Lore`) ||
get("_saberForceUses") >= 5,
do: (): void => {
for (const barrel of barrels) {
visitUrl("barrel.php");
visitUrl(`choice.php?whichchoice=1099&pwd&option=1&slot=${barrel}`);
}
},
combat: new CombatStrategy().macro(
Macro.trySkill($skill`Meteor Shower`)
.trySkill($skill`%fn, spit on me!`)
.trySkill($skill`Use the Force`)
.abort()
),
outfit: () => ({
weapon: $item`Fourth of May Cosplay Saber`,
familiar:
get("camelSpit") >= 100
? $familiar`Melodramedary`
: $effects`Do You Crush What I Crush?, Holiday Yoked, Let It Snow/Boil/Stink/Frighten/Grease, All I Want For Crimbo Is Stuff, Crimbo Wrapping`.some(
(ef) => have(ef)
)
? $familiar`Ghost of Crimbo Carols`
: chooseFamiliar(false),
avoid: sugarItemsAboutToBreak(),
}),
choices: { 1387: 3 },
limit: { tries: 10 },
},
{
name: "Deep Dark Visions",
completed: () =>
Expand Down
36 changes: 2 additions & 34 deletions src/tasks/weapondamage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
checkValue,
forbiddenEffects,
logTestSetup,
shouldFeelLost,
startingClan,
tryAcquiringEffect,
wishFor,
Expand All @@ -61,7 +60,6 @@ export const WeaponDamageQuest: Quest = {
},
{
name: "Stand-Alone Carol Ghost Buff",
ready: () => !shouldFeelLost(),
prepare: (): void => {
restoreHp(clamp(1000, myMaxhp() / 2, myMaxhp()));
restoreMp(50);
Expand Down Expand Up @@ -123,8 +121,7 @@ export const WeaponDamageQuest: Quest = {
limit: { tries: 1 },
},
{
name: "Fax Ungulith",
ready: () => shouldFeelLost(),
name: "Ungulith Shower",
completed: () => have($item`corrupted marrow`) || have($effect`Cowrruption`),
do: (): void => {
const monsterCow =
Expand Down Expand Up @@ -164,40 +161,11 @@ export const WeaponDamageQuest: Quest = {
Macro.trySkill($skill`Meteor Shower`)
.trySkill($skill`%fn, spit on me!`)
.trySkill($skill`Use the Force`)
.trySkill($skill`Feel Envy`)
.default()
),
limit: { tries: 5 },
},
{
name: "Meteor Shower",
ready: () => !shouldFeelLost(),
completed: () =>
have($effect`Meteor Showered`) ||
!have($item`Fourth of May Cosplay Saber`) ||
!have($skill`Meteor Lore`) ||
get("_saberForceUses") >= 5,
do: $location`The Dire Warren`,
combat: new CombatStrategy().macro(
Macro.trySkill($skill`Meteor Shower`)
.trySkill($skill`%fn, spit on me!`)
.trySkill($skill`Use the Force`)
.abort()
),
outfit: () => ({
weapon: $item`Fourth of May Cosplay Saber`,
familiar:
get("camelSpit") >= 100
? $familiar`Melodramedary`
: $effects`Do You Crush What I Crush?, Holiday Yoked, Let It Snow/Boil/Stink/Frighten/Grease, All I Want For Crimbo Is Stuff, Crimbo Wrapping`.some(
(ef) => have(ef)
)
? $familiar`Ghost of Crimbo Carols`
: chooseFamiliar(false),
avoid: sugarItemsAboutToBreak(),
}),
choices: { 1387: 3 },
limit: { tries: 1 },
},
{
name: "Test",
prepare: (): void => {
Expand Down