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

Weather related Ability tests, fix for Leaf Guard not preventing Rest. #2957

Merged
merged 10 commits into from
May 2, 2023

Conversation

ShaeTsuPog
Copy link

@ShaeTsuPog ShaeTsuPog commented Apr 27, 2023

Description

I had need for some weather related ability tests, so I made some. In doing so I found that Leaf Guard isn't interacting correctly with Rest, so I fixed that. Since Generation 5, Leaf Guard prevents the user from using Rest under sun, but on Upcoming it currently doesn't work (there's no jumpifleafguardprotected in the script).

Images

For reference, this is from the Bulbapedia page on Leaf Guard:
vivaldi_bRNJbDoYd8

And here is a Showdown match against myself demonstrating it:
https://replay.pokemonshowdown.com/gen9customgame-1852491367

Note on the tests

This was my first time writing these things, I just referenced already existing tests for them. Let me know if they can be improved.

Issue(s) that this PR fixes

N/A

Discord contact info

Shae#9032

@AsparagusEduardo
Copy link
Collaborator

This needs a config to toggle between its generational behaviors.
You can look at something like B_GHOSTS_ESCAPE for examples of preproc configs in .s files

@ShaeTsuPog
Copy link
Author

This needs a config to toggle between its generational behaviors. You can look at something like B_GHOSTS_ESCAPE for examples of preproc configs in .s files

BattleScript_EffectRest::
	attackcanceler
	attackstring
	ppreduce
	jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_RestIsAlreadyAsleep
	jumpifability BS_ATTACKER, ABILITY_COMATOSE, BattleScript_RestIsAlreadyAsleep
	jumpifuproarwakes BattleScript_RestCantSleep
	jumpifability BS_TARGET, ABILITY_INSOMNIA, BattleScript_InsomniaProtects
	jumpifability BS_TARGET, ABILITY_VITAL_SPIRIT, BattleScript_InsomniaProtects
+.if B_LEAF_GUARD_PREVENTS_REST >= GEN_5
	jumpifleafguardprotected BS_TARGET, BattleScript_LeafGuardPreventsRest
+.endif
	trysetrest BattleScript_AlreadyAtFullHp
	pause B_WAIT_TIME_SHORT
	printfromtable gRestUsedStringIds
	waitmessage B_WAIT_TIME_LONG
	updatestatusicon BS_ATTACKER
	waitstate
	goto BattleScript_PresentHealTarget
// Ability settings
#define B_EXPANDED_ABILITY_NAMES    TRUE       // If TRUE, ability names are increased from 12 characters to 16 characters.
#define B_ABILITY_WEATHER           GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
#define B_GALE_WINGS                GEN_LATEST // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL        GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.
#define B_SHADOW_TAG_ESCAPE         GEN_LATEST // In Gen4+, if both sides have a Pokémon with Shadow Tag, all battlers can escape. Before, neither side could escape this situation.
#define B_MOODY_ACC_EVASION         GEN_LATEST // In Gen8, Moody CANNOT raise Accuracy and Evasion anymore.
#define B_FLASH_FIRE_FROZEN         GEN_LATEST // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before.
#define B_SYNCHRONIZE_NATURE        GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously.
#define B_SYNCHRONIZE_TOXIC         GEN_LATEST // In Gen5+, if a Pokémon with Synchronize is badly poisoned, the opponent will also become badly poisoned. Previously, the opponent would become regular poisoned.
#define B_UPDATED_INTIMIDATE        GEN_LATEST // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. It also activates Rattled.
#define B_OBLIVIOUS_TAUNT           GEN_LATEST // In Gen6+, Pokémon with Oblivious can't be taunted.
#define B_STURDY                    GEN_LATEST // In Gen5+, Sturdy causes the Pokémon to have 1 HP remaining if another Pokémon's attack or confusion damage would have brought it from full health to 0 HP.
#define B_PLUS_MINUS_INTERACTION    GEN_LATEST // In Gen5+, Plus and Minus can be activated with themselves and the opposite ability. Before, only the opposing ability could activate it.
#define B_WEATHER_FORMS             GEN_LATEST // In Gen5+, Castform and Cherrim revert to their base form upon losing their respective ability. Cherrim needs Flower Gift to swap forms.
#define B_SYMBIOSIS_GEMS            GEN_LATEST // In Gen7+, Symbiosis passes an item after a gem-boosted attack. Previously, items are passed before the gem-boosted attack hits, making the item effect apply.
#define B_CHECK_IF_CHARGED_UP       TRUE       // If set to TRUE, certain abilities such as Electromorphosis WILL check if the STATUS3_CHARGED_UP status flag is applied.
#define B_ABSORBING_ABILITY_STRING  GEN_LATEST // In Gen5+, the abilities that absorb moves of a certain type use a generic string for stat increases and decreases.
+#define B_LEAF_GUARD_PREVENTS_REST  GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight.

Done, unless I overlooked something.

@ShaeTsuPog
Copy link
Author

I did in fact overlook something, but I'll ask for confirmation on this to make sure.

I'm assuming that ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_LATEST); is wanted in the Rest test for Leaf Guard?

@mrgriffin
Copy link
Collaborator

I'm assuming that ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_LATEST); is wanted in the Rest test for Leaf Guard?

I think ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_5); but yeah, you've got the right idea :)

@AsparagusEduardo
Copy link
Collaborator

I think ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_5); but yeah, you've got the right idea :)

Yep, this is what it should be

#define B_LEAF_GUARD_PREVENTS_REST GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight.

lgtm 👍

@ShaeTsuPog
Copy link
Author

I think ASSUME(B_LEAF_GUARD_PREVENTS_REST >= GEN_5); but yeah, you've got the right idea :)

Yep, this is what it should be

#define B_LEAF_GUARD_PREVENTS_REST GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight.

lgtm 👍

Should be good to go now then.

test/ability_dry_skin.c Outdated Show resolved Hide resolved
test/ability_dry_skin.c Outdated Show resolved Hide resolved
test/ability_dry_skin.c Outdated Show resolved Hide resolved
test/ability_dry_skin.c Outdated Show resolved Hide resolved
test/ability_dry_skin.c Outdated Show resolved Hide resolved
test/ability_dry_skin.c Show resolved Hide resolved
test/ability_leaf_guard.c Show resolved Hide resolved
test/ability_leaf_guard.c Outdated Show resolved Hide resolved
test/ability_leaf_guard.c Show resolved Hide resolved
test/ability_snow_cloak.c Outdated Show resolved Hide resolved
@ShaeTsuPog
Copy link
Author

Ready for re-review.

I have some more ability tests I've written, but I'll make a separate PR for those later so this one doesn't get slowed down.

@AsparagusEduardo AsparagusEduardo merged commit ae2d5f7 into rh-hideout:upcoming May 2, 2023
@AsparagusEduardo AsparagusEduardo mentioned this pull request May 31, 2023
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