From 3f0f7c6b7f1c286bf997d62e055553c3a8e02b84 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 15 Feb 2023 15:30:29 +0100 Subject: [PATCH] Fix Battle Bond activating multiple times in battle --- include/battle.h | 1 + src/battle_script_commands.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/battle.h b/include/battle.h index 79413441c..01dc8d7e0 100644 --- a/include/battle.h +++ b/include/battle.h @@ -653,6 +653,7 @@ struct BattleStruct u8 targetsDone[MAX_BATTLERS_COUNT]; // Each battler as a bit. u16 overwrittenAbilities[MAX_BATTLERS_COUNT]; // abilities overwritten during battle (keep separate from battle history in case of switching) bool8 allowedToChangeFormInWeather[PARTY_SIZE][2]; // For each party member and side, used by Ice Face. + u8 battleBondTransformed[2]; // Bitfield for each party. }; #define F_DYNAMIC_TYPE_1 (1 << 6) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d1c0a7c77..905bf2b61 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -9851,8 +9851,10 @@ static void Cmd_various(void) case VARIOUS_TRY_ACTIVATE_BATTLE_BOND: if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND && HasAttackerFaintedTarget() - && CalculateEnemyPartyCount() > 1) + && CalculateEnemyPartyCount() > 1 + && !(gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) { + gBattleStruct->battleBondTransformed[GET_BATTLER_SIDE2(gBattlerAttacker)] |= gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]; PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species); gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species; gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH; @@ -14965,7 +14967,7 @@ static void Cmd_callnative(void) func(); } -// Callnative Funcs +// Callnative Funcs void BS_CalcMetalBurstDmg(void) { u8 sideAttacker = GetBattlerSide(gBattlerAttacker);