Fix Weak Armor interrupting multi hit moves (#3497)

This commit is contained in:
DizzyEggg 2023-10-30 20:44:42 +01:00 committed by GitHub
parent 3788d84439
commit 72dad4d7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -9122,6 +9122,7 @@ BattleScript_WeakArmorActivates::
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_WeakArmorActivatesSpeed
pause B_WAIT_TIME_SHORTEST
printfromtable gStatDownStringIds
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED @ Set by statbuffchange when stat can't be decreased
waitmessage B_WAIT_TIME_LONG
goto BattleScript_WeakArmorActivatesSpeed
BattleScript_WeakArmorDefAnim:
@ -9136,6 +9137,7 @@ BattleScript_WeakArmorActivatesSpeed:
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_ROSE_EMPTY, BattleScript_WeakArmorActivatesEnd
pause B_WAIT_TIME_SHORTEST
printstring STRINGID_TARGETSTATWONTGOHIGHER
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED
waitmessage B_WAIT_TIME_LONG
goto BattleScript_WeakArmorActivatesEnd
BattleScript_WeakArmorSpeedAnim:

View File

@ -5231,8 +5231,8 @@ u32 AbilityBattleEffects(u32 caseID, u32 battler, u32 ability, u32 special, u32
&& TARGET_TURN_DAMAGED
&& IsBattlerAlive(battler)
&& IS_MOVE_PHYSICAL(gCurrentMove)
&& (CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN) // Don't activate if speed cannot be raised
|| CompareStat(battler, STAT_DEF, MIN_STAT_STAGE, CMP_GREATER_THAN))) // Don't activate if defense cannot be lowered
&& (CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN) // Don't activate if both Speed and Defense cannot be raised.
|| CompareStat(battler, STAT_DEF, MIN_STAT_STAGE, CMP_GREATER_THAN)))
{
if (gBattleMoves[gCurrentMove].effect == EFFECT_HIT_ESCAPE && CanBattlerSwitch(gBattlerAttacker))
gProtectStructs[battler].disableEjectPack = TRUE; // Set flag for target

View File

@ -133,7 +133,6 @@ SINGLE_BATTLE_TEST("Weak Armor still lowers Defense if Speed can't go any higher
SINGLE_BATTLE_TEST("Weak Armor doesn't interrupt multi hit moves if Defense can't go any lower")
{
u32 j;
KNOWN_FAILING;
GIVEN {
PLAYER(SPECIES_MAGCARGO) { Ability(ABILITY_WEAK_ARMOR); Defense(999); }
OPPONENT(SPECIES_CLOYSTER) { Ability(ABILITY_SKILL_LINK); }
@ -156,20 +155,22 @@ SINGLE_BATTLE_TEST("Weak Armor doesn't interrupt multi hit moves if Defense can'
for (j = 0; j < 2; j++)
{
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
// Ability doesn't activate if neither stat can be changed.
NONE_OF {
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
MESSAGE("Magcargo's Defense won't go lower!");
MESSAGE("Slugma's Speed won't go higher!");
MESSAGE("Magcargo's Speed won't go higher!");
}
}
} THEN {
EXPECT_EQ(player->statStages[STAT_DEF], MIN_STAT_STAGE);
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 2);
EXPECT_EQ(player->statStages[STAT_SPEED], MAX_STAT_STAGE);
}
}
SINGLE_BATTLE_TEST("Weak Armor doesn't interrupt multi hit moves if Speed can't go any higher")
{
u32 j;
KNOWN_FAILING;
GIVEN {
PLAYER(SPECIES_MAGCARGO) { Ability(ABILITY_WEAK_ARMOR); Defense(999); }
OPPONENT(SPECIES_CLOYSTER) { Ability(ABILITY_SKILL_LINK); }
@ -190,7 +191,7 @@ SINGLE_BATTLE_TEST("Weak Armor doesn't interrupt multi hit moves if Speed can't
MESSAGE("Magcargo's Speed won't go higher!");
}
} THEN {
EXPECT_EQ(player->statStages[STAT_DEF], MIN_STAT_STAGE);
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 2);
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE - 5);
EXPECT_EQ(player->statStages[STAT_SPEED], MAX_STAT_STAGE);
}
}