smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.65k stars 2.71k forks source link

Emergency Exit now activates between hazards #10299

Open chouettevan opened 1 month ago

chouettevan commented 1 month ago

Fixed an emergency exit bug.it should now activate between hazards.

MathyFurret commented 1 month ago

Hi and welcome to the PS repository! From my testing, Emergency Exit already works fine with hazards; here is a replay from the current version of the main server: https://replay.pokemonshowdown.com/gen7anythinggoes-2127259105

Can you provide a replay that demonstrates the bug?

chouettevan commented 1 month ago

The problem is not that emergency exit does not activate after entry hazards but that it does not activate between hazards Here is a replay from the current version of the main server:https://replay.pokemonshowdown.com/gen7ou-2128354558-sf422zzrt4pfpufmk9mi5bklotct5gipw

MathyFurret commented 1 month ago

I see, thanks! Unfortunately, I don't think this will fix the issue. The EntryHazard is used for triggering entry hazards, not running effects related to them. What your change would do is make the Emergency Exit ability's handler run at the same time as the entry hazards will. Due to the order event handlers are queued in, the ability's handler always runs before the hazards themselves, instead of between them, which is what we need.

Also, you should generally include a unit test for mechanics fixes. Conveniently there already is one on line 324 of test/sim/abilities/emergencyexit.js; all you have to do is delete the .skip.