Skip to content

Commit

Permalink
Better pull logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignose committed Apr 2, 2024
1 parent 2f53a0f commit b148b38
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
76 changes: 51 additions & 25 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,18 +522,53 @@ const meteorite = Math.min(8, computeWeaponDamage(false) - 1) + 4;
const slippers = Math.min(4, 1 + ((-1 * computeCombatFrequency(false)) / 5) * 3);
const chlamys = Math.min(3, ((-1 * computeCombatFrequency(false)) / 5) * 3);

export const pullValue = new Map([
[$item`box of Familiar Jacks`, famJacksValue],
[$item`Stick-Knife of Loathing`, stickKnife],
[$item`Staff of Simmering Hatred`, staff],
[$item`Buddy Bjorn`, 6.8],
[$item`meteorite necklace`, meteorite],
[$item`Great Wolf's beastly trousers`, greatWolfs],
[$item`repaid diaper`, 3],
[$item`tobiko marble soda`, tobikoSoda],
[$item`chalk chlamys`, chlamys],
[$item`Fuzzy Slippers of Hatred`, slippers],
]);
type valuePull = {
item: Item;
value: number;
};

export const pullValue: valuePull[] = [
{
item: $item`box of Familiar Jacks`,
value: famJacksValue,
},
{
item: $item`Stick-Knife of Loathing`,
value: stickKnife,
},
{
item: $item`Staff of Simmering Hatred`,
value: staff,
},
{
item: $item`Buddy Bjorn`,
value: 6.8,
},
{
item: $item`meteorite necklace`,
value: meteorite,
},
{
item: $item`Great Wolf's beastly trousers`,
value: greatWolfs,
},
{
item: $item`repaid diaper`,
value: 3,
},
{
item: $item`tobiko marble soda`,
value: tobikoSoda,
},
{
item: $item`chalk chlamys`,
value: chlamys,
},
{
item: $item`Fuzzy Slippers of Hatred`,
value: slippers,
},
];

export function checkPull(item: Item): boolean {
if (
Expand All @@ -548,19 +583,10 @@ export function checkPull(item: Item): boolean {
}

export function findMaxPull(): Item | null {
let maxItem: Item | null = null;
let maxValue = -1;

for (const [item, value] of pullValue) {
if (checkPull(item)) {
if (value > maxValue) {
maxValue = value;
maxItem = item;
}
}
}

return maxItem;
return maxBy(
pullValue.filter(({ item }) => storageAmount(item) >= 1),
`value`
).item;
}

export const forbiddenEffects: Effect[] = [];
Expand Down
2 changes: 2 additions & 0 deletions src/tasks/spelldamage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
restoreHp,
restoreMp,
retrieveItem,
use,
useSkill,
visitUrl,
} from "kolmafia";
Expand Down Expand Up @@ -84,6 +85,7 @@ export const SpellDamageQuest: Quest = {
do: (): void => {
visitUrl("inventory.php?action=pocket");
visitUrl("choice.php?whichchoice=1420&option=1&pocket=177");
use($item`Yeg's Motel hand soap`);
},
limit: { tries: 1 },
},
Expand Down

0 comments on commit b148b38

Please sign in to comment.