Skip to content

Commit

Permalink
Framework for Bat Wings (#2148)
Browse files Browse the repository at this point in the history
* Outline

* Update with actual pref

* Bump mafia version

* upgrade packages

* updates for latest mafia version

* actually equip the bat wings

* format

* sniffs no longer overwrite banishes

* better outfit construction

* Add bat winbg tracking to improve rates

* Update barfTurn.ts

* Update barfTurn.ts

---------

Co-authored-by: horrible little slime <[email protected]>
  • Loading branch information
Ignose and horrible-little-slime authored Oct 6, 2024
1 parent a681b95 commit 208a050
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 45 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/eslint-config-garbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@eslint/js": "^9.9.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-libram": "^0.4.13",
"eslint-plugin-libram": "^0.4.14",
"typescript-eslint": "^8.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"eslint": "^9.9.0",
"eslint-config-garbo": "^0.0.1",
"kolmafia": "^5.28067.0",
"libram": "^0.9.10",
"libram": "^0.9.11",
"lint-staged": "^15.2.9",
"madge": "^8.0.0",
"prettier": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo-lib/src/wanderer/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function canWanderTypeBackup(location: Location): boolean {
function canWanderTypeFreeFight(location: Location): boolean {
if (
location === $location`The Fun-Guy Mansion` &&
get("funGuyMansionKills", 0) >= 100
get("funGuyMansionKills") >= 100
) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"garbo-lib": "*",
"grimoire-kolmafia": "^0.3.26",
"kolmafia": "^5.28067.0",
"libram": "^0.9.10"
"libram": "^0.9.11"
},
"devDependencies": {
"@babel/cli": "^7.24.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo/src/familiar/barfFamiliar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function getCachedOutfitValues(fam: Familiar) {
computeBarfOutfit(
{
familiar: fam,
avoid: $items`Kramco Sausage-o-Matic™, cursed magnifying glass, protonic accelerator pack, "I Voted!" sticker, li'l pirate costume, bag of many confections`,
avoid: $items`Kramco Sausage-o-Matic™, cursed magnifying glass, protonic accelerator pack, "I Voted!" sticker, li'l pirate costume, bag of many confections, bat wings`,
},
true,
).dress();
Expand Down
18 changes: 9 additions & 9 deletions packages/garbo/src/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,7 @@ const freeRunFightSources = [
((have($item`industrial fire extinguisher`) &&
get("_fireExtinguisherCharge") >= 10) ||
(have($familiar`XO Skeleton`) && get("_xoHugsUsed") < 11) ||
(have($item`bat wings`) && get("_batWingsSwoopUsed") < 11) ||
(have($skill`Perpetrate Mild Evil`) &&
get("_mildEvilPerpetrated") < 3)) &&
get("_VYKEACompanionLevel") === 0 && // don't attempt this in case you re-run garbo after making a vykea furniture
Expand Down Expand Up @@ -1297,6 +1298,7 @@ const freeRunFightSources = [
.trySkillRepeat(
$skill`Fire Extinguisher: Polar Vortex`,
$skill`Perpetrate Mild Evil`,
$skill`Swoop like a Bat`,
)
.step(runSource.macro)
.setAutoAttack();
Expand All @@ -1314,13 +1316,16 @@ const freeRunFightSources = [
const zone = getBestItemStealZone();
const spec: OutfitSpec =
have($familiar`XO Skeleton`) && get("_xoHugsUsed") < 11
? { familiar: $familiar`XO Skeleton` }
: {};
? { familiar: $familiar`XO Skeleton`, equip: [] }
: { equip: [] };
if (
have($item`industrial fire extinguisher`) &&
get("_fireExtinguisherCharge") >= 10
) {
spec.equip = $items`industrial fire extinguisher`;
spec.equip?.push($item`industrial fire extinguisher`);
}
if (have($item`bat wings`) && get("_batWingsSwoopUsed") < 11) {
spec.equip?.push($item`bat wings`);
}
spec.modifier = zone?.maximize ?? [];
return spec;
Expand Down Expand Up @@ -1973,12 +1978,7 @@ function getBestItemStealZone(mappingMonster = false): ItemStealZone | null {
(zone) =>
zone.isOpen() &&
(mappingMonster || !zone.requireMapTheMonsters) &&
asArray(zone.monster).some(
(m) =>
!isBanished(m) ||
get("olfactedMonster") === m ||
get("_gallapagosMonster") === m,
),
asArray(zone.monster).some((m) => !isBanished(m)),
);
const vorticesAvail = have($item`industrial fire extinguisher`)
? Math.floor(get("_fireExtinguisherCharge") / 10)
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function defaultTarget() {
}

export function main(argString = ""): void {
sinceKolmafiaRevision(28067); // yes, can haz is like o hai
sinceKolmafiaRevision(28078); // track remaining bat wing skills
checkGithubVersion();

// Hit up main.php to get out of easily escapable choices
Expand Down
15 changes: 15 additions & 0 deletions packages/garbo/src/outfit/dropsgear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,20 @@ function simpleTargetCrits(mode: BonusEquipMode): Map<Item, number> {
]);
}

function batWings(mode: BonusEquipMode): Map<Item, number> {
const batWings = $item`bat wings`;
if (
!have(batWings) ||
mode !== BonusEquipMode.BARF ||
get("_batWingsFreeFights") >= 5
) {
return new Map<Item, number>();
}
const batWingsRate = 0.25;
const value = batWingsRate * get("valueOfAdventure");
return new Map<Item, number>([[batWings, value]]);
}

export function bonusGear(
mode: BonusEquipMode,
valueCircumstantialBonus = true,
Expand All @@ -299,6 +313,7 @@ export function bonusGear(
...sneegleebs(),
...bindlestocking(mode),
...simpleTargetCrits(mode),
...batWings(mode),
...(valueCircumstantialBonus
? new Map<Item, number>([
...pantsgiving(mode),
Expand Down
2 changes: 2 additions & 0 deletions packages/garbo/src/outfit/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export function bestBjornalike(outfit: Outfit): Item | null {
if (bjornalikes.length === 0) return null;
if (bjornalikes.length === 1) return bjornalikes[0];

if (outfit.bonuses.has($item`bat wings`)) return $item`Crown of Thrones`;

const hasStrongLep = findLeprechaunMultiplier(meatFamiliar()) >= 2;
const goodRobortHats = $items`crumpled felt fedora`;
if (myClass() === $class`Turtle Tamer`) {
Expand Down
27 changes: 8 additions & 19 deletions packages/garbo/src/tasks/dailyItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
have,
maxBy,
questStep,
set,
SourceTerminal,
sum,
withChoice,
Expand Down Expand Up @@ -186,35 +185,25 @@ const DailyItemTasks: GarboTask[] = [
name: "2002 Mr. Store",
ready: () => have($item`2002 Mr. Store Catalog`),
completed: () =>
get("availableMrStore2002Credits", 0) === 0 &&
get("_2002MrStoreCreditsCollected", true),
get("availableMrStore2002Credits") === 0 &&
get("_2002MrStoreCreditsCollected"),
do: (): void => {
const bestItem = maxBy(
Item.all().filter((i) => sellsItem($coinmaster`Mr. Store 2002`, i)),
garboValue,
);
buy(
$coinmaster`Mr. Store 2002`,
get("availableMrStore2002Credits", 0),
get("availableMrStore2002Credits"),
bestItem,
);
},
spendsTurn: false,
},
{
name: "Check Sept-Ember",
ready: () => have($item`Sept-Ember Censer`),
completed: () => get("_septEmbersCollected", false),
do: (): void => {
visitUrl("shop.php?whichshop=september", false);
set("_septEmbersCollected", true);
},
spendsTurn: false,
},
{
name: "Spend Sept-Ember Embers",
ready: () => have($item`Sept-Ember Censer`) && globalOptions.ascend,
completed: () => get("availableSeptEmbers", 0) === 0,
completed: () => get("availableSeptEmbers") === 0,
do: (): void => {
const itemsWithCosts = Item.all()
.filter((i) => sellsItem($coinmaster`Sept-Ember Censer`, i))
Expand All @@ -225,14 +214,14 @@ const DailyItemTasks: GarboTask[] = [
garboValue(item) / sellPrice($coinmaster`Sept-Ember Censer`, item),
}));

while (get("availableSeptEmbers", 0) > 0) {
while (get("availableSeptEmbers") > 0) {
const { item, cost } = maxBy(
itemsWithCosts.filter(
({ cost }) => cost <= get("availableSeptEmbers", 0),
({ cost }) => cost <= get("availableSeptEmbers"),
),
"value",
);
const toBuy = Math.floor(get("availableSeptEmbers", 0) / cost);
const toBuy = Math.floor(get("availableSeptEmbers") / cost);
buy($coinmaster`Sept-Ember Censer`, toBuy, item);
}
},
Expand Down Expand Up @@ -524,7 +513,7 @@ const DailyItemTasks: GarboTask[] = [
(!(myInebriety() > inebrietyLimit()) ||
(have($item`Drunkula's wineglass`) &&
canEquip($item`Drunkula's wineglass`))),
completed: () => get("_candyCaneSwordOvergrownShrine", true),
completed: () => get("_candyCaneSwordOvergrownShrine"),
do: () => {
visitUrl("adventure.php?snarfblat=348");
runChoice(4);
Expand Down
22 changes: 11 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3888,7 +3888,7 @@ __metadata:
"@types/eslint__js": ^8.42.3
eslint: ^9.9.0
eslint-config-prettier: ^9.1.0
eslint-plugin-libram: ^0.4.13
eslint-plugin-libram: ^0.4.14
lint-staged: ^15.2.9
madge: ^8.0.0
prettier: ^3.3.3
Expand All @@ -3912,13 +3912,13 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-libram@npm:^0.4.13":
version: 0.4.13
resolution: "eslint-plugin-libram@npm:0.4.13"
"eslint-plugin-libram@npm:^0.4.14":
version: 0.4.14
resolution: "eslint-plugin-libram@npm:0.4.14"
dependencies:
html-entities: ^2.5.2
requireindex: ~1.2.0
checksum: 745e5588e1695080313bd2a9b4d723c6a17652693f205d571c9c2fef7270e30ee0389416997d6047f812bcfe8da4f2a0ceca171b9bc153156a422f91ec27aa8b
checksum: 5395edbb43cc849010365bfacc0090e9a5111040abbfb934b965112021ac61449e25f6002ee4093f0cfd3ade4b3bf612aa7a804ec37b339f347a161d2aa287c1
languageName: node
linkType: hard

Expand Down Expand Up @@ -4335,7 +4335,7 @@ __metadata:
eslint: ^9.9.0
eslint-config-garbo: ^0.0.1
kolmafia: ^5.28067.0
libram: ^0.9.10
libram: ^0.9.11
lint-staged: ^15.2.9
madge: ^8.0.0
prettier: ^3.3.3
Expand Down Expand Up @@ -4390,7 +4390,7 @@ __metadata:
garbo-lib: "*"
grimoire-kolmafia: ^0.3.26
kolmafia: ^5.28067.0
libram: ^0.9.10
libram: ^0.9.11
lint-staged: ^15.2.9
madge: ^8.0.0
prettier: ^3.3.3
Expand Down Expand Up @@ -5054,14 +5054,14 @@ __metadata:
languageName: node
linkType: hard

"libram@npm:^0.9.10":
version: 0.9.10
resolution: "libram@npm:0.9.10"
"libram@npm:^0.9.11":
version: 0.9.11
resolution: "libram@npm:0.9.11"
dependencies:
html-entities: ^2.5.2
peerDependencies:
kolmafia: ^5.27668.0
checksum: 26e7513a92c89a0d85b59cbe32def8ec690e84c5d93e66af8db253208028cb93a5285803f1ac93dcf876b57f35be185513095683400407c63ac8e9da730351ca
checksum: 2746b9b102bf882ef0ce58794347068d6082aad9bbb1ba5dd1ac8d876c0d2beb3690350c4bb0cd3b350b44855ce5f16315e16939303045d47e892aa7d881764d
languageName: node
linkType: hard

Expand Down

0 comments on commit 208a050

Please sign in to comment.