-
Notifications
You must be signed in to change notification settings - Fork 65
Initial support for Comma Chameleon #1416
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,14 @@ import { | |
| Familiar, | ||
| familiarWeight, | ||
| Item, | ||
| mallPrice, | ||
| myFamiliar, | ||
| numericModifier, | ||
| print, | ||
| Slot, | ||
| toInt, | ||
| useFamiliar, | ||
| visitUrl, | ||
| weightAdjustment, | ||
| } from "kolmafia"; | ||
| import { | ||
|
|
@@ -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"; | ||
|
|
@@ -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; | ||
|
|
@@ -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 | ||
| ) | ||
| ) - | ||
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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")) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,6 +130,7 @@ import { | |
| bestShadowRift, | ||
| burnLibrams, | ||
| dogOrHolidayWanderer, | ||
| EMBEZZLER_MULTIPLIER, | ||
| embezzlerLog, | ||
| ESTIMATED_OVERDRUNK_TURNS, | ||
| expectedEmbezzlerProfit, | ||
|
|
@@ -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", | ||
|
|
@@ -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`); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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`) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of using
sumNumberswithmap, just usesum; do thespliceearlier in the process to make this work