diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index c227391ca..8f3cfb657 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3044,17 +3044,17 @@ AI_TrySkillSwapOnAlly: end AI_TrySkillSwapOnAlly2: - if_not_equal 14, Score_Minus30_ - if_has_move AI_USER_PARTNER, MOVE_FIRE_BLAST, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_THUNDER, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_CROSS_CHOP, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_HYDRO_PUMP, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_DYNAMIC_PUNCH, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_BLIZZARD, AI_TrySkillSwapOnAllyEnd - if_has_move AI_USER_PARTNER, MOVE_MEGAHORN, AI_TrySkillSwapOnAllyEnd + if_not_equal ABILITY_COMPOUND_EYES, Score_Minus30_ + if_has_move AI_USER_PARTNER, MOVE_FIRE_BLAST, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_THUNDER, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_CROSS_CHOP, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_HYDRO_PUMP, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_DYNAMIC_PUNCH, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_BLIZZARD, AI_TrySkillSwapOnAllyPlus3 + if_has_move AI_USER_PARTNER, MOVE_MEGAHORN, AI_TrySkillSwapOnAllyPlus3 goto Score_Minus30_ -AI_TrySkillSwapOnAllyEnd: +AI_TrySkillSwapOnAllyPlus3: goto Score_Plus3 AI_TryStatusOnAlly: diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2125fc47e..fec030bb5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -399,19 +399,19 @@ BattleScript_EffectExplosion:: faintifabilitynotdamp setatkhptozero waitstate - jumpifbyte CMP_NO_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_MISSED, BattleScript_82D8B94 - call BattleScript_82D8BEA - goto BattleScript_82D8B96 -BattleScript_82D8B94:: + jumpifbyte CMP_NO_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_MISSED, BattleScript_ExplosionDoAnimStartLoop + call BattleScript_PreserveMissedBitDoMoveAnim + goto BattleScript_ExplosionLoop +BattleScript_ExplosionDoAnimStartLoop: attackanimation waitanimation -BattleScript_82D8B96:: +BattleScript_ExplosionLoop: movevaluescleanup critcalc damagecalc typecalc adjustnormaldamage - accuracycheck BattleScript_82D8BCF, ACC_CURR_MOVE + accuracycheck BattleScript_ExplosionMissed, ACC_CURR_MOVE effectivenesssound hitanimation BS_TARGET waitstate @@ -424,20 +424,20 @@ BattleScript_82D8B96:: tryfaintmon BS_TARGET, FALSE, NULL setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 - jumpifnexttargetvalid BattleScript_82D8B96 + jumpifnexttargetvalid BattleScript_ExplosionLoop tryfaintmon BS_ATTACKER, FALSE, NULL end -BattleScript_82D8BCF:: +BattleScript_ExplosionMissed: effectivenesssound resultmessage waitmessage 0x40 setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 - jumpifnexttargetvalid BattleScript_82D8B96 + jumpifnexttargetvalid BattleScript_ExplosionLoop tryfaintmon BS_ATTACKER, FALSE, NULL end -BattleScript_82D8BEA:: +BattleScript_PreserveMissedBitDoMoveAnim: bicbyte gMoveResultFlags, MOVE_RESULT_MISSED attackanimation waitanimation @@ -446,14 +446,14 @@ BattleScript_82D8BEA:: BattleScript_EffectDreamEater:: attackcanceler - jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_82D8C0E - jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_82D8C18 -BattleScript_82D8C0E:: + jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_DreamEaterNoEffect + jumpifstatus BS_TARGET, STATUS1_SLEEP, BattleScript_DreamEaterWorked +BattleScript_DreamEaterNoEffect: attackstring ppreduce waitmessage 0x40 goto BattleScript_WasntAffected -BattleScript_82D8C18:: +BattleScript_DreamEaterWorked: accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring ppreduce @@ -479,7 +479,7 @@ BattleScript_82D8C18:: jumpifmovehadnoeffect BattleScript_DreamEaterTryFaintEnd printstring STRINGID_PKMNDREAMEATEN waitmessage 0x40 -BattleScript_DreamEaterTryFaintEnd:: +BattleScript_DreamEaterTryFaintEnd: tryfaintmon BS_TARGET, FALSE, NULL goto BattleScript_MoveEnd @@ -606,9 +606,9 @@ BattleScript_EffectRampage:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE attackstring - jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_82D8DAE + jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_EffectRampage2 ppreduce -BattleScript_82D8DAE:: +BattleScript_EffectRampage2: confuseifrepeatingattackends goto BattleScript_HitFromCritCalc @@ -2297,8 +2297,7 @@ BattleScript_EffectSmellingsalt:: setmoveeffect MOVE_EFFECT_REMOVE_PARALYSIS | MOVE_EFFECT_CERTAIN jumpifstatus BS_TARGET, STATUS1_PARALYSIS, BattleScript_SmellingsaltDoubleDmg goto BattleScript_EffectHit - -BattleScript_SmellingsaltDoubleDmg:: +BattleScript_SmellingsaltDoubleDmg: setbyte sDMG_MULTIPLIER, 0x2 goto BattleScript_EffectHit @@ -2593,7 +2592,7 @@ BattleScript_EffectSecretPower:: goto BattleScript_EffectHit BattleScript_EffectDoubleEdge:: - setmoveeffect MOVE_EFFECT_RECOIL_33_PARALYSIS | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN + setmoveeffect MOVE_EFFECT_RECOIL_33 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN goto BattleScript_EffectHit BattleScript_EffectTeeterDance:: @@ -3050,12 +3049,12 @@ BattleScript_82DAA83:: BattleScript_FrontierTrainerBattleWon:: jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_PayDayMoneyAndPickUpItems - jumpifbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAAAB + jumpifbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_FrontierTrainerBattleWon_TwoDefeated printstring STRINGID_PLAYERDEFEATEDTRAINER1 - goto BattleScript_82DAAAE -BattleScript_82DAAAB:: + goto BattleScript_FrontierTrainerBattleWon_LoseTexts +BattleScript_FrontierTrainerBattleWon_TwoDefeated: printstring STRINGID_TWOENEMIESDEFEATED -BattleScript_82DAAAE:: +BattleScript_FrontierTrainerBattleWon_LoseTexts: trainerslidein BS_ATTACKER waitstate printstring STRINGID_TRAINER1LOSETEXT @@ -3065,10 +3064,10 @@ BattleScript_82DAAAE:: trainerslidein BS_FAINTED waitstate printstring STRINGID_TRAINER2LOSETEXT -BattleScript_82DAACB:: - jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_82DAADA +BattleScript_82DAACB: + jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_FrontierTrainerBattleWon_End pickup -BattleScript_82DAADA:: +BattleScript_FrontierTrainerBattleWon_End: end2 BattleScript_SmokeBallEscape:: @@ -3172,7 +3171,7 @@ BattleScript_PursuitDmgOnSwitchOut:: jumpifbyte CMP_EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet setbyte sGIVEEXP_STATE, 0x0 getexp BS_TARGET -BattleScript_PursuitDmgOnSwitchOutRet:: +BattleScript_PursuitDmgOnSwitchOutRet: return BattleScript_Pausex20:: @@ -3968,17 +3967,17 @@ BattleScript_MoveEffectConfusion:: waitmessage 0x40 return -BattleScript_MoveEffectRecoil33:: - jumpifmove MOVE_STRUGGLE, BattleScript_DoRecoil33 - jumpifability BS_ATTACKER, ABILITY_ROCK_HEAD, BattleScript_Recoil33End -BattleScript_DoRecoil33:: +BattleScript_MoveEffectRecoil:: + jumpifmove MOVE_STRUGGLE, BattleScript_DoRecoil + jumpifability BS_ATTACKER, ABILITY_ROCK_HEAD, BattleScript_RecoilEnd +BattleScript_DoRecoil:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER printstring STRINGID_PKMNHITWITHRECOIL waitmessage 0x40 tryfaintmon BS_ATTACKER, FALSE, NULL -BattleScript_Recoil33End:: +BattleScript_RecoilEnd:: return BattleScript_ItemSteal:: @@ -4048,38 +4047,37 @@ BattleScript_82DB4AF:: waitmessage 0x40 return -BattleScript_82DB4B8:: - call BattleScript_82DB4BE +BattleScript_IntimidateActivatesEnd3:: + call BattleScript_PauseIntimidateActivates end3 -BattleScript_82DB4BE:: +BattleScript_PauseIntimidateActivates: pause 0x20 -BattleScript_82DB4C1:: +BattleScript_IntimidateActivates:: setbyte gBattlerTarget, 0x0 setstatchanger STAT_ATK, 1, TRUE -BattleScript_82DB4CD:: - trygetintimidatetarget BattleScript_82DB51B - jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_82DB510 - jumpifability BS_TARGET, ABILITY_CLEAR_BODY, BattleScript_82DB51C - jumpifability BS_TARGET, ABILITY_HYPER_CUTTER, BattleScript_82DB51C - jumpifability BS_TARGET, ABILITY_WHITE_SMOKE, BattleScript_82DB51C - statbuffchange 0x21, BattleScript_82DB510 - jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_82DB510 +BattleScript_IntimidateActivatesLoop: + trygetintimidatetarget BattleScript_IntimidateActivatesReturn + jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_IntimidateActivatesLoopIncrement + 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 0x21, BattleScript_IntimidateActivatesLoopIncrement + jumpifbyte CMP_GREATER_THAN, cMULTISTRING_CHOOSER, 0x1, BattleScript_IntimidateActivatesLoopIncrement setgraphicalstatchangevalues playanimation BS_TARGET, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1 printstring STRINGID_PKMNCUTSATTACKWITH waitmessage 0x40 -BattleScript_82DB510:: +BattleScript_IntimidateActivatesLoopIncrement: addbyte gBattlerTarget, 0x1 - goto BattleScript_82DB4CD -BattleScript_82DB51B:: + goto BattleScript_IntimidateActivatesLoop +BattleScript_IntimidateActivatesReturn: return - -BattleScript_82DB51C:: +BattleScript_IntimidatePrevented: pause 0x20 printstring STRINGID_PREVENTEDFROMWORKING waitmessage 0x40 - goto BattleScript_82DB510 + goto BattleScript_IntimidateActivatesLoopIncrement BattleScript_DroughtActivates:: pause 0x20 @@ -4252,7 +4250,7 @@ BattleScript_AbilityCuredStatus:: updatestatusicon BS_SCRIPTING return -BattleScript_82DB695:: +BattleScript_IgnoresWhileAsleep:: printstring STRINGID_PKMNIGNORESASLEEP waitmessage 0x40 setbyte sMOVEEND_STATE, 0x0 @@ -4285,7 +4283,7 @@ BattleScript_IgnoresAndFallsAsleep:: moveend 0x2, 0x10 end -BattleScript_82DB6F0:: +BattleScript_IgnoresAndHitsItself:: printstring STRINGID_PKMNWONTOBEY waitmessage 0x40 goto BattleScript_DoSelfConfusionDmg @@ -4463,7 +4461,7 @@ BattleScript_ActionSelectionItemsCantBeUsed:: printselectionstring STRINGID_ITEMSCANTBEUSEDNOW endselectionscript -BattleScript_82DB87D:: +BattleScript_FlushMessageBox:: printstring STRINGID_EMPTYSTRING3 return diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 1197dfb6e..a52d256fc 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -26,16 +26,9 @@ extern const u8 BattleScript_LocalBattleLost[]; extern const u8 BattleScript_LocalBattleLostPrintWhiteOut[]; extern const u8 BattleScript_LocalBattleLostEnd[]; extern const u8 BattleScript_CheckDomeDrew[]; -extern const u8 BattleScript_82DAA0B[]; -extern const u8 BattleScript_82DAA31[]; +extern const u8 BattleScript_FlushMessageBox[]; extern const u8 BattleScript_LinkBattleWonOrLost[]; -extern const u8 BattleScript_82DAA5C[]; -extern const u8 BattleScript_82DAA83[]; extern const u8 BattleScript_FrontierTrainerBattleWon[]; -extern const u8 BattleScript_82DAAAB[]; -extern const u8 BattleScript_82DAAAE[]; -extern const u8 BattleScript_82DAACB[]; -extern const u8 BattleScript_82DAADA[]; extern const u8 BattleScript_SmokeBallEscape[]; extern const u8 BattleScript_RanAwayUsingMonAbility[]; extern const u8 BattleScript_GotAwaySafely[]; @@ -45,11 +38,6 @@ extern const u8 BattleScript_PrintFailedToRunString[]; extern const u8 BattleScript_PrintCantEscapeFromBattle[]; extern const u8 BattleScript_PrintFullBox[]; extern const u8 BattleScript_ActionSwitch[]; -extern const u8 BattleScript_82DAB35[]; -extern const u8 BattleScript_82DAB37[]; -extern const u8 BattleScript_82DAB44[]; -extern const u8 BattleScript_82DAB77[]; -extern const u8 BattleScript_82DABB8[]; extern const u8 BattleScript_Pausex20[]; extern const u8 BattleScript_LevelUp[]; extern const u8 BattleScript_RainContinuesOrEnds[]; @@ -62,13 +50,10 @@ extern const u8 BattleScript_SideStatusWoreOff[]; extern const u8 BattleScript_SafeguardProtected[]; extern const u8 BattleScript_SafeguardEnds[]; extern const u8 BattleScript_LeechSeedTurnDrain[]; -extern const u8 BattleScript_82DAD47[]; -extern const u8 BattleScript_82DAD4D[]; extern const u8 BattleScript_BideStoringEnergy[]; extern const u8 BattleScript_BideAttack[]; extern const u8 BattleScript_BideNoEnergyToAttack[]; extern const u8 BattleScript_SuccessForceOut[]; -extern const u8 BattleScript_82DADF1[]; extern const u8 BattleScript_MistProtected[]; extern const u8 BattleScript_RageIsBuilding[]; extern const u8 BattleScript_MoveUsedIsDisabled[]; @@ -79,32 +64,16 @@ extern const u8 BattleScript_SelectingUnusableMoveInPalace[]; extern const u8 BattleScript_EncoredNoMore[]; extern const u8 BattleScript_DestinyBondTakesLife[]; extern const u8 BattleScript_SpikesOnAttacker[]; -extern const u8 BattleScript_82DAE7A[]; extern const u8 BattleScript_SpikesOnTarget[]; -extern const u8 BattleScript_82DAEB1[]; extern const u8 BattleScript_SpikesOnFaintedBattler[]; -extern const u8 BattleScript_82DAEE8[]; -extern const u8 BattleScript_82DAEFE[]; extern const u8 BattleScript_PerishSongTakesLife[]; extern const u8 BattleScript_PerishSongCountGoesDown[]; extern const u8 BattleScript_AllStatsUp[]; -extern const u8 BattleScript_82DAF54[]; -extern const u8 BattleScript_82DAF72[]; -extern const u8 BattleScript_82DAF86[]; -extern const u8 BattleScript_82DAF9A[]; -extern const u8 BattleScript_82DAFAE[]; -extern const u8 BattleScript_82DAFC2[]; extern const u8 BattleScript_RapidSpinAway[]; extern const u8 BattleScript_WrapFree[]; extern const u8 BattleScript_LeechSeedFree[]; extern const u8 BattleScript_SpikesFree[]; extern const u8 BattleScript_MonTookFutureAttack[]; -extern const u8 BattleScript_82DB001[]; -extern const u8 BattleScript_82DB008[]; -extern const u8 BattleScript_82DB020[]; -extern const u8 BattleScript_82DB027[]; -extern const u8 BattleScript_82DB03F[]; -extern const u8 BattleScript_82DB058[]; extern const u8 BattleScript_NoMovesLeft[]; extern const u8 BattleScript_SelectingMoveWithNoPP[]; extern const u8 BattleScript_NoPPForMove[]; @@ -117,8 +86,6 @@ extern const u8 BattleScript_SelectingNotAllowedMoveTauntInPalace[]; extern const u8 BattleScript_WishComesTrue[]; extern const u8 BattleScript_IngrainTurnHeal[]; extern const u8 BattleScript_AtkDefDown[]; -extern const u8 BattleScript_82DB144[]; -extern const u8 BattleScript_82DB167[]; extern const u8 BattleScript_KnockedOff[]; extern const u8 BattleScript_MoveUsedIsImprisoned[]; extern const u8 BattleScript_SelectingImprisionedMove[]; @@ -129,15 +96,11 @@ extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_EnduredMsg[]; extern const u8 BattleScript_OneHitKOMsg[]; extern const u8 BattleScript_SAtkDown2[]; -extern const u8 BattleScript_82DB1FE[]; extern const u8 BattleScript_FocusPunchSetUp[]; extern const u8 BattleScript_MoveUsedIsAsleep[]; extern const u8 BattleScript_MoveUsedWokeUp[]; extern const u8 BattleScript_MonWokeUpInUproar[]; extern const u8 BattleScript_PoisonTurnDmg[]; -extern const u8 BattleScript_82DB243[]; -extern const u8 BattleScript_82DB245[]; -extern const u8 BattleScript_82DB25E[]; extern const u8 BattleScript_BurnTurnDmg[]; extern const u8 BattleScript_MoveUsedIsFrozen[]; extern const u8 BattleScript_MoveUsedUnfroze[]; @@ -147,8 +110,6 @@ extern const u8 BattleScript_MoveUsedFlinched[]; extern const u8 BattleScript_PrintUproarOverTurns[]; extern const u8 BattleScript_ThrashConfuses[]; extern const u8 BattleScript_MoveUsedIsConfused[]; -extern const u8 BattleScript_82DB2D4[]; -extern const u8 BattleScript_82DB2FF[]; extern const u8 BattleScript_MoveUsedIsConfusedNoMore[]; extern const u8 BattleScript_PrintPayDayMoneyString[]; extern const u8 BattleScript_WrapTurnDmg[]; @@ -159,7 +120,6 @@ extern const u8 BattleScript_NightmareTurnDmg[]; extern const u8 BattleScript_CurseTurnDmg[]; extern const u8 BattleScript_TargetPRLZHeal[]; extern const u8 BattleScript_MoveEffectSleep[]; -extern const u8 BattleScript_82DB374[]; extern const u8 BattleScript_YawnMakesAsleep[]; extern const u8 BattleScript_MoveEffectPoison[]; extern const u8 BattleScript_MoveEffectBurn[]; @@ -170,7 +130,7 @@ extern const u8 BattleScript_MoveEffectToxic[]; extern const u8 BattleScript_MoveEffectPayDay[]; extern const u8 BattleScript_MoveEffectWrap[]; extern const u8 BattleScript_MoveEffectConfusion[]; -extern const u8 BattleScript_MoveEffectRecoil33[]; +extern const u8 BattleScript_MoveEffectRecoil[]; extern const u8 BattleScript_DoRecoil33[]; extern const u8 BattleScript_Recoil33End[]; extern const u8 BattleScript_ItemSteal[]; @@ -183,14 +143,8 @@ extern const u8 BattleScript_ShedSkinActivates[]; extern const u8 BattleScript_WeatherFormChanges[]; extern const u8 BattleScript_WeatherFormChangesLoop[]; extern const u8 BattleScript_CastformChange[]; -extern const u8 BattleScript_82DB4AF[]; -extern const u8 BattleScript_82DB4B8[]; -extern const u8 BattleScript_82DB4BE[]; -extern const u8 BattleScript_82DB4C1[]; -extern const u8 BattleScript_82DB4CD[]; -extern const u8 BattleScript_82DB510[]; -extern const u8 BattleScript_82DB51B[]; -extern const u8 BattleScript_82DB51C[]; +extern const u8 BattleScript_IntimidateActivatesEnd3[]; +extern const u8 BattleScript_IntimidateActivates[]; extern const u8 BattleScript_DroughtActivates[]; extern const u8 BattleScript_TookAttack[]; extern const u8 BattleScript_SturdyPreventsOHKO[]; @@ -218,12 +172,11 @@ extern const u8 BattleScript_ApplySecondaryEffect[]; extern const u8 BattleScript_SynchronizeActivates[]; extern const u8 BattleScript_NoItemSteal[]; extern const u8 BattleScript_AbilityCuredStatus[]; -extern const u8 BattleScript_82DB695[]; +extern const u8 BattleScript_IgnoresWhileAsleep[]; extern const u8 BattleScript_IgnoresAndUsesRandomMove[]; extern const u8 BattleScript_MoveUsedLoafingAround[]; -extern const u8 BattleScript_82DB6C7[]; extern const u8 BattleScript_IgnoresAndFallsAsleep[]; -extern const u8 BattleScript_82DB6F0[]; +extern const u8 BattleScript_IgnoresAndHitsItself[]; extern const u8 BattleScript_SubstituteFade[]; extern const u8 BattleScript_BerryCurePrlzEnd2[]; extern const u8 BattleScript_BerryCureParRet[]; @@ -249,18 +202,11 @@ extern const u8 BattleScript_SelectingNotAllowedMoveChoiceItem[]; extern const u8 BattleScript_HangedOnMsg[]; extern const u8 BattleScript_BerryConfuseHealEnd2[]; extern const u8 BattleScript_BerryStatRaiseEnd2[]; -extern const u8 BattleScript_82DB85B[]; extern const u8 BattleScript_BerryFocusEnergyEnd2[]; extern const u8 BattleScript_ActionSelectionItemsCantBeUsed[]; -extern const u8 BattleScript_82DB87D[]; -extern const u8 BattleScript_82DB881[]; -extern const u8 BattleScript_82DB887[]; -extern const u8 BattleScript_82DB89D[]; extern const u8 BattleScript_ArenaTurnBeginning[]; -extern const u8 BattleScript_82DB8E0[]; +extern const u8 BattleScript_82DB881[]; extern const u8 BattleScript_82DB8F3[]; -extern const u8 BattleScript_82DB973[]; -extern const u8 BattleScript_82DB992[]; extern const u8 BattleScript_AskIfWantsToForfeitMatch[]; extern const u8 BattleScript_PrintPlayerForfeited[]; extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[]; @@ -268,23 +214,12 @@ extern const u8 BattleScript_BallThrow[]; extern const u8 BattleScript_BallThrowByWally[]; extern const u8 BattleScript_SafariBallThrow[]; extern const u8 BattleScript_SuccessBallThrow[]; -extern const u8 BattleScript_82DBD92[]; -extern const u8 BattleScript_82DBDA5[]; -extern const u8 BattleScript_82DBDC2[]; -extern const u8 BattleScript_82DBDC3[]; extern const u8 BattleScript_WallyBallThrow[]; extern const u8 BattleScript_ShakeBallThrow[]; -extern const u8 BattleScript_82DBE01[]; extern const u8 BattleScript_TrainerBallBlock[]; -extern const u8 BattleScript_82DBE12[]; -extern const u8 BattleScript_82DBE1C[]; -extern const u8 BattleScript_82DBE4B[]; -extern const u8 BattleScript_82DBE6F[]; -extern const u8 BattleScript_82DBE91[]; extern const u8 BattleScript_RunByUsingItem[]; extern const u8 BattleScript_ActionWatchesCarefully[]; extern const u8 BattleScript_ActionGetNear[]; extern const u8 BattleScript_ActionThrowPokeblock[]; -extern const u8 BattleScript_82DBEE3[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/battle_util.h b/include/battle_util.h index be9b5f1fe..b3fff196e 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_CONTACT 0x4 +#define ABILITYEFFECT_MOVE_END 0x4 #define ABILITYEFFECT_IMMUNITY 0x5 #define ABILITYEFFECT_FORECAST 0x6 #define ABILITYEFFECT_SYNCHRONIZE 0x7 @@ -35,6 +35,8 @@ #define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) #define ITEMEFFECT_ON_SWITCH_IN 0x0 +#define ITEMEFFECT_MOVE_END 0x3 +#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4 #define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK))) #define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK))) diff --git a/include/constants/battle.h b/include/constants/battle.h index b3f9d919a..e5ca9d7ae 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -252,7 +252,7 @@ #define MOVE_EFFECT_RAPIDSPIN 0x23 #define MOVE_EFFECT_REMOVE_PARALYSIS 0x24 #define MOVE_EFFECT_ATK_DEF_DOWN 0x25 -#define MOVE_EFFECT_RECOIL_33_PARALYSIS 0x26 +#define MOVE_EFFECT_RECOIL_33 0x26 #define MOVE_EFFECT_ATK_PLUS_2 0x27 #define MOVE_EFFECT_DEF_PLUS_2 0x28 #define MOVE_EFFECT_SPD_PLUS_2 0x29 diff --git a/src/battle_main.c b/src/battle_main.c index c31fb48d5..be6f789ec 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3888,7 +3888,7 @@ static void TryDoEventsBeforeFirstTurn(void) // Check all switch in items having effect from the fastest mon to slowest. while (gBattleStruct->switchInItemsCounter < gBattlersCount) { - if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], 0) != 0) + if (ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gBattlerByTurnOrder[gBattleStruct->switchInItemsCounter], FALSE)) effect++; gBattleStruct->switchInItemsCounter++; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 12a66df80..44194deda 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -700,7 +700,7 @@ static const u8* const sMoveEffectBS_Ptrs[] = BattleScript_MoveEffectPayDay, // MOVE_EFFECT_PAYDAY BattleScript_MoveEffectSleep, // MOVE_EFFECT_CHARGING BattleScript_MoveEffectWrap, // MOVE_EFFECT_WRAP - BattleScript_MoveEffectRecoil33, // MOVE_EFFECT_RECOIL_25 + BattleScript_MoveEffectRecoil, // MOVE_EFFECT_RECOIL_25 BattleScript_MoveEffectSleep, // MOVE_EFFECT_ATK_PLUS_1 BattleScript_MoveEffectSleep, // MOVE_EFFECT_DEF_PLUS_1 BattleScript_MoveEffectSleep, // MOVE_EFFECT_SPD_PLUS_1 @@ -724,7 +724,7 @@ static const u8* const sMoveEffectBS_Ptrs[] = BattleScript_MoveEffectSleep, // MOVE_EFFECT_RAPIDSPIN BattleScript_MoveEffectSleep, // MOVE_EFFECT_REMOVE_PARALYSIS BattleScript_MoveEffectSleep, // MOVE_EFFECT_ATK_DEF_DOWN - BattleScript_MoveEffectRecoil33, // MOVE_EFFECT_RECOIL_33_PARALYSIS + BattleScript_MoveEffectRecoil, // MOVE_EFFECT_RECOIL_33 }; static const struct WindowTemplate sUnusedWinTemplate = {0, 1, 3, 7, 0xF, 0x1F, 0x3F}; @@ -2843,7 +2843,7 @@ void SetMoveEffect(bool8 primary, u8 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_AtkDefDown; break; - case MOVE_EFFECT_RECOIL_33_PARALYSIS: // Volt Tackle + case MOVE_EFFECT_RECOIL_33: // Double Edge gBattleMoveDamage = gHpDealt / 3; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1; @@ -4497,20 +4497,38 @@ static void atk48_playstatchangeanimation(void) } } -#define ATK49_LAST_CASE 17 +enum +{ + ATK49_RAGE, + ATK49_DEFROST, + ATK49_SYNCHRONIZE_TARGET, + ATK49_MOVE_END_ABILITIES, + ATK49_STATUS_IMMUNITY_ABILITIES, + ATK49_SYNCHRONIZE_ATTACKER, + ATK49_CHOICE_MOVE, + ATK49_CHANGED_ITEMS, + ATK49_ATTACKER_INVISIBLE, + ATK49_ATTACKER_VISIBLE, + ATK49_TARGET_VISIBLE, + ATK49_ITEM_EFFECTS_ALL, + ATK49_KINGSROCK_SHELLBELL, + ATK49_SUBSTITUTE, + ATK49_UPDATE_LAST_MOVES, + ATK49_MIRROR_MOVE, + ATK49_NEXT_TARGET, + ATK49_COUNT, +}; static void atk49_moveend(void) { s32 i; - bool32 effect; - u8 moveType; - u8 holdEffectAtk; - u16 *choicedMoveAtk; + bool32 effect = FALSE; + u8 moveType = 0; + u8 holdEffectAtk = 0; + u16 *choicedMoveAtk = NULL; u8 arg1, arg2; u16 originallyUsedMove; - effect = FALSE; - if (gChosenMove == 0xFFFF) originallyUsedMove = 0; else @@ -4531,7 +4549,7 @@ static void atk49_moveend(void) { switch (gBattleScripting.atk49_state) { - case 0: // rage check + case ATK49_RAGE: // rage check if (gBattleMons[gBattlerTarget].status2 & STATUS2_RAGE && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) @@ -4545,7 +4563,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 1: // defrosting check + case ATK49_DEFROST: // defrosting check if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE && gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget && gSpecialStatuses[gBattlerTarget].specialDmg @@ -4561,28 +4579,28 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 2: // target synchronize + case ATK49_SYNCHRONIZE_TARGET: // target synchronize if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattlerTarget, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; - case 3: // contact abilities - if (AbilityBattleEffects(ABILITYEFFECT_CONTACT, gBattlerTarget, 0, 0, 0)) + case ATK49_MOVE_END_ABILITIES: // Such as abilities activating on contact(Poison Spore, Rough Skin, etc.). + if (AbilityBattleEffects(ABILITYEFFECT_MOVE_END, gBattlerTarget, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; - case 4: // status immunities + case ATK49_STATUS_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 gBattleScripting.atk49_state++; break; - case 5: // attacker synchronize + case ATK49_SYNCHRONIZE_ATTACKER: // attacker synchronize if (AbilityBattleEffects(ABILITYEFFECT_ATK_SYNCHRONIZE, gBattlerAttacker, 0, 0, 0)) effect = TRUE; gBattleScripting.atk49_state++; break; - case 6: // update choice band move + case ATK49_CHOICE_MOVE: // update choice band move if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND || gChosenMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF)) goto LOOP; @@ -4605,7 +4623,7 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; } break; - case 7: // changed held items + case ATK49_CHANGED_ITEMS: // changed held items for (i = 0; i < gBattlersCount; i++) { u16* changedItem = &gBattleStruct->changedItems[i]; @@ -4617,18 +4635,18 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 11: // item effects for all battlers - if (ItemBattleEffects(3, 0, FALSE)) + case ATK49_ITEM_EFFECTS_ALL: // item effects for all battlers + if (ItemBattleEffects(ITEMEFFECT_MOVE_END, 0, FALSE)) effect = TRUE; else gBattleScripting.atk49_state++; break; - case 12: // king's rock and shell bell - if (ItemBattleEffects(4, 0, FALSE)) + case ATK49_KINGSROCK_SHELLBELL: // king's rock and shell bell + if (ItemBattleEffects(ITEMEFFECT_KINGSROCK_SHELLBELL, 0, FALSE)) effect = TRUE; gBattleScripting.atk49_state++; break; - case 8: // make attacker sprite invisible + case ATK49_ATTACKER_INVISIBLE: // make attacker sprite invisible if (gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE) && gHitMarker & HITMARKER_NO_ANIMATIONS) { @@ -4640,7 +4658,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 9: // make attacker sprite visible + case ATK49_ATTACKER_VISIBLE: // make attacker sprite visible if (gMoveResultFlags & MOVE_RESULT_NO_EFFECT || !(gStatuses3[gBattlerAttacker] & (STATUS3_SEMI_INVULNERABLE)) || WasUnableToUseMove(gBattlerAttacker)) @@ -4655,7 +4673,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 10: // make target sprite visible + case ATK49_TARGET_VISIBLE: // make target sprite visible if (!gSpecialStatuses[gBattlerTarget].restoredBattlerSprite && gBattlerTarget < gBattlersCount && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) { @@ -4668,7 +4686,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 13: // update substitute + case ATK49_SUBSTITUTE: // update substitute for (i = 0; i < gBattlersCount; i++) { if (gDisableStructs[i].substituteHP == 0) @@ -4676,7 +4694,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 14: // This case looks interesting, although I am not certain what it does. Probably fine tunes edge cases. + case ATK49_UPDATE_LAST_MOVES: if (gHitMarker & HITMARKER_SWAP_ATTACKER_TARGET) { gActiveBattler = gBattlerAttacker; @@ -4725,7 +4743,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 15: // mirror move + case ATK49_MIRROR_MOVE: // mirror move if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker]) && !(gBattleStruct->field_91 & gBitTable[gBattlerAttacker]) && gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED && gHitMarker & HITMARKER_OBEYS && gBattlerAttacker != gBattlerTarget && !(gHitMarker & HITMARKER_FAINTED(gBattlerTarget)) @@ -4746,7 +4764,7 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case 16: // + case ATK49_NEXT_TARGET: // For moves hitting two opposing Pokemon. if (!(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE) && gBattleTypeFlags & BATTLE_TYPE_DOUBLE && !gProtectStructs[gBattlerAttacker].chargingTurn && gBattleMoves[gCurrentMove].target == MOVE_TARGET_BOTH && !(gHitMarker & HITMARKER_NO_ATTACKSTRING)) @@ -4759,7 +4777,7 @@ static void atk49_moveend(void) gBattleScripting.atk49_state = 0; MoveValuesCleanUp(); BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); - gBattlescriptCurrInstr = BattleScript_82DB87D; + gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } else @@ -4769,18 +4787,18 @@ static void atk49_moveend(void) } gBattleScripting.atk49_state++; break; - case ATK49_LAST_CASE: + case ATK49_COUNT: break; } if (arg1 == 1 && effect == FALSE) - gBattleScripting.atk49_state = ATK49_LAST_CASE; + gBattleScripting.atk49_state = ATK49_COUNT; if (arg1 == 2 && arg2 == gBattleScripting.atk49_state) - gBattleScripting.atk49_state = ATK49_LAST_CASE; + gBattleScripting.atk49_state = ATK49_COUNT; - } while (gBattleScripting.atk49_state != ATK49_LAST_CASE && effect == FALSE); + } while (gBattleScripting.atk49_state != ATK49_COUNT && effect == FALSE); - if (gBattleScripting.atk49_state == ATK49_LAST_CASE && effect == FALSE) + if (gBattleScripting.atk49_state == ATK49_COUNT && effect == FALSE) gBattlescriptCurrInstr += 3; } @@ -5550,8 +5568,8 @@ static void atk52_switchineffects(void) gDisableStructs[gActiveBattler].truantUnknownBit = 0; - if (AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0) == 0 && - ItemBattleEffects(0, gActiveBattler, 0) == 0) + if (!AbilityBattleEffects(ABILITYEFFECT_ON_SWITCHIN, gActiveBattler, 0, 0, 0) + && !ItemBattleEffects(ITEMEFFECT_ON_SWITCH_IN, gActiveBattler, FALSE)) { gSideStatuses[GetBattlerSide(gActiveBattler)] &= ~(SIDE_STATUS_SPIKES_DAMAGED); diff --git a/src/battle_util.c b/src/battle_util.c index 875244d79..5096a2f3a 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -821,12 +821,12 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS1: // item effects - if (ItemBattleEffects(1, gActiveBattler, 0)) + if (ItemBattleEffects(1, gActiveBattler, FALSE)) effect++; gBattleStruct->turnEffectsTracker++; break; case ENDTURN_ITEMS2: // item effects again - if (ItemBattleEffects(1, gActiveBattler, 1)) + if (ItemBattleEffects(1, gActiveBattler, TRUE)) effect++; gBattleStruct->turnEffectsTracker++; break; @@ -1280,7 +1280,7 @@ bool8 HandleFaintedMonActions(void) gBattleStruct->faintedActionsState = 4; break; case 6: - if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, 1) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) + if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, TRUE) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) return TRUE; gBattleStruct->faintedActionsState++; break; @@ -2083,7 +2083,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA } } break; - case ABILITYEFFECT_CONTACT: // 4 + case ABILITYEFFECT_MOVE_END: // Think contact abilities. switch (gLastUsedAbility) { case ABILITY_COLOR_CHANGE: @@ -2343,7 +2343,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA { gLastUsedAbility = ABILITY_INTIMIDATE; gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); - BattleScriptPushCursorAndCallback(BattleScript_82DB4B8); + BattleScriptPushCursorAndCallback(BattleScript_IntimidateActivatesEnd3); gBattleStruct->intimidateBattler = i; effect++; break; @@ -2415,7 +2415,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA gLastUsedAbility = ABILITY_INTIMIDATE; gStatuses3[i] &= ~(STATUS3_INTIMIDATE_POKES); BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_82DB4C1; + gBattlescriptCurrInstr = BattleScript_IntimidateActivates; gBattleStruct->intimidateBattler = i; effect++; break; @@ -3044,7 +3044,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case 2: break; - case 3: + case ITEMEFFECT_MOVE_END: for (battlerId = 0; battlerId < gBattlersCount; battlerId++) { gLastUsedItem = gBattleMons[battlerId].item; @@ -3177,7 +3177,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) gPotentialItemEffectBattler = battlerId; BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_WhiteHerbRet; - return effect; // unnecessary return + return effect; } break; } @@ -3192,7 +3192,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) } } break; - case 4: + case ITEMEFFECT_KINGSROCK_SHELLBELL: if (gBattleMoveDamage) { switch (atkHoldEffect) @@ -3386,7 +3386,7 @@ u8 IsMonDisobedient(void) gBattleMons[gBattlerAttacker].status2 &= ~(STATUS2_RAGE); if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP && (gCurrentMove == MOVE_SNORE || gCurrentMove == MOVE_SLEEP_TALK)) { - gBattlescriptCurrInstr = BattleScript_82DB695; + gBattlescriptCurrInstr = BattleScript_IgnoresWhileAsleep; return 1; } @@ -3440,7 +3440,7 @@ u8 IsMonDisobedient(void) { gBattleMoveDamage = CalculateBaseDamage(&gBattleMons[gBattlerAttacker], &gBattleMons[gBattlerAttacker], MOVE_POUND, 0, 40, 0, gBattlerAttacker, gBattlerAttacker); gBattlerTarget = gBattlerAttacker; - gBattlescriptCurrInstr = BattleScript_82DB6F0; + gBattlescriptCurrInstr = BattleScript_IgnoresAndHitsItself; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; return 2; }