Skip to content

Commit

Permalink
streamlines and fixes to mapping in item steal zones; upgrade libram (#…
Browse files Browse the repository at this point in the history
…2157)

* streamlines and fixes to mapping in item steal zones; upgrade libram

* use `BatWings` functions in `dropsgear`
  • Loading branch information
horrible-little-slime authored Oct 14, 2024
1 parent 208a050 commit 05c046c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
Binary file not shown.
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.11",
"libram": "^0.9.12",
"lint-staged": "^15.2.9",
"madge": "^8.0.0",
"prettier": "^3.3.3",
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.11"
"libram": "^0.9.12"
},
"devDependencies": {
"@babel/cli": "^7.24.8",
Expand Down
35 changes: 19 additions & 16 deletions packages/garbo/src/fights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ import {
$stat,
$thrall,
ActionSource,
BatWings,
Cartography,
ChestMimic,
CinchoDeMayo,
clamp,
Expand Down Expand Up @@ -1101,8 +1103,7 @@ const freeFightSources = [
!get("_firedJokestersGun") &&
have($item`The Jokester's gun`) &&
canEquip($item`The Jokester's gun`) &&
have($skill`Comprehensive Cartography`) &&
get("_monstersMapped") < 3,
Cartography.availableMaps() > 0,
() => {
try {
Macro.skill($skill`Fire the Jokester's Gun`)
Expand Down Expand Up @@ -1267,17 +1268,13 @@ const freeRunFightSources = [
(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
getBestItemStealZone(true) !== null,
getBestItemStealZone() !== null,
(runSource: ActionSource) => {
setupItemStealZones();
const best = getBestItemStealZone(true);
const best = getBestItemStealZone();
if (!best) throw `Unable to find fire extinguisher zone?`;
const mappingMonster =
have($skill`Comprehensive Cartography`) &&
get("_monstersMapped") < 3 &&
best.location.wanderers &&
have($skill`Comprehensive Cartography`) &&
get("_monstersMapped") < 3;
Cartography.availableMaps() > 0 && best.location.wanderers;
const monsters = asArray(best.monster);
try {
if (best.preReq) best.preReq();
Expand Down Expand Up @@ -1324,7 +1321,7 @@ const freeRunFightSources = [
) {
spec.equip?.push($item`industrial fire extinguisher`);
}
if (have($item`bat wings`) && get("_batWingsSwoopUsed") < 11) {
if (BatWings.swoopsRemaining() > 0) {
spec.equip?.push($item`bat wings`);
}
spec.modifier = zone?.maximize ?? [];
Expand Down Expand Up @@ -1973,23 +1970,30 @@ const itemStealZones = [
),
] as ItemStealZone[];

function getBestItemStealZone(mappingMonster = false): ItemStealZone | null {
function getBestItemStealZone(
canMapMonster = Cartography.availableMaps() > 0 ||
Cartography.currentlyMapping(),
): ItemStealZone | null {
const targets = itemStealZones.filter(
(zone) =>
zone.isOpen() &&
(mappingMonster || !zone.requireMapTheMonsters) &&
asArray(zone.monster).some((m) => !isBanished(m)),
(canMapMonster ||
(!zone.requireMapTheMonsters &&
asArray(zone.monster).some((m) => !isBanished(m)))),
);
const vorticesAvail = have($item`industrial fire extinguisher`)
? Math.floor(get("_fireExtinguisherCharge") / 10)
: 0;
const hugsAvail = have($familiar`XO Skeleton`)
? clamp(11 - get("_xoHugsUsed"), 0, 11)
: 0;
const swoopsAvail = BatWings.swoopsRemaining();
const value = (zone: ItemStealZone): number => {
// We have to divide hugs by 2 - will likely use a banish as a free run so we will be alternating zones.
return (
zone.dropRate * garboValue(zone.item) * (vorticesAvail + hugsAvail / 2) -
zone.dropRate *
garboValue(zone.item) *
(vorticesAvail + swoopsAvail + hugsAvail / 2) -
zone.openCost()
);
};
Expand Down Expand Up @@ -2100,8 +2104,7 @@ function killRobortCreaturesForFree() {
while (
freeKill &&
canAdventure($location`The Copperhead Club`) &&
have($skill`Comprehensive Cartography`) &&
get("_monstersMapped") < 3
Cartography.availableMaps() > 0
) {
if (have($effect`Crappily Disguised as a Waiter`)) {
setChoice(855, 4);
Expand Down
8 changes: 4 additions & 4 deletions packages/garbo/src/outfit/dropsgear.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
$skill,
$slot,
$slots,
BatWings,
BurningLeaves,
clamp,
DaylightShavings,
Expand Down Expand Up @@ -288,14 +289,13 @@ function simpleTargetCrits(mode: BonusEquipMode): Map<Item, number> {
function batWings(mode: BonusEquipMode): Map<Item, number> {
const batWings = $item`bat wings`;
if (
!have(batWings) ||
!BatWings.have() ||
mode !== BonusEquipMode.BARF ||
get("_batWingsFreeFights") >= 5
BatWings.flapChance() === 0
) {
return new Map<Item, number>();
}
const batWingsRate = 0.25;
const value = batWingsRate * get("valueOfAdventure");
const value = BatWings.flapChance() * get("valueOfAdventure");
return new Map<Item, number>([[batWings, value]]);
}

Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4335,7 +4335,7 @@ __metadata:
eslint: ^9.9.0
eslint-config-garbo: ^0.0.1
kolmafia: ^5.28067.0
libram: ^0.9.11
libram: ^0.9.12
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.11
libram: ^0.9.12
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.11":
version: 0.9.11
resolution: "libram@npm:0.9.11"
"libram@npm:^0.9.12":
version: 0.9.12
resolution: "libram@npm:0.9.12"
dependencies:
html-entities: ^2.5.2
peerDependencies:
kolmafia: ^5.27668.0
checksum: 2746b9b102bf882ef0ce58794347068d6082aad9bbb1ba5dd1ac8d876c0d2beb3690350c4bb0cd3b350b44855ce5f16315e16939303045d47e892aa7d881764d
checksum: 0d023ac40dccf9f23c080d1a83a0e1513fb17710ab89460bdb944d40b46b2bea7530386dbc0164cf2d4c4a1e23a48a740a2ed0426c21ab503746380d31297d1a
languageName: node
linkType: hard

Expand Down

0 comments on commit 05c046c

Please sign in to comment.