add messages for stockpile effects wear off

This commit is contained in:
DizzyEggg 2023-02-27 12:31:29 +01:00
parent e537be76ea
commit 3338a6b786
7 changed files with 65 additions and 11 deletions

View File

@ -1317,6 +1317,12 @@
.2byte \holdEffect
.4byte \jumpInstr
.endm
.macro dostockpilestatchangeswearoff, battler:req, statChangeInstr:req
callnative BS_DoStockpileStatChangesWearOff
.byte \battler
.4byte \statChangeInstr
.endm
.macro jumpifmorethanhalfHP battler:req, jumpInstr:req
callnative BS_JumpIfMoreThanHalfHP

View File

@ -5570,6 +5570,21 @@ BattleScript_EffectStockpileSpDef::
BattleScript_EffectStockpileEnd:
stockpile 1
goto BattleScript_MoveEnd
BattleScript_MoveEffectStockpileWoreOff::
dostockpilestatchangeswearoff BS_ATTACKER, BattleScript_StockpileStatChangeDown
printstring STRINGID_STOCKPILEDEFFECTWOREOFF
waitmessage B_WAIT_TIME_SHORT
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::
attackcanceler

View File

@ -456,6 +456,7 @@ extern const u8 BattleScript_HealingWishActivates[];
extern const u8 BattleScript_LunarDanceActivates[];
extern const u8 BattleScript_ShellTrapSetUp[];
extern const u8 BattleScript_CouldntFullyProtect[];
extern const u8 BattleScript_MoveEffectStockpileWoreOff[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -372,8 +372,9 @@
#define MOVE_EFFECT_TRAP_BOTH 70
#define MOVE_EFFECT_DOUBLE_SHOCK 71
#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_CERTAIN 0x8000

View File

@ -642,8 +642,9 @@
#define STRINGID_PREPARESHELLTRAP 640
#define STRINGID_SHELLTRAPDIDNTWORK 641
#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.
// String ids before this (e.g. STRINGID_INTROMSG) are not in the table,

View File

@ -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_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_StockpiledEffectWoreOff[] = _("{B_ATK_NAME_WITH_PREFIX}'s stockpiled\neffect wore off!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_STOCKPILEDEFFECTWOREOFF - BATTLESTRINGS_TABLE_START] = sText_StockpiledEffectWoreOff,
[STRINGID_COULDNTFULLYPROTECT - BATTLESTRINGS_TABLE_START] = sText_CouldntFullyProtect,
[STRINGID_ATTACKERGAINEDSTRENGTHFROMTHEFALLEN - BATTLESTRINGS_TABLE_START] = sText_AttackerGainedStrengthFromTheFallen,
[STRINGID_ABILITYWEAKENEDFSURROUNDINGMONSSTAT - BATTLESTRINGS_TABLE_START] = sText_AbilityWeakenedSurroundingMonsStat,

View File

@ -2890,6 +2890,7 @@ void SetMoveEffect(bool32 primary, u32 certain)
case MOVE_EFFECT_KNOCK_OFF:
case MOVE_EFFECT_SMACK_DOWN:
case MOVE_EFFECT_REMOVE_STATUS:
case MOVE_EFFECT_STOCKPILE_WORE_OFF:
gBattleStruct->moveEffect2 = gBattleScripting.moveEffect;
gBattlescriptCurrInstr++;
return;
@ -5609,6 +5610,15 @@ static void Cmd_moveend(void)
case MOVE_EFFECT_KNOCK_OFF:
effect = TryKnockOffBattleScript(gBattlerTarget);
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:
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))
{
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
// Restore stat changes from stockpile.
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
gBattleStruct->moveEffect2 = MOVE_EFFECT_STOCKPILE_WORE_OFF;
}
gBattlescriptCurrInstr = cmd->nextInstr;
}
@ -11689,14 +11696,10 @@ static void Cmd_stockpiletohpheal(void)
gBattleMoveDamage *= -1;
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
gBattleStruct->moveEffect2 = MOVE_EFFECT_STOCKPILE_WORE_OFF;
gBattlescriptCurrInstr = cmd->nextInstr;
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)
{
#if B_CRITICAL_CAPTURE == TRUE