diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 997af51cc..d2d678254 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -391,11 +391,11 @@ .byte 0x47 .endm - .macro playstatchangeanimation battler:req, param1:req, param2:req + .macro playstatchangeanimation battler:req, stats:req, statchange:req .byte 0x48 .byte \battler - .byte \param1 - .byte \param2 + .byte \stats + .byte \statchange .endm .macro moveend param0:req, param1:req @@ -738,10 +738,10 @@ .byte 0x88 .endm - .macro statbuffchange param0:req, param1:req + .macro statbuffchange flags:req, jumpptr:req .byte 0x89 - .byte \param0 - .4byte \param1 + .byte \flags + .4byte \jumpptr .endm .macro normalisebuffs diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f3dc679e3..2f823f687 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -511,7 +511,7 @@ BattleScript_EffectStatUp:: BattleScript_EffectStatUpAfterAtkCanceler:: attackstring ppreduce - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_StatUpEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_StatUpEnd jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpAttackAnim pause 0x20 goto BattleScript_StatUpPrintString @@ -557,7 +557,7 @@ BattleScript_EffectStatDown:: accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring ppreduce - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_StatDownEnd + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_StatDownEnd jumpifbyte CMP_LESS_THAN, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatDownDoAnim jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x3, BattleScript_StatDownEnd pause 0x20 @@ -1513,17 +1513,17 @@ BattleScript_CurseTrySpeed:: attackanimation waitanimation setstatchanger STAT_SPEED, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseTryAttack + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseTryAttack printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_CurseTryAttack:: setstatchanger STAT_ATK, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseTryDefence + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseTryDefence printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_CurseTryDefence:: setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CurseEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CurseEnd printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_CurseEnd:: @@ -1635,7 +1635,7 @@ BattleScript_EffectSwagger:: attackanimation waitanimation setstatchanger STAT_ATK, 2, FALSE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_SwaggerTryConfuse + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_SwaggerTryConfuse jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SwaggerTryConfuse setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 @@ -1834,7 +1834,7 @@ BattleScript_EffectSkullBash:: setbyte sTWOTURN_STRINGID, 0x2 call BattleScriptFirstChargingTurn setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_SkullBashEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_SkullBashEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SkullBashEnd setgraphicalstatchangevalues playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 @@ -2037,7 +2037,7 @@ BattleScript_EffectDefenseCurl:: ppreduce setdefensecurlbit setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DefenseCurlDoStatUpAnim + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DefenseCurlDoStatUpAnim jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_StatUpPrintString attackanimation waitanimation @@ -2178,7 +2178,7 @@ BattleScript_EffectFlatter:: attackanimation waitanimation setstatchanger STAT_SPATK, 1, FALSE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_FlatterTryConfuse + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_FlatterTryConfuse jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_FlatterTryConfuse setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 @@ -2235,14 +2235,14 @@ BattleScript_EffectMemento:: playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO | STAT_CHANGE_SKIP_NEXT_ANIM playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO setstatchanger STAT_ATK, 2, TRUE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTrySpAtk + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTrySpAtk jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTrySpAtk printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_EffectMementoTrySpAtk: playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO setstatchanger STAT_SPATK, 2, TRUE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_EffectMementoTryFaint + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_EffectMementoTryFaint jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_EffectMementoTryFaint printfromtable gStatDownStringIds waitmessage 0x40 @@ -2680,14 +2680,14 @@ BattleScript_TickleDoMoveAnim:: playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_SKIP_NEXT_ANIM playstatchangeanimation BS_TARGET, BIT_ATK, STAT_CHANGE_NEGATIVE setstatchanger STAT_ATK, 1, TRUE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleTryLowerDef + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TickleTryLowerDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleTryLowerDef printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_TickleTryLowerDef:: playstatchangeanimation BS_TARGET, BIT_DEF, STAT_CHANGE_NEGATIVE setstatchanger STAT_DEF, 1, TRUE - statbuffchange STAT_CHANGE_BS_PTR, BattleScript_TickleEnd + statbuffchange STAT_BUFF_ALLOW_PTR, BattleScript_TickleEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TickleEnd printfromtable gStatDownStringIds waitmessage 0x40 @@ -2713,13 +2713,13 @@ BattleScript_CosmicPowerDoMoveAnim:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0 setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CosmicPowerTrySpDef + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerTrySpDef printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_CosmicPowerTrySpDef:: setstatchanger STAT_SPDEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CosmicPowerEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CosmicPowerEnd printfromtable gStatUpStringIds waitmessage 0x40 @@ -2742,13 +2742,13 @@ BattleScript_BulkUpDoMoveAnim:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0x0 setstatchanger STAT_ATK, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_BulkUpTryDef + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpTryDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpTryDef printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_BulkUpTryDef:: setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_BulkUpEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_BulkUpEnd printfromtable gStatUpStringIds waitmessage 0x40 @@ -2767,13 +2767,13 @@ BattleScript_CalmMindDoMoveAnim:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0x0 setstatchanger STAT_SPATK, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CalmMindTrySpDef + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindTrySpDef printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_CalmMindTrySpDef:: setstatchanger STAT_SPDEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_CalmMindEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_CalmMindEnd printfromtable gStatUpStringIds waitmessage 0x40 @@ -2799,13 +2799,13 @@ BattleScript_DragonDanceDoMoveAnim:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0x0 setstatchanger STAT_ATK, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DragonDanceTrySpeed + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceTrySpeed printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_DragonDanceTrySpeed:: setstatchanger STAT_SPEED, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_DragonDanceEnd + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceEnd jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_DragonDanceEnd printfromtable gStatUpStringIds waitmessage 0x40 @@ -3471,27 +3471,27 @@ BattleScript_AllStatsUpAtk:: 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 | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpDef + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpDef printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_AllStatsUpDef:: setstatchanger STAT_DEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpeed + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpeed printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_AllStatsUpSpeed:: setstatchanger STAT_SPEED, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpAtk + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpAtk printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_AllStatsUpSpAtk:: setstatchanger STAT_SPATK, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpSpDef + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpSpDef printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_AllStatsUpSpDef:: setstatchanger STAT_SPDEF, 1, FALSE - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_AllStatsUpRet + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpRet printfromtable gStatUpStringIds waitmessage 0x40 BattleScript_AllStatsUpRet:: @@ -3638,14 +3638,14 @@ BattleScript_AtkDefDown:: playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, STAT_CHANGE_IGNORE_ABILITY | STAT_CHANGE_NEGATIVE | STAT_CHANGE_SKIP_NEXT_ANIM playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_IGNORE_ABILITY | STAT_CHANGE_NEGATIVE setstatchanger STAT_ATK, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB144 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB144 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_82DB144:: playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_IGNORE_ABILITY | STAT_CHANGE_NEGATIVE setstatchanger STAT_DEF, 1, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_82DB167 + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_82DB167 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 printfromtable gStatDownStringIds waitmessage 0x40 @@ -3711,7 +3711,7 @@ BattleScript_SAtkDown2:: setbyte sSTAT_ANIM_PLAYED, FALSE playstatchangeanimation BS_ATTACKER, BIT_SPATK, STAT_CHANGE_IGNORE_ABILITY | STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO setstatchanger STAT_SPATK, 2, TRUE - statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_CHANGE_BS_PTR, BattleScript_SAtkDown2End + statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN | STAT_BUFF_ALLOW_PTR, BattleScript_SAtkDown2End jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End printfromtable gStatDownStringIds waitmessage 0x40 @@ -4042,7 +4042,7 @@ BattleScript_IntimidateActivatesLoop: jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented - statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_BS_PTR, BattleScript_IntimidateActivatesLoopIncrement + statbuffchange STAT_BUFF_NOT_PROTECT_AFFECTED | STAT_BUFF_ALLOW_PTR, BattleScript_IntimidateActivatesLoopIncrement jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_IntimidateActivatesLoopIncrement setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 @@ -4420,7 +4420,7 @@ BattleScript_BerryConfuseHealEnd2:: BattleScript_BerryStatRaiseEnd2:: playanimation BS_ATTACKER, B_ANIM_ITEM_EFFECT, NULL - statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_CHANGE_BS_PTR, BattleScript_82DB85B + statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_82DB85B BattleScript_82DB85B:: setbyte cMULTISTRING_CHOOSER, 0x4 call BattleScript_StatUp diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 963570aa7..dd54980c5 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -39,7 +39,7 @@ #define BS_EFFECT_BATTLER 2 #define BS_FAINTED 3 #define BS_BATTLER_0 7 -#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_status_icon_update +#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon #define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability #define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability #define BS_SCRIPTING 10 @@ -48,7 +48,7 @@ #define BS_PLAYER2 13 #define BS_OPPONENT2 14 -// accuracy calc +// Cmd_accuracycheck #define NO_ACC_CALC 0xFFFE #define NO_ACC_CALC_CHECK_LOCK_ON 0xFFFF #define ACC_CURR_MOVE 0 @@ -61,7 +61,7 @@ #define CMP_COMMON_BITS 0x4 #define CMP_NO_COMMON_BITS 0x5 -// atk76, various +// Cmd_various #define VARIOUS_CANCEL_MULTI_TURN_MOVES 0 #define VARIOUS_SET_MAGIC_COAT_TARGET 1 #define VARIOUS_IS_RUNNING_IMPOSSIBLE 2 @@ -84,25 +84,35 @@ #define VARIOUS_SET_TELEPORT_OUTCOME 25 #define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26 -// manipulatedmg +// Cmd_manipulatedmg #define DMG_CHANGE_SIGN 0 #define DMG_RECOIL_FROM_MISS 1 #define DMG_DOUBLED 2 -// flag used for the jumpifcantswitch command +// Cmd_jumpifcantswitch #define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80 -// statchange defines -#define STAT_CHANGE_BS_PTR 0x1 -#define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20 +// Cmd_statbuffchange +#define STAT_BUFF_ALLOW_PTR 0x1 // If set, allow use of jumpptr. Set in every use of statbuffchange +#define STAT_BUFF_NOT_PROTECT_AFFECTED 0x20 -// playstatchangeanimation +// stat change flags for Cmd_playstatchangeanimation #define STAT_CHANGE_NEGATIVE 0x1 #define STAT_CHANGE_BY_TWO 0x2 #define STAT_CHANGE_SKIP_NEXT_ANIM 0x4 #define STAT_CHANGE_IGNORE_ABILITY 0x8 -// moveend cases +// stat flags for Cmd_playstatchangeanimation +#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 + +// cases for Cmd_moveend #define MOVEEND_RAGE 0 #define MOVEEND_DEFROST 1 #define MOVEEND_SYNCHRONIZE_TARGET 2 @@ -122,13 +132,4 @@ #define MOVEEND_NEXT_TARGET 16 #define MOVEEND_COUNT 17 -#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 85ca4e167..14158376c 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7169,8 +7169,8 @@ static void Cmd_negativedamage(void) gBattlescriptCurrInstr++; } -#define STAT_CHANGE_WORKED 0 -#define STAT_CHANGE_DIDNT_WORK 1 +#define STAT_BUFF_WORKED 0 +#define STAT_BUFF_DIDNT_WORK 1 static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) { @@ -7189,9 +7189,9 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) certain++; flags &= ~(MOVE_EFFECT_CERTAIN); - if (flags & STAT_CHANGE_NOT_PROTECT_AFFECTED) + if (flags & STAT_BUFF_NOT_PROTECT_AFFECTED) notProtectAffected++; - flags &= ~(STAT_CHANGE_NOT_PROTECT_AFFECTED); + flags &= ~(STAT_BUFF_NOT_PROTECT_AFFECTED); PREPARE_STAT_BUFFER(gBattleTextBuff1, statId) @@ -7200,7 +7200,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer && !certain && gCurrentMove != MOVE_CURSE) { - if (flags == STAT_CHANGE_BS_PTR) + if (flags == STAT_BUFF_ALLOW_PTR) { if (gSpecialStatuses[gActiveBattler].statLowered) { @@ -7214,19 +7214,19 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gSpecialStatuses[gActiveBattler].statLowered = 1; } } - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else if (gCurrentMove != MOVE_CURSE && notProtectAffected != TRUE && JumpIfMoveAffectedByProtect(0)) { gBattlescriptCurrInstr = BattleScript_ButItFailed; - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else if ((gBattleMons[gActiveBattler].ability == ABILITY_CLEAR_BODY || gBattleMons[gActiveBattler].ability == ABILITY_WHITE_SMOKE) && !certain && gCurrentMove != MOVE_CURSE) { - if (flags == STAT_CHANGE_BS_PTR) + if (flags == STAT_BUFF_ALLOW_PTR) { if (gSpecialStatuses[gActiveBattler].statLowered) { @@ -7242,12 +7242,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gSpecialStatuses[gActiveBattler].statLowered = 1; } } - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else if (gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && !certain && statId == STAT_ACC) { - if (flags == STAT_CHANGE_BS_PTR) + if (flags == STAT_BUFF_ALLOW_PTR) { BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; @@ -7255,12 +7255,12 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gLastUsedAbility = gBattleMons[gActiveBattler].ability; RecordAbilityBattle(gActiveBattler, gLastUsedAbility); } - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else if (gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && !certain && statId == STAT_ATK) { - if (flags == STAT_CHANGE_BS_PTR) + if (flags == STAT_BUFF_ALLOW_PTR) { BattleScriptPush(BS_ptr); gBattleScripting.battler = gActiveBattler; @@ -7268,11 +7268,11 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) gLastUsedAbility = gBattleMons[gActiveBattler].ability; RecordAbilityBattle(gActiveBattler, gLastUsedAbility); } - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else if (gBattleMons[gActiveBattler].ability == ABILITY_SHIELD_DUST && flags == 0) { - return STAT_CHANGE_DIDNT_WORK; + return STAT_BUFF_DIDNT_WORK; } else // try to decrease { @@ -7333,19 +7333,19 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) if (gBattleMons[gActiveBattler].statStages[statId] > 0xC) gBattleMons[gActiveBattler].statStages[statId] = 0xC; - if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_CHANGE_BS_PTR) + if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR) gMoveResultFlags |= MOVE_RESULT_MISSED; - if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && !(flags & STAT_CHANGE_BS_PTR)) - return STAT_CHANGE_DIDNT_WORK; + if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && !(flags & STAT_BUFF_ALLOW_PTR)) + return STAT_BUFF_DIDNT_WORK; - return STAT_CHANGE_WORKED; + return STAT_BUFF_WORKED; } static void Cmd_statbuffchange(void) { const u8* jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2); - if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_CHANGE_WORKED) + if (ChangeStatBuffs(gBattleScripting.statChanger & 0xF0, GET_STAT_BUFF_ID(gBattleScripting.statChanger), gBattlescriptCurrInstr[1], jumpPtr) == STAT_BUFF_WORKED) gBattlescriptCurrInstr += 6; }