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

Add Snapper as a valuable familiar for copyTarget freeFightFamiliars #2132

Merged
merged 21 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
32 changes: 26 additions & 6 deletions packages/garbo/src/familiar/freeFightFamiliar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { garboValue } from "../garboValue";
import getConstantValueFamiliars from "./constantValueFamiliars";
import getDropFamiliars from "./dropFamiliars";
import getExperienceFamiliars from "./experienceFamiliars";
import { GeneralFamiliar, timeToMeatify } from "./lib";
import { GeneralFamiliar, snapperValue, timeToMeatify } from "./lib";
import { meatFamiliar } from "./meatFamiliar";
import { gooseDroneEligible, valueDrops } from "../lib";
import { globalOptions } from "../config";
Expand All @@ -42,7 +42,10 @@ const DEFAULT_MENU_OPTIONS = {
allowAttackFamiliars: true,
mode: "free",
} as const;
export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
export function menu(
options: MenuOptions = {},
fight?: string,
Rinn marked this conversation as resolved.
Show resolved Hide resolved
): GeneralFamiliar[] {
const {
includeExperienceFamiliars,
canChooseMacro,
Expand Down Expand Up @@ -73,7 +76,7 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
}

if (
mode === "target" &&
mode.includes("target") &&
Rinn marked this conversation as resolved.
Show resolved Hide resolved
Rinn marked this conversation as resolved.
Show resolved Hide resolved
gooseDroneEligible() &&
get("gooseDronesRemaining") < copyTargetCount()
) {
Expand All @@ -91,6 +94,19 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
limit: "experience",
});
}

if (
mode === "target" &&
(fight ? !["Macrometeorite", "Powerful Glove"].includes(fight) : true)
) {
familiarMenu.push({
familiar: $familiar`Red-Nosed Snapper`,
expectedValue: mode === "target" ? snapperValue() : 0,
leprechaunMultiplier: 0,
limit: "special",
});
}

if (canOpenRedPresent()) {
familiarMenu.push({
familiar: $familiar`Crimbo Shrub`,
Expand Down Expand Up @@ -165,6 +181,7 @@ export function getAllJellyfishDrops(): {

export function freeFightFamiliarData(
options: MenuOptions = {},
fight?: string,
): GeneralFamiliar {
const compareFamiliars = (a: GeneralFamiliar, b: GeneralFamiliar) => {
if (a === null) return b;
Expand All @@ -174,14 +191,17 @@ export function freeFightFamiliarData(
return a.expectedValue > b.expectedValue ? a : b;
};

return menu(options).reduce(compareFamiliars, {
return menu(options, fight).reduce(compareFamiliars, {
familiar: $familiar.none,
expectedValue: 0,
leprechaunMultiplier: 0,
limit: "none",
});
}

export function freeFightFamiliar(options: MenuOptions = {}): Familiar {
return freeFightFamiliarData(options).familiar;
export function freeFightFamiliar(
options: MenuOptions = {},
fight?: string,
): Familiar {
return freeFightFamiliarData(options, fight).familiar;
}
21 changes: 21 additions & 0 deletions packages/garbo/src/familiar/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import {
clamp,
get,
have,
Snapper,
sumNumbers,
} from "libram";
import { globalOptions } from "../config";
import { baseMeat, ESTIMATED_OVERDRUNK_TURNS, turnsToNC } from "../lib";
import { digitizedMonstersRemaining, estimatedGarboTurns } from "../turns";
import { garboValue } from "../garboValue";
import { copyTargetCount } from "../target";

export type GeneralFamiliar = {
familiar: Familiar;
Expand Down Expand Up @@ -131,3 +134,21 @@ export function estimatedBarfExperience(): number {

return sumNumbers(sources);
}

const ESTIMATED_ENVELOPE_VALUE = 50_000;

export function snapperValue(): number {
const item = Snapper.phylumItem.get(globalOptions.target.phylum);
const denominator =
11 -
(Snapper.getTrackedPhylum() === globalOptions.target.phylum
? Snapper.getProgress()
: 0);
if (denominator > copyTargetCount()) return 0;

if (!item) return 0;
Rinn marked this conversation as resolved.
Show resolved Hide resolved

if (item === $item`envelope full of Meat`)
return ESTIMATED_ENVELOPE_VALUE / denominator;
return garboValue(item) / denominator;
}
10 changes: 9 additions & 1 deletion packages/garbo/src/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ import {
Requirement,
Robortender,
set,
Snapper,
SourceTerminal,
sum,
undelay,
Expand Down Expand Up @@ -398,7 +399,7 @@ function familiarSpec(underwater: boolean, fight: string): OutfitSpec {
}

if (isFreeAndCopyable(globalOptions.target)) {
return { familiar: freeFightFamiliar({ mode: "target" }) };
return { familiar: freeFightFamiliar({ mode: "target" }, fight) };
}

return { familiar: meatFamiliar() };
Expand Down Expand Up @@ -528,6 +529,13 @@ export function dailyFights(): void {

const famSpec = familiarSpec(underwater, nextFight.name);

if (
famSpec.familiar === $familiar`Red-Nosed Snapper` &&
Snapper.getTrackedPhylum() !== globalOptions.target.phylum
) {
Snapper.trackPhylum(globalOptions.target.phylum);
}

setLocation(location);
meatTargetOutfit({ ...nextFight.spec, ...famSpec }, location).dress();

Expand Down
Loading