Fixes Stomping Tantrum effect not doubling power in certain situations (#5140)

* Fixes Stomping Tantrum effect not doubling power in certain situations

* fix dancer test
This commit is contained in:
Alex 2024-08-12 01:05:38 +02:00 committed by GitHub
parent 805bb2888c
commit 863b96f759
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 141 additions and 7 deletions

View file

@ -1364,9 +1364,8 @@ static void Cmd_attackcanceler(void)
}
// Z-moves and Max Moves bypass protection, but deal reduced damage (factored in AccumulateOtherModifiers)
if ((IsZMove(gCurrentMove)
|| IsMaxMove(gCurrentMove))
&& IS_BATTLER_PROTECTED(gBattlerTarget))
if ((IsZMove(gCurrentMove) || IsMaxMove(gCurrentMove))
&& IS_BATTLER_PROTECTED(gBattlerTarget))
{
BattleScriptPush(cmd->nextInstr);
gBattlescriptCurrInstr = BattleScript_CouldntFullyProtect;
@ -5825,7 +5824,9 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++;
break;
case MOVEEND_UPDATE_LAST_MOVES:
if (gMoveResultFlags & (MOVE_RESULT_FAILED | MOVE_RESULT_DOESNT_AFFECT_FOE))
if ((gMoveResultFlags & (MOVE_RESULT_FAILED | MOVE_RESULT_DOESNT_AFFECT_FOE))
|| (gBattleMons[gBattlerAttacker].status2 & (STATUS2_FLINCHED))
|| gProtectStructs[gBattlerAttacker].prlzImmobility)
gBattleStruct->lastMoveFailed |= gBitTable[gBattlerAttacker];
else
gBattleStruct->lastMoveFailed &= ~(gBitTable[gBattlerAttacker]);
@ -6267,9 +6268,8 @@ static void Cmd_moveend(void)
}
}
if (!(gBattleStruct->lastMoveFailed & gBitTable[gBattlerAttacker]
|| (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove
&& gBattleStruct->bouncedMoveIsUsed)))
if (!(gMoveResultFlags & (MOVE_RESULT_FAILED | MOVE_RESULT_DOESNT_AFFECT_FOE)
|| (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove && gBattleStruct->bouncedMoveIsUsed)))
{ // Dance move succeeds
// Set target for other Dancer mons; set bit so that mon cannot activate Dancer off of its own move
if (!gSpecialStatuses[gBattlerAttacker].dancerUsedMove)

View file

@ -0,0 +1,134 @@
#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_STOMPING_TANTRUM].effect == EFFECT_STOMPING_TANTRUM);
}
SINGLE_BATTLE_TEST("Stomping Tatrum will deal double damage if user flinched on the previous turn")
{
s16 damage[3];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WYNAUT);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); SWITCH(opponent, 1); }
TURN { MOVE(opponent, MOVE_FAKE_OUT); MOVE(player, MOVE_CELEBRATE); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_FAKE_OUT, opponent);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[2]);
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(2.0), damage[1]);
EXPECT_EQ(damage[0], damage[2]);
}
}
SINGLE_BATTLE_TEST("Stomping Tatrum will deal double damage if user failed to attack due to paralysis")
{
s16 damage[3];
PASSES_RANDOMLY(25, 100, RNG_PARALYSIS);
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(100); Item(ITEM_POTION); };
OPPONENT(SPECIES_WOBBUFFET) { Speed(10); Item(ITEM_LUM_BERRY); };
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); MOVE(opponent, MOVE_THUNDER_WAVE); }
TURN { MOVE(player, MOVE_CELEBRATE); MOVE(opponent, MOVE_TRICK); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_THUNDER_WAVE, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_TRICK, opponent);
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[2]);
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(2.0), damage[1]);
EXPECT_EQ(damage[0], damage[2]);
}
}
SINGLE_BATTLE_TEST("Stomping Tatrum will not deal double damage if target protects")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(opponent, MOVE_PROTECT); MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
ANIMATION(ANIM_TYPE_MOVE, MOVE_PROTECT, opponent);
MESSAGE("Foe Wobbuffet protected itself!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
} THEN {
EXPECT_EQ(damage[0], damage[1]);
}
}
SINGLE_BATTLE_TEST("Stomping Tatrum will not deal double damage if it failed on the previous turn cause of Protect")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_BRIGHTPOWDER); };
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM, hit: FALSE); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
MESSAGE("Wobbuffet's attack missed!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
} THEN {
EXPECT_EQ(damage[0], damage[1]);
}
}
SINGLE_BATTLE_TEST("Stomping Tatrum will deal double damage if user was immune to previous move")
{
s16 damage[2];
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_PIDGEY);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); SWITCH(opponent, 1); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); SWITCH(opponent, 0); }
TURN { MOVE(player, MOVE_STOMPING_TANTRUM); SWITCH(opponent, 1); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[0]);
MESSAGE("It doesn't affect Foe Pidgey…");
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOMPING_TANTRUM, player);
HP_BAR(opponent, captureDamage: &damage[1]);
} THEN {
EXPECT_MUL_EQ(damage[0], Q_4_12(2.0), damage[1]);
}
}