forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed switch-in abilities activating on terrain change (#2881)
- Loading branch information
Showing
5 changed files
with
364 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include "global.h" | ||
#include "test_battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Electric Terrain protects grounded battlers from falling asleep") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_CLAYDOL) { Ability(ABILITY_LEVITATE); } | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); MOVE(opponent, MOVE_SPORE); } | ||
TURN { MOVE(player, MOVE_SPORE); } | ||
} SCENE { | ||
MESSAGE("Wobbuffet used ElctrcTrrain!"); | ||
MESSAGE("Foe Claydol used Spore!"); | ||
MESSAGE("Wobbuffet surrounds itself with electrified terrain!"); | ||
MESSAGE("Wobbuffet used Spore!"); | ||
MESSAGE("Foe Claydol fell asleep!"); | ||
STATUS_ICON(opponent, sleep: TRUE); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Electric Terrain activates Electric Seed and Mimicry") | ||
{ | ||
GIVEN { | ||
ASSUME(P_GEN_8_POKEMON == TRUE); | ||
ASSUME(gItems[ITEM_ELECTRIC_SEED].holdEffect == HOLD_EFFECT_SEEDS); | ||
ASSUME(gItems[ITEM_ELECTRIC_SEED].holdEffectParam == HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN); | ||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_ELECTRIC_SEED); } | ||
OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
MESSAGE("Using Electric Seed, the defense of Wobbuffet rose!"); | ||
ABILITY_POPUP(opponent); | ||
MESSAGE("Foe Stunfisk's type changed to Electr!"); | ||
} FINALLY { | ||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_ELECTRIC); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Electric Terrain increases power of Electric-type moves by 30/50 percent", s16 damage) | ||
{ | ||
bool32 terrain; | ||
PARAMETRIZE { terrain = FALSE; } | ||
PARAMETRIZE { terrain = TRUE; } | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
if (terrain) | ||
TURN { MOVE(player, MOVE_ELECTRIC_TERRAIN); } | ||
TURN { MOVE(player, MOVE_THUNDER_SHOCK); } | ||
} SCENE { | ||
MESSAGE("Wobbuffet used ThunderShock!"); | ||
HP_BAR(opponent, captureDamage: &results[i].damage); | ||
} FINALLY { | ||
if (B_TERRAIN_TYPE_BOOST >= GEN_8) | ||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.3), results[1].damage); | ||
else | ||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#include "global.h" | ||
#include "test_battle.h" | ||
|
||
SINGLE_BATTLE_TEST("Misty Terrain protects grounded battlers from non-volatile status conditions") | ||
{ | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_CLAYDOL) { Ability(ABILITY_LEVITATE); } | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_MISTY_TERRAIN); MOVE(opponent, MOVE_TOXIC); } | ||
TURN { MOVE(player, MOVE_TOXIC); } | ||
} SCENE { | ||
MESSAGE("Wobbuffet used MistyTerrain!"); | ||
MESSAGE("Foe Claydol used Toxic!"); | ||
MESSAGE("Wobbuffet surrounds itself with a protective mist!"); | ||
NOT { STATUS_ICON(opponent, badPoison: TRUE); } | ||
MESSAGE("Wobbuffet used Toxic!"); | ||
STATUS_ICON(opponent, badPoison: TRUE); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Misty Terrain activates Misty Seed and Mimicry") | ||
{ | ||
GIVEN { | ||
ASSUME(P_GEN_8_POKEMON == TRUE); | ||
ASSUME(gItems[ITEM_MISTY_SEED].holdEffect == HOLD_EFFECT_SEEDS); | ||
ASSUME(gItems[ITEM_MISTY_SEED].holdEffectParam == HOLD_EFFECT_PARAM_MISTY_TERRAIN); | ||
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_MISTY_SEED); } | ||
OPPONENT(SPECIES_STUNFISK_GALARIAN) { Ability(ABILITY_MIMICRY); } | ||
} WHEN { | ||
TURN { MOVE(player, MOVE_MISTY_TERRAIN); } | ||
} SCENE { | ||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); | ||
MESSAGE("Using Misty Seed, the sp. defense of Wobbuffet rose!"); | ||
ABILITY_POPUP(opponent); | ||
MESSAGE("Foe Stunfisk's type changed to Fairy!"); | ||
} FINALLY { | ||
EXPECT_EQ(gBattleMons[B_POSITION_OPPONENT_LEFT].type1, TYPE_FAIRY); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Misty Terrain does not increase the power of Fairy-type moves", s16 damage) | ||
{ | ||
bool32 terrain; | ||
PARAMETRIZE { terrain = FALSE; } | ||
PARAMETRIZE { terrain = TRUE; } | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
if (terrain) | ||
TURN { MOVE(player, MOVE_MISTY_TERRAIN); } | ||
TURN { MOVE(player, MOVE_MOONBLAST); } | ||
} SCENE { | ||
MESSAGE("Wobbuffet used Moonblast!"); | ||
HP_BAR(opponent, captureDamage: &results[i].damage); | ||
} FINALLY { | ||
EXPECT_EQ(results[0].damage, results[1].damage); | ||
} | ||
} | ||
|
||
SINGLE_BATTLE_TEST("Misty Terrain decreases power of Dragon-type moves by 50 percent", s16 damage) | ||
{ | ||
bool32 terrain; | ||
PARAMETRIZE { terrain = FALSE; } | ||
PARAMETRIZE { terrain = TRUE; } | ||
GIVEN { | ||
PLAYER(SPECIES_WOBBUFFET); | ||
OPPONENT(SPECIES_WOBBUFFET); | ||
} WHEN { | ||
if (terrain) | ||
TURN { MOVE(player, MOVE_MISTY_TERRAIN); } | ||
TURN { MOVE(player, MOVE_DRAGON_CLAW); } | ||
} SCENE { | ||
MESSAGE("Wobbuffet used Dragon Claw!"); | ||
HP_BAR(opponent, captureDamage: &results[i].damage); | ||
} FINALLY { | ||
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); | ||
} | ||
} |
Oops, something went wrong.