diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 27c5a86c4..8f55c1edb 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1162,7 +1162,7 @@ .4byte \ptr .endm - .macro trygetintimidatetarget ptr:req + .macro unused2 ptr:req .byte 0xe1 .4byte \ptr .endm @@ -1332,8 +1332,8 @@ various \battler, VARIOUS_GET_BATTLER_FAINTED .endm - .macro resetintimidatetracebits battler:req - various \battler, VARIOUS_RESET_INTIMIDATE_TRACE_BITS + .macro resetswitchinabilitybits battler:req + various \battler, VARIOUS_RESET_SWITCH_IN_ABILITY_BITS .endm .macro updatechoicemoveonlvlup battler:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 5af38e818..69eb5a904 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6189,7 +6189,7 @@ BattleScript_FaintedMonTryChoose: jumpifbyte CMP_EQUAL, gBattleCommunication, PARTY_SIZE, BattleScript_FaintedMonSendOutNew @ Switch Pokémon before opponent atknameinbuff1 - resetintimidatetracebits BS_ATTACKER + resetswitchinabilitybits BS_ATTACKER hpthresholds2 BS_ATTACKER printstring STRINGID_RETURNMON switchoutabilities BS_ATTACKER @@ -8259,19 +8259,15 @@ BattleScript_TryAdrenalineOrb: BattleScript_TryAdrenalineOrbRet: return -BattleScript_IntimidateActivatesEnd3:: - call BattleScript_PauseIntimidateActivates - end3 - -BattleScript_PauseIntimidateActivates: - pause B_WAIT_TIME_SHORT BattleScript_IntimidateActivates:: + showabilitypopup BS_ATTACKER + pause B_WAIT_TIME_LONG + destroyabilitypopup setbyte gBattlerTarget, 0 - call BattleScript_AbilityPopUp -BattleScript_IntimidateActivatesLoop: - setstatchanger STAT_ATK, 1, TRUE - trygetintimidatetarget BattleScript_IntimidateActivatesReturn - jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateActivatesLoopIncrement +BattleScript_IntimidateLoop: + jumpifbyteequal gBattlerTarget, gBattlerAttacker, BattleScript_IntimidateLoopIncrement + jumpiftargetally BattleScript_IntimidateLoopIncrement + jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateLoopIncrement jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_IntimidatePrevented @@ -8281,27 +8277,31 @@ BattleScript_IntimidateActivatesLoop: jumpifability BS_TARGET, ABILITY_OWN_TEMPO, BattleScript_IntimidatePrevented jumpifability BS_TARGET, ABILITY_OBLIVIOUS, BattleScript_IntimidatePrevented .endif - statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | STAT_CHANGE_ALLOW_PTR, BattleScript_IntimidateActivatesLoopIncrement - jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 1, BattleScript_IntimidateActivatesLoopIncrement +BattleScript_IntimidateEffect: + copybyte sBATTLER, gBattlerTarget + statbuffchange STAT_CHANGE_NOT_PROTECT_AFFECTED | MOVE_EFFECT_CERTAIN, NULL setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printstring STRINGID_PKMNCUTSATTACKWITH waitmessage B_WAIT_TIME_LONG call BattleScript_TryAdrenalineOrb -BattleScript_IntimidateActivatesLoopIncrement: +BattleScript_IntimidateLoopIncrement: addbyte gBattlerTarget, 1 - goto BattleScript_IntimidateActivatesLoop -BattleScript_IntimidateActivatesReturn: - return + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_IntimidateLoop +BattleScript_IntimidateEnd: + destroyabilitypopup + pause B_WAIT_TIME_MED + end3 + BattleScript_IntimidatePrevented: - pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp + pause B_WAIT_TIME_LONG setbyte gBattleCommunication STAT_ATK - stattextbuffer BS_ATTACKER + stattextbuffer BS_TARGET printstring STRINGID_STATWASNOTLOWERED waitmessage B_WAIT_TIME_LONG call BattleScript_TryAdrenalineOrb - goto BattleScript_IntimidateActivatesLoopIncrement + goto BattleScript_IntimidateLoopIncrement BattleScript_DroughtActivates:: pause B_WAIT_TIME_SHORT diff --git a/include/battle.h b/include/battle.h index ebc8be057..06e07b341 100644 --- a/include/battle.h +++ b/include/battle.h @@ -53,7 +53,7 @@ struct ResourceFlags #define RESOURCE_FLAG_FLASH_FIRE 0x1 #define RESOURCE_FLAG_ROOST 0x2 #define RESOURCE_FLAG_UNBURDEN 0x4 -#define RESOURCE_FLAG_INTIMIDATED 0x8 +#define RESOURCE_FLAG_UNUSED 0x8 #define RESOURCE_FLAG_TRACED 0x10 #define RESOURCE_FLAG_EMERGENCY_EXIT 0x20 #define RESOURCE_FLAG_NEUTRALIZING_GAS 0x40 @@ -158,7 +158,6 @@ struct SpecialStatus u8 statLowered:1; u8 lightningRodRedirected:1; u8 restoredBattlerSprite: 1; - u8 intimidatedMon:1; u8 traced:1; u8 ppNotAffectedByPressure:1; u8 faintedHasReplacement:1; @@ -583,7 +582,6 @@ struct BattleStruct u8 AI_itemFlags[2]; u16 choicedMove[MAX_BATTLERS_COUNT]; u16 changedItems[MAX_BATTLERS_COUNT]; - u8 intimidateBattler; u8 switchInItemsCounter; u8 arenaTurnCounter; u8 turnSideTracker; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 16ac7a8c8..75afdbf63 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -152,7 +152,6 @@ extern const u8 BattleScript_ShedSkinActivates[]; extern const u8 BattleScript_WeatherFormChanges[]; extern const u8 BattleScript_WeatherFormChangesLoop[]; extern const u8 BattleScript_WeatherFormChange[]; -extern const u8 BattleScript_IntimidateActivatesEnd3[]; extern const u8 BattleScript_IntimidateActivates[]; extern const u8 BattleScript_DroughtActivates[]; extern const u8 BattleScript_TookAttack[]; diff --git a/include/battle_util.h b/include/battle_util.h index 3f516daba..257b5a743 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -29,13 +29,11 @@ #define ABILITYEFFECT_WEATHER_FORM 7 #define ABILITYEFFECT_SYNCHRONIZE 8 #define ABILITYEFFECT_ATK_SYNCHRONIZE 9 -#define ABILITYEFFECT_INTIMIDATE1 10 -#define ABILITYEFFECT_INTIMIDATE2 11 -#define ABILITYEFFECT_TRACE1 12 -#define ABILITYEFFECT_TRACE2 13 -#define ABILITYEFFECT_MOVE_END_OTHER 14 -#define ABILITYEFFECT_NEUTRALIZINGGAS 15 -#define ABILITYEFFECT_FIELD_SPORT 16 // Only used if B_SPORT_TURNS < GEN_6 +#define ABILITYEFFECT_TRACE1 10 +#define ABILITYEFFECT_TRACE2 11 +#define ABILITYEFFECT_MOVE_END_OTHER 12 +#define ABILITYEFFECT_NEUTRALIZINGGAS 13 +#define ABILITYEFFECT_FIELD_SPORT 14 // Only used if B_SPORT_TURNS < GEN_6 // Special cases #define ABILITYEFFECT_MUD_SPORT 252 // Only used if B_SPORT_TURNS < GEN_6 #define ABILITYEFFECT_WATER_SPORT 253 // Only used if B_SPORT_TURNS < GEN_6 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 06a09fc17..2d6db1fbb 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -93,7 +93,7 @@ #define VARIOUS_IS_RUNNING_IMPOSSIBLE 2 #define VARIOUS_GET_MOVE_TARGET 3 #define VARIOUS_GET_BATTLER_FAINTED 4 -#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5 +#define VARIOUS_RESET_SWITCH_IN_ABILITY_BITS 5 #define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6 #define VARIOUS_RESET_PLAYER_FAINTED 7 #define VARIOUS_PALACE_FLAVOR_TEXT 8 diff --git a/src/battle_main.c b/src/battle_main.c index 392e53268..0e4d1c395 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3720,8 +3720,6 @@ static void TryDoEventsBeforeFirstTurn(void) if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gBattlerAttacker, 0, 0, 0) != 0) return; } - if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) != 0) - return; if (AbilityBattleEffects(ABILITYEFFECT_TRACE1, 0, 0, 0, 0) != 0) return; // Check all switch in items having effect from the fastest mon to slowest. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8b0796e2b..6838fcf9e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -544,7 +544,7 @@ static void Cmd_setuserstatus3(void); static void Cmd_assistattackselect(void); static void Cmd_trysetmagiccoat(void); static void Cmd_trysetsnatch(void); -static void Cmd_trygetintimidatetarget(void); +static void Cmd_unused2(void); static void Cmd_switchoutabilities(void); static void Cmd_jumpifhasnohp(void); static void Cmd_getsecretpowereffect(void); @@ -803,7 +803,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = Cmd_assistattackselect, //0xDE Cmd_trysetmagiccoat, //0xDF Cmd_trysetsnatch, //0xE0 - Cmd_trygetintimidatetarget, //0xE1 + Cmd_unused2, //0xE1 Cmd_switchoutabilities, //0xE2 Cmd_jumpifhasnohp, //0xE3 Cmd_getsecretpowereffect, //0xE4 @@ -6788,7 +6788,6 @@ static void Cmd_switchineffects(void) if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0) || ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE) - || AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE2, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE2, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_WEATHER_FORM, 0, 0, 0, 0)) return; @@ -8474,8 +8473,7 @@ static void Cmd_various(void) else gBattleCommunication[0] = FALSE; break; - case VARIOUS_RESET_INTIMIDATE_TRACE_BITS: - gSpecialStatuses[gActiveBattler].intimidatedMon = FALSE; + case VARIOUS_RESET_SWITCH_IN_ABILITY_BITS: gSpecialStatuses[gActiveBattler].traced = FALSE; gSpecialStatuses[gActiveBattler].switchInAbilityDone = FALSE; break; @@ -8639,7 +8637,6 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 3; AbilityBattleEffects(ABILITYEFFECT_NEUTRALIZINGGAS, gActiveBattler, 0, 0, 0); AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0); - AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE2, gActiveBattler, 0, 0, 0); AbilityBattleEffects(ABILITYEFFECT_TRACE2, gActiveBattler, 0, 0, 0); return; case VARIOUS_SAVE_TARGET: @@ -13542,27 +13539,8 @@ static void Cmd_trysetsnatch(void) } } -static void Cmd_trygetintimidatetarget(void) +static void Cmd_unused2(void) { - u8 side; - - gBattleScripting.battler = gBattleStruct->intimidateBattler; - side = GetBattlerSide(gBattleScripting.battler); - - PREPARE_ABILITY_BUFFER(gBattleTextBuff1, gBattleMons[gBattleScripting.battler].ability) - - for (;gBattlerTarget < gBattlersCount; gBattlerTarget++) - { - if (GetBattlerSide(gBattlerTarget) == side) - continue; - if (!(gAbsentBattlerFlags & gBitTable[gBattlerTarget])) - break; - } - - if (gBattlerTarget >= gBattlersCount) - gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1); - else - gBattlescriptCurrInstr += 5; } static void Cmd_switchoutabilities(void) diff --git a/src/battle_util.c b/src/battle_util.c index d8ec3f079..614912df9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -4779,10 +4779,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } break; case ABILITY_INTIMIDATE: - if (!(gSpecialStatuses[battler].intimidatedMon)) + if (!gSpecialStatuses[battler].switchInAbilityDone) { - gBattleResources->flags->flags[battler] |= RESOURCE_FLAG_INTIMIDATED; - gSpecialStatuses[battler].intimidatedMon = TRUE; + gSpecialStatuses[battler].switchInAbilityDone = TRUE; + SET_STATCHANGER(STAT_ATK, 1, TRUE); + BattleScriptPushCursorAndCallback(BattleScript_IntimidateActivates); + effect++; } break; case ABILITY_FORECAST: @@ -5957,30 +5959,6 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move } } break; - case ABILITYEFFECT_INTIMIDATE1: - case ABILITYEFFECT_INTIMIDATE2: - for (i = 0; i < gBattlersCount; i++) - { - if (GetBattlerAbility(i) == ABILITY_INTIMIDATE && gBattleResources->flags->flags[i] & RESOURCE_FLAG_INTIMIDATED - && (IsBattlerAlive(BATTLE_OPPOSITE(i)) || IsBattlerAlive(BATTLE_PARTNER(BATTLE_OPPOSITE(i))))) // At least one opposing mon has to be alive. - { - gBattleResources->flags->flags[i] &= ~RESOURCE_FLAG_INTIMIDATED; - gLastUsedAbility = ABILITY_INTIMIDATE; - if (caseID == ABILITYEFFECT_INTIMIDATE1) - { - BattleScriptPushCursorAndCallback(BattleScript_IntimidateActivatesEnd3); - } - else - { - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_IntimidateActivates; - } - battler = gBattlerAbility = gBattleStruct->intimidateBattler = i; - effect++; - break; - } - } - break; case ABILITYEFFECT_TRACE1: case ABILITYEFFECT_TRACE2: for (i = 0; i < gBattlersCount; i++)