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 16 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
1 change: 1 addition & 0 deletions packages/garbo-lib/src/value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export function makeValue(
),
],
[$item`inflammable leaf`, inflammableLeafCurrency()],
[$item`envelope full of Meat`, () => 50_000],
[
$item`crystalline cheer`,
currency(
Expand Down
31 changes: 23 additions & 8 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 @@ -30,6 +30,7 @@ type MenuOptions = Partial<{
canChooseMacro: boolean;
location: Location;
extraFamiliars: GeneralFamiliar[];
excludeFamiliar: Familiar[];
includeExperienceFamiliars: boolean;
allowAttackFamiliars: boolean;
mode: "barf" | "free" | "target";
Expand All @@ -38,6 +39,7 @@ const DEFAULT_MENU_OPTIONS = {
canChooseMacro: true,
location: $location`none`,
extraFamiliars: [],
excludeFamiliar: [],
includeExperienceFamiliars: true,
allowAttackFamiliars: true,
mode: "free",
Expand All @@ -48,6 +50,7 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
canChooseMacro,
location,
extraFamiliars,
excludeFamiliar,
allowAttackFamiliars,
mode,
} = {
Expand Down Expand Up @@ -91,6 +94,16 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
limit: "experience",
});
}

if (mode === "target") {
Rinn marked this conversation as resolved.
Show resolved Hide resolved
familiarMenu.push({
familiar: $familiar`Red-Nosed Snapper`,
expectedValue: snapperValue(),
leprechaunMultiplier: 0,
limit: "special",
});
}

if (canOpenRedPresent()) {
familiarMenu.push({
familiar: $familiar`Crimbo Shrub`,
Expand Down Expand Up @@ -128,13 +141,15 @@ export function menu(options: MenuOptions = {}): GeneralFamiliar[] {
});
}

if (!allowAttackFamiliars) {
return familiarMenu.filter(
(fam) => !(fam.familiar.physicalDamage || fam.familiar.elementalDamage),
);
}

return familiarMenu;
return familiarMenu.filter(
({ familiar }) =>
(allowAttackFamiliars ||
!(familiar.physicalDamage || familiar.elementalDamage)) &&
!excludeFamiliar.some(
(excludedFamiliar) => excludedFamiliar === familiar,
) &&
have(familiar),
Rinn marked this conversation as resolved.
Show resolved Hide resolved
);
}

export function getAllJellyfishDrops(): {
Expand Down
17 changes: 17 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,17 @@ export function estimatedBarfExperience(): number {

return sumNumbers(sources);
}

export function snapperValue(): number {
const item = Snapper.phylumItem.get(globalOptions.target.phylum);
if (!item) return 0;

const denominator =
11 -
(Snapper.getTrackedPhylum() === globalOptions.target.phylum
? Snapper.getProgress()
: 0);
if (denominator > copyTargetCount()) return 0;

return garboValue(item) / denominator;
}
16 changes: 16 additions & 0 deletions 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,6 +399,14 @@ function familiarSpec(underwater: boolean, fight: string): OutfitSpec {
}

if (isFreeAndCopyable(globalOptions.target)) {
if (["Macrometeorite", "Powerful Glove"].includes(fight)) {
Ignose marked this conversation as resolved.
Show resolved Hide resolved
return {
familiar: freeFightFamiliar({
mode: "target",
excludeFamiliar: [$familiar`Red-Nosed Snapper`],
}),
};
}
return { familiar: freeFightFamiliar({ mode: "target" }) };
}

Expand Down Expand Up @@ -528,6 +537,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