test for electromorphosis, small fix for wind power
This commit is contained in:
parent
c0f10623d6
commit
04feba8314
3 changed files with 139 additions and 8 deletions
|
@ -5691,7 +5691,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
|
||||||
&& TARGET_TURN_DAMAGED
|
&& TARGET_TURN_DAMAGED
|
||||||
&& IsBattlerAlive(gBattlerTarget))
|
&& IsBattlerAlive(gBattlerTarget))
|
||||||
{
|
{
|
||||||
gBattlerAttacker = gBattlerTarget;
|
|
||||||
BattleScriptPushCursor();
|
BattleScriptPushCursor();
|
||||||
gBattlescriptCurrInstr = BattleScript_WindPowerActivates;
|
gBattlescriptCurrInstr = BattleScript_WindPowerActivates;
|
||||||
effect++;
|
effect++;
|
||||||
|
|
56
test/ability_electromorphosis.c
Normal file
56
test/ability_electromorphosis.c
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
#include "global.h"
|
||||||
|
#include "test_battle.h"
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Electromorphosis sets up Charge when hit by any move")
|
||||||
|
{
|
||||||
|
s16 dmgBefore, dmgAfter;
|
||||||
|
u16 move;
|
||||||
|
|
||||||
|
PARAMETRIZE {move = MOVE_TACKLE; }
|
||||||
|
PARAMETRIZE {move = MOVE_GUST; }
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gBattleMoves[MOVE_TACKLE].power != 0);
|
||||||
|
ASSUME(gBattleMoves[MOVE_GUST].power != 0);
|
||||||
|
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL);
|
||||||
|
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
|
||||||
|
ASSUME(gBattleMoves[MOVE_THUNDERBOLT].power != 0);
|
||||||
|
ASSUME(gBattleMoves[MOVE_THUNDERBOLT].type == TYPE_ELECTRIC);
|
||||||
|
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_ELECTROMORPHOSIS); Speed(10); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) {Ability(ABILITY_LIMBER); Speed(5) ;} // Limber, so it doesn't get paralyzed.
|
||||||
|
}
|
||||||
|
WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_THUNDERBOLT), MOVE(opponent, move); }
|
||||||
|
TURN { MOVE(player, MOVE_THUNDERBOLT), MOVE(opponent, move); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDERBOLT, player);
|
||||||
|
HP_BAR(opponent, captureDamage: &dmgBefore);
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
|
||||||
|
HP_BAR(player);
|
||||||
|
ABILITY_POPUP(player, ABILITY_ELECTROMORPHOSIS);
|
||||||
|
if (move == MOVE_TACKLE) {
|
||||||
|
MESSAGE("Being hit by Tackle charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MESSAGE("Being hit by Gust charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDERBOLT, player);
|
||||||
|
HP_BAR(opponent, captureDamage: &dmgAfter);
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, move, opponent);
|
||||||
|
HP_BAR(player);
|
||||||
|
ABILITY_POPUP(player, ABILITY_ELECTROMORPHOSIS);
|
||||||
|
if (move == MOVE_TACKLE) {
|
||||||
|
MESSAGE("Being hit by Tackle charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MESSAGE("Being hit by Gust charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
THEN {
|
||||||
|
EXPECT_MUL_EQ(dmgBefore, Q_4_12(2.0), dmgAfter);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,9 @@ ASSUMPTIONS
|
||||||
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].power != 0);
|
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].power != 0);
|
||||||
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].target == MOVE_TARGET_BOTH);
|
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].target == MOVE_TARGET_BOTH);
|
||||||
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].flags & FLAG_WIND_MOVE);
|
ASSUME(gBattleMoves[MOVE_AIR_CUTTER].flags & FLAG_WIND_MOVE);
|
||||||
|
ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].power != 0);
|
||||||
|
ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].target == MOVE_TARGET_FOES_AND_ALLY);
|
||||||
|
ASSUME(gBattleMoves[MOVE_PETAL_BLIZZARD].flags & FLAG_WIND_MOVE);
|
||||||
ASSUME(!(gBattleMoves[MOVE_TACKLE].flags & FLAG_WIND_MOVE));
|
ASSUME(!(gBattleMoves[MOVE_TACKLE].flags & FLAG_WIND_MOVE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,11 +105,11 @@ SINGLE_BATTLE_TEST("Wind Power sets up Charge for opponent when hit by a wind mo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ability when hit by a multi target move")
|
DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ability when hit by a 2/3 target move")
|
||||||
{
|
{
|
||||||
u16 abilityLeft, abilityRight;
|
u16 move, abilityLeft, abilityRight;
|
||||||
|
|
||||||
PARAMETRIZE {abilityLeft = ABILITY_NONE, abilityRight = ABILITY_WIND_POWER; }
|
PARAMETRIZE {abilityLeft = ABILITY_NONE, abilityRight = ABILITY_WIND_POWER;}
|
||||||
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_NONE; }
|
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_NONE; }
|
||||||
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_WIND_POWER; }
|
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_WIND_POWER; }
|
||||||
|
|
||||||
|
@ -116,7 +119,7 @@ DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ab
|
||||||
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(20); }
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(20); }
|
||||||
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(15); }
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(15); }
|
||||||
} WHEN {
|
} WHEN {
|
||||||
TURN { MOVE(opponentLeft, MOVE_AIR_CUTTER);}
|
TURN { MOVE(opponentLeft, MOVE_AIR_CUTTER); MOVE(opponentRight, MOVE_AIR_CUTTER);}
|
||||||
} SCENE {
|
} SCENE {
|
||||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_AIR_CUTTER, opponentLeft);
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_AIR_CUTTER, opponentLeft);
|
||||||
|
|
||||||
|
@ -125,9 +128,6 @@ DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ab
|
||||||
ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER);
|
ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER);
|
||||||
MESSAGE("Being hit by Air Cutter charged Wobbuffet with power!");
|
MESSAGE("Being hit by Air Cutter charged Wobbuffet with power!");
|
||||||
}
|
}
|
||||||
NOT HP_BAR(opponentLeft);
|
|
||||||
NOT HP_BAR(opponentRight);
|
|
||||||
|
|
||||||
HP_BAR(playerRight);
|
HP_BAR(playerRight);
|
||||||
if (abilityRight == ABILITY_WIND_POWER) {
|
if (abilityRight == ABILITY_WIND_POWER) {
|
||||||
ABILITY_POPUP(playerRight, ABILITY_WIND_POWER);
|
ABILITY_POPUP(playerRight, ABILITY_WIND_POWER);
|
||||||
|
@ -143,3 +143,79 @@ DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ab
|
||||||
EXPECT_EQ(opponentLeft->hp, opponentLeft->maxHP);
|
EXPECT_EQ(opponentLeft->hp, opponentLeft->maxHP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DOUBLE_BATTLE_TEST("Wind Power activates correctly for every battler with the ability when hit by a 3 target move")
|
||||||
|
{
|
||||||
|
u16 abilityLeft, abilityRight;
|
||||||
|
|
||||||
|
PARAMETRIZE {abilityLeft = ABILITY_NONE, abilityRight = ABILITY_WIND_POWER; }
|
||||||
|
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_NONE; }
|
||||||
|
PARAMETRIZE {abilityLeft = ABILITY_WIND_POWER, abilityRight = ABILITY_WIND_POWER; }
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(abilityLeft); Speed(10); }
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(abilityRight); Speed(5); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(20); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_LIMBER); Speed(15); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponentLeft, MOVE_PETAL_BLIZZARD);}
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_PETAL_BLIZZARD, opponentLeft);
|
||||||
|
|
||||||
|
HP_BAR(playerLeft);
|
||||||
|
if (abilityLeft == ABILITY_WIND_POWER) {
|
||||||
|
ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by PetalBlizzrd charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
HP_BAR(playerRight);
|
||||||
|
if (abilityRight == ABILITY_WIND_POWER) {
|
||||||
|
ABILITY_POPUP(playerRight, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by PetalBlizzrd charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
HP_BAR(opponentRight);
|
||||||
|
NOT HP_BAR(opponentLeft);
|
||||||
|
}
|
||||||
|
THEN {
|
||||||
|
EXPECT_NE(playerLeft->hp, playerLeft->maxHP);
|
||||||
|
EXPECT_NE(playerRight->hp, playerRight->maxHP);
|
||||||
|
EXPECT_NE(opponentRight->hp, opponentRight->maxHP);
|
||||||
|
EXPECT_EQ(opponentLeft->hp, opponentLeft->maxHP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DOUBLE_BATTLE_TEST("Wind Power activates correctly when Tailwind is used")
|
||||||
|
{
|
||||||
|
bool8 opponentSide;
|
||||||
|
|
||||||
|
PARAMETRIZE {opponentSide = TRUE;}
|
||||||
|
PARAMETRIZE {opponentSide = FALSE;}
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gBattleMoves[MOVE_TAILWIND].effect == EFFECT_TAILWIND);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_WIND_POWER); Speed(10); }
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_WIND_POWER); Speed(5); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_WIND_POWER); Speed(20); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Ability(ABILITY_WIND_POWER); Speed(15); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE((opponentSide == TRUE) ? opponentLeft : playerLeft, MOVE_TAILWIND);}
|
||||||
|
} SCENE {
|
||||||
|
if (opponentSide) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAILWIND, opponentLeft);
|
||||||
|
|
||||||
|
ABILITY_POPUP(opponentLeft, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by Tailwind charged Foe Wobbuffet with power!");
|
||||||
|
|
||||||
|
ABILITY_POPUP(opponentRight, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by Tailwind charged Foe Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TAILWIND, playerLeft);
|
||||||
|
|
||||||
|
ABILITY_POPUP(playerLeft, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by Tailwind charged Wobbuffet with power!");
|
||||||
|
|
||||||
|
ABILITY_POPUP(playerRight, ABILITY_WIND_POWER);
|
||||||
|
MESSAGE("Being hit by Tailwind charged Wobbuffet with power!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue