From d943f891c5fa790fef9f8c3847302a213c0e9361 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 21 Dec 2022 10:08:16 -0300 Subject: [PATCH] Applied Wind Power and Wind Rider correction -Renamed TryActivateWindRiderLoop to BattleScript_TryTailwindAbilitiesLoop -Modified how it handles the check for Wind Rider by using a various and incorporated Wind Power into the mix because that ability is affected by Tailwind as well. --- asm/macros/battle_script.inc | 5 +++++ data/battle_scripts_1.s | 18 ++++++++---------- include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 17 +++++++++++++++++ src/battle_util.c | 6 ------ 5 files changed, 31 insertions(+), 16 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index ee001e244..994cf4d52 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -2005,6 +2005,11 @@ .byte \stat .endm + .macro trywindriderpower battler:req, ptr:req + various \battler, VARIOUS_TRY_WIND_RIDER_POWER + .4byte \ptr + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 615017713..0f5f2d3a5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2876,22 +2876,20 @@ BattleScript_EffectTailwind: waitanimation printstring STRINGID_TAILWINDBLEW waitmessage B_WAIT_TIME_LONG - call TryActivateWindRiderLoop + call BattleScript_TryTailwindAbilitiesLoop goto BattleScript_MoveEnd -TryActivateWindRiderLoop: +BattleScript_TryTailwindAbilitiesLoop: savetarget setbyte gBattlerTarget, 0 -BattleScript_WindRiderLoop_Iter: - jumpifability BS_TARGET, ABILITY_WIND_RIDER, BattleScript_WindRiderLoop_Activate - goto BattleScript_WindRiderLoop_Increment -BattleScript_WindRiderLoop_Activate: +BattleScript_TryTailwindAbilitiesLoop_Iter: + trywindriderpower BS_TARGET, BattleScript_TryTailwindAbilitiesLoop_Increment call BattleScript_AbilityPopUp - modifybattlerstatstage BS_TARGET, STAT_ATK, INCREASE, 1, BattleScript_WindRiderLoop_Increment, ANIM_ON -BattleScript_WindRiderLoop_Increment: + modifybattlerstatstage BS_TARGET, STAT_ATK, INCREASE, 1, BattleScript_TryTailwindAbilitiesLoop_Increment, ANIM_ON +BattleScript_TryTailwindAbilitiesLoop_Increment: addbyte gBattlerTarget, 0x1 - jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_WindRiderLoop_Iter -BattleScript_WindRiderLoop_Ret: + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TryTailwindAbilitiesLoop_Iter +BattleScript_TryTailwindAbilitiesLoop_Ret: restoretarget return diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 0fcb2bbb0..3aba0144d 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -247,6 +247,7 @@ #define VARIOUS_GET_BATTLER_SIDE 156 #define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157 #define VARIOUS_SWAP_STATS 158 +#define VARIOUS_TRY_WIND_RIDER_POWER 159 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 089585d5a..807cafa28 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10099,6 +10099,23 @@ static void Cmd_various(void) PREPARE_STAT_BUFFER(gBattleTextBuff1, statId); } break; + case VARIOUS_TRY_WIND_RIDER_POWER: + { + u16 ability = GetBattlerAbility(gActiveBattler); + if (GetBattlerSide(gActiveBattler) == GetBattlerSide(gBattlerAttacker) + && (ability == ABILITY_WIND_RIDER || ability == ABILITY_WIND_POWER)) + { + gLastUsedAbility = ability; + RecordAbilityBattle(gActiveBattler, gLastUsedAbility); + gBattlerAbility = gBattleScripting.battler = gActiveBattler; + gBattlescriptCurrInstr += 7; + } + else + { + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + } + } + return; } // End of switch (gBattlescriptCurrInstr[2]) gBattlescriptCurrInstr += 3; diff --git a/src/battle_util.c b/src/battle_util.c index ba26128f3..b11a10e52 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2378,12 +2378,6 @@ u8 DoFieldEndTurnEffects(void) BattleScriptExecute(BattleScript_TailwindEnds); effect++; } - if (IsAbilityOnSide(gActiveBattler, ABILITY_WIND_POWER)) - { - gCurrentMove = MOVE_TAILWIND; - BattleScriptExecute(BattleScript_WindPowerActivatesEnd2); - effect++; - } } gBattleStruct->turnSideTracker++; if (effect != 0)