Skip to content

Commit

Permalink
quad tom specifically doesn't require a drum machine
Browse files Browse the repository at this point in the history
  • Loading branch information
horrible-little-slime committed Sep 29, 2024
1 parent f5eba66 commit 77330dd
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions packages/garbo/src/tasks/freeGiantSandworm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const SandwormTasks: GarboFreeFightTask[] = [
...[
{
name: $skill`Chest X-Ray`.name,
ready: () => have($item`Lil' Doctor™ bag`),
ready: () => drumMachineWorthIt() && have($item`Lil' Doctor™ bag`),
completed: () => get("_chestXRayUsed") >= 3,
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Chest X-Ray`),
Expand All @@ -166,7 +166,9 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Asdon Martin: Missile Launcher`.name,
ready: () => getWorkshed() === $item`Asdon Martin keyfob (on ring)`,
ready: () =>
drumMachineWorthIt() &&
getWorkshed() === $item`Asdon Martin keyfob (on ring)`,
completed: () => get("_missileLauncherUsed"),
prepare: () => AsdonMartin.fillTo(100),
combat: new GarboStrategy(() =>
Expand All @@ -176,7 +178,7 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Gingerbread Mob Hit`.name,
ready: () => have($skill`Gingerbread Mob Hit`),
ready: () => drumMachineWorthIt() && have($skill`Gingerbread Mob Hit`),
completed: () => get("_gingerbreadMobHitUsed"),
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Gingerbread Mob Hit`),
Expand All @@ -185,7 +187,7 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Shattering Punch`.name,
ready: () => have($skill`Shattering Punch`),
ready: () => drumMachineWorthIt() && have($skill`Shattering Punch`),
completed: () => get("_shatteringPunchUsed") >= 3,
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Shattering Punch`),
Expand All @@ -194,7 +196,7 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $item`replica bat-oomerang`.name,
ready: () => have($item`replica bat-oomerang`),
ready: () => drumMachineWorthIt() && have($item`replica bat-oomerang`),
completed: () => get("_usedReplicaBatoomerang") >= 3,
combat: new GarboStrategy(() =>
sandwormMacro().tryItem($item`replica bat-oomerang`),
Expand All @@ -203,7 +205,10 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Shocking Lick`.name,
ready: () => globalOptions.ascend && get("shockingLickCharges") > 0,
ready: () =>
drumMachineWorthIt() &&
globalOptions.ascend &&
get("shockingLickCharges") > 0,
completed: () => get("shockingLickCharges") === 0,
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Shocking Lick`),
Expand All @@ -212,7 +217,10 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Lightning Strike`.name,
ready: () => have($skill`Lightning Strike`) && myLightning() >= 20,
ready: () =>
drumMachineWorthIt() &&
have($skill`Lightning Strike`) &&
myLightning() >= 20,
completed: () => myLightning() < 20,
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Lightning Strike`),
Expand All @@ -221,7 +229,7 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: $skill`Free-For-All`.name,
ready: () => have($skill`Free-For-All`),
ready: () => drumMachineWorthIt() && have($skill`Free-For-All`),
completed: () => have($effect`Everything Looks Red`),
combat: new GarboStrategy(() =>
sandwormMacro().trySkill($skill`Free-For-All`),
Expand All @@ -230,7 +238,9 @@ const SandwormTasks: GarboFreeFightTask[] = [
},
{
name: "Yellow Ray",
ready: () => have($skill`Fondeluge`) || have($item`Jurassic Parka`),
ready: () =>
(drumMachineWorthIt() && have($skill`Fondeluge`)) ||
have($item`Jurassic Parka`),
completed: () => have($effect`Everything Looks Yellow`),
combat: new GarboStrategy(() =>
sandwormMacro()
Expand Down Expand Up @@ -296,9 +306,9 @@ function hasWorms(): boolean {

const REJECTION = 1 / 10;
const BASE_RATE = 1 / 100;
let _sandwormRate: number;
function sandwormRate(): number {
if (!_sandwormRate) {
let _drumMachineWorthIt: boolean;
function drumMachineWorthIt(): boolean {
if (_drumMachineWorthIt === undefined) {
Outfit.from(
sandwormSpec(),
new Error("Failed to generate Sandworm outfit"),
Expand All @@ -307,20 +317,18 @@ function sandwormRate(): number {
have($skill`Steely-Eyed Squint`) && !have($effect`Steely-Eyed Squint`)
? 2
: 1;
_sandwormRate =
const rate =
REJECTION *
clamp(BASE_RATE * (1 + (getModifier("Item Drop") * squint) / 100), 0, 1);
_drumMachineWorthIt =
mallPrice($item`drum machine`) < rate * garboValue($item`spice melange`);
}
return _sandwormRate;
return _drumMachineWorthIt;
}

// Use free fights on melanges if prices are reasonable
export const FreeGiantSandwormQuest: Quest<GarboTask> = {
name: "Free Giant Sandworm",
tasks: SandwormTasks,
ready: () =>
sober() &&
hasWorms() &&
mallPrice($item`drum machine`) <
sandwormRate() * garboValue($item`spice melange`),
ready: () => sober() && hasWorms(),
};

0 comments on commit 77330dd

Please sign in to comment.