Skip to content

Commit

Permalink
Fix Fixed some moves' on-hit effects bypassing Substitutes where they…
Browse files Browse the repository at this point in the history
… shouldn't and some other things discovered along the way rh-hideout#4558
  • Loading branch information
Pawkkie committed May 29, 2024
1 parent ccd1e93 commit da4a53c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 46 deletions.
36 changes: 18 additions & 18 deletions test/battle/ability/shield_dust.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ SINGLE_BATTLE_TEST("Shield Dust blocks secondary effects")
PARAMETRIZE { move = MOVE_FAKE_OUT; }
PARAMETRIZE { move = MOVE_ROCK_TOMB; }
PARAMETRIZE { move = MOVE_SPIRIT_SHACKLE; }
PARAMETRIZE { move = MOVE_PSYCHIC_NOISE; }
// PARAMETRIZE { move = MOVE_PSYCHIC_NOISE; }

GIVEN {
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_NUZZLE, MOVE_EFFECT_PARALYSIS, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_INFERNO, MOVE_EFFECT_BURN, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_MORTAL_SPIN, MOVE_EFFECT_POISON, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_FAKE_OUT, MOVE_EFFECT_FLINCH, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_ROCK_TOMB, MOVE_EFFECT_SPD_MINUS_1, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_SPIRIT_SHACKLE, MOVE_EFFECT_PREVENT_ESCAPE, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_PSYCHIC_NOISE, MOVE_EFFECT_PSYCHIC_NOISE, 100) == TRUE);
ASSUME(gBattleMoves[MOVE_NUZZLE].effect == MOVE_EFFECT_PARALYSIS);
ASSUME(gBattleMoves[MOVE_INFERNO].effect == MOVE_EFFECT_BURN);
ASSUME(gBattleMoves[MOVE_MORTAL_SPIN].effect == MOVE_EFFECT_POISON);
ASSUME(gBattleMoves[MOVE_FAKE_OUT].effect == MOVE_EFFECT_FLINCH);
ASSUME(gBattleMoves[MOVE_ROCK_TOMB].effect == MOVE_EFFECT_SPD_MINUS_1);
ASSUME(gBattleMoves[MOVE_SPIRIT_SHACKLE].effect == MOVE_EFFECT_PREVENT_ESCAPE);
// ASSUME(gBattleMoves[MOVE_PSYCHIC_NOISE].effect == MOVE_EFFECT_PSYCHIC_NOISE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_VIVILLON) { Ability(ABILITY_SHIELD_DUST); }
} WHEN {
Expand All @@ -33,7 +33,7 @@ SINGLE_BATTLE_TEST("Shield Dust blocks secondary effects")
MESSAGE("Foe Vivillon was poisoned!");
MESSAGE("Foe Vivillon flinched!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Vivillon was prevented from healing!");
// MESSAGE("Foe Vivillon was prevented from healing!");
}
} THEN { // Can't find good way to test trapping
EXPECT(!(opponent->status2 & STATUS2_ESCAPE_PREVENTION));
Expand All @@ -49,11 +49,11 @@ SINGLE_BATTLE_TEST("Shield Dust does not block primary effects")
PARAMETRIZE { move = MOVE_PAY_DAY; }

GIVEN {
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_INFESTATION, MOVE_EFFECT_WRAP, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_THOUSAND_ARROWS, MOVE_EFFECT_SMACK_DOWN, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_JAW_LOCK, MOVE_EFFECT_TRAP_BOTH, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_PAY_DAY, MOVE_EFFECT_PAYDAY, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_SMACK_DOWN, MOVE_EFFECT_SMACK_DOWN, 0) == TRUE);
ASSUME(gBattleMoves[MOVE_INFESTATION].effect == MOVE_EFFECT_WRAP);
ASSUME(gBattleMoves[MOVE_THOUSAND_ARROWS].effect == MOVE_EFFECT_SMACK_DOWN);
ASSUME(gBattleMoves[MOVE_JAW_LOCK].effect == MOVE_EFFECT_TRAP_BOTH);
ASSUME(gBattleMoves[MOVE_PAY_DAY].effect == MOVE_EFFECT_PAYDAY);
ASSUME(gBattleMoves[MOVE_SMACK_DOWN].effect == MOVE_EFFECT_SMACK_DOWN);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_VIVILLON) { Ability(ABILITY_SHIELD_DUST); }
} WHEN {
Expand Down Expand Up @@ -93,10 +93,10 @@ SINGLE_BATTLE_TEST("Shield Dust does not block self-targeting effects, primary o
PARAMETRIZE { move = MOVE_METEOR_ASSAULT; }

GIVEN {
ASSUME(MoveHasAdditionalEffectSelf(MOVE_POWER_UP_PUNCH, MOVE_EFFECT_ATK_PLUS_1) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_RAPID_SPIN, MOVE_EFFECT_RAPID_SPIN) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_LEAF_STORM, MOVE_EFFECT_SP_ATK_TWO_DOWN) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_METEOR_ASSAULT, MOVE_EFFECT_RECHARGE) == TRUE);
ASSUME(gBattleMoves[MOVE_POWER_UP_PUNCH].effect == MOVE_EFFECT_ATK_PLUS_1);
ASSUME(gBattleMoves[MOVE_RAPID_SPIN].effect == EFFECT_RAPID_SPIN);
ASSUME(gBattleMoves[MOVE_LEAF_STORM].effect == MOVE_EFFECT_SP_ATK_TWO_DOWN);
ASSUME(gBattleMoves[MOVE_METEOR_ASSAULT].effect == MOVE_EFFECT_RECHARGE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_VIVILLON) { Ability(ABILITY_SHIELD_DUST); }
} WHEN {
Expand Down
35 changes: 17 additions & 18 deletions test/battle/item_effect/covert_cloak.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ SINGLE_BATTLE_TEST("Covert Cloak blocks secondary effects")
PARAMETRIZE { move = MOVE_FAKE_OUT; }
PARAMETRIZE { move = MOVE_ROCK_TOMB; }
PARAMETRIZE { move = MOVE_SPIRIT_SHACKLE; }
PARAMETRIZE { move = MOVE_PSYCHIC_NOISE; }
// PARAMETRIZE { move = MOVE_PSYCHIC_NOISE; }

GIVEN {
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_NUZZLE, MOVE_EFFECT_PARALYSIS, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_INFERNO, MOVE_EFFECT_BURN, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_MORTAL_SPIN, MOVE_EFFECT_POISON, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_FAKE_OUT, MOVE_EFFECT_FLINCH, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_ROCK_TOMB, MOVE_EFFECT_SPD_MINUS_1, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_SPIRIT_SHACKLE, MOVE_EFFECT_PREVENT_ESCAPE, 100) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_PSYCHIC_NOISE, MOVE_EFFECT_PSYCHIC_NOISE, 100) == TRUE);
ASSUME(gBattleMoves[MOVE_NUZZLE].effect == MOVE_EFFECT_PARALYSIS);
ASSUME(gBattleMoves[MOVE_INFERNO].effect == MOVE_EFFECT_BURN);
ASSUME(gBattleMoves[MOVE_MORTAL_SPIN].effect == MOVE_EFFECT_POISON);
ASSUME(gBattleMoves[MOVE_FAKE_OUT].effect == MOVE_EFFECT_FLINCH);
ASSUME(gBattleMoves[MOVE_ROCK_TOMB].effect == MOVE_EFFECT_SPD_MINUS_1);
ASSUME(gBattleMoves[MOVE_SPIRIT_SHACKLE].effect == MOVE_EFFECT_PREVENT_ESCAPE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_COVERT_CLOAK); }
} WHEN {
Expand All @@ -33,7 +32,7 @@ SINGLE_BATTLE_TEST("Covert Cloak blocks secondary effects")
MESSAGE("Foe Wobbuffet was poisoned!");
MESSAGE("Foe Wobbuffet flinched!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
MESSAGE("Foe Wobbuffet was prevented from healing!");
// MESSAGE("Foe Wobbuffet was prevented from healing!");
}
} THEN { // Can't find good way to test trapping
EXPECT(!(opponent->status2 & STATUS2_ESCAPE_PREVENTION));
Expand All @@ -49,11 +48,11 @@ SINGLE_BATTLE_TEST("Covert Cloak does not block primary effects")
PARAMETRIZE { move = MOVE_PAY_DAY; }

GIVEN {
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_INFESTATION, MOVE_EFFECT_WRAP, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_THOUSAND_ARROWS, MOVE_EFFECT_SMACK_DOWN, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_JAW_LOCK, MOVE_EFFECT_TRAP_BOTH, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_PAY_DAY, MOVE_EFFECT_PAYDAY, 0) == TRUE);
ASSUME(MoveHasAdditionalEffectWithChance(MOVE_SMACK_DOWN, MOVE_EFFECT_SMACK_DOWN, 0) == TRUE);
ASSUME(gBattleMoves[MOVE_INFESTATION].effect == MOVE_EFFECT_WRAP);
ASSUME(gBattleMoves[MOVE_THOUSAND_ARROWS].effect == MOVE_EFFECT_SMACK_DOWN);
ASSUME(gBattleMoves[MOVE_JAW_LOCK].effect == MOVE_EFFECT_TRAP_BOTH);
ASSUME(gBattleMoves[MOVE_PAY_DAY].effect == MOVE_EFFECT_PAYDAY);
ASSUME(gBattleMoves[MOVE_SMACK_DOWN].effect == MOVE_EFFECT_SMACK_DOWN);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_SKARMORY) { Item(ITEM_COVERT_CLOAK); }
} WHEN {
Expand Down Expand Up @@ -92,10 +91,10 @@ SINGLE_BATTLE_TEST("Covert Cloak does not block self-targeting effects, primary
PARAMETRIZE { move = MOVE_METEOR_ASSAULT; }

GIVEN {
ASSUME(MoveHasAdditionalEffectSelf(MOVE_POWER_UP_PUNCH, MOVE_EFFECT_ATK_PLUS_1) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_RAPID_SPIN, MOVE_EFFECT_RAPID_SPIN) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_LEAF_STORM, MOVE_EFFECT_SP_ATK_TWO_DOWN) == TRUE);
ASSUME(MoveHasAdditionalEffectSelf(MOVE_METEOR_ASSAULT, MOVE_EFFECT_RECHARGE) == TRUE);
ASSUME(gBattleMoves[MOVE_POWER_UP_PUNCH].effect == MOVE_EFFECT_ATK_PLUS_1);
ASSUME(gBattleMoves[MOVE_RAPID_SPIN].effect == EFFECT_RAPID_SPIN);
ASSUME(gBattleMoves[MOVE_LEAF_STORM].effect == MOVE_EFFECT_SP_ATK_TWO_DOWN);
ASSUME(gBattleMoves[MOVE_METEOR_ASSAULT].effect == MOVE_EFFECT_RECHARGE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_COVERT_CLOAK); }
} WHEN {
Expand Down
2 changes: 1 addition & 1 deletion test/battle/move_effect/smack_down.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_SMACK_DOWN].additionalEffects->moveEffect == MOVE_EFFECT_SMACK_DOWN);
ASSUME(gBattleMoves[MOVE_SMACK_DOWN].effect == EFFECT_SMACK_DOWN);
}

