Skip to content

Commit

Permalink
Merge pull request #90 from loathers/mini-kiwi
Browse files Browse the repository at this point in the history
implement & export mini-kiwi spading project
  • Loading branch information
horrible-little-slime committed Jun 18, 2024
2 parents 64a5a4b + e9deb15 commit aacd03b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/excavator-projects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DROP_MR_SCREEGES } from "./projects/dropMrScreeges";
import { GENIE } from "./projects/genie";
import { HOOKAH } from "./projects/hookah";
import { JUICE_BAR } from "./projects/juiceBar";
import { MINI_KIWI } from "./projects/miniKiwi";
import { MONSTER_PARTS } from "./projects/monsterParts";
import { MUMMING_TRUNK } from "./projects/mummingTrunk";
import { OUT_OF_ORDER } from "./projects/outOfOrder";
Expand All @@ -30,6 +31,7 @@ export const projects: ExcavatorProject[] = [
DROP_MIXED_EVERYTHING,
DROP_MR_CHEENGS,
DROP_MR_SCREEGES,
MINI_KIWI,
MONSTER_PARTS,
MUMMING_TRUNK,
OUT_OF_ORDER,
Expand Down
61 changes: 61 additions & 0 deletions packages/excavator-projects/projects/miniKiwi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import {
Familiar,
Item,
currentRound,
familiarWeight,
getProperty,
haveEquipped,
lastMonster,
myFamiliar,
myId,
myLocation,
myPath,
myTotalTurnsSpent,
weightAdjustment,
} from "kolmafia";

import { ExcavatorProject } from "../type";
import { toNormalisedString } from "../utils";

type KiwiData = {
player: number;
gotDrop: boolean;
dropsToday: number;
location: string;
monster: string;
baseWeight: number;
buffedWeight: number;
turn: number;
path: string;
hasGoggles: boolean;
};

function spadeKiwi(encounter: string, page: string): KiwiData | null {
if (currentRound() !== 0) return null;
if (myFamiliar() !== Familiar.get("Mini Kiwi")) return null;

return {
player: Number(myId()),
gotDrop: page.includes("You acquire an item: <b>mini kiwi</b>"),
dropsToday: Number(getProperty("_miniKiwiDrops")),
location: toNormalisedString(myLocation()),
path: toNormalisedString(myPath()),
baseWeight: familiarWeight(Familiar.get("Mini Kiwi")),
buffedWeight:
familiarWeight(Familiar.get("Mini Kiwi")) + weightAdjustment(),
turn: myTotalTurnsSpent(),
hasGoggles: haveEquipped(Item.get("aviator goggles")),
monster: toNormalisedString(lastMonster()),
};
}

export const MINI_KIWI: ExcavatorProject = {
name: "Mini Kiwi",
description:
"Determine the formula and factors of the Mini Kiwi's mini-kiwi drop rate",
author: "sweaty bill",
hooks: {
COMBAT_ROUND: spadeKiwi,
},
since: 27973, // mini kiwi familiar equipment added
};
2 changes: 1 addition & 1 deletion packages/excavator-projects/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function toNormalisedItem(name: string) {
return item === Item.none ? name : toNormalisedString(item);
}

export function toNormalisedString(thing: Item | Monster | Location) {
export function toNormalisedString(thing: Item | Monster | Location | Path) {
return `[${thing.id}]${"name" in thing ? thing.name : thing.toString()}`;
}

Expand Down

0 comments on commit aacd03b

Please sign in to comment.