From 68145cd002e43a42194ce6fe8c9a5d390402e622 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 29 Jul 2018 15:33:16 +0200 Subject: [PATCH] Document atk48 --- data/battle_scripts_1.s | 76 +++++++++++----------- include/battle.h | 2 +- include/constants/battle_script_commands.h | 13 +++- src/battle_script_commands.c | 8 +-- 4 files changed, 54 insertions(+), 45 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0487199b5..959258ea0 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2240,34 +2240,34 @@ BattleScript_EffectMemento:: setatkhptozero attackanimation waitanimation - jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_82DA148 - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_TARGET, 0x12, 0x7 - playstatchangeanimation BS_TARGET, 0x2, 0x3 + jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_EffectMementoPrintNoEffect + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO | ATK48_ONLY_MULTIPLE + playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO setstatchanger STAT_ATK, 2, TRUE - statbuffchange 0x1, BattleScript_82DA119 - jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_82DA119 + statbuffchange 0x1, BattleScript_EffectMementoTrySpAtk + jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTrySpAtk printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DA119:: - playstatchangeanimation BS_TARGET, 0x10, 0x3 +BattleScript_EffectMementoTrySpAtk: + playstatchangeanimation BS_TARGET, BIT_SPATK, ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO setstatchanger STAT_SPATK, 2, TRUE - statbuffchange 0x1, BattleScript_82DA13C - jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_82DA13C + statbuffchange 0x1, BattleScript_EffectMementoTryFaint + jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTryFaint printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DA13C:: +BattleScript_EffectMementoTryFaint: tryfaintmon BS_ATTACKER, FALSE, NULL goto BattleScript_MoveEnd -BattleScript_82DA148:: +BattleScript_EffectMementoPrintNoEffect: printstring STRINGID_BUTNOEFFECT waitmessage 0x40 - goto BattleScript_82DA13C -BattleScript_82DA153:: + goto BattleScript_EffectMementoTryFaint +BattleScript_82DA153: attackstring ppreduce jumpifattackandspecialattackcannotfall BattleScript_82DA15A -BattleScript_82DA15A:: +BattleScript_82DA15A: setatkhptozero pause 0x40 effectivenesssound @@ -2688,16 +2688,16 @@ BattleScript_TickleDoMoveAnim:: accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE attackanimation waitanimation - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_TARGET, 0x6, 0x5 - playstatchangeanimation BS_TARGET, 0x2, 0x1 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE + playstatchangeanimation BS_TARGET, BIT_ATK, ATK48_STAT_NEGATIVE setstatchanger STAT_ATK, 1, TRUE statbuffchange 0x1, BattleScript_TickleTryLowerDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleTryLowerDef printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_TickleTryLowerDef:: - playstatchangeanimation BS_TARGET, 0x4, 0x1 + playstatchangeanimation BS_TARGET, BIT_DEF, ATK48_STAT_NEGATIVE setstatchanger STAT_DEF, 1, TRUE statbuffchange 0x1, BattleScript_TickleEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleEnd @@ -2722,8 +2722,8 @@ BattleScript_EffectCosmicPower:: BattleScript_CosmicPowerDoMoveAnim:: attackanimation waitanimation - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x24, 0x0 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0 setstatchanger STAT_DEF, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CosmicPowerTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerTrySpDef @@ -2751,8 +2751,8 @@ BattleScript_EffectBulkUp:: BattleScript_BulkUpDoMoveAnim:: attackanimation waitanimation - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x6, 0x0 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0x0 setstatchanger STAT_ATK, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_BulkUpTryDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpTryDef @@ -2776,8 +2776,8 @@ BattleScript_EffectCalmMind:: BattleScript_CalmMindDoMoveAnim:: attackanimation waitanimation - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x30, 0x0 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0x0 setstatchanger STAT_SPATK, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_CalmMindTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindTrySpDef @@ -2808,8 +2808,8 @@ BattleScript_EffectDragonDance:: BattleScript_DragonDanceDoMoveAnim:: attackanimation waitanimation - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0xA, 0x0 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0x0 setstatchanger STAT_ATK, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_DragonDanceTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceTrySpeed @@ -3487,8 +3487,8 @@ BattleScript_AllStatsUp:: jumpifstat BS_ATTACKER, CMP_LESS_THAN, STAT_SPATK, 0xC, BattleScript_AllStatsUpAtk jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, 0xC, BattleScript_AllStatsUpRet BattleScript_AllStatsUpAtk:: - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x3E, 0x0 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0 setstatchanger STAT_ATK, 1, FALSE statbuffchange MOVE_EFFECT_AFFECTS_USER | 0x1, BattleScript_AllStatsUpDef printfromtable gStatUpStringIds @@ -3655,16 +3655,16 @@ BattleScript_PrintMonIsRooted:: goto BattleScript_MoveEnd BattleScript_AtkDefDown:: - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x6, 0xD - playstatchangeanimation BS_ATTACKER, 0x2, 0x9 + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_ONLY_MULTIPLE + playstatchangeanimation BS_ATTACKER, BIT_ATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE setstatchanger STAT_ATK, 1, TRUE statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB144 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_82DB144:: - playstatchangeanimation BS_ATTACKER, 0x4, 0x9 + playstatchangeanimation BS_ATTACKER, BIT_DEF, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE setstatchanger STAT_DEF, 1, TRUE statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB167 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 @@ -3729,14 +3729,14 @@ BattleScript_OneHitKOMsg:: return BattleScript_SAtkDown2:: - setbyte sFIELD_1B, 0x0 - playstatchangeanimation BS_ATTACKER, 0x10, 0xB + setbyte sSTAT_ANIM_PLAYED, FALSE + playstatchangeanimation BS_ATTACKER, BIT_SPATK, ATK48_DONT_CHECK_LOWER | ATK48_STAT_NEGATIVE | ATK48_STAT_BY_TWO setstatchanger STAT_SPATK, 2, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_82DB1FE - jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB1FE + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | 0x1, BattleScript_SAtkDown2End + jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End printfromtable gStatDownStringIds waitmessage 0x40 -BattleScript_82DB1FE:: +BattleScript_SAtkDown2End:: return BattleScript_FocusPunchSetUp:: diff --git a/include/battle.h b/include/battle.h index f6c50ea8a..073b16147 100644 --- a/include/battle.h +++ b/include/battle.h @@ -592,7 +592,7 @@ struct BattleScripting u8 animTurn; u8 animTargetsHit; u8 statChanger; - u8 field_1B; + bool8 statAnimPlayed; u8 atk23_state; u8 battleStyle; u8 atk6C_state; diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index c820a1114..84ec9d512 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -17,7 +17,7 @@ #define sB_ANIM_TURN gBattleScripting + 0x18 #define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19 #define sSTATCHANGER gBattleScripting + 0x1A -#define sFIELD_1B gBattleScripting + 0x1B +#define sSTAT_ANIM_PLAYED gBattleScripting + 0x1B #define sGIVEEXP_STATE gBattleScripting + 0x1C #define sBATTLE_STYLE gBattleScripting + 0x1D #define sLVLBOX_STATE gBattleScripting + 0x1E @@ -91,7 +91,16 @@ // atk48 #define ATK48_STAT_NEGATIVE 0x1 #define ATK48_STAT_BY_TWO 0x2 -#define ATK48_BIT_x4 0x4 +#define ATK48_ONLY_MULTIPLE 0x4 #define ATK48_DONT_CHECK_LOWER 0x8 +#define BIT_HP 0x1 +#define BIT_ATK 0x2 +#define BIT_DEF 0x4 +#define BIT_SPEED 0x8 +#define BIT_SPATK 0x10 +#define BIT_SPDEF 0x20 +#define BIT_ACC 0x40 +#define BIT_EVASION 0x80 + #endif // GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3af03a5e0..ec81fcae2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4479,16 +4479,16 @@ static void atk48_playstatchangeanimation(void) } } - if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStatsCount < 2) + if (gBattlescriptCurrInstr[3] & ATK48_ONLY_MULTIPLE && changeableStatsCount < 2) { gBattlescriptCurrInstr += 4; } - else if (changeableStatsCount != 0 && gBattleScripting.field_1B == 0) + else if (changeableStatsCount != 0 && !gBattleScripting.statAnimPlayed) { BtlController_EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId); MarkBattlerForControllerExec(gActiveBattler); - if (gBattlescriptCurrInstr[3] & ATK48_BIT_x4 && changeableStatsCount > 1) - gBattleScripting.field_1B = 1; + if (gBattlescriptCurrInstr[3] & ATK48_ONLY_MULTIPLE && changeableStatsCount > 1) + gBattleScripting.statAnimPlayed = TRUE; gBattlescriptCurrInstr += 4; } else