SINGLE_BATTLE_TEST("Smack Down does not ground mons behind substitutes")
Expand Down
4 changes: 2 additions & 2 deletions test/battle/move_effect/smelling_salts.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_SMELLING_SALTS].additionalEffects->moveEffect == MOVE_EFFECT_REMOVE_STATUS);
ASSUME(gBattleMoves[MOVE_SMELLING_SALTS].argument == STATUS1_PARALYSIS);
ASSUME(gBattleMoves[MOVE_SMELLING_SALTS].effect == EFFECT_SMELLING_SALTS);
// ASSUME(gBattleMoves[MOVE_SMELLING_SALTS].argument == STATUS1_PARALYSIS);
}

SINGLE_BATTLE_TEST("Smelling Salts does not cure paralyzed pokemons behind substitutes or get increased power")
Expand Down
4 changes: 1 addition & 3 deletions test/battle/move_effect/sparkling_aria.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_SPARKLING_ARIA].additionalEffects->moveEffect == MOVE_EFFECT_REMOVE_STATUS);
ASSUME(gBattleMoves[MOVE_SPARKLING_ARIA].argument == STATUS1_BURN);
ASSUME(gBattleMoves[MOVE_SPARKLING_ARIA].soundMove == TRUE);
ASSUME(gBattleMoves[MOVE_SPARKLING_ARIA].effect == EFFECT_SPARKLING_ARIA);
}

