From 34cafa746ce99fcf4efe6f1513ef51e9a694d6cc Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sun, 4 Dec 2022 18:55:37 -0300 Subject: [PATCH] =?UTF-8?q?Implemented=20Electromorphosis'=20effect=20Also?= =?UTF-8?q?=20added=20a=20battle=20preproc=20config=20to=20check=20if=20th?= =?UTF-8?q?e=20STATUS3=5FCHARGED=5FUP=20was=20already=20applied.=20Pok?= =?UTF-8?q?=C3=A9mon=20Scarlet=20and=20Violet=20don't=20check=20if=20this?= =?UTF-8?q?=20status=20flag=20was=20already=20applied=20on=20the=20target?= =?UTF-8?q?=20of=20abilities=20like=20Electromorphosis=20(and=20Wind=20Pow?= =?UTF-8?q?er=20until=20proven=20otherwise.)=20As=20a=20result,=20the=20ga?= =?UTF-8?q?me=20will=20trigger=20the=20ability=20multiple=20times=20if=20t?= =?UTF-8?q?hey're=20hit=20by=20a=20multihit=20move.=20This=20directive=20m?= =?UTF-8?q?akes=20the=20code=20end=20the=20ability=20effect=20preemptively?= =?UTF-8?q?=20if=20the=20target=20does=20have=20the=20status=20flag=20appl?= =?UTF-8?q?ied.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/battle_scripts_1.s | 2 ++ include/config/battle.h | 1 + src/battle_util.c | 1 + 3 files changed, 4 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f1e3902b4d..01c0df71a9 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -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 diff --git a/include/config/battle.h b/include/config/battle.h index 644f9955c1..3f359a6f2e 100644 --- a/include/config/battle.h +++ b/include/config/battle.h @@ -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. diff --git a/src/battle_util.c b/src/battle_util.c index e12612fa8f..e79947b09b 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -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