mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Swallow/Spit Up Gen 5 Behavior and tests for Swallow/Spit Up/Stockpile (#2790)
This commit is contained in:
commit
dec1b16138
@ -1318,6 +1318,12 @@
|
|||||||
.4byte \jumpInstr
|
.4byte \jumpInstr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
.macro dostockpilestatchangeswearoff, battler:req, statChangeInstr:req
|
||||||
|
callnative BS_DoStockpileStatChangesWearOff
|
||||||
|
.byte \battler
|
||||||
|
.4byte \statChangeInstr
|
||||||
|
.endm
|
||||||
|
|
||||||
.macro jumpifmorethanhalfHP battler:req, jumpInstr:req
|
.macro jumpifmorethanhalfHP battler:req, jumpInstr:req
|
||||||
callnative BS_JumpIfMoreThanHalfHP
|
callnative BS_JumpIfMoreThanHalfHP
|
||||||
.byte \battler
|
.byte \battler
|
||||||
|
@ -5545,6 +5545,9 @@ BattleScript_EffectStockpile::
|
|||||||
waitanimation
|
waitanimation
|
||||||
printfromtable gStockpileUsedStringIds
|
printfromtable gStockpileUsedStringIds
|
||||||
waitmessage B_WAIT_TIME_LONG
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
.if B_STOCKPILE_RAISES_DEFS < GEN_4
|
||||||
|
goto BattleScript_EffectStockpileEnd
|
||||||
|
.endif
|
||||||
jumpifmovehadnoeffect BattleScript_EffectStockpileEnd
|
jumpifmovehadnoeffect BattleScript_EffectStockpileEnd
|
||||||
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_EffectStockpileDef
|
jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_DEF, MAX_STAT_STAGE, BattleScript_EffectStockpileDef
|
||||||
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_EffectStockpileEnd
|
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_EffectStockpileEnd
|
||||||
@ -5566,6 +5569,23 @@ BattleScript_EffectStockpileEnd:
|
|||||||
stockpile 1
|
stockpile 1
|
||||||
goto BattleScript_MoveEnd
|
goto BattleScript_MoveEnd
|
||||||
|
|
||||||
|
BattleScript_MoveEffectStockpileWoreOff::
|
||||||
|
.if B_STOCKPILE_RAISES_DEFS >= GEN_4
|
||||||
|
dostockpilestatchangeswearoff BS_ATTACKER, BattleScript_StockpileStatChangeDown
|
||||||
|
printstring STRINGID_STOCKPILEDEFFECTWOREOFF
|
||||||
|
waitmessage B_WAIT_TIME_SHORT
|
||||||
|
.endif
|
||||||
|
return
|
||||||
|
|
||||||
|
BattleScript_StockpileStatChangeDown:
|
||||||
|
statbuffchange MOVE_EFFECT_AFFECTS_USER, BattleScript_StockpileStatChangeDown_Ret
|
||||||
|
setgraphicalstatchangevalues
|
||||||
|
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
|
||||||
|
printfromtable gStatDownStringIds
|
||||||
|
waitmessage B_WAIT_TIME_LONG
|
||||||
|
BattleScript_StockpileStatChangeDown_Ret:
|
||||||
|
return
|
||||||
|
|
||||||
BattleScript_EffectSpitUp::
|
BattleScript_EffectSpitUp::
|
||||||
attackcanceler
|
attackcanceler
|
||||||
jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_SpitUpFailProtect
|
jumpifbyte CMP_EQUAL, cMISS_TYPE, B_MSG_PROTECTED, BattleScript_SpitUpFailProtect
|
||||||
|
@ -456,6 +456,7 @@ extern const u8 BattleScript_HealingWishActivates[];
|
|||||||
extern const u8 BattleScript_LunarDanceActivates[];
|
extern const u8 BattleScript_LunarDanceActivates[];
|
||||||
extern const u8 BattleScript_ShellTrapSetUp[];
|
extern const u8 BattleScript_ShellTrapSetUp[];
|
||||||
extern const u8 BattleScript_CouldntFullyProtect[];
|
extern const u8 BattleScript_CouldntFullyProtect[];
|
||||||
|
extern const u8 BattleScript_MoveEffectStockpileWoreOff[];
|
||||||
|
|
||||||
// zmoves
|
// zmoves
|
||||||
extern const u8 BattleScript_ZMoveActivateDamaging[];
|
extern const u8 BattleScript_ZMoveActivateDamaging[];
|
||||||
|
@ -96,7 +96,8 @@
|
|||||||
#define B_DARK_VOID_FAIL GEN_LATEST // In Gen7+, only Darkrai can use Dark Void.
|
#define B_DARK_VOID_FAIL GEN_LATEST // In Gen7+, only Darkrai can use Dark Void.
|
||||||
#define B_BURN_HIT_THAW GEN_LATEST // In Gen6+, damaging moves with a chance of burn will thaw the target, regardless if they're fire-type moves or not.
|
#define B_BURN_HIT_THAW GEN_LATEST // In Gen6+, damaging moves with a chance of burn will thaw the target, regardless if they're fire-type moves or not.
|
||||||
#define B_HEALING_WISH_SWITCH GEN_LATEST // In Gen5+, the mon receiving Healing Wish is sent out at the end of the turn.
|
#define B_HEALING_WISH_SWITCH GEN_LATEST // In Gen5+, the mon receiving Healing Wish is sent out at the end of the turn.
|
||||||
// Additionally, in gen8+ the Healing Wish's effect will be stored until the user switches into a statused or hurt mon.
|
// Additionally, in gen8+ the Healing Wish's effect will be stored until the user switches into a statused or hurt mon
|
||||||
|
#define B_STOCKPILE_RAISES_DEFS GEN_LATEST // In Gen4+, Stockpile also raises Defense and Sp.Defense stats. Once Spit Up / Swallow is used, these stat changes are lost.
|
||||||
|
|
||||||
// Ability settings
|
// Ability settings
|
||||||
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.
|
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.
|
||||||
|
@ -372,8 +372,9 @@
|
|||||||
#define MOVE_EFFECT_TRAP_BOTH 70
|
#define MOVE_EFFECT_TRAP_BOTH 70
|
||||||
#define MOVE_EFFECT_DOUBLE_SHOCK 71
|
#define MOVE_EFFECT_DOUBLE_SHOCK 71
|
||||||
#define MOVE_EFFECT_ROUND 72
|
#define MOVE_EFFECT_ROUND 72
|
||||||
|
#define MOVE_EFFECT_STOCKPILE_WORE_OFF 74
|
||||||
|
|
||||||
#define NUM_MOVE_EFFECTS 73
|
#define NUM_MOVE_EFFECTS 75
|
||||||
|
|
||||||
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
#define MOVE_EFFECT_AFFECTS_USER 0x4000
|
||||||
#define MOVE_EFFECT_CERTAIN 0x8000
|
#define MOVE_EFFECT_CERTAIN 0x8000
|
||||||
|
@ -642,8 +642,9 @@
|
|||||||
#define STRINGID_PREPARESHELLTRAP 640
|
#define STRINGID_PREPARESHELLTRAP 640
|
||||||
#define STRINGID_SHELLTRAPDIDNTWORK 641
|
#define STRINGID_SHELLTRAPDIDNTWORK 641
|
||||||
#define STRINGID_COULDNTFULLYPROTECT 642
|
#define STRINGID_COULDNTFULLYPROTECT 642
|
||||||
|
#define STRINGID_STOCKPILEDEFFECTWOREOFF 643
|
||||||
|
|
||||||
#define BATTLESTRINGS_COUNT 643
|
#define BATTLESTRINGS_COUNT 644
|
||||||
|
|
||||||
// This is the string id that gBattleStringsTable starts with.
|
// This is the string id that gBattleStringsTable starts with.
|
||||||
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
|
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,
|
||||||
|
@ -177,8 +177,8 @@ static const u8 sText_PkmnCausedUproar[] = _("{B_ATK_NAME_WITH_PREFIX} caused\na
|
|||||||
static const u8 sText_PkmnMakingUproar[] = _("{B_ATK_NAME_WITH_PREFIX} is making\nan UPROAR!");
|
static const u8 sText_PkmnMakingUproar[] = _("{B_ATK_NAME_WITH_PREFIX} is making\nan UPROAR!");
|
||||||
static const u8 sText_PkmnCalmedDown[] = _("{B_ATK_NAME_WITH_PREFIX} calmed down.");
|
static const u8 sText_PkmnCalmedDown[] = _("{B_ATK_NAME_WITH_PREFIX} calmed down.");
|
||||||
static const u8 sText_PkmnCantSleepInUproar[] = _("But {B_DEF_NAME_WITH_PREFIX} can't\nsleep in an UPROAR!");
|
static const u8 sText_PkmnCantSleepInUproar[] = _("But {B_DEF_NAME_WITH_PREFIX} can't\nsleep in an UPROAR!");
|
||||||
static const u8 sText_PkmnStockpiled[] = _("{B_ATK_NAME_WITH_PREFIX} STOCKPILED\n{B_BUFF1}!");
|
static const u8 sText_PkmnStockpiled[] = _("{B_ATK_NAME_WITH_PREFIX} stockpiled\n{B_BUFF1}!");
|
||||||
static const u8 sText_PkmnCantStockpile[] = _("{B_ATK_NAME_WITH_PREFIX} can't\nSTOCKPILE any more!");
|
static const u8 sText_PkmnCantStockpile[] = _("{B_ATK_NAME_WITH_PREFIX} can't\nstockpile any more!");
|
||||||
static const u8 sText_PkmnCantSleepInUproar2[] = _("But {B_DEF_NAME_WITH_PREFIX} can't\nsleep in an UPROAR!");
|
static const u8 sText_PkmnCantSleepInUproar2[] = _("But {B_DEF_NAME_WITH_PREFIX} can't\nsleep in an UPROAR!");
|
||||||
static const u8 sText_UproarKeptPkmnAwake[] = _("But the UPROAR kept\n{B_DEF_NAME_WITH_PREFIX} awake!");
|
static const u8 sText_UproarKeptPkmnAwake[] = _("But the UPROAR kept\n{B_DEF_NAME_WITH_PREFIX} awake!");
|
||||||
static const u8 sText_PkmnStayedAwakeUsing[] = _("{B_DEF_NAME_WITH_PREFIX} stayed awake\nusing its {B_DEF_ABILITY}!");
|
static const u8 sText_PkmnStayedAwakeUsing[] = _("{B_DEF_NAME_WITH_PREFIX} stayed awake\nusing its {B_DEF_ABILITY}!");
|
||||||
@ -360,8 +360,8 @@ static const u8 sText_SunlightFaded[] = _("The sunlight faded.");
|
|||||||
static const u8 sText_StartedHail[] = _("It started to hail!");
|
static const u8 sText_StartedHail[] = _("It started to hail!");
|
||||||
static const u8 sText_HailContinues[] = _("Hail continues to fall.");
|
static const u8 sText_HailContinues[] = _("Hail continues to fall.");
|
||||||
static const u8 sText_HailStopped[] = _("The hail stopped.");
|
static const u8 sText_HailStopped[] = _("The hail stopped.");
|
||||||
static const u8 sText_FailedToSpitUp[] = _("But it failed to SPIT UP\na thing!");
|
static const u8 sText_FailedToSpitUp[] = _("But it failed to spit up\na thing!");
|
||||||
static const u8 sText_FailedToSwallow[] = _("But it failed to SWALLOW\na thing!");
|
static const u8 sText_FailedToSwallow[] = _("But it failed to swallow\na thing!");
|
||||||
static const u8 sText_WindBecameHeatWave[] = _("The wind turned into a\nHEAT WAVE!");
|
static const u8 sText_WindBecameHeatWave[] = _("The wind turned into a\nHEAT WAVE!");
|
||||||
static const u8 sText_StatChangesGone[] = _("All stat changes were\neliminated!");
|
static const u8 sText_StatChangesGone[] = _("All stat changes were\neliminated!");
|
||||||
static const u8 sText_CoinsScattered[] = _("Coins scattered everywhere!");
|
static const u8 sText_CoinsScattered[] = _("Coins scattered everywhere!");
|
||||||
@ -777,9 +777,11 @@ static const u8 sText_AttackerGainedStrengthFromTheFallen[] = _("{B_ATK_NAME_WIT
|
|||||||
static const u8 sText_PrepareShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set a shell trap!");
|
static const u8 sText_PrepareShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set a shell trap!");
|
||||||
static const u8 sText_ShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell trap didn't work!");
|
static const u8 sText_ShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell trap didn't work!");
|
||||||
static const u8 sText_CouldntFullyProtect[] = _("{B_DEF_NAME_WITH_PREFIX} couldn't fully protect\nitself and got hurt!");
|
static const u8 sText_CouldntFullyProtect[] = _("{B_DEF_NAME_WITH_PREFIX} couldn't fully protect\nitself and got hurt!");
|
||||||
|
static const u8 sText_StockpiledEffectWoreOff[] = _("{B_ATK_NAME_WITH_PREFIX}'s stockpiled\neffect wore off!");
|
||||||
|
|
||||||
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||||
{
|
{
|
||||||
|
[STRINGID_STOCKPILEDEFFECTWOREOFF - BATTLESTRINGS_TABLE_START] = sText_StockpiledEffectWoreOff,
|
||||||
[STRINGID_COULDNTFULLYPROTECT - BATTLESTRINGS_TABLE_START] = sText_CouldntFullyProtect,
|
[STRINGID_COULDNTFULLYPROTECT - BATTLESTRINGS_TABLE_START] = sText_CouldntFullyProtect,
|
||||||
[STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN - BATTLESTRINGS_TABLE_START] = sText_AttackerGainedStrengthFromTheFallen,
|
[STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN - BATTLESTRINGS_TABLE_START] = sText_AttackerGainedStrengthFromTheFallen,
|
||||||
[STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT - BATTLESTRINGS_TABLE_START] = sText_AbilityWeakenedSurroundingMonsStat,
|
[STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT - BATTLESTRINGS_TABLE_START] = sText_AbilityWeakenedSurroundingMonsStat,
|
||||||
|
@ -2890,6 +2890,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
|||||||
case MOVE_EFFECT_KNOCK_OFF:
|
case MOVE_EFFECT_KNOCK_OFF:
|
||||||
case MOVE_EFFECT_SMACK_DOWN:
|
case MOVE_EFFECT_SMACK_DOWN:
|
||||||
case MOVE_EFFECT_REMOVE_STATUS:
|
case MOVE_EFFECT_REMOVE_STATUS:
|
||||||
|
case MOVE_EFFECT_STOCKPILE_WORE_OFF:
|
||||||
gBattleStruct->moveEffect2 = gBattleScripting.moveEffect;
|
gBattleStruct->moveEffect2 = gBattleScripting.moveEffect;
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
return;
|
return;
|
||||||
@ -5609,6 +5610,15 @@ static void Cmd_moveend(void)
|
|||||||
case MOVE_EFFECT_KNOCK_OFF:
|
case MOVE_EFFECT_KNOCK_OFF:
|
||||||
effect = TryKnockOffBattleScript(gBattlerTarget);
|
effect = TryKnockOffBattleScript(gBattlerTarget);
|
||||||
break;
|
break;
|
||||||
|
case MOVE_EFFECT_STOCKPILE_WORE_OFF:
|
||||||
|
if (gDisableStructs[gBattlerAttacker].stockpileCounter != 0)
|
||||||
|
{
|
||||||
|
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
||||||
|
effect = TRUE;
|
||||||
|
BattleScriptPush(gBattlescriptCurrInstr);
|
||||||
|
gBattlescriptCurrInstr = BattleScript_MoveEffectStockpileWoreOff;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case MOVE_EFFECT_SMACK_DOWN:
|
case MOVE_EFFECT_SMACK_DOWN:
|
||||||
if (!IsBattlerGrounded(gBattlerTarget) && IsBattlerAlive(gBattlerTarget))
|
if (!IsBattlerGrounded(gBattlerTarget) && IsBattlerAlive(gBattlerTarget))
|
||||||
{
|
{
|
||||||
@ -11651,10 +11661,7 @@ static void Cmd_stockpiletobasedamage(void)
|
|||||||
|
|
||||||
if (!(gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && gBattleMons[gBattlerTarget].hp != 0))
|
if (!(gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && gBattleMons[gBattlerTarget].hp != 0))
|
||||||
{
|
{
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
gBattleStruct->moveEffect2 = MOVE_EFFECT_STOCKPILE_WORE_OFF;
|
||||||
// Restore stat changes from stockpile.
|
|
||||||
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
|
|
||||||
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
|
|
||||||
}
|
}
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
}
|
}
|
||||||
@ -11689,14 +11696,10 @@ static void Cmd_stockpiletohpheal(void)
|
|||||||
gBattleMoveDamage *= -1;
|
gBattleMoveDamage *= -1;
|
||||||
|
|
||||||
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
|
||||||
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
|
gBattleStruct->moveEffect2 = MOVE_EFFECT_STOCKPILE_WORE_OFF;
|
||||||
gBattlescriptCurrInstr = cmd->nextInstr;
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
gBattlerTarget = gBattlerAttacker;
|
gBattlerTarget = gBattlerAttacker;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore stat changes from stockpile.
|
|
||||||
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
|
|
||||||
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16136,6 +16139,31 @@ void BS_JumpIfHoldEffect(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BS_DoStockpileStatChangesWearOff(void)
|
||||||
|
{
|
||||||
|
NATIVE_ARGS(u8 battler, const u8 *statChangeInstr);
|
||||||
|
|
||||||
|
u32 battler = GetBattlerForBattleScript(cmd->battler);
|
||||||
|
if (gDisableStructs[battler].stockpileDef != 0)
|
||||||
|
{
|
||||||
|
SET_STATCHANGER(STAT_DEF, abs(gDisableStructs[battler].stockpileDef), TRUE);
|
||||||
|
gDisableStructs[battler].stockpileDef = 0;
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = cmd->statChangeInstr;
|
||||||
|
}
|
||||||
|
else if (gDisableStructs[battler].stockpileSpDef)
|
||||||
|
{
|
||||||
|
SET_STATCHANGER(STAT_SPDEF, abs(gDisableStructs[battler].stockpileSpDef), TRUE);
|
||||||
|
gDisableStructs[battler].stockpileSpDef = 0;
|
||||||
|
BattleScriptPushCursor();
|
||||||
|
gBattlescriptCurrInstr = cmd->statChangeInstr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gBattlescriptCurrInstr = cmd->nextInstr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool32 CriticalCapture(u32 odds)
|
static bool32 CriticalCapture(u32 odds)
|
||||||
{
|
{
|
||||||
#if B_CRITICAL_CAPTURE == TRUE
|
#if B_CRITICAL_CAPTURE == TRUE
|
||||||
|
254
test/move_effect_stockpile.c
Normal file
254
test/move_effect_stockpile.c
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "test_battle.h"
|
||||||
|
|
||||||
|
// These tests cover all 3 effects: Stockpile, Spit up and Swallow.
|
||||||
|
ASSUMPTIONS
|
||||||
|
{
|
||||||
|
ASSUME(gBattleMoves[MOVE_STOCKPILE].effect == EFFECT_STOCKPILE);
|
||||||
|
ASSUME(gBattleMoves[MOVE_SWALLOW].effect == EFFECT_SWALLOW);
|
||||||
|
ASSUME(gBattleMoves[MOVE_SPIT_UP].effect == EFFECT_SPIT_UP);
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Stockpile's count can go up only to 3")
|
||||||
|
{
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 1!");
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 2!");
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 3!");
|
||||||
|
|
||||||
|
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet can't stockpile any more!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAX_HP_TEST 400
|
||||||
|
SINGLE_BATTLE_TEST("Spit Up and Swallow don't work if used without Stockpile")
|
||||||
|
{
|
||||||
|
u32 move;
|
||||||
|
PARAMETRIZE {move = MOVE_SWALLOW ;}
|
||||||
|
PARAMETRIZE {move = MOVE_SPIT_UP ;}
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) {HP(10), MaxHP(MAX_HP_TEST) ;}
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, move); }
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
TURN { MOVE(player, move); }
|
||||||
|
} SCENE {
|
||||||
|
NOT ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||||
|
if (move == MOVE_SWALLOW)
|
||||||
|
MESSAGE("But it failed to swallow a thing!");
|
||||||
|
else
|
||||||
|
MESSAGE("But it failed to spit up a thing!");
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 1!");
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||||
|
if (move == MOVE_SPIT_UP) {
|
||||||
|
HP_BAR(opponent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
HP_BAR(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Spit Up's power raises depending on Stockpile's count", s16 damage)
|
||||||
|
{
|
||||||
|
u8 count;
|
||||||
|
PARAMETRIZE { count = 1;}
|
||||||
|
PARAMETRIZE { count = 2;}
|
||||||
|
PARAMETRIZE { count = 3;}
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET);
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
if (count != 1){
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
if (count == 3) {
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TURN { MOVE(player, MOVE_SPIT_UP); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 1!");
|
||||||
|
if (count != 1) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 2!");
|
||||||
|
if (count == 3) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 3!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SPIT_UP, player);
|
||||||
|
HP_BAR(opponent, captureDamage: &results[i].damage);
|
||||||
|
} FINALLY {
|
||||||
|
EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage);
|
||||||
|
EXPECT_MUL_EQ(results[0].damage, Q_4_12(3.0), results[2].damage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Swallow heals HP depending on Stockpile's count", s16 hpHeal)
|
||||||
|
{
|
||||||
|
u8 count;
|
||||||
|
PARAMETRIZE { count = 1;}
|
||||||
|
PARAMETRIZE { count = 2;}
|
||||||
|
PARAMETRIZE { count = 3;}
|
||||||
|
GIVEN {
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) {HP(1), MaxHP(MAX_HP_TEST); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET);
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
if (count != 1){
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
if (count == 3) {
|
||||||
|
TURN { MOVE(player, MOVE_STOCKPILE); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TURN { MOVE(player, MOVE_SWALLOW); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 1!");
|
||||||
|
if (count != 1) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 2!");
|
||||||
|
if (count == 3) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, player);
|
||||||
|
MESSAGE("Wobbuffet stockpiled 3!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SWALLOW, player);
|
||||||
|
HP_BAR(player, captureDamage: &results[i].hpHeal);
|
||||||
|
} FINALLY {
|
||||||
|
EXPECT_EQ(results[0].hpHeal, -(MAX_HP_TEST / 4));
|
||||||
|
EXPECT_EQ(results[1].hpHeal, -(MAX_HP_TEST / 2));
|
||||||
|
EXPECT_EQ(results[2].hpHeal, -(MAX_HP_TEST - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SINGLE_BATTLE_TEST("Stockpile temporarily raises Def and Sp.Def", s16 dmgPyhsical, s16 dmgSpecial)
|
||||||
|
{
|
||||||
|
u16 move;
|
||||||
|
PARAMETRIZE {move = MOVE_STOCKPILE;}
|
||||||
|
PARAMETRIZE {move = MOVE_CELEBRATE;}
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(B_STOCKPILE_RAISES_DEFS >= GEN_4);
|
||||||
|
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
|
||||||
|
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) {Speed(2); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(player, move); MOVE(opponent, MOVE_TACKLE); }
|
||||||
|
TURN { MOVE(opponent, MOVE_GUST); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, move, player);
|
||||||
|
if (move == MOVE_STOCKPILE) {
|
||||||
|
MESSAGE("Wobbuffet stockpiled 1!");
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
|
||||||
|
MESSAGE("Wobbuffet's defense rose!");
|
||||||
|
MESSAGE("Wobbuffet's sp. defense rose!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent);
|
||||||
|
HP_BAR(player, captureDamage: &results[i].dmgPyhsical);
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_GUST, opponent);
|
||||||
|
HP_BAR(player, captureDamage: &results[i].dmgSpecial);
|
||||||
|
} FINALLY {
|
||||||
|
EXPECT_MUL_EQ(results[0].dmgPyhsical, Q_4_12(1.5), results[1].dmgPyhsical);
|
||||||
|
EXPECT_MUL_EQ(results[0].dmgSpecial, Q_4_12(1.5), results[1].dmgSpecial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DOUBLE_BATTLE_TEST("Stockpile's Def and Sp.Def boost is lost after using Spit Up or Swallow", s16 dmgPyhsicalBefore, s16 dmgPhysicalAfter, s16 dmgSpecialBefore, s16 dmgSpecialAfter)
|
||||||
|
{
|
||||||
|
u8 count;
|
||||||
|
u16 move;
|
||||||
|
PARAMETRIZE {count = 1, move = MOVE_SPIT_UP;}
|
||||||
|
PARAMETRIZE {count = 2, move = MOVE_SWALLOW;}
|
||||||
|
PARAMETRIZE {count = 3, move = MOVE_SPIT_UP;}
|
||||||
|
GIVEN {
|
||||||
|
ASSUME(B_STOCKPILE_RAISES_DEFS >= GEN_4);
|
||||||
|
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
|
||||||
|
ASSUME(gBattleMoves[MOVE_GUST].split == SPLIT_SPECIAL);
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) {Speed(4); HP(MAX_HP_TEST - 1); MaxHP(MAX_HP_TEST); }
|
||||||
|
PLAYER(SPECIES_WOBBUFFET) {Speed(3); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) {Speed(2); }
|
||||||
|
OPPONENT(SPECIES_WOBBUFFET) {Speed(1); }
|
||||||
|
} WHEN {
|
||||||
|
TURN { MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft, criticalHit:FALSE); MOVE(opponentRight, MOVE_GUST, criticalHit:FALSE, target:playerLeft);}
|
||||||
|
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
|
||||||
|
if (count != 1) {
|
||||||
|
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
|
||||||
|
if (count == 3) {
|
||||||
|
TURN { MOVE(playerLeft, MOVE_STOCKPILE);}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TURN { MOVE(playerLeft, move, target:opponentLeft); MOVE(opponentLeft, MOVE_TACKLE, target:playerLeft, criticalHit:FALSE); MOVE(opponentRight, MOVE_GUST, target:playerLeft, criticalHit:FALSE); }
|
||||||
|
} SCENE {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentLeft);
|
||||||
|
HP_BAR(playerLeft, captureDamage: &results[i].dmgPyhsicalBefore);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_GUST, opponentRight);
|
||||||
|
HP_BAR(playerLeft, captureDamage: &results[i].dmgSpecialBefore);
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, playerLeft);
|
||||||
|
if (count != 1) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, playerLeft);
|
||||||
|
if (count == 3) {
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_STOCKPILE, playerLeft);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, move, playerLeft);
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
|
||||||
|
if (count == 1) {
|
||||||
|
MESSAGE("Wobbuffet's defense fell!");
|
||||||
|
}
|
||||||
|
else if (count == 2) {
|
||||||
|
MESSAGE("Wobbuffet's defense harshly fell!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MESSAGE("Wobbuffet's defense severely fell!");
|
||||||
|
}
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, playerLeft);
|
||||||
|
if (count == 1) {
|
||||||
|
MESSAGE("Wobbuffet's sp. defense fell!");
|
||||||
|
}
|
||||||
|
else if (count == 2) {
|
||||||
|
MESSAGE("Wobbuffet's sp. defense harshly fell!");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MESSAGE("Wobbuffet's sp. defense severely fell!");
|
||||||
|
}
|
||||||
|
MESSAGE("Wobbuffet's stockpiled effect wore off!");
|
||||||
|
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponentLeft);
|
||||||
|
HP_BAR(playerLeft, captureDamage: &results[i].dmgPhysicalAfter);
|
||||||
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_GUST, opponentRight);
|
||||||
|
HP_BAR(playerLeft, captureDamage: &results[i].dmgSpecialAfter);
|
||||||
|
} FINALLY {
|
||||||
|
EXPECT_MUL_EQ(results[0].dmgPyhsicalBefore, UQ_4_12(1.0), results[0].dmgPhysicalAfter);
|
||||||
|
EXPECT_MUL_EQ(results[0].dmgSpecialBefore, UQ_4_12(1.0), results[0].dmgSpecialAfter);
|
||||||
|
EXPECT_MUL_EQ(results[1].dmgPyhsicalBefore, UQ_4_12(1.0), results[1].dmgPhysicalAfter);
|
||||||
|
EXPECT_MUL_EQ(results[1].dmgSpecialBefore, UQ_4_12(1.0), results[1].dmgSpecialAfter);
|
||||||
|
EXPECT_MUL_EQ(results[2].dmgPyhsicalBefore, UQ_4_12(1.0), results[2].dmgPhysicalAfter);
|
||||||
|
EXPECT_MUL_EQ(results[2].dmgSpecialBefore, UQ_4_12(1.0), results[2].dmgSpecialAfter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -433,7 +433,7 @@
|
|||||||
// NOTE: If the stack is too small the test runner will probably crash
|
// NOTE: If the stack is too small the test runner will probably crash
|
||||||
// or loop.
|
// or loop.
|
||||||
#define BATTLE_TEST_STACK_SIZE 1024
|
#define BATTLE_TEST_STACK_SIZE 1024
|
||||||
#define MAX_QUEUED_EVENTS 16
|
#define MAX_QUEUED_EVENTS 25
|
||||||
|
|
||||||
enum { BATTLE_TEST_SINGLES, BATTLE_TEST_DOUBLES };
|
enum { BATTLE_TEST_SINGLES, BATTLE_TEST_DOUBLES };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user