added a bugfix for the interaction between Curse and Pressure #1946
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It was recently discovered by LRXC that Pokémon Emerald has a bug where if the player has a Pokémon with Pressure and the opposing non-ghost Pokémon uses Curse, two PP are deducted instead of just one. Since a non-ghost Curse only affects the user, I believe that it should not interact with Pressure. This is the case when the player's non-ghost Pokémon uses Curse against the opponent's Pressure Pokémon - there, only one PP is deducted. This asymmetric interaction indicates that this is a bug. I believe that the reason is that when the player uses Curse, there is a check in battle_controller_player.c (line 486) that makes the user the target of the move when it not a ghost type, but there is no corresponding check in player_controller_opponent.c, so presumably when the AI uses Curse the target always remains (one of) the player's Pokémon, since in battle_moves.h, the target is defined as "MOVE_TARGET_SELECTED".
To make sure that non-ghost Curse never interacts with Pressure as was most likely intended, I added a bugfix in battle_script_commands.c, Cmd_ppreduce(), starting line 1224, where ppToDeduct doesn't increase if the move is Curse and the user is not a ghost type.
I have tested this myself in Emerald where my Torkoal's Curse against a wild Absol with Pressure on Route 120 only deducted 1 PP, but without the bugfix, the wild Regice's Curse against my Absol with Pressure deducted 2 PP (I caught it with a Master Ball right after it used the move to check.) After my bugfix, Regice's Curse now only deducted 1 PP.
Discord contact info
rogerwrightshoe