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

Fix: Protean + Neutralizing Gas interaction #10805

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

@andrebastosdias andrebastosdias changed the title Neutralizinggas protean Fix Protean + Neutralizing Gas interaction Jan 7, 2025
@andrebastosdias andrebastosdias changed the title Fix Protean + Neutralizing Gas interaction Fix: Protean + Neutralizing Gas interaction Jan 7, 2025
@andrebastosdias andrebastosdias deleted the neutralizinggas_protean branch January 7, 2025 19:22
@andrebastosdias andrebastosdias restored the neutralizinggas_protean branch January 7, 2025 19:24
@@ -2875,6 +2875,12 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
}
}
},
onAnySwitchIn(pokemon) {
if (this.event.target === pokemon && ['libero', 'protean'].includes(pokemon.getAbility().id)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the best or standard way to check if this is the Pokémon switching in?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what you're asking but pokemon will always be the Pokémon switching in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but I'm pretty sure that when a switch occurs, onAnySwitchIn is called for every active Pokémon and pokemon does not refer to the Pokémon switching in.

I wanted to know if this.event.target is the best way to access the switching-in Pokémon or if there is another variable that could be used.

Copy link
Contributor

Choose a reason for hiding this comment

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

onAnySwitchIn is called for every active effect with that handler, but pokemon is always the Pokémon switching in; if you wanted to know which Pokémon has Neutralizing Gas, you would need to look at this.effectState.target.

Copy link
Contributor Author

@andrebastosdias andrebastosdias Jan 9, 2025

Choose a reason for hiding this comment

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

Oh, I'm dumb. onAnySwitchIn is called for every active Pokémon, but only the one with Neutralizing Gas triggers this specific function. Thanks!

@DaWoblefet
Copy link
Member

This bug would also apply for Abilities like Embody Aspect, since they also only activate once per time out on the field.

@@ -2875,6 +2875,11 @@ export const Abilities: import('../sim/dex-abilities').AbilityDataTable = {
}
}
},
onAnySwitchIn(pokemon) {
Copy link
Member

@DaWoblefet DaWoblefet Jan 10, 2025

Choose a reason for hiding this comment

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

I feel like this should not be tied to Neutralizing Gas specifically. I'm sure there's some Baton Pass Gastro Acid shenanigans you can do to cause the same thing to happen. Wouldn't it be better to just delete the effectState for Protean/Libero/Embody Aspect when the Pokemon leaves the field / loses the Ability (like how Slow Start does it)? I don't see why we're removing it on switchin in the first place.

@DaWoblefet
Copy link
Member

DaWoblefet commented Jan 10, 2025

You can't merge the effectStates for Protean and Libero either, I don't think. If you change type with Libero, then Skill Swap it Protean, you can still change type with the newly acquired Protean. In general, you can Skill Swap around Libero / Protean and change your type again each time, too (e.g. use Bite with Libero -> change to Dark-type; be given Protean; use Tackle with Protean -> change to Normal-type; be given Libero; use Bite with Libero -> change to Dark-type). It should only hold the effectState for as long as the Pokemon has the Ability.

@andrebastosdias
Copy link
Contributor Author

andrebastosdias commented Jan 10, 2025

onSwitchOut wouldn't run, unless it's hard-coded in another place.

The ability states are being reset.

pokemon-showdown/data/moves.ts

Lines 17214 to 17223 in c8bc6be

this.singleEvent('End', sourceAbility, source.abilityState, source);
this.singleEvent('End', targetAbility, target.abilityState, target);
source.ability = targetAbility.id;
target.ability = sourceAbility.id;
source.abilityState = {id: this.toID(source.ability), target: source};
target.abilityState = {id: this.toID(target.ability), target: target};
source.volatileStaleness = undefined;
if (!target.isAlly(source)) target.volatileStaleness = 'external';
this.singleEvent('Start', targetAbility, source.abilityState, source);
this.singleEvent('Start', sourceAbility, target.abilityState, target);

@DaWoblefet
Copy link
Member

Skill Swap Libero -> Skill Swap Libero works, yeah. The effectState is tied to the particular instance of the Ability, so to speak.

As another example, using Libero Bite -> change to Dark-type, then switch in Neutralizing Gas and switch it out, then using Shore Up will not change to Ground-type.

@andrebastosdias
Copy link
Contributor Author

andrebastosdias commented Jan 10, 2025

We could add an ability check with eventid !== 'End' && effect.effectType === 'Ability' && (target instanceof Pokemon) && target.ignoringAbility(), but that approach seems quite inelegant.

Perhaps we could use previouslySwitchedIn.

@DaWoblefet
Copy link
Member

The ability states are being reset.

Does just using abilityState work for Protean / Libero / Embody Aspect work then?

@DaWoblefet DaWoblefet force-pushed the neutralizinggas_protean branch from cfc16e0 to 4a3d5e2 Compare January 10, 2025 20:28
@DaWoblefet DaWoblefet merged commit 639b930 into smogon:master Jan 10, 2025
1 check passed
@DaWoblefet
Copy link
Member

Thanks andrebastosdias!

@andrebastosdias andrebastosdias deleted the neutralizinggas_protean branch January 10, 2025 20:36
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