Missing Strength sap tests (#3860)
* add missing strength sap tests * a --------- Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
parent
bc4d4d21e4
commit
604b823ffd
3 changed files with 153 additions and 1 deletions
|
@ -1613,15 +1613,28 @@ BattleScript_StrengthSapTryHp:
|
||||||
attackanimation
|
attackanimation
|
||||||
waitanimation
|
waitanimation
|
||||||
BattleScript_StrengthSapHp:
|
BattleScript_StrengthSapHp:
|
||||||
|
jumpifability BS_TARGET, ABILITY_LIQUID_OOZE, BattleScript_StrengthSapManipulateDmg
|
||||||
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveEnd
|
jumpifstatus3 BS_ATTACKER, STATUS3_HEAL_BLOCK, BattleScript_MoveEnd
|
||||||
jumpiffullhp BS_ATTACKER, BattleScript_MoveEnd
|
jumpiffullhp BS_ATTACKER, BattleScript_MoveEnd
|
||||||
|
BattleScript_StrengthSapManipulateDmg:
|
||||||
manipulatedamage DMG_BIG_ROOT
|
manipulatedamage DMG_BIG_ROOT
|
||||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
||||||
|
jumpifability BS_TARGET, ABILITY_LIQUID_OOZE, BattleScript_StrengthSapLiquidOoze
|
||||||
healthbarupdate BS_ATTACKER
|
healthbarupdate BS_ATTACKER
|
||||||
datahpupdate BS_ATTACKER
|
datahpupdate BS_ATTACKER
|
||||||
printstring STRINGID_PKMNENERGYDRAINED
|
printstring STRINGID_PKMNENERGYDRAINED
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
goto BattleScript_MoveEnd
|
goto BattleScript_MoveEnd
|
||||||
|
BattleScript_StrengthSapLiquidOoze:
|
||||||
|
call BattleScript_AbilityPopUpTarget
|
||||||
|
manipulatedamage DMG_CHANGE_SIGN
|
||||||
|
setbyte cMULTISTRING_CHOOSER, B_MSG_ABSORB_OOZE
|
||||||
|
healthbarupdate BS_ATTACKER
|
||||||
|
datahpupdate BS_ATTACKER
|
||||||
|
printfromtable gAbsorbDrainStringIds
|
||||||
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
tryfaintmon BS_ATTACKER
|
||||||
|
goto BattleScript_MoveEnd
|
||||||
BattleScript_StrengthSapMustLower:
|
BattleScript_StrengthSapMustLower:
|
||||||
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_MoveEnd
|
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_MoveEnd
|
||||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_MoveEnd
|
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_FELL_EMPTY, BattleScript_MoveEnd
|
||||||
|
|
|
@ -304,7 +304,7 @@ static const u8 sText_PkmnsXPreventsYLoss[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}
|
||||||
static const u8 sText_PkmnsXInfatuatedY[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\ninfatuated {B_ATK_NAME_WITH_PREFIX}!");
|
static const u8 sText_PkmnsXInfatuatedY[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\ninfatuated {B_ATK_NAME_WITH_PREFIX}!");
|
||||||
static const u8 sText_PkmnsXMadeYIneffective[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nmade {B_CURRENT_MOVE} ineffective!");
|
static const u8 sText_PkmnsXMadeYIneffective[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\nmade {B_CURRENT_MOVE} ineffective!");
|
||||||
static const u8 sText_PkmnsXCuredYProblem[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\ncured its {B_BUFF1} problem!");
|
static const u8 sText_PkmnsXCuredYProblem[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}'s {B_SCR_ACTIVE_ABILITY}\ncured its {B_BUFF1} problem!");
|
||||||
static const u8 sText_ItSuckedLiquidOoze[] = _("It sucked up the\nLIQUID OOZE!");
|
static const u8 sText_ItSuckedLiquidOoze[] = _("It sucked up the\nliquid ooze!");
|
||||||
static const u8 sText_PkmnTransformed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} transformed!");
|
static const u8 sText_PkmnTransformed[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} transformed!");
|
||||||
static const u8 sText_PkmnsXTookAttack[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\ntook the attack!");
|
static const u8 sText_PkmnsXTookAttack[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_DEF_ABILITY}\ntook the attack!");
|
||||||
const u8 gText_PkmnsXPreventsSwitching[] = _("{B_BUFF1}'s {B_LAST_ABILITY}\nprevents switching!\p");
|
const u8 gText_PkmnsXPreventsSwitching[] = _("{B_BUFF1}'s {B_LAST_ABILITY}\nprevents switching!\p");
|
||||||
|
|
|
@ -57,3 +57,142 @@ SINGLE_BATTLE_TEST("Strength Sap works exactly the same when attacker is behind
|
||||||
EXPECT_EQ(results[i].hp * -1, atkStat);
|
EXPECT_EQ(results[i].hp * -1, atkStat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This test checks all stat stages from -6 to +6.
|
||||||
|
SINGLE_BATTLE_TEST("Strength Sap lowers Attack by 1 and restores HP based on target's Attack Stat and stat Change", s16 hp)
|
||||||
|
{
|
||||||
|
s32 j = 0, statStage = 0;
|
||||||
|
|
||||||
|
for (j = 0; j <= MAX_STAT_STAGE; j++) {
|
||||||
|
if (j == DEFAULT_STAT_STAGE - 1) { continue; } // Ignore -6, because Strength Sap won't work otherwise
|
||||||
|
PARAMETRIZE{ statStage = j; }
|
||||||
|
}
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gBattleMoves[MOVE_WORK_UP].effect == EFFECT_ATTACK_SPATK_UP);
|
||||||
|
ASSUME(gBattleMoves[MOVE_GROWL].effect == EFFECT_ATTACK_DOWN);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { HP(50); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(60); }
|
||||||
|
} WHEN {
|
||||||
|
if (statStage > DEFAULT_STAT_STAGE) { // +
|
||||||
|
for (j = statStage; j > DEFAULT_STAT_STAGE; j--) {
|
||||||
|
TURN { MOVE(opponent, MOVE_HOWL); }
|
||||||
|
}
|
||||||
|
} else if (statStage < DEFAULT_STAT_STAGE) { // -
|
||||||
|
for (j = statStage; j < DEFAULT_STAT_STAGE - 1; j++) { // - 1 because Strength Sap always lowers Attack
|
||||||
|
TURN { MOVE(player, MOVE_GROWL); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
||||||
|
} SCENE {
|
||||||
|
if (statStage > DEFAULT_STAT_STAGE) { // +
|
||||||
|
for (j = statStage; j > DEFAULT_STAT_STAGE; j--) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_HOWL, opponent);
|
||||||
|
}
|
||||||
|
} else if (statStage < DEFAULT_STAT_STAGE) { // -
|
||||||
|
for (j = statStage; j < DEFAULT_STAT_STAGE - 1; j++) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_GROWL, player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MESSAGE("Wobbuffet used Strength Sap!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||||
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
||||||
|
HP_BAR(player, captureDamage: &results[i].hp);
|
||||||
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
||||||
|
} THEN {
|
||||||
|
if (statStage < DEFAULT_STAT_STAGE) {
|
||||||
|
EXPECT_EQ(results[i].hp * -1, (60 * gStatStageRatios[statStage + 1][0] / gStatStageRatios[statStage + 1][1]));
|
||||||
|
} else {
|
||||||
|
EXPECT_EQ(results[i].hp * -1, (60 * gStatStageRatios[statStage][0] / gStatStageRatios[statStage][1]));
|
||||||
|
}
|
||||||
|
} FINALLY {
|
||||||
|
// This makes sure gStatStageRatios works correctly and the lower the attack stage the lower hp obtained.
|
||||||
|
for (j = 0; j < MAX_STAT_STAGE - 1; j++) {
|
||||||
|
EXPECT_GT(abs(results[j + 1].hp), abs(results[j].hp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Strength Sap fails if target is at -6 Atk")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gBattleMoves[MOVE_CHARM].effect == EFFECT_ATTACK_DOWN_2);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_CHARM); }
|
||||||
|
TURN { MOVE(player, MOVE_CHARM); }
|
||||||
|
TURN { MOVE(player, MOVE_CHARM); }
|
||||||
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_CHARM, player);
|
||||||
|
MESSAGE("Wobbuffet used Strength Sap!");
|
||||||
|
NONE_OF {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||||
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
||||||
|
HP_BAR(player);
|
||||||
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
||||||
|
}
|
||||||
|
MESSAGE("Foe Wobbuffet's Attack won't go lower!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Strength Sap restores more HP if Big Root is held", s16 hp)
|
||||||
|
{
|
||||||
|
u32 item;
|
||||||
|
|
||||||
|
PARAMETRIZE { item = ITEM_NONE; }
|
||||||
|
PARAMETRIZE { item = ITEM_BIG_ROOT; }
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(gItems[ITEM_BIG_ROOT].holdEffect == HOLD_EFFECT_BIG_ROOT);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) { HP(200); Item(item); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(100); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); }
|
||||||
|
} SCENE {
|
||||||
|
MESSAGE("Wobbuffet used Strength Sap!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||||
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
||||||
|
HP_BAR(player, captureDamage: &results[i].hp);
|
||||||
|
MESSAGE("Foe Wobbuffet had its energy drained!");
|
||||||
|
} FINALLY {
|
||||||
|
EXPECT_GT(abs(results[1].hp), abs(results[0].hp));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Strength Sap makes attacker lose HP if target's ability is Liquid Ooze")
|
||||||
|
{
|
||||||
|
s16 lostHp;
|
||||||
|
s32 atkStat;
|
||||||
|
|
||||||
|
PARAMETRIZE { atkStat = 100; }
|
||||||
|
PARAMETRIZE { atkStat = 490; } // Checks that attacker can faint with no problems.
|
||||||
|
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) { Attack(atkStat); Ability(ABILITY_LIQUID_OOZE); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_STRENGTH_SAP); if (atkStat == 490) { SEND_OUT(player, 1); } }
|
||||||
|
} SCENE {
|
||||||
|
MESSAGE("Wobbuffet used Strength Sap!");
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STRENGTH_SAP, player);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent);
|
||||||
|
MESSAGE("Foe Wobbuffet's Attack fell!");
|
||||||
|
ABILITY_POPUP(opponent, ABILITY_LIQUID_OOZE);
|
||||||
|
HP_BAR(player, captureDamage: &lostHp);
|
||||||
|
MESSAGE("It sucked up the liquid ooze!");
|
||||||
|
if (atkStat >= 490) {
|
||||||
|
MESSAGE("Wobbuffet fainted!");
|
||||||
|
MESSAGE("Go! Wobbuffet!");
|
||||||
|
}
|
||||||
|
} THEN {
|
||||||
|
EXPECT_EQ(lostHp, atkStat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue