Skip to content
Draft
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
56 changes: 56 additions & 0 deletions src/familiar/barfFamiliar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import {
Familiar,
familiarWeight,
Item,
mallPrice,
myFamiliar,
numericModifier,
print,
Slot,
toInt,
useFamiliar,
visitUrl,
weightAdjustment,
} from "kolmafia";
import {
Expand All @@ -20,8 +23,10 @@ import {
findLeprechaunMultiplier,
get,
getModifier,
have,
maxBy,
sum,
sumNumbers,
} from "libram";
import { NumericModifier } from "libram/dist/modifierTypes";
import { BonusEquipMode, bonusGear } from "../outfit";
Expand All @@ -33,6 +38,8 @@ import { getExperienceFamiliarLimit } from "./experienceFamiliars";
import { getAllJellyfishDrops, menu } from "./freeFightFamiliar";
import { GeneralFamiliar, timeToMeatify, turnsAvailable } from "./lib";
import { meatFamiliar } from "./meatFamiliar";
import { acquire } from "../acquire";
import { garboValue } from "../session";

const ITEM_DROP_VALUE = 0.72;
const MEAT_DROP_VALUE = baseMeat / 100;
Expand Down Expand Up @@ -152,6 +159,55 @@ export function barfFamiliar(): Familiar {
if (!meatFamiliarEntry) throw new Error("Something went wrong when initializing familiars!");

const meatFamiliarValue = totalFamiliarValue(meatFamiliarEntry);

// Consider making a comma jellyfish
if (
!have($familiar`Space Jellyfish`) &&
have($familiar`Comma Chameleon`) &&
get("commaFamiliar") !== $familiar`Space Jellyfish`
) {
const potentialJellyfishTurns = Math.min(40, turnsAvailable());
const jellyPrice = garboValue($item`stench jelly`);
const commaJellyfishValue =
sumNumbers(
[
1.0,
1.0 / 2.0,
1.0 / 3.0,
1.0 / 4.0,
1.0 / 5.0,
...Array(100)
.fill(0)
.map(() => 1.0 / 20.0),
]
.map((val) => (val * jellyPrice > meatFamiliarValue ? val * jellyPrice : 0))
.splice(
get("_spaceJellyfishDrops"),
get("_spaceJellyfishDrops") + potentialJellyfishTurns
)
) -
Comment on lines +171 to +188
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of using sumNumbers with map, just use sum; do the splice earlier in the process to make this work

potentialJellyfishTurns * meatFamiliarValue;

if (commaJellyfishValue >= mallPrice($item`space jellybicycle`)) {
if (acquire(1, $item`space jellybicycle`, commaJellyfishValue, false)) {
useFamiliar($familiar`Comma Chameleon`);
visitUrl(
`inv_equip.php?which=2&action=equip&whichitem=${toInt($item`space jellybicycle`)}&pwd`
);
visitUrl("charpane.php");
fullMenu.push(
menu({
canChooseMacro: true,
location: $location`Barf Mountain`,
includeExperienceFamiliars: false,
})
.filter((f) => f.familiar === $familiar`Comma Chameleon`)
.map(calculateOutfitValue)[0]
);
Comment on lines +198 to +206
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell what it is you're trying to do here, but it doesn't seem like the best way to achieve it.

}
}
}

const viableMenu = fullMenu.filter((f) => totalFamiliarValue(f) > meatFamiliarValue);

if (viableMenu.every(({ limit }) => limit !== "none")) {
Expand Down
20 changes: 19 additions & 1 deletion src/familiar/freeFightFamiliar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
limit: "special",
});
}

if (location.zone === "Dinseylandfill" && have($familiar`Comma Chameleon`)) {
familiarMenu.push({
familiar: $familiar`Comma Chameleon`,
expectedValue:
get("commaFamiliar") === $familiar`Space Jellyfish`
? garboValue($item`stench jelly`) /
(get("_spaceJellyfishDrops") < 5 ? get("_spaceJellyfishDrops") + 1 : 20)
: 0,
leprechaunMultiplier: 0,
limit: "special",
});
}
}

const meatFam = meatFamiliar();
Expand All @@ -92,7 +105,12 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
}

export function getAllJellyfishDrops(): { expectedValue: number; turnsAtValue: number }[] {
if (!have($familiar`Space Jellyfish`)) return [{ expectedValue: 0, turnsAtValue: 0 }];
if (
!have($familiar`Space Jellyfish`) &&
(!have($familiar`Comma Chameleon`) || get("commaFamiliar") !== $familiar`Space Jellyfish`)
) {
return [{ expectedValue: 0, turnsAtValue: 0 }];
}

const current = get("_spaceJellyfishDrops");
const returnValue = [];
Expand Down
5 changes: 4 additions & 1 deletion src/familiar/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export function timeToMeatify(): boolean {
}

export function pocketProfessorLectures(): number {
return 2 + Math.ceil(Math.sqrt(familiarWeight($familiar`Pocket Professor`) + weightAdjustment()));
const prof = have($familiar`Pocket Professor`)
? $familiar`Pocket Professor`
: $familiar`Comma Chameleon`;
return 2 + Math.ceil(Math.sqrt(familiarWeight(prof) + weightAdjustment()));
}

export function canOpenRedPresent(): boolean {
Expand Down
45 changes: 35 additions & 10 deletions src/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import {
bestShadowRift,
burnLibrams,
dogOrHolidayWanderer,
EMBEZZLER_MULTIPLIER,
embezzlerLog,
ESTIMATED_OVERDRUNK_TURNS,
expectedEmbezzlerProfit,
Expand Down Expand Up @@ -382,7 +383,7 @@ export function dailyFights(): void {
embezzlerSetup();

// PROFESSOR COPIES
if (have($familiar`Pocket Professor`)) {
if (have($familiar`Pocket Professor`) || have($familiar`Comma Chameleon`)) {
const potentialPocketProfessorLectures = [
{
property: "_garbo_meatChain",
Expand Down Expand Up @@ -415,18 +416,42 @@ export function dailyFights(): void {

const chip = $item`Pocket Professor memory chip`;
const jacks = $item`box of Familiar Jacks`;
useFamiliar($familiar`Pocket Professor`);
if (!have(chip)) {
if (mallPrice(jacks) < mallPrice(chip)) {
retrieveItem(jacks);
use(jacks);
} else {
retrieveItem(chip);
useFamiliar(
have($familiar`Pocket Professor`)
? $familiar`Pocket Professor`
: $familiar`Comma Chameleon`
);
if (myFamiliar() === $familiar`Pocket Professor`) {
if (!have(chip)) {
if (mallPrice(jacks) < mallPrice(chip)) {
retrieveItem(jacks);
use(jacks);
} else {
retrieveItem(chip);
}
}
} else {
if (get("commaFamiliar") !== $familiar`Pocket Professor`) {
if (!have(chip)) {
acquire(
1,
chip,
EMBEZZLER_MULTIPLIER() *
get("valueOfAdventure") *
Math.min(40, pocketProfessorLectures() - get("_pocketProfessorLectures"))
);
}
visitUrl(`inv_equip.php?which=2&action=equip&whichitem=${toInt(chip)}&pwd`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to make the chameleon your familiar before calling this, or equip straight to the terrarium

visitUrl("charpane.php");
}
}

const profSpec: OutfitSpec = { familiar: $familiar`Pocket Professor` };
if (have(chip)) {
const profSpec: OutfitSpec = {
familiar: have($familiar`Pocket Professor`)
? $familiar`Pocket Professor`
: $familiar`Comma Chameleon`,
};
if (have(chip) && myFamiliar() === $familiar`Pocket Professor`) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chameleon can't equip chip, so that's not going to work

profSpec.famequip = chip;
}

Expand Down