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 eject pack interactions #10704

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ShivaD173
Copy link
Contributor

  • Fix Commander not taking hazard damage
  • Fix some eject pack interactions
    • Applying effects (and switching out) is speed based instead of location based
    • Cannot switch out until pokemon have started
  • Still to be fixed:
    • Eject Button should trigger before Eject Pack
    • Log should only display eject pack on switch, not when it is triggered
    • Whatever the last test in ejectpack.js is supposed to test.

@DaWoblefet
Copy link
Member

  • Whatever the last test in ejectpack.js is supposed to test.

This test is definitely off; what I think I was trying to write 3 years ago was if you choose your actions, and one of those actions was to switch slot 1 to 3, but the opponent switches in Intimidate first, forcing Eject Pack to resolve and switching slot 2 to 3, that initial switch should still happen. So slot 1 would still switch to slot 3. Here's a PS replay of the buggy behavior to make it more clear (notice how we indicate the switch doesn't resolve): https://replay.pokemonshowdown.com/gen9doublescustomgame-2254947672

So in that test, it should have Wynaut on the left slot (battle.p2.active[0]) and Morelull on the right slot (battle.p2.active[1]).

There's another Eject Pack bug I don't have a test written for: https://www.smogon.com/forums/threads/various-eject-pack-bugs.3733517/post-10009741

Could you speak a bit more about your implementation? It's not clear to me why you're doing a Speed sort in runMoveEffects; when multiple Pokemon get hit by a spread move, e.g. Bulldoze, the order drops happen is ally -> left -> right, not based on Speed. Same thing for faints, same thing for the order Pokemon have their attack lowered from Intimidate, etc.

@ShivaD173
Copy link
Contributor Author

Sorry, I haven't had time to work on this, and I saw that pyuk has started a PR doing some similar stuff, so if this just gets closed, thats fine by me. The speed sort was just wrong, it broke no other tests, so I thought it might work. This is done in a (slightly) better way now.

The main approach is waiting for all mons to "start" before a switch-out is called. In addition, it aggregates all switch-outs until the next time a switch out can be called, then does it by speed order. This does break the Eject Pack + eject button case, but this seems rare enough to be skipped until a proper refactor.

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.

2 participants