sovereignx/test/battle/ability/own_tempo.c
Alex 594633aa15
Remove Duplicate ai code from battle_ai_util.c (#4883)
* Remove Duplicate ai code from battle_ai_util.c

* Add GetBattlerAbility in toxic self check
2024-07-03 10:48:31 +02:00

131 lines
5 KiB
C

#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Own Tempo prevents Intimidate but no other stat down changes")
{
GIVEN {
ASSUME(B_UPDATED_INTIMIDATE >= GEN_8);
ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE);
PLAYER(SPECIES_EKANS) { Ability(ABILITY_INTIMIDATE); };
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
} WHEN {
TURN { MOVE(player, MOVE_SCARY_FACE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_INTIMIDATE);
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Slowpoke's Own Tempo prevents stat loss!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SCARY_FACE, player);
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Slowpoke's Own Tempo prevents stat loss!");
}
}
}
SINGLE_BATTLE_TEST("Own Tempo prevents confusion from moves by the opponent")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
} WHEN {
TURN { MOVE(player, MOVE_CONFUSE_RAY); }
} SCENE {
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Slowpoke's Own Tempo prevents confusion!");
}
}
SINGLE_BATTLE_TEST("Own Tempo prevents confusion from moves by the user")
{
GIVEN {
ASSUME(MoveHasAdditionalEffectSelf(MOVE_PETAL_DANCE, MOVE_EFFECT_THRASH));
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
} WHEN {
TURN { MOVE(opponent, MOVE_PETAL_DANCE); }
TURN { MOVE(opponent, MOVE_PETAL_DANCE); }
TURN { MOVE(opponent, MOVE_PETAL_DANCE); }
TURN { MOVE(opponent, MOVE_PETAL_DANCE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PETAL_DANCE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PETAL_DANCE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PETAL_DANCE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PETAL_DANCE, opponent);
NONE_OF { MESSAGE("Foe Slowpoke became confused due to fatigue!"); }
}
}
SINGLE_BATTLE_TEST("Own Tempo is ignored by Mold Breaker")
{
KNOWN_FAILING; // Ideally the func CanBeConfused should be split into AttackerCanBeConfused and TargetCanBeConfused or we do it in the same func but have a check for when battlerAtk == battlerDef
GIVEN {
ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE);
PLAYER(SPECIES_PINSIR) { Ability(ABILITY_MOLD_BREAKER); }
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
} WHEN {
TURN { MOVE(player, MOVE_CONFUSE_RAY); }
} SCENE {
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Slowpoke's Own Tempo prevents confusion!");
}
}
}
SINGLE_BATTLE_TEST("Own Tempo cures confusion obtained from an opponent with Mold Breaker")
{
KNOWN_FAILING;
GIVEN {
ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE);
PLAYER(SPECIES_PINSIR) { Ability(ABILITY_MOLD_BREAKER); };
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
} WHEN {
TURN { MOVE(player, MOVE_CONFUSE_RAY); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFUSE_RAY, player);
MESSAGE("Foe Slowpoke became confused!");
NONE_OF {
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_CONFUSION, opponent);
}
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Slowpoke's Own Tempo cured its confusion problem!");
}
}
SINGLE_BATTLE_TEST("Own Tempo cures confusion if it's obtained via Skill Swap")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_CONFUSE_RAY].effect == EFFECT_CONFUSE);
ASSUME(gMovesInfo[MOVE_SKILL_SWAP].effect == EFFECT_SKILL_SWAP);
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); };
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CONFUSE_RAY); }
TURN { MOVE(player, MOVE_SKILL_SWAP);
MOVE(opponent, MOVE_TACKLE);
}
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_CONFUSE_RAY, player);
MESSAGE("Foe Wobbuffet became confused!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_SKILL_SWAP, player);
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
MESSAGE("Foe Wobbuffet's Own Tempo cured its confusion problem!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
}
}
SINGLE_BATTLE_TEST("Own Tempo prevents confusion from items")
{
GIVEN {
ASSUME(gItemsInfo[ITEM_BERSERK_GENE].holdEffect == HOLD_EFFECT_BERSERK_GENE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SLOWPOKE) { Ability(ABILITY_OWN_TEMPO); Item(ITEM_BERSERK_GENE); };
} WHEN {
TURN { MOVE(opponent, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
ABILITY_POPUP(opponent, ABILITY_OWN_TEMPO);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
}
}