Add tests for Mega Evo, Focus Punch, Beak Blast

This commit is contained in:
DizzyEggg 2023-03-08 13:22:53 +01:00
parent f6089a0057
commit 51c8edd825
6 changed files with 257 additions and 12 deletions

View File

@ -3027,7 +3027,11 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId)
toCpy = gSaveBlock2Ptr->playerName;
break;
case B_POSITION_PLAYER_RIGHT:
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_MULTI))
if ((gBattleTypeFlags & BATTLE_TYPE_RECORDED) && !(gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER)))
{
toCpy = gLinkPlayers[0].name;
}
else if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_MULTI))
{
toCpy = gLinkPlayers[2].name;
}

View File

@ -5464,6 +5464,9 @@ static void Cmd_moveend(void)
{
gProtectStructs[gBattlerAttacker].touchedProtectLike = FALSE;
gBattleMons[gBattlerAttacker].status1 = STATUS1_BURN;
gActiveBattler = gBattlerAttacker;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_BeakBlastBurn;
effect = 1;

View File

@ -10301,31 +10301,31 @@ static const struct TrainerMonNoItemDefaultMoves sParty_MayRustboroTorchic[] = {
static const struct TrainerMonItemCustomMoves sParty_Roxanne2[] = {
{
.iv = 255,
.lvl = 5,
.species = SPECIES_AMPHAROS,
.heldItem = ITEM_AMPHAROSITE,
.moves = {MOVE_PROTECT, MOVE_ROLLOUT, MOVE_MAGNITUDE, MOVE_EXPLOSION}
.lvl = 100,
.species = SPECIES_BEEDRILL,
.heldItem = 0,
.moves = {MOVE_FLING}
},
{
.iv = 255,
.lvl = 35,
.lvl = 100,
.species = SPECIES_KABUTO,
.heldItem = ITEM_SITRUS_BERRY,
.moves = {MOVE_SWORDS_DANCE, MOVE_ICE_BEAM, MOVE_SURF, MOVE_ROCK_SLIDE}
},
{
.iv = 255,
.lvl = 35,
.species = SPECIES_ONIX,
.lvl = 100,
.species = SPECIES_THUNDURUS,
.heldItem = ITEM_NONE,
.moves = {MOVE_IRON_TAIL, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE}
.moves = {MOVE_THUNDER, MOVE_EXPLOSION, MOVE_ROAR, MOVE_ROCK_SLIDE}
},
{
.iv = 255,
.lvl = 37,
.species = SPECIES_NOSEPASS,
.lvl = 99,
.species = SPECIES_SABLEYE,
.heldItem = ITEM_SITRUS_BERRY,
.moves = {MOVE_DOUBLE_TEAM, MOVE_EXPLOSION, MOVE_PROTECT, MOVE_ROCK_SLIDE}
.moves = {MOVE_DOUBLE_TEAM, MOVE_EXPLOSION, MOVE_DARK_PULSE, MOVE_IRON_HEAD}
}
};

View File

@ -104,3 +104,52 @@ SINGLE_BATTLE_TEST("Abilities replaced by Mega Evolution do not affect turn orde
ASSUME(player->speed == 45);
}
}
DOUBLE_BATTLE_TEST("Mega Evolution happens after switching, but before Focus Punch-like Moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_FOCUS_PUNCH].effect == EFFECT_FOCUS_PUNCH);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_VENUSAUR) { Item(ITEM_VENUSAURITE);}
OPPONENT(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { SWITCH(opponentRight, 2); MOVE(playerRight, MOVE_FOCUS_PUNCH, megaEvolve: TRUE, target:opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target:opponentLeft); }
TURN {};
} SCENE {
MESSAGE("2 withdrew Wobbuffet!");
MESSAGE("2 sent out Wobbuffet!");
MESSAGE("Venusaur's Venusaurite is reacting to 1's Mega Ring!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, playerRight);
MESSAGE("Venusaur has Mega Evolved into Mega Venusaur!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerRight);
MESSAGE("Venusaur is tightening its focus!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerLeft);
MESSAGE("Wobbuffet is tightening its focus!");
}
}
SINGLE_BATTLE_TEST("Regular Mega Evolution and Fervent Wish Mega Evolution can happen on the same turn")
{
GIVEN {
PLAYER(SPECIES_RAYQUAZA) { Moves(MOVE_DRAGON_ASCENT, MOVE_CELEBRATE); Speed(3);}
OPPONENT(SPECIES_GARDEVOIR) { Item(ITEM_GARDEVOIRITE); Speed(2);}
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE, megaEvolve: TRUE); MOVE(opponent, MOVE_CELEBRATE, megaEvolve: TRUE); }
} SCENE {
MESSAGE("1's fervent wish has reached Rayquaza!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, player);
MESSAGE("Rayquaza has Mega Evolved into Mega Rayquaza!");
MESSAGE("Foe Gardevoir's Gardevoirite is reacting to 's Mega Ring!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponent);
MESSAGE("Foe Gardevoir has Mega Evolved into Mega Gardevoir!");
} THEN {
EXPECT_EQ(player->species, SPECIES_RAYQUAZA_MEGA);
EXPECT_EQ(opponent->species, SPECIES_GARDEVOIR_MEGA);
}
}

View File

@ -0,0 +1,113 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_BEAK_BLAST].effect == EFFECT_BEAK_BLAST);
}
DOUBLE_BATTLE_TEST("Beak Blast's charging message is shown before other moves are used")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BEAK_BLAST].priority < 0);
PLAYER(SPECIES_WYNAUT) {Speed(10); }
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(3); }
} WHEN {
TURN { MOVE(playerLeft, MOVE_BEAK_BLAST, target:opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_BEAK_BLAST_SETUP, playerLeft);
MESSAGE("Wynaut started heating up its beak!");
MESSAGE("Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerRight);
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentRight);
MESSAGE("Foe Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponentLeft);
MESSAGE("Wynaut used Beak Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BEAK_BLAST, playerLeft);
HP_BAR(opponentLeft);
}
}
DOUBLE_BATTLE_TEST("Beak Blast burns all who make contact with the pokemon")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_BEAK_BLAST].priority < 0);
ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT);
PLAYER(SPECIES_WYNAUT) {Speed(10); }
PLAYER(SPECIES_WOBBUFFET) {Speed(5); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(3); }
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
} WHEN {
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft); MOVE(opponentRight, MOVE_TACKLE, target:playerLeft); MOVE(playerLeft, MOVE_BEAK_BLAST, target:opponentLeft); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_BEAK_BLAST_SETUP, playerLeft);
MESSAGE("Wynaut started heating up its beak!");
MESSAGE("Wobbuffet used Celebrate!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, playerRight);
MESSAGE("Foe Wobbuffet used Tackle!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentLeft);
HP_BAR(playerLeft);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentLeft);
MESSAGE("Foe Wobbuffet was burned!");
STATUS_ICON(opponentLeft, burn: TRUE);
MESSAGE("Foe Wobbuffet used Tackle!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentRight);
HP_BAR(playerLeft);
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponentRight);
MESSAGE("Foe Wobbuffet was burned!");
STATUS_ICON(opponentRight, burn: TRUE);
MESSAGE("Wynaut used Beak Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BEAK_BLAST, playerLeft);
HP_BAR(opponentLeft);
}
}
SINGLE_BATTLE_TEST("Beak Blast burns only when contact moves are used")
{
u32 move;
bool32 burn;
PARAMETRIZE { move = MOVE_TACKLE; burn = TRUE; }
PARAMETRIZE { move = MOVE_WATER_GUN; burn = FALSE; }
PARAMETRIZE { move = MOVE_LEER; burn = FALSE; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].flags & FLAG_MAKES_CONTACT);
ASSUME(!(gBattleMoves[MOVE_WATER_GUN].flags & FLAG_MAKES_CONTACT));
ASSUME(!(gBattleMoves[MOVE_LEER].flags & FLAG_MAKES_CONTACT));
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_BEAK_BLAST); MOVE(opponent, move); }
TURN {}
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_BEAK_BLAST_SETUP, player);
MESSAGE("Wobbuffet started heating up its beak!");
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
if (burn) {
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent);
MESSAGE("Foe Wobbuffet was burned!");
STATUS_ICON(opponent, burn: TRUE);
}
else {
NONE_OF {
ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_BRN, opponent);
MESSAGE("Foe Wobbuffet was burned!");
STATUS_ICON(opponent, burn: TRUE);
}
}
MESSAGE("Wobbuffet used Beak Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BEAK_BLAST, player);
HP_BAR(opponent);
}
}

