Color change fixes (#4472)

* Fixed forseen moves not triggering Color Change and added tests for Color Change

* Added issue number to Known Failing test

---------

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
hedara90 2024-05-01 23:23:37 +02:00 committed by GitHub
parent 48d71b0de1
commit 77e17247cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 149 additions and 0 deletions

View file

@ -6637,6 +6637,7 @@ BattleScript_DoFutureAttackResult:
checkteamslost BattleScript_FutureAttackEnd
BattleScript_FutureAttackEnd::
moveendcase MOVEEND_RAGE
moveendcase MOVEEND_ABILITIES
moveendfromto MOVEEND_ITEM_EFFECTS_ALL, MOVEEND_UPDATE_LAST_MOVES
setbyte gMoveResultFlags, 0
end2

View file

@ -0,0 +1,148 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Color Change changes the type of a Pokemon being hit by a move if the type of the move and the Pokemon are different")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Wobbuffet's Color Change made it the Normal type!");
}
}
SINGLE_BATTLE_TEST("Color Change does not change the type when hit by a move that's the same type as itself")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_PSYCHO_CUT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player);
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Wobbuffet's Color Change made it the Normal type!");
}
}
}
SINGLE_BATTLE_TEST("Color Change does not change the type of a dual-type Pokemon when hit by a move that shares its primary type")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_XATU) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_PSYCHO_CUT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player);
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Xatu's Color Change made it the Psychic type!");
}
}
}
SINGLE_BATTLE_TEST("Color Change does not change the type of a dual-type Pokemon when hit by a move that shares its secondary type")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SLOWBRO) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_PSYCHO_CUT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player);
NONE_OF {
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Slowbro's Color Change made it the Psychic type!");
}
}
}
SINGLE_BATTLE_TEST("Color Change changes the user to Electric type if hit by a move while the opponent is under the effect of Electrify")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(opponent, MOVE_ELECTRIFY); MOVE(player, MOVE_PSYCHO_CUT); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player);
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Wobbuffet's Color Change made it the Electr type!");
}
}
SINGLE_BATTLE_TEST("Color Change changes the type when a Pokemon is hit by Future Sight")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SNORLAX) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_FUTURE_SIGHT); }
TURN { }
TURN { }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player);
MESSAGE("Foe Snorlax took the Future Sight attack!");
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Snorlax's Color Change made it the Psychc type!");
}
}
SINGLE_BATTLE_TEST("Color Change changes the type when a Pokemon is hit by Doom Desire")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(player, MOVE_DOOM_DESIRE); }
TURN { }
TURN { }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_DOOM_DESIRE, player);
MESSAGE("Foe Wobbuffet took the Doom Desire attack!");
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Wobbuffet's Color Change made it the Steel type!");
}
}
SINGLE_BATTLE_TEST("Color Change changes the type to Electric when a Pokemon is hit by a forseen attack under the effect of Electrify")
{
KNOWN_FAILING; // #4471.
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_BLASTOISE) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_FUTURE_SIGHT); }
TURN { }
TURN { MOVE(opponent, MOVE_ELECTRIFY); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player);
MESSAGE("Foe Blastoise took the Future Sight attack!");
MESSAGE("It's super effective!");
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Blastoise's Color Change made it the Electr type!");
}
}
SINGLE_BATTLE_TEST("Color Change changes the type to Normal when a Pokemon is hit by a forseen attack under the effect of Normalize")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_NORMALIZE); }
OPPONENT(SPECIES_BLASTOISE) { Ability(ABILITY_COLOR_CHANGE); }
} WHEN {
TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_FUTURE_SIGHT); }
TURN { }
TURN { }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player);
MESSAGE("Foe Blastoise took the Future Sight attack!");
ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE);
MESSAGE("Foe Blastoise's Color Change made it the Normal type!");
}
}