Fix Battle Bond

Battle Bond Greninja transforms only after a KO, and doesn't revert when switched out.
This commit is contained in:
BuffelSaft 2021-10-14 16:18:11 +13:00
parent e66820e646
commit bb8d0e3d6b
5 changed files with 22 additions and 15 deletions

View File

@ -1825,6 +1825,10 @@
various BS_ATTACKER, VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER
.endm
.macro tryactivatebattlebond battler:req
various \battler, VARIOUS_TRY_ACTIVATE_BATTLE_BOND
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -5288,6 +5288,7 @@ BattleScript_FaintTarget::
tryactivatemoxie BS_ATTACKER @ and chilling neigh, as one ice rider
tryactivatebeastboost BS_ATTACKER
tryactivategrimneigh BS_ATTACKER @ and as one shadow rider
tryactivatebattlebond BS_ATTACKER
trytrainerslidefirstdownmsg BS_TARGET
return

View File

@ -185,6 +185,7 @@
#define VARIOUS_REMOVE_TERRAIN 113
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 114
#define VARIOUS_TRY_TO_CLEAR_PRIMAL_WEATHER 115
#define VARIOUS_TRY_ACTIVATE_BATTLE_BOND 116
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -8822,6 +8822,19 @@ static void Cmd_various(void)
}
break;
}
case VARIOUS_TRY_ACTIVATE_BATTLE_BOND:
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
&& HasAttackerFaintedTarget()
&& CalculateEnemyPartyCount() > 1)
{
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
return;
}
break;
}
gBattlescriptCurrInstr += 3;

View File

@ -5147,18 +5147,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
effect++;
}
break;
case ABILITY_BATTLE_BOND:
if (gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_BATTLE_BOND
&& gBattleResults.opponentFaintCounter != 0
&& CalculateEnemyPartyCount() > 1)
{
PREPARE_SPECIES_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerAttacker].species);
gBattleStruct->changedSpecies[gBattlerPartyIndexes[gBattlerAttacker]] = gBattleMons[gBattlerAttacker].species;
gBattleMons[gBattlerAttacker].species = SPECIES_GRENINJA_ASH;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BattleBondActivatesOnMoveEndAttacker;
}
break;
}
break;
case ABILITYEFFECT_MOVE_END_OTHER: // Abilities that activate on *another* battler's moveend: Dancer, Soul-Heart, Receiver, Symbiosis
@ -8846,6 +8834,7 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
static const u16 species[][2] = // changed form id, default form id
{
{SPECIES_MIMIKYU_BUSTED, SPECIES_MIMIKYU},
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
{SPECIES_AEGISLASH_BLADE, SPECIES_AEGISLASH},
{SPECIES_DARMANITAN_ZEN_MODE, SPECIES_DARMANITAN},
{SPECIES_MINIOR, SPECIES_MINIOR_CORE_RED},
@ -8858,11 +8847,10 @@ void UndoFormChange(u32 monId, u32 side, bool32 isSwitchingOut)
{SPECIES_WISHIWASHI_SCHOOL, SPECIES_WISHIWASHI},
{SPECIES_CRAMORANT_GORGING, SPECIES_CRAMORANT},
{SPECIES_CRAMORANT_GULPING, SPECIES_CRAMORANT},
{SPECIES_GRENINJA_ASH, SPECIES_GRENINJA_BATTLE_BOND},
};
if (isSwitchingOut) // Don't revert Mimikyu Busted when switching out
i = 1;
if (isSwitchingOut) // Don't revert Mimikyu Busted or Ash-Greninja when switching out
i = 2;
else
i = 0;