View File

@ -0,0 +1,76 @@
#include "global.h"
#include "test_battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_FOCUS_PUNCH].effect == EFFECT_FOCUS_PUNCH);
}
SINGLE_BATTLE_TEST("Focus Punch activates only if not damaged")
{
u32 move;
bool32 activate;
PARAMETRIZE { move = MOVE_TACKLE; activate = FALSE; }
PARAMETRIZE { move = MOVE_WATER_GUN; activate = FALSE; }
PARAMETRIZE { move = MOVE_LEER; activate = TRUE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_FOCUS_PUNCH); MOVE(opponent, move); }
} SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, player);
MESSAGE("Wobbuffet is tightening its focus!");
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
if (activate) {
MESSAGE("Wobbuffet used Focus Punch!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOCUS_PUNCH, player);
HP_BAR(opponent);
} else {
MESSAGE("Wobbuffet lost its focus and couldn't move!");
NONE_OF {
MESSAGE("Wobbuffet used Focus Punch!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOCUS_PUNCH, player);
HP_BAR(opponent);
}
}
}
}
DOUBLE_BATTLE_TEST("Focus Punch activation is based on Speed")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) {Speed(2) ;}
PLAYER(SPECIES_WYNAUT) {Speed(3) ;}
OPPONENT(SPECIES_WOBBUFFET) {Speed(1) ;}
OPPONENT(SPECIES_WYNAUT) {Speed(5) ;}
} WHEN {
TURN { MOVE(opponentRight, MOVE_FOCUS_PUNCH, target:playerLeft); MOVE(playerRight, MOVE_FOCUS_PUNCH, target:opponentLeft); MOVE(playerLeft, MOVE_FOCUS_PUNCH, target:opponentLeft); MOVE(opponentLeft, MOVE_FOCUS_PUNCH, target:playerLeft); }
}
SCENE {
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, opponentRight);
MESSAGE("Foe Wynaut is tightening its focus!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerRight);
MESSAGE("Wynaut is tightening its focus!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, playerLeft);
MESSAGE("Wobbuffet is tightening its focus!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FOCUS_PUNCH_SETUP, opponentLeft);
MESSAGE("Foe Wobbuffet is tightening its focus!");
MESSAGE("Foe Wynaut used Focus Punch!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOCUS_PUNCH, opponentRight);
HP_BAR(playerLeft);
MESSAGE("Wynaut used Focus Punch!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_FOCUS_PUNCH, playerRight);
HP_BAR(opponentLeft);
MESSAGE("Wobbuffet lost its focus and couldn't move!");
MESSAGE("Foe Wobbuffet lost its focus and couldn't move!");
}
}