From 47bfeaeecd5bed4342227e257d8b52c510d011b6 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 30 Oct 2021 18:31:44 +1300 Subject: [PATCH] Implement Gorilla Tactics It's Choice Band but as an ability. --- data/battle_scripts_1.s | 4 ++++ include/battle_scripts.h | 1 + include/constants/battle_string_ids.h | 3 ++- src/battle_message.c | 2 ++ src/battle_script_commands.c | 2 +- src/battle_util.c | 21 +++++++++++++++++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index dd6af61e5..072563e39 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8502,6 +8502,10 @@ BattleScript_SelectingNotAllowedMoveChoiceItem:: printselectionstring STRINGID_ITEMALLOWSONLYYMOVE endselectionscript +BattleScript_SelectingNotAllowedMoveGorillaTactics:: + printselectionstring STRINGID_ABILITYALLOWSONLYMOVE + endselectionscript + BattleScript_SelectingNotAllowedMoveAssaultVest:: printselectionstring STRINGID_ASSAULTVESTDOESNTALLOW endselectionscript diff --git a/include/battle_scripts.h b/include/battle_scripts.h index ec95a4549..0bc09156e 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -402,5 +402,6 @@ extern const u8 BattleScript_BlockedByPrimalWeatherEnd3[]; extern const u8 BattleScript_BlockedByPrimalWeatherRet[]; extern const u8 BattleScript_PrimalReversion[]; extern const u8 BattleScript_HyperspaceFuryRemoveProtect[]; +extern const u8 BattleScript_SelectingNotAllowedMoveGorillaTactics[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 1d461e2a0..638306971 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -597,8 +597,9 @@ #define STRINGID_BUTPOKEMONCANTUSETHEMOVE 594 #define STRINGID_BUTHOOPACANTUSEIT 595 #define STRINGID_BROKETHROUGHPROTECTION 596 +#define STRINGID_ABILITYALLOWSONLYMOVE 597 -#define BATTLESTRINGS_COUNT 597 +#define BATTLESTRINGS_COUNT 598 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_message.c b/src/battle_message.c index f26726a69..94a30ea5d 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -723,9 +723,11 @@ static const u8 sText_PkmnRevertedToPrimal[] = _("{B_ATK_NAME_WITH_PREFIX}'s Pri static const u8 sText_ButPokemonCantUseTheMove[] = _("But {B_ATK_NAME_WITH_PREFIX} can't\nuse the move!"); static const u8 sText_ButHoopaCantUseIt[] = _("But Hoopa can't use it\nthe way it is now!"); static const u8 sText_BrokeThroughProtection[] = _("It broke through the\n{B_DEF_NAME_WITH_PREFIX}'s protection!"); +static const u8 sText_AbilityAllowsOnlyMove[] = _("{B_ATK_ABILITY} allows the\nuse of only {B_CURRENT_MOVE}!\p"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ABILITYALLOWSONLYMOVE - 12] = sText_AbilityAllowsOnlyMove, [STRINGID_BROKETHROUGHPROTECTION - 12] = sText_BrokeThroughProtection, [STRINGID_BUTPOKEMONCANTUSETHEMOVE - 12] = sText_ButPokemonCantUseTheMove, [STRINGID_BUTHOOPACANTUSEIT - 12] = sText_ButHoopaCantUseIt, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c5c922d8e..b2dcb3958 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4942,7 +4942,7 @@ static void Cmd_moveend(void) break; case MOVEEND_CHOICE_MOVE: // update choice band move if (gHitMarker & HITMARKER_OBEYS - && HOLD_EFFECT_CHOICE(holdEffectAtk) + && (HOLD_EFFECT_CHOICE(holdEffectAtk) || GetBattlerAbility(gBattlerAttacker)) && gChosenMove != MOVE_STRUGGLE && (*choicedMoveAtk == 0 || *choicedMoveAtk == 0xFFFF)) { diff --git a/src/battle_util.c b/src/battle_util.c index fe957e464..c7f6af960 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1776,6 +1776,21 @@ u8 TrySetCantSelectMoveBattleScript(void) limitations++; } } + if ((GetBattlerAbility(gActiveBattler) == ABILITY_GORILLA_TACTICS) && *choicedMove != 0 + && *choicedMove != 0xFFFF && *choicedMove != move) + { + gCurrentMove = *choicedMove; + gLastUsedItem = gBattleMons[gActiveBattler].item; + if (gBattleTypeFlags & BATTLE_TYPE_PALACE) + { + gProtectStructs[gActiveBattler].palaceUnableToUseMove = 1; + } + else + { + gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedMoveGorillaTactics; + limitations++; + } + } if (gBattleMons[gActiveBattler].pp[moveId] == 0) { @@ -1831,6 +1846,8 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check) unusableMoves |= gBitTable[i]; else if (gBattleMons[battlerId].moves[i] == MOVE_STUFF_CHEEKS && ItemId_GetPocket(gBattleMons[gActiveBattler].item) != POCKET_BERRIES) unusableMoves |= gBitTable[i]; + else if (GetBattlerAbility(battlerId) == ABILITY_GORILLA_TACTICS && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i]) + unusableMoves |= gBitTable[i]; } return unusableMoves; } @@ -7837,6 +7854,10 @@ static u32 CalcMoveBasePowerAfterModifiers(u16 move, u8 battlerAtk, u8 battlerDe if (moveType == TYPE_DRAGON) MulModifier(&modifier, UQ_4_12(1.5)); break; + case ABILITY_GORILLA_TACTICS: + if (IS_MOVE_PHYSICAL(move)) + MulModifier(&modifier, UQ_4_12(1.5)); + break; } // field abilities