From 88cae380d0f2b325463e3a4e0c6d276fe62c76b0 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Sat, 3 Dec 2022 21:20:34 -0300 Subject: [PATCH] Implemented Wind Power's effect --- data/battle_scripts_1.s | 30 +++++++++++++++++++++++++++ include/battle_scripts.h | 2 ++ include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 3 ++- src/battle_util.c | 19 +++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a70ec7cf2..f1e3902b4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6609,6 +6609,27 @@ BattleScript_WindRiderEnd: destroyabilitypopup end2 +BattleScript_WindPowerActivatesEnd2:: + setbyte gBattlerAttacker, 0 +BattleScript_WindPowerLoop: + printstring STRINGID_EMPTYSTRING3 + jumpifability BS_ATTACKER, ABILITY_WIND_POWER, BattleScript_WindPowerLoop_Cont + goto BattleScript_WindPowerIncrement +BattleScript_WindPowerLoop_Cont: + jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerIncrement + goto BattleScript_WindPower_Activate +BattleScript_WindPower_Activate: + call BattleScript_AbilityPopUp + setcharge + printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER + waitmessage B_WAIT_TIME_LONG +BattleScript_WindPowerIncrement: + addbyte gBattlerAttacker, 1 + jumpifbytenotequal gBattlerAttacker, gBattlersCount, BattleScript_WindPowerLoop +BattleScript_WindPowerEnd: + destroyabilitypopup + end2 + BattleScript_TrickRoomEnds:: printstring STRINGID_TRICKROOMENDS waitmessage B_WAIT_TIME_LONG @@ -7102,6 +7123,15 @@ BattleScript_AngerShellTrySpeed: BattleScript_AngerShellRet: return +BattleScript_WindPowerActivates:: + jumpifstatus3 BS_ATTACKER, STATUS3_CHARGED_UP, BattleScript_WindPowerActivates_Ret + call BattleScript_AbilityPopUp + setcharge + printstring STRINGID_BEINGHITCHARGEDPKMNWITHPOWER + waitmessage B_WAIT_TIME_LONG +BattleScript_WindPowerActivates_Ret: + return + BattleScript_PerishSongCountGoesDown:: printstring STRINGID_PKMNPERISHCOUNTFELL waitmessage B_WAIT_TIME_LONG diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 4d1d750df..5953a8c76 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -438,6 +438,8 @@ extern const u8 BattleScript_AngerShellActivates[]; extern const u8 BattleScript_WellBakedBodyActivates[]; extern const u8 BattleScript_WindRiderActivatesEnd2[]; extern const u8 BattleScript_WindRiderActivatesMoveEnd[]; +extern const u8 BattleScript_WindPowerActivates[]; +extern const u8 BattleScript_WindPowerActivatesEnd2[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 4bce51a45..70841dd9a 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -630,8 +630,9 @@ #define STRINGID_ATTACKERHEALEDITSBURN 628 #define STRINGID_ATTACKERMELTEDTHEICE 629 #define STRINGID_TARGETTOUGHEDITOUT 630 +#define STRINGID_BEINGHITCHARGEDPKMNWITHPOWER 631 -#define BATTLESTRINGS_COUNT 631 +#define BATTLESTRINGS_COUNT 632 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_message.c b/src/battle_message.c index c243e3041..b4f2c80f0 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -759,10 +759,11 @@ static const u8 sText_AttackerBrokeThroughParalysis[] = _("{B_ATK_NAME_WITH_PREF static const u8 sText_AttackerHealedItsBurn[] = _("{B_ATK_NAME_WITH_PREFIX} healed its burn with\nits sheer determination!"); static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melted the ice with\nits fiery determination!"); static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); - +static const u8 sText_BeingHitChargedPkmnWithPower[] = _("Being hit by {B_CURRENT_MOVE}\ncharged {B_ATK_NAME_WITH_PREFIX} with power!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_BEINGHITCHARGEDPKMNWITHPOWER - BATTLESTRINGS_TABLE_START] = sText_BeingHitChargedPkmnWithPower, [STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut, [STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce, [STRINGID_ATTACKERHEALEDITSBURN - BATTLESTRINGS_TABLE_START] = sText_AttackerHealedItsBurn, diff --git a/src/battle_util.c b/src/battle_util.c index cdaf67b59..e12612fa8 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2378,6 +2378,12 @@ u8 DoFieldEndTurnEffects(void) BattleScriptExecute(BattleScript_WindRiderActivatesEnd2); effect++; } + if (IsAbilityOnSide(gActiveBattler, ABILITY_WIND_POWER)) + { + gCurrentMove = MOVE_TAILWIND; + BattleScriptExecute(BattleScript_WindPowerActivatesEnd2); + effect++; + } } gBattleStruct->turnSideTracker++; if (effect != 0) @@ -5777,6 +5783,19 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move effect++; } break; + case ABILITY_WIND_POWER: + if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) + && !gProtectStructs[gBattlerAttacker].confusionSelfDmg + && TARGET_TURN_DAMAGED + && gBattleMoves[gCurrentMove].flags & FLAG_WIND_MOVE + && IsBattlerAlive(gBattlerTarget)) + { + gBattlerAttacker = gBattlerTarget; + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_WindPowerActivates; + effect++; + } + break; } break; case ABILITYEFFECT_MOVE_END_ATTACKER: // Same as above, but for attacker