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

Add B_FLAG_SLEEP_CLAUSE #5566

Open
wants to merge 65 commits into
base: upcoming
Choose a base branch
from
Open

Conversation

Pawkkie
Copy link
Collaborator

@Pawkkie Pawkkie commented Oct 22, 2024

Description

Up front this is an enormously collaborative PR that @iriv24 and I have been working on a for a few months, happy to finally PR it. This PR adds B_FLAG_SLEEP_CLAUSE that can be set with a flag to enable sleep clause per-battle.

This sleep clause implementation follows Smogon's philosophy: "If a player has already put a Pokemon on his/her opponent's side to sleep and it is still sleeping, another one can't be put to sleep."

Notably this differs from Bulbapedia's description of how Rest specifically behaves in official titles that have supported sleep clause (Stadium, Colosseum, and XD). In those games, Rest seems to activate sleep clause (if I am reading through Bulbapedia's typo correctly), while in Smogon / Showdown supported metagames, any self inflicted sleep does not activate sleep clause (Rest, Effect Spore, etc.).

I don't feel this unique Rest behaviour is worth a config, but we can add one if it's considered blocking. Good candidate for a future follow-up PR.

The implementation was written from tests / scenarios first, so the test suite is very extensive. If anyone can think of additional scenarios we should include tests for, feel free to suggest them!

EDIT: Please enjoy this video of iriv doing some manual testing for some of the cases, particularly sleep due to disobedience which we can't cover with the battle tests.

Issue(s) that this PR fixes

Closes #5576 (mgriffin approved lol)

New KNOWN_FAILING Tests

Sleep Clause: Sleep clause is deactivated when a sleeping mon is woken up by using Sleep Talk into a status curing move: Fails due to #5557, sleep clause implementation works as intended.

Sleep Clause: Sleep clause is deactivated when a sleeping mon is sent out and transforms into a mon with Insomnia / Vital spirit: Fails due to #5564, sleep clause implementation works as intended.

Sleep Clause: Mold Breaker Pokémon sleeping Vital Spirit / Insomnia activates sleep clause: Fails due to #5578 , sleep clause implementation works as intended.

People who collaborated with me in this PR

@Pawkkie
@iriv24

Things to note in the release changelog:

  • Based on Smogon's sleep clause philosophy
  • Toggleable per-battle by setting / unsetting the flag assigned to B_FLAG_SLEEP_CLAUSE

Discord contact info

@Pawkkie
@iriv24

Pawkkie and others added 30 commits July 14, 2024 01:40
add one test case and several TODO battle tests
…nts near places that will need handling, took a stab at items that cure sleep but no dice
@Pawkkie Pawkkie marked this pull request as ready for review October 25, 2024 22:55
@Pawkkie
Copy link
Collaborator Author

Pawkkie commented Oct 25, 2024

Finally ready for review! :)

include/battle.h Outdated Show resolved Hide resolved
@Pawkkie Pawkkie marked this pull request as draft October 26, 2024 22:11
@Pawkkie Pawkkie marked this pull request as ready for review October 27, 2024 16:51
src/battle_ai_util.c Outdated Show resolved Hide resolved
src/battle_ai_main.c Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-mechanic Pertains to battle mechanics new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants