Merge branch 'RHH/master' into RHH/upcoming
This commit is contained in:
commit
e28d0c627a
3 changed files with 131 additions and 2 deletions
|
@ -9104,6 +9104,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:
|
||||
|
@ -9118,6 +9119,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:
|
||||
|
|
|
@ -5146,8 +5146,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
|
||||
|
|
|
@ -29,6 +29,13 @@ SINGLE_BATTLE_TEST("Weak Armor lowers Defense by 1 and boosts Speed by 2 when hi
|
|||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Slugma's Weak Armor raised its Speed!");
|
||||
} else {
|
||||
NONE_OF {
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Slugma's Weak Armor raised its Speed!");
|
||||
}
|
||||
}
|
||||
} THEN {
|
||||
if (move == MOVE_TACKLE) {
|
||||
|
@ -68,3 +75,123 @@ SINGLE_BATTLE_TEST("Weak Armor does not trigger when brought in by Dragon Tail a
|
|||
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Weak Armor still lowers boosts Speed if Defense can't go any lower")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SCREECH); }
|
||||
TURN { MOVE(opponent, MOVE_SCREECH); }
|
||||
TURN { MOVE(opponent, MOVE_SCREECH); }
|
||||
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||
HP_BAR(player);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor lowered its Defense!");
|
||||
}
|
||||
MESSAGE("Slugma's Defense won't go lower!");
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor raised its Speed!");
|
||||
} THEN {
|
||||
EXPECT_EQ(player->statStages[STAT_DEF], MIN_STAT_STAGE);
|
||||
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 2);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Weak Armor still lowers Defense if Speed can't go any higher")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_SLUGMA) { Ability(ABILITY_WEAK_ARMOR); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_AGILITY); }
|
||||
TURN { MOVE(player, MOVE_AGILITY); }
|
||||
TURN { MOVE(player, MOVE_AGILITY); }
|
||||
TURN { MOVE(opponent, MOVE_TACKLE); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||
HP_BAR(player);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor lowered its Defense!");
|
||||
NONE_OF {
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||
MESSAGE("Slugma's Weak Armor raised its Speed!");
|
||||
}
|
||||
MESSAGE("Slugma's Speed won't go higher!");
|
||||
} THEN {
|
||||
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE - 1);
|
||||
EXPECT_EQ(player->statStages[STAT_SPEED], MAX_STAT_STAGE);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Weak Armor doesn't interrupt multi hit moves if Defense can't go any lower")
|
||||
{
|
||||
u32 j;
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_MAGCARGO) { Ability(ABILITY_WEAK_ARMOR); Defense(999); }
|
||||
OPPONENT(SPECIES_CLOYSTER) { Ability(ABILITY_SKILL_LINK); }
|
||||
} WHEN {
|
||||
TURN { MOVE(opponent, MOVE_SCREECH); }
|
||||
TURN { MOVE(opponent, MOVE_SCREECH); }
|
||||
TURN { MOVE(opponent, MOVE_FURY_SWIPES); }
|
||||
} SCENE {
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
MESSAGE("Magcargo's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Magcargo's Weak Armor raised its Speed!");
|
||||
}
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
MESSAGE("Magcargo's Defense won't go lower!");
|
||||
MESSAGE("Magcargo's Weak Armor raised its Speed!");
|
||||
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("Magcargo's Speed won't go higher!");
|
||||
}
|
||||
}
|
||||
} THEN {
|
||||
EXPECT_EQ(player->statStages[STAT_DEF], MIN_STAT_STAGE);
|
||||
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;
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_MAGCARGO) { Ability(ABILITY_WEAK_ARMOR); Defense(999); }
|
||||
OPPONENT(SPECIES_CLOYSTER) { Ability(ABILITY_SKILL_LINK); }
|
||||
} WHEN {
|
||||
TURN { MOVE(player, MOVE_AGILITY); }
|
||||
TURN { MOVE(player, MOVE_AGILITY); }
|
||||
TURN { MOVE(opponent, MOVE_FURY_SWIPES); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
MESSAGE("Magcargo's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Magcargo's Weak Armor raised its Speed!");
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FURY_SWIPES, opponent);
|
||||
ABILITY_POPUP(player, ABILITY_WEAK_ARMOR);
|
||||
MESSAGE("Magcargo's Weak Armor lowered its Defense!");
|
||||
MESSAGE("Magcargo's Speed won't go higher!");
|
||||
}
|
||||
} THEN {
|
||||
EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE - 5);
|
||||
EXPECT_EQ(player->statStages[STAT_SPEED], MAX_STAT_STAGE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue