Skip to content

Commit

Permalink
filter bad effects from modifiers instead of hard coding (#2141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinn authored Oct 1, 2024
1 parent 1dfdb14 commit 2b541ed
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 deletions.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/garbo-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
]
},
"peerDependencies": {
"kolmafia": "^5.28064.0",
"kolmafia": "^5.28067.0",
"libram": "^0.9.10"
},
"devDependencies": {
"eslint": "^9.9.0",
"eslint-config-garbo": "^0.0.1",
"kolmafia": "^5.28064.0",
"kolmafia": "^5.28067.0",
"libram": "^0.9.10",
"lint-staged": "^15.2.9",
"madge": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/garbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"dependencies": {
"garbo-lib": "*",
"grimoire-kolmafia": "^0.3.26",
"kolmafia": "^5.28064.0",
"kolmafia": "^5.28067.0",
"libram": "^0.9.10"
},
"devDependencies": {
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(28063); // Update for new BALLS predicates
sinceKolmafiaRevision(28067); // yes, can haz is like o hai
checkGithubVersion();

// Hit up main.php to get out of easily escapable choices
Expand Down
35 changes: 20 additions & 15 deletions packages/garbo/src/mood.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
booleanModifier,
cliExecute,
Effect,
getWorkshed,
Expand Down Expand Up @@ -227,23 +228,27 @@ export function useBuffExtenders(): void {
}
}

const stings = [
...$effects`Apoplectic with Rage, Barfpits, Berry Thorny, Biologically Shocked, Bone Homie, Boner Battalion, Coal-Powered, Curse of the Black Pearl Onion, Dizzy with Rage, Drenched With Filth, EVISCERATE!, Fangs and Pangs, Frigidalmatian, Gummi Badass, Haiku State of Mind, It's Electric!, Jabañero Saucesphere, Jalapeño Saucesphere, Little Mouse Skull Buddy, Long Live GORF, Mayeaugh, Permanent Halloween, Psalm of Pointiness, Pygmy Drinking Buddy, Quivering with Rage, Scarysauce, Skeletal Cleric, Skeletal Rogue, Skeletal Warrior, Skeletal Wizard, Smokin', Soul Funk, Spiky Frozen Hair, Stinkybeard, Stuck-Up Hair, Can Has Cyborger, Feeling Nervous`,
$effect`Burning, Man`,
$effect`Yes, Can Haz`,
];
const textAlteringEffects = $effects`Can Has Cyborger, Dis Abled, Haiku State of Mind, Just the Best Anapests, O Hai!, Robocamo`;
export const teleportEffects = $effects`Teleportitis, Feeling Lost, Funday!`;
const otherwiseBadEffects = $effects`Temporary Blindness`;
const damageEffects = Effect.all().filter((x) =>
["Thorns", "Sporadic Thorns", "Damage Aura", "Sporadic Damage Aura"].some(
(modifier) => numericModifier(x, modifier) > 0,
),
);
const textAlteringEffects = Effect.all().filter((x) =>
booleanModifier(x, "Alters Page Text"),
);
export const teleportEffects = Effect.all().filter((x) =>
booleanModifier(x, "Adventure Randomly"),
);
const otherBadEffects = Effect.all().filter(
(x) => booleanModifier(x, "Blind") || booleanModifier(x, "Always Fumble"),
);
export function shrugBadEffects(...exclude: Effect[]): void {
[
...stings,
...damageEffects,
...textAlteringEffects,
...teleportEffects,
...otherwiseBadEffects,
].forEach((effect) => {
if (have(effect) && !exclude.includes(effect)) {
uneffect(effect);
}
});
...otherBadEffects,
]
.filter((effect) => have(effect) && !exclude.includes(effect))
.forEach((effect) => uneffect(effect));
}
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4334,14 +4334,14 @@ __metadata:
dependencies:
eslint: ^9.9.0
eslint-config-garbo: ^0.0.1
kolmafia: ^5.28064.0
kolmafia: ^5.28067.0
libram: ^0.9.10
lint-staged: ^15.2.9
madge: ^8.0.0
prettier: ^3.3.3
typescript: ^5.5.4
peerDependencies:
kolmafia: ^5.28064.0
kolmafia: ^5.28067.0
libram: ^0.9.10
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -4389,7 +4389,7 @@ __metadata:
eslint-config-garbo: ^0.0.1
garbo-lib: "*"
grimoire-kolmafia: ^0.3.26
kolmafia: ^5.28064.0
kolmafia: ^5.28067.0
libram: ^0.9.10
lint-staged: ^15.2.9
madge: ^8.0.0
Expand Down Expand Up @@ -5037,10 +5037,10 @@ __metadata:
languageName: node
linkType: hard

"kolmafia@npm:^5.28064.0":
version: 5.28064.0
resolution: "kolmafia@npm:5.28064.0"
checksum: 619b5b862c93307b7238ecff6352a3391d67972ef138ebe343faa7419d63a2d649cdf931bbab92a320bbf4f6aa647ef38a0f8a2b1201f647907d2eef63cec098
"kolmafia@npm:^5.28067.0":
version: 5.28069.0
resolution: "kolmafia@npm:5.28069.0"
checksum: 67c53aae0b5e4b7986ece0ec90567bf2a2182d7096792f0058aa5a788c0c3f14a78327b20509f8a63e466d9bf6685a26dcb738e75621f3886333c4bfb0f356a1
languageName: node
linkType: hard

Expand Down

0 comments on commit 2b541ed

Please sign in to comment.