Test Dragon Tail

Remove the "But it failed!" message if the foe cannot be switched.
This commit is contained in:
Martin Griffin 2023-02-19 21:08:30 +00:00 committed by Martin Griffin
parent 666e59b37f
commit afe09e9653
4 changed files with 76 additions and 6 deletions

View File

@ -2128,9 +2128,9 @@ BattleScript_EffectHitSwitchTarget:
moveendall
jumpifability BS_TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut
jumpifstatus3 BS_TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted
tryhitswitchtarget BattleScript_EffectHitSwitchTargetMoveEnd
BattleScript_EffectHitSwitchTargetMoveEnd:
end
tryhitswitchtarget BattleScript_MoveEnd
forcerandomswitch BattleScript_MoveEnd
goto BattleScript_MoveEnd
BattleScript_EffectClearSmog:
setmoveeffect MOVE_EFFECT_CLEAR_SMOG
@ -3708,7 +3708,6 @@ BattleScript_EffectRoar::
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed
BattleScript_ForceRandomSwitch::
forcerandomswitch BattleScript_ButItFailed
BattleScript_EffectMultiHit::

View File

@ -293,7 +293,6 @@ extern const u8 BattleScript_WishMegaEvolution[];
extern const u8 BattleScript_MoveEffectRecoilWithStatus[];
extern const u8 BattleScript_EffectWithChance[];
extern const u8 BattleScript_MoveEffectClearSmog[];
extern const u8 BattleScript_ForceRandomSwitch[];
extern const u8 BattleScript_SideStatusWoreOffReturn[];
extern const u8 BattleScript_MoveEffectSmackDown[];
extern const u8 BattleScript_MoveEffectFlameBurst[];

View File

@ -9792,7 +9792,7 @@ static void Cmd_various(void)
&& GetBattlerAbility(gBattlerTarget) != ABILITY_GUARD_DOG)
{
gBattleScripting.switchCase = B_SWITCH_HIT;
gBattlescriptCurrInstr = BattleScript_ForceRandomSwitch;
gBattlescriptCurrInstr = cmd->nextInstr;
}
else
{

View File

@ -0,0 +1,72 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_DRAGON_TAIL].effect == EFFECT_HIT_SWITCH_TARGET);
ASSUME(gBattleMoves[MOVE_LOCK_ON].effect == EFFECT_LOCK_ON);
}
SINGLE_BATTLE_TEST("Dragon Tail switches the target with a random non-fainted replacement")
{
KNOWN_FAILING; // Only 18/50. Waiting for an improved PASSES_RANDOMLY.
PASSES_RANDOMLY(90 * 1, 100 * 2);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_BULBASAUR);
OPPONENT(SPECIES_CHARMANDER);
OPPONENT(SPECIES_SQUIRTLE) { HP(0); }
} WHEN {
TURN { MOVE(player, MOVE_DRAGON_TAIL); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, player);
MESSAGE("Foe Bulbasaur was dragged out!");
}
}
DOUBLE_BATTLE_TEST("Dragon Tail switches the target with a random non-battler, non-fainted replacement")
{
PASSES_RANDOMLY(90 * 1, 100 * 2);
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
OPPONENT(SPECIES_BULBASAUR);
OPPONENT(SPECIES_CHARMANDER);
OPPONENT(SPECIES_SQUIRTLE) { HP(0); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_DRAGON_TAIL, target: opponentRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, playerLeft);
MESSAGE("Foe Bulbasaur was dragged out!");
}
}
SINGLE_BATTLE_TEST("Dragon Tail does not fail if no replacements")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_DRAGON_TAIL); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, player);
NOT MESSAGE("But it failed!");
}
}
SINGLE_BATTLE_TEST("Dragon Tail does not fail if replacements fainted")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT) { HP(0); }
} WHEN {
TURN { MOVE(player, MOVE_DRAGON_TAIL); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DRAGON_TAIL, player);
NOT MESSAGE("But it failed!");
}
}