diff --git a/src/battle_main.c b/src/battle_main.c index c3c3c11610..606f293454 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4060,11 +4060,10 @@ void BattleTurnPassed(void) { gChosenActionByBattler[i] = B_ACTION_NONE; gChosenMoveByBattler[i] = MOVE_NONE; + gBattleStruct->monToSwitchIntoId[i] = PARTY_SIZE; + gStatuses4[i] &= ~STATUS4_ELECTRIFIED; } - for (i = 0; i < MAX_BATTLERS_COUNT; i++) - *(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE; - *(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags; BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG); AssignUsableGimmicks(); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bd4451f7d7..bdf1f8ee53 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10209,6 +10209,7 @@ static void Cmd_various(void) gBattlescriptCurrInstr = cmd->failInstr; else { + SetTypeBeforeUsingMove(gCalledMove, gBattlerTarget); gEffectBattler = gBattleStruct->lastMoveTarget[gBattlerTarget]; gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED; gBattleStruct->atkCancellerTracker = 0; diff --git a/src/battle_util.c b/src/battle_util.c index 4dc9c9b45e..2d4798b0dd 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2272,7 +2272,6 @@ enum ENDTURN_ITEMS2, ENDTURN_ORBS, ENDTURN_ROOST, - ENDTURN_ELECTRIFY, ENDTURN_POWDER, ENDTURN_THROAT_CHOP, ENDTURN_SLOW_START, @@ -2866,10 +2865,6 @@ u8 DoBattlerEndTurnEffects(void) gBattleResources->flags->flags[battler] &= ~RESOURCE_FLAG_ROOST; gBattleStruct->turnEffectsTracker++; break; - case ENDTURN_ELECTRIFY: - gStatuses4[battler] &= ~STATUS4_ELECTRIFIED; - gBattleStruct->turnEffectsTracker++; - break; case ENDTURN_POWDER: gBattleMons[battler].status2 &= ~STATUS2_POWDER; gBattleStruct->turnEffectsTracker++; diff --git a/test/battle/ability/color_change.c b/test/battle/ability/color_change.c index d3a6489f00..668cb01b62 100644 --- a/test/battle/ability/color_change.c +++ b/test/battle/ability/color_change.c @@ -4,29 +4,33 @@ 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 { + ASSUME(gSpeciesInfo[SPECIES_KECLEON].types[0] != TYPE_PSYCHIC && gSpeciesInfo[SPECIES_KECLEON].types[1] != TYPE_PSYCHIC); + ASSUME(gMovesInfo[MOVE_PSYWAVE].type == TYPE_PSYCHIC); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } } WHEN { - TURN { MOVE(player, MOVE_TACKLE); } + TURN { MOVE(player, MOVE_PSYWAVE); } } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYWAVE, player); ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Wobbuffet's Color Change made it the Normal type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Psychic type!"); } } SINGLE_BATTLE_TEST("Color Change does not change the type when hit by a move that's the same type as itself") { GIVEN { + ASSUME(gSpeciesInfo[SPECIES_KECLEON].types[0] == TYPE_NORMAL || gSpeciesInfo[SPECIES_KECLEON].types[1] == TYPE_NORMAL); + ASSUME(gMovesInfo[MOVE_TACKLE].type == TYPE_NORMAL); PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } } WHEN { - TURN { MOVE(player, MOVE_PSYCHO_CUT); } + TURN { MOVE(player, MOVE_TACKLE); } } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player); NONE_OF { ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Wobbuffet's Color Change made it the Normal type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Normal type!"); } } } @@ -34,11 +38,12 @@ SINGLE_BATTLE_TEST("Color Change does not change the type when hit by a move tha 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); } + PLAYER(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_SLOWBRO); } WHEN { - TURN { MOVE(player, MOVE_PSYCHO_CUT); } + TURN { MOVE(opponent, MOVE_SKILL_SWAP); MOVE(player, MOVE_PSYCHO_CUT); } } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SKILL_SWAP, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player); NONE_OF { ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); @@ -50,11 +55,12 @@ SINGLE_BATTLE_TEST("Color Change does not change the type of a dual-type Pokemon 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); } + PLAYER(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_SLOWBRO); } WHEN { - TURN { MOVE(player, MOVE_PSYCHO_CUT); } + TURN { MOVE(opponent, MOVE_SKILL_SWAP); MOVE(player, MOVE_PSYCHO_CUT); } } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SKILL_SWAP, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_PSYCHO_CUT, player); NONE_OF { ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); @@ -67,13 +73,13 @@ SINGLE_BATTLE_TEST("Color Change changes the user to Electric type if hit by a m { GIVEN { PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { 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("The opposing Wobbuffet's Color Change made it the Electric type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Electric type!"); } } @@ -81,16 +87,16 @@ SINGLE_BATTLE_TEST("Color Change changes the type when a Pokemon is hit by Futur { GIVEN { PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_SNORLAX) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } } WHEN { TURN { MOVE(player, MOVE_FUTURE_SIGHT); } TURN { } TURN { } } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player); - MESSAGE("The opposing Snorlax took the Future Sight attack!"); + MESSAGE("The opposing Kecleon took the Future Sight attack!"); ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Snorlax's Color Change made it the Psychic type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Psychic type!"); } } @@ -98,35 +104,33 @@ SINGLE_BATTLE_TEST("Color Change changes the type when a Pokemon is hit by Doom { GIVEN { PLAYER(SPECIES_WOBBUFFET); - OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } } WHEN { TURN { MOVE(player, MOVE_DOOM_DESIRE); } TURN { } TURN { } } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_DOOM_DESIRE, player); - MESSAGE("The opposing Wobbuffet took the Doom Desire attack!"); + MESSAGE("The opposing Kecleon took the Doom Desire attack!"); ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Wobbuffet's Color Change made it the Steel type!"); + MESSAGE("The opposing Kecleon'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); } + OPPONENT(SPECIES_KECLEON) { 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("The opposing Blastoise took the Future Sight attack!"); - MESSAGE("It's super effective!"); + MESSAGE("The opposing Kecleon took the Future Sight attack!"); ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Blastoise's Color Change made it the Electr type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Electric type!"); } } @@ -134,15 +138,18 @@ SINGLE_BATTLE_TEST("Color Change changes the type to Normal when a Pokemon is hi { GIVEN { PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_NORMALIZE); } - OPPONENT(SPECIES_BLASTOISE) { Ability(ABILITY_COLOR_CHANGE); } + OPPONENT(SPECIES_KECLEON) { Ability(ABILITY_COLOR_CHANGE); } } WHEN { TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_FUTURE_SIGHT); } - TURN { } + TURN { MOVE(player, MOVE_SOAK); } TURN { } } SCENE { ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player); - MESSAGE("The opposing Blastoise took the Future Sight attack!"); + MESSAGE("Wobbuffet used Soak!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SOAK, player); + MESSAGE("The opposing Kecleon transformed into the Water type!"); + MESSAGE("The opposing Kecleon took the Future Sight attack!"); ABILITY_POPUP(opponent, ABILITY_COLOR_CHANGE); - MESSAGE("The opposing Blastoise's Color Change made it the Normal type!"); + MESSAGE("The opposing Kecleon's Color Change made it the Normal type!"); } } diff --git a/test/battle/move_effect/electrify.c b/test/battle/move_effect/electrify.c index e60bbdaf22..374a5b143f 100644 --- a/test/battle/move_effect/electrify.c +++ b/test/battle/move_effect/electrify.c @@ -18,7 +18,6 @@ SINGLE_BATTLE_TEST("Electrify makes the target's move Electric-type for the rema DOUBLE_BATTLE_TEST("Electrify makes the target's move Electric-type for the remainder of the turn (double move)") { - KNOWN_FAILING; GIVEN { ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND || gSpeciesInfo[SPECIES_SANDSLASH].types[1] == TYPE_GROUND); ASSUME(gMovesInfo[MOVE_TACKLE].type != TYPE_ELECTRIC); @@ -53,9 +52,8 @@ SINGLE_BATTLE_TEST("Electrify can change status moves to Electric-type") } } -SINGLE_BATTLE_TEST("Electrify changes the type of foreseen moves") +SINGLE_BATTLE_TEST("Electrify changes the type of foreseen moves when hitting its target") { - KNOWN_FAILING; GIVEN { ASSUME(gSpeciesInfo[SPECIES_SANDSLASH].types[0] == TYPE_GROUND || gSpeciesInfo[SPECIES_SANDSLASH].types[1] == TYPE_GROUND); ASSUME(gMovesInfo[MOVE_FUTURE_SIGHT].effect == EFFECT_FUTURE_SIGHT); @@ -63,12 +61,12 @@ SINGLE_BATTLE_TEST("Electrify changes the type of foreseen moves") PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_SANDSLASH); } WHEN { - TURN { MOVE(opponent, MOVE_ELECTRIFY); MOVE(player, MOVE_FUTURE_SIGHT); } - TURN {} + TURN { MOVE(opponent, MOVE_CELEBRATE); MOVE(player, MOVE_FUTURE_SIGHT); } TURN {} + TURN { MOVE(opponent, MOVE_ELECTRIFY); } } SCENE { - ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRIFY, opponent); ANIMATION(ANIM_TYPE_MOVE, MOVE_FUTURE_SIGHT, player); + ANIMATION(ANIM_TYPE_MOVE, MOVE_ELECTRIFY, opponent); NOT HP_BAR(opponent); } } diff --git a/test/battle/move_effect/instruct.c b/test/battle/move_effect/instruct.c index 59772ea944..b31076f3fe 100644 --- a/test/battle/move_effect/instruct.c +++ b/test/battle/move_effect/instruct.c @@ -216,3 +216,26 @@ DOUBLE_BATTLE_TEST("Instruct-called moves keep their priority") NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, playerRight); } } + +DOUBLE_BATTLE_TEST("Instructed move will be absorbed by Lightning Rod if it turns into an Electric Type move") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + PLAYER(SPECIES_WYNAUT); + OPPONENT(SPECIES_PIKACHU) { Ability(ABILITY_LIGHTNING_ROD); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { + MOVE(playerLeft, MOVE_TACKLE, target: opponentLeft); + MOVE(opponentLeft, MOVE_PLASMA_FISTS, target: playerLeft); + MOVE(playerRight, MOVE_INSTRUCT, target: playerLeft); + MOVE(opponentRight, MOVE_CELEBRATE); + } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_PLASMA_FISTS, opponentLeft); + ANIMATION(ANIM_TYPE_MOVE, MOVE_INSTRUCT, playerRight); + ABILITY_POPUP(opponentLeft, ABILITY_LIGHTNING_ROD); + NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, playerLeft); + } +}