Implemented Electromorphosis' effect

Also added a battle preproc config to check if the STATUS3_CHARGED_UP was already applied.
Pokémon Scarlet and Violet don't check if this status flag was already applied on the target of abilities like Electromorphosis (and Wind Power until proven otherwise.)
As a result, the game will trigger the ability multiple times if they're hit by a multihit move.
This directive makes the code end the ability effect preemptively if the target does have the status flag applied.
This commit is contained in:
LOuroboros 2022-12-04 18:55:37 -03:00
parent 88cae380d0
commit 34cafa746c
3 changed files with 4 additions and 0 deletions

View File

@ -7124,7 +7124,9 @@ BattleScript_AngerShellRet:
return
BattleScript_WindPowerActivates::
.if B_CHECK_IF_CHARGED_UP == TRUE
jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerActivates_Ret
.endif
call BattleScript_AbilityPopUp
setcharge
printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER

View File

@ -109,6 +109,7 @@
#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.
// Item settings
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.

View File

@ -5784,6 +5784,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
}
break;
case ABILITY_WIND_POWER:
case ABILITY_ELECTROMORPHOSIS:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !gProtectStructs[gBattlerAttacker].confusionSelfDmg
&& TARGET_TURN_DAMAGED