Fix Magic Coat reflecting hazard moves incorrectly when used by a partner (#8272)
This commit is contained in:
parent
13bae5d1b2
commit
7fd1404354
@ -1167,7 +1167,26 @@ static void Cmd_attackcanceler(void)
|
||||
}
|
||||
|
||||
u32 isBounceable = MoveCanBeBouncedBack(gCurrentMove);
|
||||
if (gProtectStructs[gBattlerTarget].bounceMove
|
||||
bool32 bounceActive = (gProtectStructs[gBattlerTarget].bounceMove && IsBattlerAlive(gBattlerTarget));
|
||||
|
||||
if (!bounceActive
|
||||
&& !gBattleStruct->bouncedMoveIsUsed
|
||||
&& isBounceable
|
||||
&& GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove) == MOVE_TARGET_OPPONENTS_FIELD)
|
||||
{
|
||||
u32 partner = BATTLE_PARTNER(gBattlerTarget);
|
||||
|
||||
if (partner < gBattlersCount
|
||||
&& GetBattlerSide(partner) == GetBattlerSide(gBattlerTarget)
|
||||
&& gProtectStructs[partner].bounceMove
|
||||
&& IsBattlerAlive(partner))
|
||||
{
|
||||
gBattlerTarget = partner;
|
||||
bounceActive = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (bounceActive
|
||||
&& isBounceable
|
||||
&& !gBattleStruct->bouncedMoveIsUsed)
|
||||
{
|
||||
|
||||
@ -32,3 +32,32 @@ SINGLE_BATTLE_TEST("Magic Coat prints the correct message when bouncing back a m
|
||||
STATUS_ICON(opponent, sleep: TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Magic Coat reflects hazards regardless of the user's position")
|
||||
{
|
||||
struct BattlePokemon *coatUser = NULL;
|
||||
PARAMETRIZE { coatUser = playerLeft; }
|
||||
PARAMETRIZE { coatUser = playerRight; }
|
||||
ASSUME(GetMoveEffect(MOVE_SPIKES) == EFFECT_SPIKES);
|
||||
ASSUME(GetMoveEffect(MOVE_STEALTH_ROCK) == EFFECT_STEALTH_ROCK);
|
||||
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WYNAUT);
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT);
|
||||
} WHEN {
|
||||
TURN { MOVE(coatUser, MOVE_MAGIC_COAT); MOVE(opponentRight, MOVE_STEALTH_ROCK); MOVE(opponentLeft, MOVE_SPIKES); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_MAGIC_COAT, coatUser);
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_STEALTH_ROCK, opponentRight);
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIKES, opponentLeft);
|
||||
}
|
||||
} THEN {
|
||||
EXPECT(!IsHazardOnSide(B_SIDE_PLAYER, HAZARDS_STEALTH_ROCK));
|
||||
EXPECT(!IsHazardOnSide(B_SIDE_PLAYER, HAZARDS_SPIKES));
|
||||
EXPECT(IsHazardOnSide(B_SIDE_OPPONENT, HAZARDS_STEALTH_ROCK));
|
||||
EXPECT(IsHazardOnSide(B_SIDE_OPPONENT, HAZARDS_SPIKES));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user