Fixes Ally Switch in multi battles (#7109)
This commit is contained in:
parent
a000a743df
commit
c120fa71dc
@ -1398,8 +1398,8 @@
|
||||
callnative BS_AllySwitchSwapBattler
|
||||
.endm
|
||||
|
||||
.macro allyswitchfailchance jumpInstr:req
|
||||
callnative BS_AllySwitchFailChance
|
||||
.macro tryallyswitch jumpInstr:req
|
||||
callnative BS_TryAllySwitch
|
||||
.4byte \jumpInstr
|
||||
.endm
|
||||
|
||||
|
||||
@ -1105,8 +1105,7 @@ BattleScript_EffectAllySwitch::
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifnoally BS_ATTACKER, BattleScript_ButItFailed
|
||||
allyswitchfailchance BattleScript_ButItFailed
|
||||
tryallyswitch BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
@ The actual data/gfx swap happens in the move animation. Here it's just the gBattlerAttacker / scripting battler change
|
||||
|
||||
@ -17699,25 +17699,34 @@ void BS_AllySwitchSwapBattler(void)
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
|
||||
void BS_AllySwitchFailChance(void)
|
||||
void BS_TryAllySwitch(void)
|
||||
{
|
||||
NATIVE_ARGS(const u8 *failInstr);
|
||||
|
||||
if (B_ALLY_SWITCH_FAIL_CHANCE >= GEN_9)
|
||||
if (!IsBattlerAlive(BATTLE_PARTNER(gBattlerAttacker))
|
||||
|| (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER && gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
|
||||
|| (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT && gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS))
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
}
|
||||
else if (B_ALLY_SWITCH_FAIL_CHANCE >= GEN_9)
|
||||
{
|
||||
TryResetProtectUseCounter(gBattlerAttacker);
|
||||
if (sProtectSuccessRates[gDisableStructs[gBattlerAttacker].protectUses] < Random())
|
||||
{
|
||||
gDisableStructs[gBattlerAttacker].protectUses = 0;
|
||||
gBattlescriptCurrInstr = cmd->failInstr;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
gDisableStructs[gBattlerAttacker].protectUses++;
|
||||
}
|
||||
}
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||
}
|
||||
}
|
||||
|
||||
void BS_RunStatChangeItems(void)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user