DOUBLE_BATTLE_TEST("Sparkling Aria cures burns from all Pokemon on the field and behind substitutes")
Expand Down
3 changes: 1 addition & 2 deletions test/battle/move_effect/thousand_arrows.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_THOUSAND_ARROWS].additionalEffects->moveEffect == MOVE_EFFECT_SMACK_DOWN);
ASSUME(gBattleMoves[MOVE_THOUSAND_ARROWS].ignoreTypeIfFlyingAndUngrounded == TRUE);
ASSUME(gBattleMoves[MOVE_THOUSAND_ARROWS].effect == EFFECT_SMACK_DOWN);
}

SINGLE_BATTLE_TEST("Thousand Arrows does not ground mons behind substitutes")
Expand Down
3 changes: 1 addition & 2 deletions test/battle/move_effect/wake_up_slap.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_WAKE_UP_SLAP].additionalEffects->moveEffect == MOVE_EFFECT_REMOVE_STATUS);
ASSUME(gBattleMoves[MOVE_WAKE_UP_SLAP].argument == STATUS1_SLEEP);
ASSUME(gBattleMoves[MOVE_WAKE_UP_SLAP].effect == EFFECT_WAKE_UP_SLAP);
}

SINGLE_BATTLE_TEST("Wake-Up Slap does not cure paralyzed pokemons behind substitutes or get increased power")
Expand Down

0 comments on commit da4a53c

Please sign in to comment.