Skip to content

Embezzler lucky #2367

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
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
23 changes: 2 additions & 21 deletions packages/garbo/src/combat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ import {
monsterManuelAvailable,
targetingMeat,
} from "./lib";
import { CombatStrategy } from "grimoire-kolmafia";
import { copyTargetCount } from "./target";
import { garboValue } from "./garboValue";

Expand Down Expand Up @@ -884,13 +883,13 @@ export class Macro extends StrictMacro {
}
}

type CustomizeMacroOptions = {
export type CustomizeMacroOptions = {
freeWanderer: (macro: StrictMacro) => Macro;
tentacle: (macro: StrictMacro) => Macro;
innateWanderer: (macro: StrictMacro) => Macro;
};

function customizeMacro<M extends StrictMacro>(
export function customizeMacro<M extends StrictMacro>(
macro: M,
{
freeWanderer = () => Macro.basicCombat(),
Expand Down Expand Up @@ -991,21 +990,3 @@ export function garboAdventureAuto<M extends StrictMacro>(
makeCcs(nextMacro);
runCombatBy(() => adv1(loc, -1, ""));
}

export class GarboStrategy extends CombatStrategy {
constructor(
macro: () => Macro,
postAuto = macro,
useAutoAttack = () => true,
options: Partial<CustomizeMacroOptions> = {},
) {
super();
const macroCustom = () => customizeMacro(macro(), options);
if (useAutoAttack()) {
const postAutoCustom = () => customizeMacro(postAuto(), options);
this.autoattack(macroCustom).macro(postAutoCustom);
} else {
this.macro(macroCustom);
}
}
}
20 changes: 20 additions & 0 deletions packages/garbo/src/combatStrategy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { CombatStrategy } from "grimoire-kolmafia";
import { customizeMacro, CustomizeMacroOptions, Macro } from "./combat";

export class GarboStrategy extends CombatStrategy {
constructor(
macro: () => Macro,
postAuto = macro,
useAutoAttack = () => true,
options: Partial<CustomizeMacroOptions> = {},
) {
super();
const macroCustom = () => customizeMacro(macro(), options);
if (useAutoAttack()) {
const postAutoCustom = () => customizeMacro(postAuto(), options);
this.autoattack(macroCustom).macro(postAutoCustom);
} else {
this.macro(macroCustom);
}
}
}
7 changes: 3 additions & 4 deletions packages/garbo/src/diet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ import {
import { acquire, priceCaps } from "./acquire";
import { withVIPClan } from "./clan";
import { globalOptions } from "./config";
import { copyTargetCount } from "./target";
import { expectedGregs, shouldAugustCast, synthesize } from "./resources";
import {
arrayEquals,
Expand All @@ -91,7 +90,7 @@ import {
} from "./lib";
import { shrugBadEffects } from "./mood";
import { Potion, PotionTier } from "./potions";
import { estimatedGarboTurns } from "./turns";
import { estimatedGarboTurns, highMeatMonsterCount } from "./turns";
import { garboValue } from "./garboValue";

const MPA = get("valueOfAdventure");
Expand Down Expand Up @@ -927,7 +926,7 @@ function balanceMenu(
baseMenu: MenuItem<Note>[],
dietPlanner: DietPlanner,
): MenuItem<Note>[] {
const baseTargets = targetingMeat() ? copyTargetCount() : 0;
const baseTargets = highMeatMonsterCount();
function rebalance(
menu: MenuItem<Note>[],
iterations: number,
Expand Down Expand Up @@ -1043,7 +1042,7 @@ function printDiet(diet: Diet<Note>, name: DietName) {
(a, b) => itemPriority(b.menuItems) - itemPriority(a.menuItems),
);

const targets = Math.floor(copyTargetCount() + countCopies(diet));
const targets = Math.floor(highMeatMonsterCount() + countCopies(diet));
const adventures = Math.floor(
estimatedGarboTurns(false) + diet.expectedAdventures(),
);
Expand Down
8 changes: 6 additions & 2 deletions packages/garbo/src/familiar/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ import {
targetMeat,
turnsToNC,
} from "../lib";
import { digitizedMonstersRemaining, estimatedGarboTurns } from "../turns";
import {
digitizedMonstersRemaining,
estimatedGarboTurns,
highMeatMonsterCount,
} from "../turns";
import { garboValue } from "../garboValue";
import { copyTargetCount } from "../target";

Expand Down Expand Up @@ -178,7 +182,7 @@ export const amuletCoinValue = () => {
const [copies, barf] = isFree(globalOptions.target)
? [0, estimatedGarboTurns()]
: (() => {
const copies = copyTargetCount();
const copies = highMeatMonsterCount();
return [copies, estimatedGarboTurns() - copies];
})();
return 0.5 * (barf * baseMeat() + copies * targetMeat());
Expand Down
14 changes: 6 additions & 8 deletions packages/garbo/src/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,7 @@ import { withStash } from "./clan";
import { garboAdventure, garboAdventureAuto, Macro, withMacro } from "./combat";
import { globalOptions } from "./config";
import { postFreeFightDailySetup } from "./dailiespost";
import {
copyTargetCount,
copyTargetSources,
getNextCopyTargetFight,
} from "./target";
import { copyTargetSources, getNextCopyTargetFight } from "./target";
import {
bestMidnightAvailable,
crateStrategy,
Expand Down Expand Up @@ -179,7 +175,7 @@ import { garboValue } from "./garboValue";
import { wanderer } from "./garboWanderer";
import { runTargetFight } from "./target/execution";
import { TargetFightRunOptions } from "./target/staging";
import { FreeFightQuest, runGarboQuests } from "./tasks";
import { EmbezzlerFightsQuest, FreeFightQuest, runGarboQuests } from "./tasks";
import {
expectedFreeFightQuestFights,
possibleFreeFightQuestTentacleFights,
Expand All @@ -195,6 +191,7 @@ import {
BuffExtensionQuest,
PostBuffExtensionQuest,
} from "./tasks/buffExtension";
import { highMeatMonsterCount } from "./turns";

const firstChainMacro = () =>
Macro.if_(
Expand Down Expand Up @@ -252,13 +249,13 @@ function meatTargetSetup() {
setLocation($location`Friar Ceremony Location`);
potionSetup(false);
maximize("MP", false);
meatMood(true, targetMeat()).execute(copyTargetCount());
meatMood(true, targetMeat()).execute(highMeatMonsterCount());
safeRestore();
freeFightMood().execute(50);
runGarboQuests([BuffExtensionQuest, PostBuffExtensionQuest]);
burnLibrams(400);

bathroomFinance(copyTargetCount());
bathroomFinance(highMeatMonsterCount());

if (SourceTerminal.have()) {
SourceTerminal.educate([$skill`Extract`, $skill`Digitize`]);
Expand Down Expand Up @@ -412,6 +409,7 @@ export function dailyFights(): void {
// check if user wants to wish for the copy target before doing setup
if (!getNextCopyTargetFight()) return;
meatTargetSetup();
if (targetingMeat()) runGarboQuests([EmbezzlerFightsQuest]);

// PROFESSOR COPIES
if (have($familiar`Pocket Professor`)) {
Expand Down
3 changes: 3 additions & 0 deletions packages/garbo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
propertyManager,
questStep,
safeRestore,
targetingMeat,
userConfirmDialog,
valueDrops,
} from "./lib";
Expand All @@ -88,6 +89,7 @@ import {
BarfTurnQuests,
CockroachSetup,
DailyFamiliarsQuest,
EmbezzlerFightsQuest,
PostQuest,
runGarboQuests,
runSafeGarboQuests,
Expand Down Expand Up @@ -610,6 +612,7 @@ export function main(argString = ""): void {
maximize("MP", false);
meatMood().execute(estimatedGarboTurns());
runGarboQuests([BuffExtensionQuest, PostBuffExtensionQuest]);
if (!targetingMeat()) runGarboQuests([EmbezzlerFightsQuest]);
try {
runGarboQuests([PostQuest(), ...BarfTurnQuests]);

Expand Down
8 changes: 8 additions & 0 deletions packages/garbo/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,14 @@ const luckyAdventures: LuckyAdventure[] = [
get("valueOfAdventure")
: 0,
},
{
location: $location`Cobb's Knob Treasury`,
phase: "target",
value: () =>
canAdventure($location`Cobb's Knob Treasury`)
? 3 * get("valueOfAdventure") // Rough estimation, they have 4x the basemeat of barf
: 0,
},
];

function determineBestLuckyAdventure(): LuckyAdventure {
Expand Down
5 changes: 2 additions & 3 deletions packages/garbo/src/outfit/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ import {
} from "libram";
import { acquire } from "../acquire";
import { globalOptions } from "../config";
import { copyTargetCount } from "../target";
import { meatFamiliar } from "../familiar";
import { targetMeat } from "../lib";
import { digitizedMonstersRemaining } from "../turns";
import { digitizedMonstersRemaining, highMeatMonsterCount } from "../turns";

export function bestBjornalike(outfit: Outfit): Item | null {
const bjornalikes = $items`Buddy Bjorn, Crown of Thrones`.filter((item) =>
Expand Down Expand Up @@ -95,7 +94,7 @@ export function useUPCsIfNeeded({ familiar }: Outfit): void {
const currentWeapon =
25 * (familiar ? findLeprechaunMultiplier(familiar) : 0);
const targets = globalOptions.ascend
? Math.min(20, copyTargetCount() || digitizedMonstersRemaining())
? Math.min(20, highMeatMonsterCount() || digitizedMonstersRemaining())
: 20;

const addedValueOfFullSword =
Expand Down
6 changes: 6 additions & 0 deletions packages/garbo/src/outfit/target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ export function meatTargetOutfit(
if (target === $location`Crab Island`) {
const meat = meatDrop($monster`giant giant crab`) + songboomMeat();
outfit.modifier.push(`${meat / 100} Meat Drop`, "-tie");
} else if (
target === $location`Cobb's Knob Treasury` &&
have($effect`Lucky!`)
) {
const meat = meatDrop($monster`Knob Goblin Embezzler`) + songboomMeat();
outfit.modifier.push(`${meat / 100} Meat Drop`, "-tie");
} else if (targetingMeat()) {
outfit.modifier.push(
`${modeValueOfMeat(BonusEquipMode.MEAT_TARGET)} Meat Drop`,
Expand Down
10 changes: 4 additions & 6 deletions packages/garbo/src/potions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,13 @@ import {
HIGHLIGHT,
improvesAStat,
pillkeeperOpportunityCost,
targetingMeat,
targetMeat,
targetMeatDifferential,
turnsToNC,
withLocation,
} from "./lib";
import { copyTargetCount } from "./target";
import { usingPurse } from "./outfit";
import { estimatedGarboTurns } from "./turns";
import { estimatedGarboTurns, highMeatMonsterCount } from "./turns";
import { globalOptions } from "./config";
import { castAugustScepterBuffs } from "./resources";

Expand Down Expand Up @@ -735,7 +733,7 @@ export function potionSetup(targetsOnly: boolean, avoidStats = false): void {
// TODO: Count PYEC.
// TODO: Count free fights (25 meat each for most).
withLocation($location.none, () => {
const targets = targetingMeat() ? copyTargetCount() : 0;
const targets = highMeatMonsterCount();

if (
have($item`Eight Days a Week Pill Keeper`) &&
Expand Down Expand Up @@ -1028,7 +1026,7 @@ export function effectValue(
effect: Effect,
duration: number,
maxTurnsWanted?: number,
targets = copyTargetCount(),
targets = highMeatMonsterCount("Scepter"), // Scepter has circular logic issues
): number {
if (effect === $effect`Shadow Affinity`) {
return globalOptions.prefs.valueOfFreeFight * duration; // Each turn of Shadow Affinity gives us one free fight
Expand All @@ -1052,7 +1050,7 @@ export function effectExtenderValue(
duration: number,
maximumNumberOfEffects?: number,
): number {
const targets = copyTargetCount();
const targets = highMeatMonsterCount();
const turns = estimatedGarboTurns();
return (
sum(getActiveEffects(), (effect) => {
Expand Down
3 changes: 2 additions & 1 deletion packages/garbo/src/resources/candyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import {
import { GarboTask } from "../tasks/engine";
import { garboValue } from "../garboValue";
import { acquire } from "../acquire";
import { GarboStrategy, Macro } from "../combat";
import { Macro } from "../combat";
import { freeFightOutfit } from "../outfit";
import { globalOptions } from "../config";
import { GarboStrategy } from "../combatStrategy";

const trickHats = $items`invisible bag, witch hat, beholed bedsheet, wolfman mask, pumpkinhead mask, mummy costume`;
const visitBlock = () =>
Expand Down
4 changes: 2 additions & 2 deletions packages/garbo/src/resources/scepter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import {
have,
} from "libram";
import { globalOptions } from "../config";
import { copyTargetCount } from "../target";
import { garboAverageValue, garboValue } from "../garboValue";
import { getBestLuckyAdventure } from "../lib";
import { effectValue, Potion } from "../potions";
import { GarboTask } from "../tasks/engine";
import { highMeatMonsterCount } from "../turns";

type ScepterSkill = {
skill: Skill;
Expand Down Expand Up @@ -75,7 +75,7 @@ const SKILL_OPTIONS: ScepterSkill[] = [
effect: $effect`Offhand Remarkable`,
duration: 30,
effectValues: { meatDrop: 80 }, // Half a purse
}).gross(copyTargetCount()) +
}).gross(highMeatMonsterCount("Scepter")) +
(globalOptions.ascend
? 0
: (5 + (have($familiar`Left-Hand Man`) ? 5 : 0)) *
Expand Down
Loading