2023-09-24 04:01:18 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "test/battle.h"
|
|
|
|
|
|
|
|
ASSUMPTIONS
|
|
|
|
{
|
2024-01-29 11:51:32 +00:00
|
|
|
ASSUME(gMovesInfo[MOVE_ELECTRIC_TERRAIN].effect == EFFECT_ELECTRIC_TERRAIN);
|
|
|
|
ASSUME(gMovesInfo[MOVE_PSYCHIC_TERRAIN].effect == EFFECT_PSYCHIC_TERRAIN);
|
|
|
|
ASSUME(gMovesInfo[MOVE_GRASSY_TERRAIN].effect == EFFECT_GRASSY_TERRAIN);
|
|
|
|
ASSUME(gMovesInfo[MOVE_MISTY_TERRAIN].effect == EFFECT_MISTY_TERRAIN);
|
|
|
|
ASSUME(gMovesInfo[MOVE_STEEL_ROLLER].effect == EFFECT_HIT_SET_REMOVE_TERRAIN);
|
|
|
|
ASSUME(gMovesInfo[MOVE_ICE_SPINNER].effect == EFFECT_HIT_SET_REMOVE_TERRAIN);
|
2023-09-24 04:01:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Steel Roller and Ice Spinner can remove a terrain from the field")
|
|
|
|
{
|
|
|
|
u32 j;
|
|
|
|
static const u16 terrainMoves[] =
|
|
|
|
{
|
|
|
|
MOVE_ELECTRIC_TERRAIN,
|
|
|
|
MOVE_PSYCHIC_TERRAIN,
|
|
|
|
MOVE_GRASSY_TERRAIN,
|
|
|
|
MOVE_MISTY_TERRAIN,
|
|
|
|
};
|
|
|
|
|
2023-10-13 17:39:35 +01:00
|
|
|
u16 terrainMove = MOVE_NONE;
|
|
|
|
u16 removeTerrainMove = MOVE_NONE;
|
2023-09-24 04:01:18 +01:00
|
|
|
|
|
|
|
for (j = 0; j < ARRAY_COUNT(terrainMoves); j++)
|
|
|
|
{
|
|
|
|
PARAMETRIZE { removeTerrainMove = MOVE_STEEL_ROLLER; terrainMove = terrainMoves[j]; }
|
|
|
|
PARAMETRIZE { removeTerrainMove = MOVE_ICE_SPINNER; terrainMove = terrainMoves[j]; }
|
|
|
|
}
|
|
|
|
|
|
|
|
GIVEN {
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(opponent, terrainMove); MOVE(player, removeTerrainMove); }
|
|
|
|
} SCENE {
|
|
|
|
ANIMATION(ANIM_TYPE_MOVE, terrainMove, opponent);
|
|
|
|
ANIMATION(ANIM_TYPE_MOVE, removeTerrainMove, player);
|
|
|
|
switch (terrainMove)
|
|
|
|
{
|
|
|
|
case MOVE_ELECTRIC_TERRAIN:
|
|
|
|
MESSAGE("The electricity disappeared from the battlefield.");
|
|
|
|
break;
|
|
|
|
case MOVE_PSYCHIC_TERRAIN:
|
2024-10-21 18:52:45 +01:00
|
|
|
MESSAGE("The weirdness disappeared from the battlefield!");
|
2023-09-24 04:01:18 +01:00
|
|
|
break;
|
|
|
|
case MOVE_GRASSY_TERRAIN:
|
|
|
|
MESSAGE("The grass disappeared from the battlefield.");
|
|
|
|
break;
|
|
|
|
case MOVE_MISTY_TERRAIN:
|
|
|
|
MESSAGE("The mist disappeared from the battlefield.");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Steel Roller fails if there is no terrain on the field")
|
|
|
|
{
|
|
|
|
GIVEN {
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(player, MOVE_STEEL_ROLLER); }
|
|
|
|
} SCENE {
|
|
|
|
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STEEL_ROLLER, player);
|
|
|
|
MESSAGE("But it failed!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Ice Spinner doesn't fail if there is no terrain on the field")
|
|
|
|
{
|
|
|
|
GIVEN {
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(player, MOVE_ICE_SPINNER); }
|
|
|
|
} SCENE {
|
|
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_ICE_SPINNER, player);
|
|
|
|
NOT MESSAGE("But it failed!");
|
|
|
|
}
|
|
|
|
}
|
2024-05-05 23:54:28 +01:00
|
|
|
|
2025-01-01 15:06:20 +00:00
|
|
|
AI_SINGLE_BATTLE_TEST("AI will not choose Steel Roller if it might fail")
|
2024-05-05 23:54:28 +01:00
|
|
|
{
|
|
|
|
u32 move;
|
|
|
|
|
|
|
|
PARAMETRIZE { move = MOVE_ELECTRIC_TERRAIN; }
|
|
|
|
PARAMETRIZE { move = MOVE_NONE; }
|
|
|
|
|
|
|
|
GIVEN {
|
|
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_STEEL_ROLLER, MOVE_ICE_SHARD); }
|
|
|
|
} WHEN {
|
|
|
|
if (move == MOVE_ELECTRIC_TERRAIN) {
|
|
|
|
TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); EXPECT_MOVE(opponent, MOVE_ICE_SHARD); }
|
|
|
|
TURN { EXPECT_MOVE(opponent, MOVE_STEEL_ROLLER); }
|
|
|
|
} else {
|
|
|
|
TURN { EXPECT_MOVE(opponent, MOVE_ICE_SHARD); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-01 15:06:20 +00:00
|
|
|
AI_SINGLE_BATTLE_TEST("AI will can choose Ice Spinner regardless if there is a terrain or not")
|
2024-05-05 23:54:28 +01:00
|
|
|
{
|
|
|
|
u32 move;
|
|
|
|
|
|
|
|
PARAMETRIZE { move = MOVE_ELECTRIC_TERRAIN; }
|
|
|
|
PARAMETRIZE { move = MOVE_NONE; }
|
|
|
|
|
|
|
|
GIVEN {
|
|
|
|
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_ICE_SPINNER, MOVE_ICE_SHARD); }
|
|
|
|
} WHEN {
|
|
|
|
if (move == MOVE_ELECTRIC_TERRAIN) {
|
|
|
|
TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); EXPECT_MOVE(opponent, MOVE_ICE_SPINNER); }
|
|
|
|
TURN { EXPECT_MOVE(opponent, MOVE_ICE_SPINNER); }
|
|
|
|
} else {
|
|
|
|
TURN { EXPECT_MOVE(opponent, MOVE_ICE_SPINNER); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|