From 9b5aee3b93ac17e3e07c3cb924fb92650d181de4 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sun, 17 Jul 2022 12:17:54 -0400 Subject: [PATCH] fix z stat-boosts --- data/battle_scripts_1.s | 10 +++++++--- src/battle_z_move.c | 36 +++++++----------------------------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bac1b83e7..a74d71246 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -9214,9 +9214,12 @@ BattleScript_ZMoveActivateDamaging:: return BattleScript_ZMoveActivateStatus:: + savetarget printstring STRINGID_ZPOWERSURROUNDS playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL setzeffect + restoretarget + copybyte sSTATCHANGER, sSAVED_STAT_CHANGER return BattleScript_ZEffectPrintString:: @@ -9232,9 +9235,10 @@ BattleScript_RecoverHPZMove:: return BattleScript_StatUpZMove:: - statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StatUpZMoveEnd - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpZMoveEnd - playanimation BS_SCRIPTING, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_StatUpZMoveEnd + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_StatUpZMoveEnd + setgraphicalstatchangevalues + playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printstring STRINGID_ZMOVESTATUP waitmessage 0x40 printfromtable gStatUpStringIds diff --git a/src/battle_z_move.c b/src/battle_z_move.c index 674082698..285a354e4 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -581,8 +581,10 @@ void SetZEffect(void) else gBattleStruct->zmove.effect = Z_EFFECT_ATK_UP_1; } - + + gBattleScripting.savedStatChanger = gBattleScripting.statChanger; // save used move's stat changer (e.g. for Z-Growl) gBattleScripting.battler = gBattlerAttacker; + switch (gBattleStruct->zmove.effect) { case Z_EFFECT_RESET_STATS: @@ -639,42 +641,18 @@ void SetZEffect(void) gBattleCommunication[MULTISTRING_CHOOSER] = MULTISTRING_Z_HP_TRAP; gBattlescriptCurrInstr = BattleScript_ZEffectPrintString; break; - case Z_EFFECT_ATK_UP_1: - case Z_EFFECT_DEF_UP_1: - case Z_EFFECT_SPD_UP_1: - case Z_EFFECT_SPATK_UP_1: - case Z_EFFECT_SPDEF_UP_1: - case Z_EFFECT_ACC_UP_1: - case Z_EFFECT_EVSN_UP_1: - SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_1 + 1, 1, FALSE); - gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_1 + 1); - gBattleScripting.animArg2 = 0; + case Z_EFFECT_ATK_UP_1 ... Z_EFFECT_EVSN_UP_1: + SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_1 + 1, 1, FALSE); BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH); gBattlescriptCurrInstr = BattleScript_StatUpZMove; break; - case Z_EFFECT_ATK_UP_2: - case Z_EFFECT_DEF_UP_2: - case Z_EFFECT_SPD_UP_2: - case Z_EFFECT_SPATK_UP_2: - case Z_EFFECT_SPDEF_UP_2: - case Z_EFFECT_ACC_UP_2: - case Z_EFFECT_EVSN_UP_2: + case Z_EFFECT_ATK_UP_2 ... Z_EFFECT_EVSN_UP_2: SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_2 + 1, 2, FALSE); - gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_2 + 1); - gBattleScripting.animArg2 = 0; BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH); gBattlescriptCurrInstr = BattleScript_StatUpZMove; break; - case Z_EFFECT_ATK_UP_3: - case Z_EFFECT_DEF_UP_3: - case Z_EFFECT_SPD_UP_3: - case Z_EFFECT_SPATK_UP_3: - case Z_EFFECT_SPDEF_UP_3: - case Z_EFFECT_ACC_UP_3: - case Z_EFFECT_EVSN_UP_3: + case Z_EFFECT_ATK_UP_3 ... Z_EFFECT_EVSN_UP_3: SET_STATCHANGER(gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_3 + 1, 3, FALSE); - gBattleScripting.animArg1 = 0xE + (gBattleStruct->zmove.effect - Z_EFFECT_ATK_UP_3 + 1); - gBattleScripting.animArg2 = 0; BattleScriptPush(gBattlescriptCurrInstr + Z_EFFECT_BS_LENGTH); gBattlescriptCurrInstr = BattleScript_StatUpZMove; break;