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

Support blank target in -item message #2302

Merged
merged 3 commits into from
Nov 27, 2024
Merged

Conversation

MathyFurret
Copy link
Contributor

For Gen 4-5 Frisk. If no target is sent with an -item message, the client first checks if there is exactly 1 possible target, and updates its item.

@MathyFurret
Copy link
Contributor Author

Guess we're on an older TS version, hold on

@MathyFurret
Copy link
Contributor Author

@@ -2229,6 +2229,20 @@ export class Battle {
let item = Dex.items.get(args[2]);
let effect = Dex.getEffect(kwArgs.from);
let ofpoke = this.getPokemon(kwArgs.of);
if (!poke) {
if (effect.id === 'frisk') {
const possibleTargets = ofpoke!.side.foe.active.filter(p => p !== null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to use find instead of filter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

find doesn't account for having >1 possible target.

@KrisXV KrisXV merged commit a77ed2a into smogon:master Nov 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants