From bb236b490d99fef02ed172e7ca86f6c70ef09527 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 15 Sep 2019 17:58:12 -0400 Subject: [PATCH] Update BS constants for Cmd rename --- data/battle_scripts_1.s | 24 +++++++++++----------- include/battle_util.h | 2 +- include/constants/battle_script_commands.h | 24 +++++++++++----------- src/battle_script_commands.c | 18 ++++++++-------- src/battle_util.c | 2 +- 5 files changed, 35 insertions(+), 35 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 9d7b241c0..f3dc679e3 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -671,7 +671,7 @@ BattleScript_MultiHitEnd:: seteffectwithchance tryfaintmon BS_TARGET, FALSE, NULL moveendcase MOVEEND_SYNCHRONIZE_TARGET - moveendfrom MOVEEND_STATUS_IMMUNITY_ABILITIES + moveendfrom MOVEEND_IMMUNITY_ABILITIES end BattleScript_EffectConversion:: @@ -882,7 +882,7 @@ BattleScript_MoveMissedDoDamage:: damagecalc typecalc adjustnormaldamage - manipulatedamage DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP + manipulatedamage DMG_RECOIL_FROM_MISS bicbyte gMoveResultFlags, MOVE_RESULT_MISSED orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER @@ -1716,7 +1716,7 @@ BattleScript_EffectBatonPass:: attackstring ppreduce jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed - jumpifcantswitch DONT_CHECK_STATUSES | BS_ATTACKER, BattleScript_ButItFailed + jumpifcantswitch SWITCH_IGNORE_ESCAPE_PREVENTION | BS_ATTACKER, BattleScript_ButItFailed attackanimation waitanimation openpartyscreen 0x1, BattleScript_ButItFailed @@ -2232,7 +2232,7 @@ BattleScript_EffectMemento:: waitanimation jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_EffectMementoPrintNoEffect setbyte sSTAT_ANIM_PLAYED, FALSE - playstatchangeanimation BS_TARGET, BIT_ATK | BIT_SPATK, STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO | STAT_CHANGE_ONLY_MULTIPLE + 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 @@ -2677,7 +2677,7 @@ BattleScript_TickleDoMoveAnim:: attackanimation waitanimation setbyte sSTAT_ANIM_PLAYED, FALSE - playstatchangeanimation BS_TARGET, BIT_ATK | BIT_DEF, STAT_CHANGE_NEGATIVE | STAT_CHANGE_ONLY_MULTIPLE + 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 @@ -2865,7 +2865,7 @@ BattleScript_FaintedMonTryChooseAnother:: jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother jumpifbyte CMP_EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother - jumpifcantswitch 11, BattleScript_FaintedMonChooseAnother + jumpifcantswitch BS_PLAYER1, BattleScript_FaintedMonChooseAnother printstring STRINGID_ENEMYABOUTTOSWITCHPKMN setbyte gBattleCommunication, 0x0 yesnobox @@ -3128,7 +3128,7 @@ BattleScript_DoSwitchOut:: switchinanim BS_ATTACKER, FALSE waitstate switchineffects BS_ATTACKER - moveendcase MOVEEND_STATUS_IMMUNITY_ABILITIES + moveendcase MOVEEND_IMMUNITY_ABILITIES moveendcase MOVEEND_MIRROR_MOVE end2 @@ -3152,7 +3152,7 @@ BattleScript_PursuitDmgOnSwitchOut:: resultmessage waitmessage 0x40 tryfaintmon BS_TARGET, FALSE, NULL - moveendfromto MOVEEND_MOVE_END_ABILITIES, MOVEEND_CHOICE_MOVE + moveendfromto MOVEEND_CONTACT_ABILITIES, MOVEEND_CHOICE_MOVE various4 BS_TARGET jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet setbyte sGIVEEXP_STATE, 0x0 @@ -3635,15 +3635,15 @@ BattleScript_PrintMonIsRooted:: BattleScript_AtkDefDown:: setbyte sSTAT_ANIM_PLAYED, FALSE - playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_ATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE | STAT_CHANGE_ONLY_MULTIPLE - playstatchangeanimation BS_ATTACKER, BIT_ATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE + 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 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB144 printfromtable gStatDownStringIds waitmessage 0x40 BattleScript_82DB144:: - playstatchangeanimation BS_ATTACKER, BIT_DEF, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE + 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 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_82DB167 @@ -3709,7 +3709,7 @@ BattleScript_OneHitKOMsg:: BattleScript_SAtkDown2:: setbyte sSTAT_ANIM_PLAYED, FALSE - playstatchangeanimation BS_ATTACKER, BIT_SPATK, STAT_CHANGE_DONT_CHECK_LOWER | STAT_CHANGE_NEGATIVE | STAT_CHANGE_BY_TWO + 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 jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_SAtkDown2End diff --git a/include/battle_util.h b/include/battle_util.h index 0756a387a..f90d812d6 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -12,7 +12,7 @@ #define ABILITYEFFECT_ENDTURN 0x1 #define ABILITYEFFECT_MOVES_BLOCK 0x2 #define ABILITYEFFECT_ABSORBING 0x3 -#define ABILITYEFFECT_MOVE_END 0x4 +#define ABILITYEFFECT_CONTACT 0x4 #define ABILITYEFFECT_IMMUNITY 0x5 #define ABILITYEFFECT_FORECAST 0x6 #define ABILITYEFFECT_SYNCHRONIZE 0x7 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index b79d87243..963570aa7 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -39,16 +39,16 @@ #define BS_EFFECT_BATTLER 2 #define BS_FAINTED 3 #define BS_BATTLER_0 7 -#define BS_ATTACKER_WITH_PARTNER 4 // for atk98_status_icon_update -#define BS_ATTACKER_SIDE 8 // for atk1E_jumpifability -#define BS_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability +#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_status_icon_update +#define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability +#define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability #define BS_SCRIPTING 10 #define BS_PLAYER1 11 #define BS_OPPONENT1 12 #define BS_PLAYER2 13 #define BS_OPPONENT2 14 -// atk 01, accuracy calc +// accuracy calc #define NO_ACC_CALC 0xFFFE #define NO_ACC_CALC_CHECK_LOCK_ON 0xFFFF #define ACC_CURR_MOVE 0 @@ -85,12 +85,12 @@ #define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26 // manipulatedmg -#define DMG_CHANGE_SIGN 0 -#define DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1 -#define DMG_DOUBLED 2 +#define DMG_CHANGE_SIGN 0 +#define DMG_RECOIL_FROM_MISS 1 +#define DMG_DOUBLED 2 // flag used for the jumpifcantswitch command -#define DONT_CHECK_STATUSES 0x80 +#define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80 // statchange defines #define STAT_CHANGE_BS_PTR 0x1 @@ -99,15 +99,15 @@ // playstatchangeanimation #define STAT_CHANGE_NEGATIVE 0x1 #define STAT_CHANGE_BY_TWO 0x2 -#define STAT_CHANGE_ONLY_MULTIPLE 0x4 -#define STAT_CHANGE_DONT_CHECK_LOWER 0x8 +#define STAT_CHANGE_SKIP_NEXT_ANIM 0x4 +#define STAT_CHANGE_IGNORE_ABILITY 0x8 // moveend cases #define MOVEEND_RAGE 0 #define MOVEEND_DEFROST 1 #define MOVEEND_SYNCHRONIZE_TARGET 2 -#define MOVEEND_MOVE_END_ABILITIES 3 -#define MOVEEND_STATUS_IMMUNITY_ABILITIES 4 +#define MOVEEND_CONTACT_ABILITIES 3 +#define MOVEEND_IMMUNITY_ABILITIES 4 #define MOVEEND_SYNCHRONIZE_ATTACKER 5 #define MOVEEND_CHOICE_MOVE 6 #define MOVEEND_CHANGED_ITEMS 7 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cbc42e6d4..49b30ee6f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4405,7 +4405,7 @@ static void Cmd_playstatchangeanimation(void) { if (statsToCheck & 1) { - if (gBattlescriptCurrInstr[3] & STAT_CHANGE_DONT_CHECK_LOWER) + if (gBattlescriptCurrInstr[3] & STAT_CHANGE_IGNORE_ABILITY) { if (gBattleMons[gActiveBattler].statStages[currStat] > 0) { @@ -4464,7 +4464,7 @@ static void Cmd_playstatchangeanimation(void) } } - if (gBattlescriptCurrInstr[3] & STAT_CHANGE_ONLY_MULTIPLE && changeableStatsCount < 2) + if (gBattlescriptCurrInstr[3] & STAT_CHANGE_SKIP_NEXT_ANIM && changeableStatsCount < 2) { gBattlescriptCurrInstr += 4; } @@ -4472,7 +4472,7 @@ static void Cmd_playstatchangeanimation(void) { BtlController_EmitBattleAnimation(0, B_ANIM_STATS_CHANGE, statAnimId); MarkBattlerForControllerExec(gActiveBattler); - if (gBattlescriptCurrInstr[3] & STAT_CHANGE_ONLY_MULTIPLE && changeableStatsCount > 1) + if (gBattlescriptCurrInstr[3] & STAT_CHANGE_SKIP_NEXT_ANIM && changeableStatsCount > 1) gBattleScripting.statAnimPlayed = TRUE; gBattlescriptCurrInstr += 4; } @@ -4547,12 +4547,12 @@ static void Cmd_moveend(void) effect = TRUE; gBattleScripting.moveendState++; break; - case MOVEEND_MOVE_END_ABILITIES: // Such as abilities activating on contact(Poison Spore, Rough Skin, etc.). - if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END, gBattlerTarget, 0, 0, 0)) + case MOVEEND_CONTACT_ABILITIES: // Also includes Color Change + if (AbilityBattleEffects(ABILITYEFFECT_CONTACT, gBattlerTarget, 0, 0, 0)) effect = TRUE; gBattleScripting.moveendState++; break; - case MOVEEND_STATUS_IMMUNITY_ABILITIES: // status immunities + case MOVEEND_IMMUNITY_ABILITIES: // status immunities if (AbilityBattleEffects(ABILITYEFFECT_IMMUNITY, 0, 0, 0, 0)) effect = TRUE; // it loops through all battlers, so we increment after its done with all battlers else @@ -4971,9 +4971,9 @@ static void Cmd_jumpifcantswitch(void) s32 lastMonId; struct Pokemon *party; - gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(DONT_CHECK_STATUSES)); + gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(SWITCH_IGNORE_ESCAPE_PREVENTION)); - if (!(gBattlescriptCurrInstr[1] & DONT_CHECK_STATUSES) + if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION) && ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)) || (gStatuses3[gActiveBattler] & STATUS3_ROOTED))) { @@ -7002,7 +7002,7 @@ static void Cmd_manipulatedamage(void) case DMG_CHANGE_SIGN: gBattleMoveDamage *= -1; break; - case DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP: + case DMG_RECOIL_FROM_MISS: gBattleMoveDamage /= 2; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; diff --git a/src/battle_util.c b/src/battle_util.c index 03f1482da..6ef51bfd2 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2084,7 +2084,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } } break; - case ABILITYEFFECT_MOVE_END: // Think contact abilities. + case ABILITYEFFECT_CONTACT: // Also includes Color Change switch (gLastUsedAbility) { case ABILITY_COLOR_CHANGE: