Skip to content
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

filter bad effects from modifiers instead of hard coding #2141

Merged
merged 8 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.28065.0",
"libram": "^0.9.10"
},
"devDependencies": {
"eslint": "^9.9.0",
"eslint-config-garbo": "^0.0.1",
"kolmafia": "^5.28064.0",
"kolmafia": "^5.28065.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.28065.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(28065); // Add boolean modifiers for Adventure Randomly, Alters Page Text, and Blind
checkGithubVersion();

// Hit up main.php to get out of easily escapable choices
Expand Down
37 changes: 22 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,29 @@ 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) =>
numericModifier(x, "Thorns") ||
numericModifier(x, "Sporadic Thorns") ||
numericModifier(x, "Damage Aura") ||
numericModifier(x, "Sporadic Damage Aura"),
);
Rinn marked this conversation as resolved.
Show resolved Hide resolved
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.28065.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.28065.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.28065.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.28065.0":
version: 5.28065.0
resolution: "kolmafia@npm:5.28065.0"
checksum: a4c0d908637e23b7eb3685d83b736005b8bc6d08a3bdd6b4aeea8c74c886397a8da0d05256d03d36451e5df3da95340578065859c33e642c62ab722cbc917703
languageName: node
linkType: hard

Expand Down
Loading