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

Machine elf dupe #2130

Merged
merged 9 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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/resources/realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,7 @@ import {
runChoice,
visitUrl,
} from "kolmafia";
import {
$item,
get,
have,
maxBy,
property,
realmAvailable,
set,
withProperty,
} from "libram";
import { $item, get, have, maxBy, property, set, withProperty } from "libram";
import { globalOptions } from "../config";
import { garboValue } from "../garboValue";
import { HIGHLIGHT } from "../lib";
Expand All @@ -29,17 +20,7 @@ function volcanoItemValue({ quantity, item }: VolcanoItem): number {
if (!have($item`Clara's bell`) || globalOptions.clarasBellClaimed) {
return Infinity;
}
// Check if we can use Clara's bell for Yachtzee
// If so, we call the opportunity cost of this about 40k
if (
realmAvailable("sleaze") &&
have($item`fishy pipe`) &&
!get("_fishyPipeUsed")
) {
return quantity * 40000;
} else {
return quantity * get("valueOfAdventure");
}
return quantity * get("valueOfAdventure");
}

if (!item.tradeable) return Infinity;
Expand Down
55 changes: 55 additions & 0 deletions packages/garbo/src/tasks/barfTurn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ import {
availableAmount,
canAdventure,
canEquip,
closetAmount,
eat,
getWorkshed,
Item,
itemAmount,
Location,
mallPrice,
maximize,
myAdventures,
myAscensions,
myInebriety,
myLevel,
myLightning,
myRain,
myTurncount,
outfitPieces,
runChoice,
takeCloset,
totalTurnsPlayed,
use,
useSkill,
Expand All @@ -39,6 +44,7 @@ import {
GingerBread,
have,
HeavyRains,
maxBy,
questStep,
realmAvailable,
set,
Expand Down Expand Up @@ -321,6 +327,22 @@ function vampOut(additionalReady: () => boolean) {
};
}

let bestDupeItem: Item | null = null;
function getBestDupeItem(): Item {
if (bestDupeItem === null || !have(bestDupeItem)) {
// Machine elf can dupe PVPable food, booze, spleen item or potion
const validItems = Item.all().filter(
(i) =>
i.tradeable &&
i.discardable &&
(i.inebriety || i.fullness || i.potion || i.spleen) &&
have(i),
);
bestDupeItem = maxBy(validItems, garboValue);
}
return bestDupeItem;
}

function willDrunkAdventure() {
return have($item`Drunkula's wineglass`) && globalOptions.ascend;
}
Expand Down Expand Up @@ -367,6 +389,39 @@ const NonBarfTurnTasks: AlternateTask[] = [
: 0,
spendsTurn: true,
},
{
name: "Machine Elf Dupe",
ready: () =>
((willDrunkAdventure() && !sober()) || !willDrunkAdventure()) &&
Shiverwarp marked this conversation as resolved.
Show resolved Hide resolved
get("encountersUntilDMTChoice") === 0 &&
garboValue(getBestDupeItem()) > get("valueOfAdventure"),
completed: () => get("lastDMTDuplication") === myAscensions(),
do: $location`The Deep Machine Tunnels`,
prepare: () => {
if (
itemAmount(getBestDupeItem()) < 1 &&
closetAmount(getBestDupeItem()) > 0
) {
takeCloset(getBestDupeItem());
}
Shiverwarp marked this conversation as resolved.
Show resolved Hide resolved
},
outfit: () =>
sober()
? {
avoid: $items`Kramco Sausage-o-Matic™`,
familiar: $familiar`Machine Elf`,
}
: {
offhand: $item`Drunkula's wineglass`,
familiar: $familiar`Machine Elf`,
},
combat: new GarboStrategy(() =>
Macro.abortWithMsg("Hit unexpected combat!"),
),
turns: () => 1,
spendsTurn: true,
choices: () => ({ 1119: 4, 1125: `1&iid=${getBestDupeItem().id}` }),
},
{
name: "Lava Dogs (drunk)",
...lavaDogs(() => willDrunkAdventure(), {
Expand Down
Loading