Added missing tests + Fix Coaching/Crafty Shield interaction (#5796)

Co-authored-by: hedara90 <90hedara@gmail.com>
This commit is contained in:
Eduardo Quezada 2024-12-11 05:05:09 -03:00 committed by GitHub
parent 5477033a19
commit 7eee3b35c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 168 additions and 9 deletions

View file

@ -8633,8 +8633,8 @@ bool32 IsBattlerProtected(u32 battlerAtk, u32 battlerDef, u32 move)
&& IsMoveMakingContact(move, gBattlerAttacker)
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_UNSEEN_FIST)
return FALSE;
else if (gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_CRAFTY_SHIELD
&& IS_MOVE_STATUS(move))
else if ((gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_CRAFTY_SHIELD)
&& IS_MOVE_STATUS(move) && gMovesInfo[move].effect != EFFECT_COACHING)
return TRUE;
else if (gMovesInfo[move].ignoresProtect)
return FALSE;

View file

@ -63,7 +63,32 @@ SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal when its abili
}
}
TO_DO_BATTLE_TEST("Forecast transforms Castform back to normal under Cloud Nine/Air Lock");
SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim back to normal under Cloud Nine/Air Lock")
{
u32 species = 0, ability = 0;
PARAMETRIZE { species = SPECIES_PSYDUCK; ability = ABILITY_CLOUD_NINE; }
PARAMETRIZE { species = SPECIES_RAYQUAZA; ability = ABILITY_AIR_LOCK; }
GIVEN {
PLAYER(SPECIES_CHERRIM_OVERCAST) { Ability(ABILITY_FLOWER_GIFT); }
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(species) { Ability(ability); }
} WHEN {
TURN { MOVE(player, MOVE_SUNNY_DAY); }
TURN { SWITCH(opponent, 1); }
} SCENE {
// transforms
ABILITY_POPUP(player, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Cherrim transformed!");
// back to normal
ABILITY_POPUP(opponent, ability);
ABILITY_POPUP(player, ABILITY_FLOWER_GIFT);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_FORM_CHANGE, player);
MESSAGE("Cherrim transformed!");
} THEN {
EXPECT_EQ(player->species, SPECIES_CHERRIM_OVERCAST);
}
}
DOUBLE_BATTLE_TEST("Flower Gift increases the attack of Cherrim and its allies by 1.5x", s16 damageL, s16 damageR)
{

View file

@ -1,8 +1,120 @@
#include "global.h"
#include "test/battle.h"
TO_DO_BATTLE_TEST("Coaching raises Attack and Defense of ally by 1 stage each");
TO_DO_BATTLE_TEST("Coaching doesn't raise stats of the user");
TO_DO_BATTLE_TEST("Coaching bypasses protection of allies");
TO_DO_BATTLE_TEST("Coaching fails in single battles");
TO_DO_BATTLE_TEST("Coaching fails if there's no ally");
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_COACHING].effect == EFFECT_COACHING);
}
DOUBLE_BATTLE_TEST("Coaching raises Attack and Defense of ally by 1 stage each")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_COACHING, target: playerRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, playerLeft);
MESSAGE("Wynaut's Attack rose!");
MESSAGE("Wynaut's Defense rose!");
}
}
DOUBLE_BATTLE_TEST("Coaching bypasses Protect")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_PROTECT].effect == EFFECT_PROTECT);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerRight, MOVE_PROTECT); MOVE(playerLeft, MOVE_COACHING, target: playerRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, playerLeft);
MESSAGE("Wynaut's Attack rose!");
MESSAGE("Wynaut's Defense rose!");
}
}
DOUBLE_BATTLE_TEST("Coaching bypasses Crafty Shield")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_CRAFTY_SHIELD].effect == EFFECT_PROTECT);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerRight, MOVE_CRAFTY_SHIELD); MOVE(playerLeft, MOVE_COACHING, target: playerRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, playerLeft);
MESSAGE("Wynaut's Attack rose!");
MESSAGE("Wynaut's Defense rose!");
}
}
DOUBLE_BATTLE_TEST("Coaching fails if all allies are is semi-invulnerable")
{
KNOWN_FAILING; // Coaching succeeds
GIVEN {
ASSUME(gMovesInfo[MOVE_FLY].effect == EFFECT_SEMI_INVULNERABLE);
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_HAWLUCHA);
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerRight, MOVE_FLY, target: opponentLeft); MOVE(playerLeft, MOVE_COACHING, target: playerRight); }
} SCENE {
MESSAGE("Hawlucha used Fly!");
MESSAGE("Wobbuffet used Coaching!");
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, playerLeft);
MESSAGE("Hawlucha's Attack rose!");
MESSAGE("Hawlucha's Defense rose!");
}
MESSAGE("But it failed!");
}
}
SINGLE_BATTLE_TEST("Coaching fails in single battles")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_COACHING); }
} SCENE {
MESSAGE("But it failed!");
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, player);
MESSAGE("Wynaut's Attack rose!");
MESSAGE("Wynaut's Defense rose!");
}
}
}
DOUBLE_BATTLE_TEST("Coaching fails if there's no ally")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT) { HP(1); };
OPPONENT(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(playerLeft, MOVE_TACKLE, target: playerRight); }
TURN { MOVE(playerLeft, MOVE_COACHING, target: playerRight); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft);
MESSAGE("Wynaut fainted!");
MESSAGE("Wobbuffet used Coaching!");
NONE_OF {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COACHING, playerLeft);
MESSAGE("Wynaut's Attack rose!");
MESSAGE("Wynaut's Defense rose!");
}
MESSAGE("But it failed!");
}
}

View file

@ -1,4 +1,21 @@
#include "global.h"
#include "test/battle.h"
TO_DO_BATTLE_TEST("Cosmic Power increases the user's Defense and Sp. Defense by 1 stage each");
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_COSMIC_POWER].effect == EFFECT_COSMIC_POWER);
}
SINGLE_BATTLE_TEST("Cosmic Power increases the user's Defense and Sp. Defense by 1 stage each")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_COSMIC_POWER); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_COSMIC_POWER, player);
MESSAGE("Wobbuffet's Defense rose!");
MESSAGE("Wobbuffet's Sp. Def rose!");
}
}

View file

@ -356,9 +356,14 @@ top:
if (gTestRunnerState.result == TEST_RESULT_PASS)
{
if (gTestRunnerState.result != gTestRunnerState.expectedResult)
{
Test_MgbaPrintf(":L%s:%d", gTestRunnerState.test->filename, SourceLine(0));
Test_MgbaPrintf(":U%s%s\e[0m", color, result);
}
else
{
Test_MgbaPrintf(":P%s%s\e[0m", color, result);
}
}
else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL)
Test_MgbaPrintf(":A%s%s\e[0m", color, result);