From 273474d57a39014654e60df151604ed5a28aeb57 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 2 Dec 2017 00:03:46 +0100 Subject: [PATCH 1/4] give names to some battlescripts --- asm/macros/battle_script.inc | 8 +- data/battle_scripts_1.s | 218 ++++++++++++++++---------------- include/battle_scripts.h | 2 +- src/battle_ai_script_commands.c | 1 - src/battle_script_commands.c | 12 +- 5 files changed, 121 insertions(+), 120 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 47e124a86..520696bff 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -422,10 +422,10 @@ .byte \bank .endm - .macro switchinanim bank, param1 + .macro switchinanim bank, dontclearsubstitutebit .byte 0x4e .byte \bank - .byte \param1 + .byte \dontclearsubstitutebit .endm .macro jumpifcantswitch bank, param1 @@ -1387,3 +1387,7 @@ .macro jumpifnostatus3 bank, status, jumpptr jumpifstatus3condition \bank, \status, 0x1, \jumpptr .endm + + .macro jumpifmovehadnoeffect jumpptr + jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, \jumpptr + .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 0be60d109..1dec99074 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -356,19 +356,19 @@ BattleScript_EffectAbsorb:: waitmessage 0x40 negativedamage orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE - jumpifability TARGET, ABILITY_LIQUID_OOZE, BattleScript_82D8B26 + jumpifability TARGET, ABILITY_LIQUID_OOZE, BattleScript_AbsorbLiquidOoze setbyte cMULTISTRING_CHOOSER, 0x0 - goto BattleScript_82D8B2E -BattleScript_82D8B26:: + goto BattleScript_AbsorbUpdateHp +BattleScript_AbsorbLiquidOoze:: manipulatedamage ATK80_DMG_CHANGE_SIGN setbyte cMULTISTRING_CHOOSER, 0x1 -BattleScript_82D8B2E:: +BattleScript_AbsorbUpdateHp:: healthbarupdate ATTACKER datahpupdate ATTACKER - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_82D8B45 + jumpifmovehadnoeffect BattleScript_AbsorbTryFainting printfromtable gLeechSeedDrainStringIds waitmessage 0x40 -BattleScript_82D8B45:: +BattleScript_AbsorbTryFainting:: tryfaintmon ATTACKER, FALSE, NULL tryfaintmon TARGET, FALSE, NULL goto BattleScript_MoveEnd @@ -470,10 +470,10 @@ BattleScript_82D8C18:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate ATTACKER datahpupdate ATTACKER - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_82D8C56 + jumpifmovehadnoeffect BattleScript_DreamEaterTryFaintEnd printstring STRINGID_PKMNDREAMEATEN waitmessage 0x40 -BattleScript_82D8C56:: +BattleScript_DreamEaterTryFaintEnd:: tryfaintmon TARGET, FALSE, NULL goto BattleScript_MoveEnd @@ -636,7 +636,7 @@ BattleScript_82D8E1F:: critcalc damagecalc typecalc - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_82D8E71 + jumpifmovehadnoeffect BattleScript_82D8E71 adjustnormaldamage attackanimation waitanimation @@ -660,7 +660,7 @@ BattleScript_82D8E71:: BattleScript_82D8E74:: resultmessage waitmessage 0x40 - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_82D8E93 + jumpifmovehadnoeffect BattleScript_82D8E93 copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6 printstring STRINGID_HITXTIMES waitmessage 0x40 @@ -784,7 +784,7 @@ BattleScript_EffectOHKO:: ppreduce accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON typecalc - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_HitFromAtkAnimation + jumpifmovehadnoeffect BattleScript_HitFromAtkAnimation tryKO BattleScript_KOFail trysetdestinybondtohappen goto BattleScript_HitFromAtkAnimation @@ -867,10 +867,9 @@ BattleScript_EffectDoubleHit:: BattleScript_EffectRecoilIfMiss:: attackcanceler - accuracycheck BattleScript_82D9135, ACC_CURR_MOVE + accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE goto BattleScript_HitFromAtkString - -BattleScript_82D9135:: +BattleScript_MoveMissedDoDamage:: attackstring ppreduce pause 0x40 @@ -1031,7 +1030,7 @@ BattleScript_EffectParalyze:: jumpifability TARGET, ABILITY_LIMBER, BattleScript_LimberProtected jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed typecalc - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_ButItFailed + jumpifmovehadnoeffect BattleScript_ButItFailed jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_AlreadyParalyzed jumpifstatus TARGET, STATUS_ANY, BattleScript_ButItFailed accuracycheck BattleScript_ButItFailed, ACC_CURR_MOVE @@ -1349,7 +1348,7 @@ BattleScript_SleepTalkUsingMove:: waitanimation setbyte sANIM_TURN, 0x0 setbyte sANIM_TARGETS_HIT, 0x0 - jumptorandomattack 0x1 + jumptorandomattack TRUE BattleScript_EffectDestinyBond:: attackcanceler @@ -1423,7 +1422,7 @@ BattleScript_DoTripleKickAttack:: damagecalc typecalc adjustnormaldamage - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_TripleKickNoMoreHits + jumpifmovehadnoeffect BattleScript_TripleKickNoMoreHits attackanimation waitanimation effectivenesssound @@ -1660,7 +1659,7 @@ BattleScript_FuryCutterHit:: critcalc damagecalc typecalc - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_FuryCutterHit + jumpifmovehadnoeffect BattleScript_FuryCutterHit adjustnormaldamage goto BattleScript_HitFromAtkAnimation @@ -1730,7 +1729,7 @@ BattleScript_EffectBatonPass:: switchindataupdate ATTACKER hpthresholds ATTACKER printstring STRINGID_SWITCHINMON - switchinanim ATTACKER, 0x1 + switchinanim ATTACKER, TRUE waitstate switchineffects ATTACKER goto BattleScript_MoveEnd @@ -2395,7 +2394,7 @@ BattleScript_EffectAssist:: waitanimation setbyte sANIM_TURN, 0x0 setbyte sANIM_TARGETS_HIT, 0x0 - jumptorandomattack 0x1 + jumptorandomattack TRUE BattleScript_EffectIngrain:: attackcanceler @@ -2448,15 +2447,15 @@ BattleScript_EffectBrickBreak:: damagecalc typecalc adjustnormaldamage - jumpifbyte EQUAL, sANIM_TURN, 0x0, BattleScript_82DA306 + jumpifbyte EQUAL, sANIM_TURN, 0x0, BattleScript_BrickBreakAnim bicbyte gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED -BattleScript_82DA306:: +BattleScript_BrickBreakAnim:: attackanimation waitanimation - jumpifbyte LESS_THAN, sANIM_TURN, 0x2, BattleScript_82DA319 + jumpifbyte LESS_THAN, sANIM_TURN, 0x2, BattleScript_BrickBreakDoHit printstring STRINGID_THEWALLSHATTERED waitmessage 0x40 -BattleScript_82DA319:: +BattleScript_BrickBreakDoHit:: typecalc2 effectivenesssound hitanimation TARGET @@ -2507,7 +2506,7 @@ BattleScript_EffectEndeavor:: copyword gHpDealt, gBattleMoveDamage accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE typecalc - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, BattleScript_HitFromAtkAnimation + jumpifmovehadnoeffect BattleScript_HitFromAtkAnimation bicbyte gBattleMoveFlags, MOVESTATUS_SUPEREFFECTIVE | MOVESTATUS_NOTVERYEFFECTIVE copyword gBattleMoveDamage, gHpDealt adjustsetdamage @@ -2596,58 +2595,58 @@ BattleScript_EffectTeeterDance:: attackstring ppreduce setbyte gBankTarget, 0x0 -BattleScript_82DA47B:: +BattleScript_TeeterDanceLoop:: movevaluescleanup setmoveeffect EFFECT_CONFUSION - jumpifbyteequal gBankAttacker, gBankTarget, BattleScript_82DA4D0 - jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_82DA4E5 - jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_82DA501 - jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_82DA50F - jumpifhasnohp TARGET, BattleScript_82DA4D0 - accuracycheck BattleScript_82DA520, ACC_CURR_MOVE - jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_82DA4F3 + jumpifbyteequal gBankAttacker, gBankTarget, BattleScript_TeeterDanceLoopIncrement + jumpifability TARGET, ABILITY_OWN_TEMPO, BattleScript_TeeterDanceOwnTempoPrevents + jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_TeeterDanceSubstitutePrevents + jumpifstatus2 TARGET, STATUS2_CONFUSION, BattleScript_TeeterDanceAlreadyConfused + jumpifhasnohp TARGET, BattleScript_TeeterDanceLoopIncrement + accuracycheck BattleScript_TeeterDanceMissed, ACC_CURR_MOVE + jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_TeeterDanceSafeguardProtected attackanimation waitanimation seteffectprimary resultmessage waitmessage 0x40 -BattleScript_82DA4C7:: +BattleScript_TeeterDanceDoMoveEndIncrement:: setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 -BattleScript_82DA4D0:: +BattleScript_TeeterDanceLoopIncrement:: addbyte gBankTarget, 0x1 - jumpifbytenotequal gBankTarget, gNoOfAllBanks, BattleScript_82DA47B + jumpifbytenotequal gBankTarget, gNoOfAllBanks, BattleScript_TeeterDanceLoop end -BattleScript_82DA4E5:: +BattleScript_TeeterDanceOwnTempoPrevents:: pause 0x20 printstring STRINGID_PKMNPREVENTSCONFUSIONWITH waitmessage 0x40 - goto BattleScript_82DA4C7 + goto BattleScript_TeeterDanceDoMoveEndIncrement -BattleScript_82DA4F3:: +BattleScript_TeeterDanceSafeguardProtected:: pause 0x20 printstring STRINGID_PKMNUSEDSAFEGUARD waitmessage 0x40 - goto BattleScript_82DA4C7 + goto BattleScript_TeeterDanceDoMoveEndIncrement -BattleScript_82DA501:: +BattleScript_TeeterDanceSubstitutePrevents:: pause 0x20 printstring STRINGID_BUTITFAILED waitmessage 0x40 - goto BattleScript_82DA4C7 + goto BattleScript_TeeterDanceDoMoveEndIncrement -BattleScript_82DA50F:: +BattleScript_TeeterDanceAlreadyConfused:: various23 ATTACKER pause 0x20 printstring STRINGID_PKMNALREADYCONFUSED waitmessage 0x40 - goto BattleScript_82DA4C7 + goto BattleScript_TeeterDanceDoMoveEndIncrement -BattleScript_82DA520:: +BattleScript_TeeterDanceMissed:: resultmessage waitmessage 0x40 - goto BattleScript_82DA4C7 + goto BattleScript_TeeterDanceDoMoveEndIncrement BattleScript_EffectMudSport:: BattleScript_EffectWaterSport:: @@ -2906,7 +2905,7 @@ BattleScript_82DA8D0:: hpthresholds GBANK_1 printstring STRINGID_SWITCHINMON atk62 GBANK_1 - switchinanim GBANK_1, 0x0 + switchinanim GBANK_1, FALSE waitstate various7 ATTACKER switchineffects GBANK_1 @@ -2929,7 +2928,7 @@ BattleScript_82DA908:: hpthresholds GBANK_1 printstring STRINGID_SWITCHINMON atk62 GBANK_1 - switchinanim GBANK_1, 0x0 + switchinanim GBANK_1, FALSE waitstate switchineffects 5 jumpifbytenotequal gBank1, gNoOfAllBanks, BattleScript_82DA908 @@ -3108,20 +3107,19 @@ BattleScript_ActionSwitch:: hpthresholds2 ATTACKER printstring STRINGID_RETURNMON setbyte sDMG_MULTIPLIER, 0x2 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_82DAB35 + jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit setmultihit 0x1 - goto BattleScript_82DAB37 - -BattleScript_82DAB35:: + goto BattleScript_PursuitSwitchDmgLoop +BattleScript_PursuitSwitchDmgSetMultihit:: setmultihit 0x2 -BattleScript_82DAB37:: - jumpifnopursuitswitchdmg BattleScript_82DAB44 +BattleScript_PursuitSwitchDmgLoop:: + jumpifnopursuitswitchdmg BattleScript_DoSwitchOut atk5F trysetdestinybondtohappen - call BattleScript_82DAB77 + call BattleScript_PursuitDmgOnSwitchOut atk5F -BattleScript_82DAB44:: - decrementmultihit BattleScript_82DAB37 +BattleScript_DoSwitchOut:: + decrementmultihit BattleScript_PursuitSwitchDmgLoop switchoutabilities ATTACKER waitstate returnatktoball @@ -3133,7 +3131,7 @@ BattleScript_82DAB44:: hpthresholds ATTACKER printstring STRINGID_SWITCHINMON atk62 ATTACKER - switchinanim ATTACKER, 0x0 + switchinanim ATTACKER, FALSE waitstate switchineffects ATTACKER setbyte sMOVEEND_STATE, 0x4 @@ -3142,7 +3140,7 @@ BattleScript_82DAB44:: moveend 0x1, 0x0 end2 -BattleScript_82DAB77:: +BattleScript_PursuitDmgOnSwitchOut:: pause 0x20 attackstring ppreduce @@ -3165,10 +3163,10 @@ BattleScript_82DAB77:: setbyte sMOVEEND_STATE, 0x3 moveend 0x2, 0x6 various4 TARGET - jumpifbyte EQUAL, gBattleCommunication, 0x0, BattleScript_82DABB8 + jumpifbyte EQUAL, gBattleCommunication, 0x0, BattleScript_PursuitDmgOnSwitchOutRet setbyte sGIVEEXP_STATE, 0x0 getexp TARGET -BattleScript_82DABB8:: +BattleScript_PursuitDmgOnSwitchOutRet:: return BattleScript_Pausex20:: @@ -3345,20 +3343,20 @@ BattleScript_BideNoEnergyToAttack:: waitmessage 0x40 goto BattleScript_ButItFailed -BattleScript_82DADD8:: +BattleScript_SuccessForceOut:: attackanimation waitanimation switchoutabilities TARGET returntoball TARGET waitstate - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_82DADF1 + jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_TrainerBattleForceOut setoutcomeonteleport ATTACKER finishaction -BattleScript_82DADF1:: +BattleScript_TrainerBattleForceOut:: getswitchedmondata TARGET switchindataupdate TARGET - switchinanim TARGET, 0x0 + switchinanim TARGET, FALSE waitstate printstring STRINGID_PKMNWASDRAGGEDOUT switchineffects TARGET @@ -3414,12 +3412,12 @@ BattleScript_SpikesOnAttacker:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate ATTACKER datahpupdate ATTACKER - call BattleScript_82DAEFE + call BattleScript_PrintHurtBySpikes tryfaintmon ATTACKER, FALSE, NULL - tryfaintmon ATTACKER, TRUE, BattleScript_82DAE7A + tryfaintmon ATTACKER, TRUE, BattleScript_SpikesOnAttackerFainted return -BattleScript_82DAE7A:: +BattleScript_SpikesOnAttackerFainted:: setbyte sGIVEEXP_STATE, 0x0 getexp ATTACKER setbyte sMOVEEND_STATE, 0x0 @@ -3430,12 +3428,12 @@ BattleScript_SpikesOnTarget:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate TARGET datahpupdate TARGET - call BattleScript_82DAEFE + call BattleScript_PrintHurtBySpikes tryfaintmon TARGET, FALSE, NULL - tryfaintmon TARGET, TRUE, BattleScript_82DAEB1 + tryfaintmon TARGET, TRUE, BattleScript_SpikesOnTargetFainted return -BattleScript_82DAEB1:: +BattleScript_SpikesOnTargetFainted:: setbyte sGIVEEXP_STATE, 0x0 getexp TARGET setbyte sMOVEEND_STATE, 0x0 @@ -3446,19 +3444,19 @@ BattleScript_SpikesOngBank1:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate GBANK_1 datahpupdate GBANK_1 - call BattleScript_82DAEFE + call BattleScript_PrintHurtBySpikes tryfaintmon GBANK_1, FALSE, NULL - tryfaintmon GBANK_1, TRUE, BattleScript_82DAEE8 + tryfaintmon GBANK_1, TRUE, BattleScript_SpikesOngBank1Fainted return -BattleScript_82DAEE8:: +BattleScript_SpikesOngBank1Fainted:: setbyte sGIVEEXP_STATE, 0x0 getexp GBANK_1 setbyte sMOVEEND_STATE, 0x0 moveend 0x0, 0x0 goto BattleScript_82DA7CD -BattleScript_82DAEFE:: +BattleScript_PrintHurtBySpikes:: printstring STRINGID_PKMNHURTBYSPIKES waitmessage 0x40 return @@ -3478,39 +3476,39 @@ BattleScript_PerishSongCountGoesDown:: end2 BattleScript_AllStatsUp:: - jumpifstat ATTACKER, LESS_THAN, ATK, 0xC, BattleScript_82DAF54 - jumpifstat ATTACKER, LESS_THAN, DEF, 0xC, BattleScript_82DAF54 - jumpifstat ATTACKER, LESS_THAN, SPEED, 0xC, BattleScript_82DAF54 - jumpifstat ATTACKER, LESS_THAN, SPATK, 0xC, BattleScript_82DAF54 - jumpifstat ATTACKER, EQUAL, SPDEF, 0xC, BattleScript_82DAFC2 -BattleScript_82DAF54:: + jumpifstat ATTACKER, LESS_THAN, ATK, 0xC, BattleScript_AllStatsUpAtk + jumpifstat ATTACKER, LESS_THAN, DEF, 0xC, BattleScript_AllStatsUpAtk + jumpifstat ATTACKER, LESS_THAN, SPEED, 0xC, BattleScript_AllStatsUpAtk + jumpifstat ATTACKER, LESS_THAN, SPATK, 0xC, BattleScript_AllStatsUpAtk + jumpifstat ATTACKER, EQUAL, SPDEF, 0xC, BattleScript_AllStatsUpRet +BattleScript_AllStatsUpAtk:: setbyte sFIELD_1B, 0x0 playstatchangeanimation ATTACKER, 0x3E, 0x0 setstatchanger ATK, 1, FALSE - statbuffchange AFFECTS_USER | 0x1, BattleScript_82DAF72 + statbuffchange AFFECTS_USER | 0x1, BattleScript_AllStatsUpDef printfromtable gStatUpStringIds waitmessage 0x40 -BattleScript_82DAF72:: +BattleScript_AllStatsUpDef:: setstatchanger DEF, 1, FALSE - statbuffchange AFFECTS_USER | 0x1, BattleScript_82DAF86 + statbuffchange AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpeed printfromtable gStatUpStringIds waitmessage 0x40 -BattleScript_82DAF86:: +BattleScript_AllStatsUpSpeed:: setstatchanger SPEED, 1, FALSE - statbuffchange AFFECTS_USER | 0x1, BattleScript_82DAF9A + statbuffchange AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpAtk printfromtable gStatUpStringIds waitmessage 0x40 -BattleScript_82DAF9A:: +BattleScript_AllStatsUpSpAtk:: setstatchanger SPATK, 1, FALSE - statbuffchange AFFECTS_USER | 0x1, BattleScript_82DAFAE + statbuffchange AFFECTS_USER | 0x1, BattleScript_AllStatsUpSpDef printfromtable gStatUpStringIds waitmessage 0x40 -BattleScript_82DAFAE:: +BattleScript_AllStatsUpSpDef:: setstatchanger SPDEF, 1, FALSE - statbuffchange AFFECTS_USER | 0x1, BattleScript_82DAFC2 + statbuffchange AFFECTS_USER | 0x1, BattleScript_AllStatsUpRet printfromtable gStatUpStringIds waitmessage 0x40 -BattleScript_82DAFC2:: +BattleScript_AllStatsUpRet:: return BattleScript_RapidSpinAway:: @@ -3765,21 +3763,21 @@ BattleScript_MonWokeUpInUproar:: BattleScript_PoisonTurnDmg:: printstring STRINGID_PKMNHURTBYPOISON waitmessage 0x40 -BattleScript_82DB243:: +BattleScript_DoStatusTurnDmg:: statusanimation ATTACKER -BattleScript_82DB245:: +BattleScript_DoTurnDmg:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate ATTACKER datahpupdate ATTACKER tryfaintmon ATTACKER, FALSE, NULL - atk24 BattleScript_82DB25E -BattleScript_82DB25E:: + atk24 BattleScript_DoTurnDmgEnd +BattleScript_DoTurnDmgEnd:: end2 BattleScript_BurnTurnDmg:: printstring STRINGID_PKMNHURTBYBURN waitmessage 0x40 - goto BattleScript_82DB243 + goto BattleScript_DoStatusTurnDmg BattleScript_MoveUsedIsFrozen:: printstring STRINGID_PKMNISFROZEN @@ -3826,8 +3824,8 @@ BattleScript_MoveUsedIsConfused:: printstring STRINGID_PKMNISCONFUSED waitmessage 0x40 status2animation ATTACKER, STATUS2_CONFUSION - jumpifbyte EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB2FF -BattleScript_82DB2D4:: + jumpifbyte EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_MoveUsedIsConfusedRet +BattleScript_DoSelfConfusionDmg:: cancelmultiturnmoves ATTACKER adjustnormaldamage2 printstring STRINGID_ITHURTCONFUSION @@ -3842,7 +3840,7 @@ BattleScript_82DB2D4:: waitmessage 0x40 tryfaintmon ATTACKER, FALSE, NULL goto BattleScript_MoveEnd -BattleScript_82DB2FF:: +BattleScript_MoveUsedIsConfusedRet:: return BattleScript_MoveUsedIsConfusedNoMore:: @@ -3859,7 +3857,7 @@ BattleScript_WrapTurnDmg:: playanimation ATTACKER, ANIM_TURN_TRAP, sANIM_ARG1 printstring STRINGID_PKMNHURTBY waitmessage 0x40 - goto BattleScript_82DB245 + goto BattleScript_DoTurnDmg BattleScript_WrapEnds:: printstring STRINGID_PKMNFREEDFROM @@ -3881,13 +3879,13 @@ BattleScript_NightmareTurnDmg:: printstring STRINGID_PKMNLOCKEDINNIGHTMARE waitmessage 0x40 status2animation ATTACKER, STATUS2_NIGHTMARE - goto BattleScript_82DB245 + goto BattleScript_DoTurnDmg BattleScript_CurseTurnDmg:: printstring STRINGID_PKMNAFFLICTEDBYCURSE waitmessage 0x40 status2animation ATTACKER, STATUS2_CURSED - goto BattleScript_82DB245 + goto BattleScript_DoTurnDmg BattleScript_TargetPRLZHeal:: printstring STRINGID_PKMNHEALEDPARALYSIS @@ -3899,7 +3897,7 @@ BattleScript_MoveEffectSleep:: statusanimation EFFECT_BANK printfromtable gFellAsleepStringIds waitmessage 0x40 -BattleScript_82DB374:: +BattleScript_UpdateEffectStatusIconRet:: updatestatusicon EFFECT_BANK waitstate return @@ -3917,25 +3915,25 @@ BattleScript_MoveEffectPoison:: statusanimation EFFECT_BANK printfromtable gGotPoisonedStringIds waitmessage 0x40 - goto BattleScript_82DB374 + goto BattleScript_UpdateEffectStatusIconRet BattleScript_MoveEffectBurn:: statusanimation EFFECT_BANK printfromtable gGotBurnedStringIds waitmessage 0x40 - goto BattleScript_82DB374 + goto BattleScript_UpdateEffectStatusIconRet BattleScript_MoveEffectFreeze:: statusanimation EFFECT_BANK printfromtable gGotFrozenStringIds waitmessage 0x40 - goto BattleScript_82DB374 + goto BattleScript_UpdateEffectStatusIconRet BattleScript_MoveEffectParalysis:: statusanimation EFFECT_BANK printfromtable gGotParalyzedStringIds waitmessage 0x40 - goto BattleScript_82DB374 + goto BattleScript_UpdateEffectStatusIconRet BattleScript_MoveEffectUproar:: printstring STRINGID_PKMNCAUSEDUPROAR @@ -3946,7 +3944,7 @@ BattleScript_MoveEffectToxic:: statusanimation EFFECT_BANK printstring STRINGID_PKMNBADLYPOISONED waitmessage 0x40 - goto BattleScript_82DB374 + goto BattleScript_UpdateEffectStatusIconRet BattleScript_MoveEffectPayDay:: printstring STRINGID_COINSSCATTERED @@ -4258,7 +4256,7 @@ BattleScript_82DB695:: BattleScript_IgnoresAndUsesRandomMove:: printstring STRINGID_PKMNIGNOREDORDERS waitmessage 0x40 - jumptorandomattack 0x0 + jumptorandomattack FALSE BattleScript_MoveUsedLoafingAround:: jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x4, BattleScript_82DB6C7 @@ -4284,7 +4282,7 @@ BattleScript_IgnoresAndFallsAsleep:: BattleScript_82DB6F0:: printstring STRINGID_PKMNWONTOBEY waitmessage 0x40 - goto BattleScript_82DB2D4 + goto BattleScript_DoSelfConfusionDmg BattleScript_SubstituteFade:: playanimation TARGET, ANIM_SUBSTITUTE_FADE, NULL diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 5131778a8..ac125725f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -414,7 +414,7 @@ extern const u8 BattleScript_82DAD4D[]; extern const u8 BattleScript_BideStoringEnergy[]; extern const u8 BattleScript_BideAttack[]; extern const u8 BattleScript_BideNoEnergyToAttack[]; -extern const u8 BattleScript_82DADD8[]; +extern const u8 BattleScript_SuccessForceOut[]; extern const u8 BattleScript_82DADF1[]; extern const u8 BattleScript_MistProtected[]; extern const u8 BattleScript_RageIsBuilding[]; diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 97226f5c9..c2e89f68d 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -12,7 +12,6 @@ #define AIScriptRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24) #define AIScriptRead16(ptr) ((ptr)[0] | (ptr)[1] << 8) -#define AIScriptRead8(ptr) ((ptr)[0]) #define AIScriptReadPtr(ptr) (const u8*) AIScriptRead32(ptr) #define AI_ACTION_DONE 0x0001 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d9b35c053..c64fb99ef 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6383,7 +6383,7 @@ static void atk62(void) static void atk63_jumptorandomattack(void) { - if (gBattlescriptCurrInstr[1] != 0) + if (gBattlescriptCurrInstr[1]) gCurrentMove = gRandomMove; else gChosenMove = gCurrentMove = gRandomMove; @@ -7790,7 +7790,7 @@ static void atk8E_initmultihitstring(void) gBattlescriptCurrInstr++; } -static bool8 sub_8051064(void) +static bool8 TryDoForceSwitchOut(void) { if (gBattleMons[gBankAttacker].level >= gBattleMons[gBankTarget].level) { @@ -7807,7 +7807,7 @@ static bool8 sub_8051064(void) *(gBattleStruct->field_58 + gBankTarget) = gBattlePartyID[gBankTarget]; } - gBattlescriptCurrInstr = BattleScript_82DADD8; + gBattlescriptCurrInstr = BattleScript_SuccessForceOut; return TRUE; } @@ -7935,7 +7935,7 @@ static void atk8F_forcerandomswitch(void) } else { - if (sub_8051064()) + if (TryDoForceSwitchOut()) { do { @@ -7968,7 +7968,7 @@ static void atk8F_forcerandomswitch(void) } else { - sub_8051064(); + TryDoForceSwitchOut(); } } @@ -9306,7 +9306,7 @@ static void atkBA_jumpifnopursuitswitchdmg(void) gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); } - if (gActionForBanks[gBankTarget] == 0 + if (gActionForBanks[gBankTarget] == ACTION_USE_MOVE && gBankAttacker == *(gBattleStruct->moveTarget + gBankTarget) && !(gBattleMons[gBankTarget].status1 & (STATUS_SLEEP | STATUS_FREEZE)) && gBattleMons[gBankAttacker].hp From d75e7ace1dd034273ca47473a2f543904f823f53 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 2 Dec 2017 14:08:55 +0100 Subject: [PATCH 2/4] label battle stuff --- asm/macros/battle_script.inc | 8 + data/battle_scripts_1.s | 96 +++++----- include/battle.h | 8 +- include/battle_scripts.h | 361 +---------------------------------- include/battle_util.h | 6 +- src/battle_2.c | 20 +- src/battle_script_commands.c | 2 +- src/battle_util.c | 100 +++++----- src/battle_util2.c | 8 +- src/evolution_scene.c | 45 ++--- 10 files changed, 156 insertions(+), 498 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 520696bff..a16b59366 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1391,3 +1391,11 @@ .macro jumpifmovehadnoeffect jumpptr jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED, \jumpptr .endm + + .macro jumpifbattletype flags, jumpptr + jumpifword COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr + .endm + + .macro jumpifnotbattletype flags, jumpptr + jumpifword NO_COMMON_BITS, gBattleTypeFlags, \flags, \jumpptr + .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 1dec99074..10de50082 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -614,7 +614,7 @@ BattleScript_EffectRoar:: jumpifstatus3 TARGET, STATUS3_ROOTED, BattleScript_82DB109 accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_ARENA, BattleScript_ButItFailed + jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed forcerandomswitch BattleScript_ButItFailed BattleScript_EffectMultiHit:: @@ -1716,7 +1716,7 @@ BattleScript_EffectBatonPass:: attackcanceler attackstring ppreduce - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_ARENA, BattleScript_ButItFailed + jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed jumpifcantswitch ATK4F_DONT_CHECK_STATUSES | ATTACKER, BattleScript_ButItFailed attackanimation waitanimation @@ -1949,7 +1949,7 @@ BattleScript_EffectTeleport:: attackcanceler attackstring ppreduce - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_ButItFailed + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed getifcantrunfrombattle ATTACKER jumpifbyte EQUAL, gBattleCommunication, 0x1, BattleScript_ButItFailed jumpifbyte EQUAL, gBattleCommunication, 0x2, BattleScript_82DA382 @@ -2845,41 +2845,41 @@ BattleScript_FaintTarget:: printstring STRINGID_TARGETFAINTED return -BattleScript_82DA7C4:: +BattleScript_GiveExp:: setbyte sGIVEEXP_STATE, 0x0 getexp TARGET end2 -BattleScript_82DA7CD:: +BattleScript_HandleFaintedMon:: atk24 BattleScript_82DA8F6 - jumpifbyte NOT_EQUAL, gBattleOutcome, 0, BattleScript_82DA8F5 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_82DA816 - jumpifword NO_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_82DA816 + jumpifbyte NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonTryChooseAnother + jumpifword NO_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonTryChooseAnother printstring STRINGID_USENEXTPKMN setbyte gBattleCommunication, 0x0 yesnobox - jumpifbyte EQUAL, gBattleCommunication + 1, 0x0, BattleScript_82DA816 - jumpifplayerran BattleScript_82DA8F5 + jumpifbyte EQUAL, gBattleCommunication + 1, 0x0, BattleScript_FaintedMonTryChooseAnother + jumpifplayerran BattleScript_FaintedMonEnd printstring STRINGID_CANTESCAPE2 -BattleScript_82DA816:: - openpartyscreen 0x3, BattleScript_82DA8F5 +BattleScript_FaintedMonTryChooseAnother:: + openpartyscreen 0x3, BattleScript_FaintedMonEnd switchhandleorder GBANK_1, 0x2 - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_82DA8D0 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_LINK, BattleScript_82DA8D0 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_x2000000, BattleScript_82DA8D0 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID, BattleScript_82DA8D0 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_82DA8D0 - jumpifword COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_82DA8D0 - jumpifbyte EQUAL, sBATTLE_STYLE, 0x1, BattleScript_82DA8D0 - jumpifcantswitch 11, BattleScript_82DA8D0 + jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother + jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother + jumpifbattletype BATTLE_TYPE_x2000000, BattleScript_FaintedMonChooseAnother + jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID, BattleScript_FaintedMonChooseAnother + jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother + jumpifword COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother + jumpifbyte EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother + jumpifcantswitch 11, BattleScript_FaintedMonChooseAnother printstring STRINGID_ENEMYABOUTTOSWITCHPKMN setbyte gBattleCommunication, 0x0 yesnobox - jumpifbyte EQUAL, gBattleCommunication + 1, 0x1, BattleScript_82DA8D0 + jumpifbyte EQUAL, gBattleCommunication + 1, 0x1, BattleScript_FaintedMonChooseAnother setatktoplayer0 - openpartyscreen 0x81, BattleScript_82DA8D0 + openpartyscreen 0x81, BattleScript_FaintedMonChooseAnother switchhandleorder ATTACKER, 0x2 - jumpifbyte EQUAL, gBattleCommunication, 0x6, BattleScript_82DA8D0 + jumpifbyte EQUAL, gBattleCommunication, 0x6, BattleScript_FaintedMonChooseAnother atknameinbuff1 resetintrimidatetracebits ATTACKER hpthresholds2 ATTACKER @@ -2898,7 +2898,7 @@ BattleScript_82DA816:: waitstate switchineffects ATTACKER resetsentmonsvalue -BattleScript_82DA8D0:: +BattleScript_FaintedMonChooseAnother:: drawpartystatussummary GBANK_1 getswitchedmondata GBANK_1 switchindataupdate GBANK_1 @@ -2909,9 +2909,9 @@ BattleScript_82DA8D0:: waitstate various7 ATTACKER switchineffects GBANK_1 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_82DA8F5 + jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonEnd cancelallactions -BattleScript_82DA8F5:: +BattleScript_FaintedMonEnd:: end2 BattleScript_82DA8F6:: @@ -2936,7 +2936,7 @@ BattleScript_82DA92C:: end2 BattleScript_LocalTrainerBattleWon:: - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalTwoTrainersDefeated + jumpifbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalTwoTrainersDefeated printstring STRINGID_PLAYERDEFEATEDTRAINER1 goto BattleScript_LocalBattleWonLoseTexts BattleScript_LocalTwoTrainersDefeated:: @@ -2945,7 +2945,7 @@ BattleScript_LocalBattleWonLoseTexts:: trainerslidein ATTACKER waitstate printstring STRINGID_TRAINER1LOSETEXT - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleWonReward + jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleWonReward trainerslideout IDENTITY_OPPONENT_MON1 waitstate trainerslidein GBANK_1 @@ -2961,10 +2961,10 @@ BattleScript_PayDayMoneyAndPickUpItems:: end2 BattleScript_LocalBattleLost:: - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID, BattleScript_LocalBattleLostPrintTrainersWinText - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_x4000000, BattleScript_LocalBattleLostPrintTrainersWinText - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd + jumpifbattletype BATTLE_TYPE_DOME, BattleScript_CheckDomeDrew + jumpifbattletype BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_x100000 | BATTLE_TYPE_PYRAMID, BattleScript_LocalBattleLostPrintTrainersWinText + jumpifbattletype BATTLE_TYPE_x4000000, BattleScript_LocalBattleLostPrintTrainersWinText + jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_LocalBattleLostEnd jumpifhalfword EQUAL, gTrainerBattleOpponent_A, 0x400, BattleScript_LocalBattleLostEnd BattleScript_LocalBattleLostPrintWhiteOut:: printstring STRINGID_PLAYERWHITEOUT @@ -2976,7 +2976,7 @@ BattleScript_LocalBattleLostEnd:: BattleScript_CheckDomeDrew:: jumpifbyte EQUAL, gBattleOutcome, DREW, BattleScript_LocalBattleLostEnd_ BattleScript_LocalBattleLostPrintTrainersWinText:: - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostPrintWhiteOut + jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostPrintWhiteOut returnopponentmon1toball ATTACKER waitstate returnopponentmon2toball ATTACKER @@ -2984,8 +2984,8 @@ BattleScript_LocalBattleLostPrintTrainersWinText:: trainerslidein ATTACKER waitstate printstring STRINGID_TRAINER1WINTEXT - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_x800000, BattleScript_LocalBattleLostDoTrainer2WinText - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleLostEnd_ + jumpifbattletype BATTLE_TYPE_x800000, BattleScript_LocalBattleLostDoTrainer2WinText + jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_LocalBattleLostEnd_ BattleScript_LocalBattleLostDoTrainer2WinText:: trainerslideout IDENTITY_OPPONENT_MON1 waitstate @@ -3008,17 +3008,17 @@ BattleScript_82DAA0B:: trainerslidein GBANK_1 waitstate printstring STRINGID_TRAINER2WINTEXT - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_RECORDED, BattleScript_82DAA31 + jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA31 atk57 BattleScript_82DAA31:: waitmessage 0x40 end2 BattleScript_LinkBattleWonOrLost:: - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_BATTLE_TOWER, BattleScript_82DAA5C + jumpifbattletype BATTLE_TYPE_BATTLE_TOWER, BattleScript_82DAA5C printstring STRINGID_BATTLEEND waitmessage 0x40 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_RECORDED, BattleScript_LinkBattleWonOrLostWaitEnd + jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_LinkBattleWonOrLostWaitEnd atk57 BattleScript_LinkBattleWonOrLostWaitEnd:: waitmessage 0x40 @@ -3036,15 +3036,15 @@ BattleScript_82DAA5C:: trainerslidein GBANK_1 waitstate printstring STRINGID_TRAINER2LOSETEXT - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_RECORDED, BattleScript_82DAA83 + jumpifbattletype BATTLE_TYPE_RECORDED, BattleScript_82DAA83 atk57 BattleScript_82DAA83:: waitmessage 0x40 end2 BattleScript_FrontierTrainerBattleWon:: - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_PayDayMoneyAndPickUpItems - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAAAB + jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_PayDayMoneyAndPickUpItems + jumpifbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAAAB printstring STRINGID_PLAYERDEFEATEDTRAINER1 goto BattleScript_82DAAAE BattleScript_82DAAAB:: @@ -3053,14 +3053,14 @@ BattleScript_82DAAAE:: trainerslidein ATTACKER waitstate printstring STRINGID_TRAINER1LOSETEXT - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB + jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS, BattleScript_82DAACB trainerslideout IDENTITY_OPPONENT_MON1 waitstate trainerslidein GBANK_1 waitstate printstring STRINGID_TRAINER2LOSETEXT BattleScript_82DAACB:: - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_PYRAMID, BattleScript_82DAADA + jumpifnotbattletype BATTLE_TYPE_PYRAMID, BattleScript_82DAADA pickup BattleScript_82DAADA:: end2 @@ -3107,7 +3107,7 @@ BattleScript_ActionSwitch:: hpthresholds2 ATTACKER printstring STRINGID_RETURNMON setbyte sDMG_MULTIPLIER, 0x2 - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit + jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit setmultihit 0x1 goto BattleScript_PursuitSwitchDmgLoop BattleScript_PursuitSwitchDmgSetMultihit:: @@ -3349,7 +3349,7 @@ BattleScript_SuccessForceOut:: switchoutabilities TARGET returntoball TARGET waitstate - jumpifword COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_TRAINER, BattleScript_TrainerBattleForceOut + jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_TrainerBattleForceOut setoutcomeonteleport ATTACKER finishaction @@ -3422,7 +3422,7 @@ BattleScript_SpikesOnAttackerFainted:: getexp ATTACKER setbyte sMOVEEND_STATE, 0x0 moveend 0x0, 0x0 - goto BattleScript_82DA7CD + goto BattleScript_HandleFaintedMon BattleScript_SpikesOnTarget:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 @@ -3438,7 +3438,7 @@ BattleScript_SpikesOnTargetFainted:: getexp TARGET setbyte sMOVEEND_STATE, 0x0 moveend 0x0, 0x0 - goto BattleScript_82DA7CD + goto BattleScript_HandleFaintedMon BattleScript_SpikesOngBank1:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 @@ -3454,7 +3454,7 @@ BattleScript_SpikesOngBank1Fainted:: getexp GBANK_1 setbyte sMOVEEND_STATE, 0x0 moveend 0x0, 0x0 - goto BattleScript_82DA7CD + goto BattleScript_HandleFaintedMon BattleScript_PrintHurtBySpikes:: printstring STRINGID_PKMNHURTBYSPIKES diff --git a/include/battle.h b/include/battle.h index 3f39db374..08c998352 100644 --- a/include/battle.h +++ b/include/battle.h @@ -618,8 +618,8 @@ struct BattleStruct u8 moneyMultiplier; u8 field_4B; u8 switchInAbilitiesCounter; - u8 field_4D; - u8 field_4E; + u8 faintedActionsState; + u8 faintedActionsBank; u8 field_4F; u16 expValue; u8 field_52; @@ -691,8 +691,8 @@ struct BattleStruct u8 field_182; u8 field_183; struct BattleEnigmaBerry battleEnigmaBerry; - u8 field_1A0; - u8 field_1A1; + u8 wishPerishSongState; + u8 wishPerishSongBank; bool8 overworldWeatherDone; u8 atkCancellerTracker; u8 field_1A4[96]; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index ac125725f..2260e38d2 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -1,356 +1,22 @@ #ifndef GUARD_BATTLE_SCRIPTS_H #define GUARD_BATTLE_SCRIPTS_H -extern const u8 BattleScript_EffectHit[]; -extern const u8 BattleScript_HitFromAtkCanceler[]; -extern const u8 BattleScript_HitFromAccCheck[]; -extern const u8 BattleScript_HitFromAtkString[]; extern const u8 BattleScript_HitFromCritCalc[]; -extern const u8 BattleScript_HitFromAtkAnimation[]; extern const u8 BattleScript_MoveEnd[]; extern const u8 BattleScript_MakeMoveMissed[]; extern const u8 BattleScript_PrintMoveMissed[]; extern const u8 BattleScript_MoveMissedPause[]; extern const u8 BattleScript_MoveMissed[]; -extern const u8 BattleScript_EffectSleep[]; -extern const u8 BattleScript_AlreadyAsleep[]; -extern const u8 BattleScript_WasntAffected[]; -extern const u8 BattleScript_CantMakeAsleep[]; -extern const u8 BattleScript_EffectPoisonHit[]; -extern const u8 BattleScript_EffectAbsorb[]; -extern const u8 BattleScript_82D8B26[]; -extern const u8 BattleScript_82D8B2E[]; -extern const u8 BattleScript_82D8B45[]; -extern const u8 BattleScript_EffectBurnHit[]; -extern const u8 BattleScript_EffectFreezeHit[]; -extern const u8 BattleScript_EffectParalyzeHit[]; -extern const u8 BattleScript_EffectExplosion[]; -extern const u8 BattleScript_82D8B94[]; -extern const u8 BattleScript_82D8B96[]; -extern const u8 BattleScript_82D8BCF[]; -extern const u8 BattleScript_82D8BEA[]; -extern const u8 BattleScript_EffectDreamEater[]; -extern const u8 BattleScript_82D8C0E[]; -extern const u8 BattleScript_82D8C18[]; -extern const u8 BattleScript_82D8C56[]; -extern const u8 BattleScript_EffectMirrorMove[]; -extern const u8 BattleScript_EffectAttackUp[]; -extern const u8 BattleScript_EffectDefenseUp[]; -extern const u8 BattleScript_EffectSpecialAttackUp[]; -extern const u8 BattleScript_EffectEvasionUp[]; -extern const u8 BattleScript_EffectStatUp[]; -extern const u8 BattleScript_EffectStatUpAfterAtkCanceler[]; -extern const u8 BattleScript_StatUpAttackAnim[]; -extern const u8 BattleScript_StatUpDoAnim[]; -extern const u8 BattleScript_StatUpPrintString[]; -extern const u8 BattleScript_StatUpEnd[]; -extern const u8 BattleScript_StatUp[]; -extern const u8 BattleScript_EffectAttackDown[]; -extern const u8 BattleScript_EffectDefenseDown[]; -extern const u8 BattleScript_EffectSpeedDown[]; -extern const u8 BattleScript_EffectAccuracyDown[]; -extern const u8 BattleScript_EffectEvasionDown[]; -extern const u8 BattleScript_EffectStatDown[]; -extern const u8 BattleScript_StatDownDoAnim[]; -extern const u8 BattleScript_StatDownPrintString[]; -extern const u8 BattleScript_82D8D60[]; -extern const u8 BattleScript_StatDown[]; -extern const u8 BattleScript_EffectHaze[]; -extern const u8 BattleScript_EffectBide[]; -extern const u8 BattleScript_EffectRampage[]; -extern const u8 BattleScript_82D8DAE[]; -extern const u8 BattleScript_EffectRoar[]; -extern const u8 BattleScript_EffectMultiHit[]; -extern const u8 BattleScript_82D8DFD[]; -extern const u8 BattleScript_82D8E1F[]; -extern const u8 BattleScript_82D8E71[]; -extern const u8 BattleScript_82D8E74[]; -extern const u8 BattleScript_82D8E93[]; -extern const u8 BattleScript_EffectConversion[]; -extern const u8 BattleScript_EffectFlinchHit[]; -extern const u8 BattleScript_EffectRestoreHp[]; -extern const u8 BattleScript_EffectToxic[]; -extern const u8 BattleScript_AlreadyPoisoned[]; -extern const u8 BattleScript_ImmunityProtected[]; -extern const u8 BattleScript_EffectPayDay[]; -extern const u8 BattleScript_EffectLightScreen[]; -extern const u8 BattleScript_EffectTriAttack[]; -extern const u8 BattleScript_EffectRest[]; -extern const u8 BattleScript_RestCantSleep[]; -extern const u8 BattleScript_RestIsAlreadyAsleep[]; -extern const u8 BattleScript_EffectOHKO[]; -extern const u8 BattleScript_KOFail[]; -extern const u8 BattleScript_EffectRazorWind[]; -extern const u8 BattleScript_TwoTurnMovesSecondTurn[]; -extern const u8 BattleScriptFirstChargingTurn[]; -extern const u8 BattleScript_EffectSuperFang[]; -extern const u8 BattleScript_EffectDragonRage[]; -extern const u8 BattleScript_EffectTrap[]; -extern const u8 BattleScript_DoWrapEffect[]; -extern const u8 BattleScript_EffectDoubleHit[]; -extern const u8 BattleScript_EffectRecoilIfMiss[]; -extern const u8 BattleScript_82D9135[]; -extern const u8 BattleScript_EffectMist[]; -extern const u8 BattleScript_EffectFocusEnergy[]; -extern const u8 BattleScript_EffectRecoil[]; -extern const u8 BattleScript_EffectConfuse[]; -extern const u8 BattleScript_AlreadyConfused[]; -extern const u8 BattleScript_EffectAttackUp2[]; -extern const u8 BattleScript_EffectDefenseUp2[]; -extern const u8 BattleScript_EffectSpeedUp2[]; -extern const u8 BattleScript_EffectSpecialAttackUp2[]; -extern const u8 BattleScript_EffectSpecialDefenseUp2[]; -extern const u8 BattleScript_EffectTransform[]; -extern const u8 BattleScript_EffectAttackDown2[]; -extern const u8 BattleScript_EffectDefenseDown2[]; -extern const u8 BattleScript_EffectSpeedDown2[]; -extern const u8 BattleScript_EffectSpecialDefenseDown2[]; -extern const u8 BattleScript_EffectReflect[]; -extern const u8 BattleScript_PrintReflectLightScreenSafeguardString[]; -extern const u8 BattleScript_EffectPoison[]; -extern const u8 BattleScript_EffectParalyze[]; -extern const u8 BattleScript_AlreadyParalyzed[]; -extern const u8 BattleScript_LimberProtected[]; -extern const u8 BattleScript_EffectAttackDownHit[]; -extern const u8 BattleScript_EffectDefenseDownHit[]; -extern const u8 BattleScript_EffectSpeedDownHit[]; -extern const u8 BattleScript_EffectSpecialAttackDownHit[]; -extern const u8 BattleScript_EffectSpecialDefenseDownHit[]; -extern const u8 BattleScript_EffectAccuracyDownHit[]; -extern const u8 BattleScript_EffectSkyAttack[]; -extern const u8 BattleScript_EffectConfuseHit[]; -extern const u8 BattleScript_EffectTwineedle[]; -extern const u8 BattleScript_EffectSubstitute[]; -extern const u8 BattleScript_SubstituteAnim[]; -extern const u8 BattleScript_SubstituteString[]; -extern const u8 BattleScript_AlreadyHasSubstitute[]; -extern const u8 BattleScript_EffectRecharge[]; -extern const u8 BattleScript_MoveUsedMustRecharge[]; -extern const u8 BattleScript_EffectRage[]; -extern const u8 BattleScript_RageMiss[]; -extern const u8 BattleScript_EffectMimic[]; -extern const u8 BattleScript_EffectMetronome[]; -extern const u8 BattleScript_EffectLeechSeed[]; -extern const u8 BattleScript_DoLeechSeed[]; -extern const u8 BattleScript_EffectSplash[]; -extern const u8 BattleScript_EffectDisable[]; -extern const u8 BattleScript_EffectLevelDamage[]; -extern const u8 BattleScript_EffectPsywave[]; -extern const u8 BattleScript_EffectCounter[]; -extern const u8 BattleScript_EffectEncore[]; -extern const u8 BattleScript_EffectPainSplit[]; -extern const u8 BattleScript_EffectSnore[]; -extern const u8 BattleScript_SnoreIsAsleep[]; -extern const u8 BattleScript_DoSnore[]; -extern const u8 BattleScript_EffectConversion2[]; -extern const u8 BattleScript_EffectLockOn[]; -extern const u8 BattleScript_EffectSketch[]; -extern const u8 BattleScript_EffectSleepTalk[]; -extern const u8 BattleScript_SleepTalkIsAsleep[]; -extern const u8 BattleScript_SleepTalkUsingMove[]; -extern const u8 BattleScript_EffectDestinyBond[]; -extern const u8 BattleScript_EffectFlail[]; -extern const u8 BattleScript_EffectSpite[]; -extern const u8 BattleScript_EffectHealBell[]; -extern const u8 BattleScript_CheckHealBellMon2Unaffected[]; -extern const u8 BattleScript_PartyHealEnd[]; -extern const u8 BattleScript_EffectTripleKick[]; -extern const u8 BattleScript_TripleKickLoop[]; -extern const u8 BattleScript_DoTripleKickAttack[]; -extern const u8 BattleScript_TripleKickNoMoreHits[]; -extern const u8 BattleScript_TripleKickPrintStrings[]; -extern const u8 BattleScript_TripleKickEnd[]; -extern const u8 BattleScript_EffectThief[]; -extern const u8 BattleScript_EffectMeanLook[]; -extern const u8 BattleScript_EffectNightmare[]; -extern const u8 BattleScript_NightmareWorked[]; -extern const u8 BattleScript_EffectMinimize[]; -extern const u8 BattleScript_EffectCurse[]; -extern const u8 BattleScript_CurseTrySpeed[]; -extern const u8 BattleScript_CurseTryAttack[]; -extern const u8 BattleScript_CurseTryDefence[]; -extern const u8 BattleScript_CurseEnd[]; -extern const u8 BattleScript_GhostCurse[]; -extern const u8 BattleScript_DoGhostCurse[]; -extern const u8 BattleScript_EffectProtect[]; -extern const u8 BattleScript_EffectSpikes[]; -extern const u8 BattleScript_EffectForesight[]; -extern const u8 BattleScript_EffectPerishSong[]; -extern const u8 BattleScript_PerishSongLoop[]; -extern const u8 BattleScript_PerishSongLoopIncrement[]; -extern const u8 BattleScript_PerishSongNotAffected[]; -extern const u8 BattleScript_EffectSandstorm[]; -extern const u8 BattleScript_EffectRollout[]; -extern const u8 BattleScript_RolloutCheckAccuracy[]; -extern const u8 BattleScript_RolloutHit[]; -extern const u8 BattleScript_EffectSwagger[]; -extern const u8 BattleScript_SwaggerTryConfuse[]; -extern const u8 BattleScript_EffectFuryCutter[]; -extern const u8 BattleScript_FuryCutterHit[]; -extern const u8 BattleScript_EffectAttract[]; -extern const u8 BattleScript_EffectReturn[]; -extern const u8 BattleScript_EffectPresent[]; -extern const u8 BattleScript_EffectSafeguard[]; -extern const u8 BattleScript_EffectThawHit[]; -extern const u8 BattleScript_EffectMagnitude[]; -extern const u8 BattleScript_EffectBatonPass[]; -extern const u8 BattleScript_EffectRapidSpin[]; -extern const u8 BattleScript_EffectSonicboom[]; -extern const u8 BattleScript_EffectMorningSun[]; -extern const u8 BattleScript_EffectHiddenPower[]; -extern const u8 BattleScript_EffectRainDance[]; -extern const u8 BattleScript_MoveWeatherChange[]; -extern const u8 BattleScript_EffectSunnyDay[]; -extern const u8 BattleScript_EffectDefenseUpHit[]; -extern const u8 BattleScript_EffectAttackUpHit[]; -extern const u8 BattleScript_EffectAllStatsUpHit[]; -extern const u8 BattleScript_EffectBellyDrum[]; -extern const u8 BattleScript_EffectPsychUp[]; -extern const u8 BattleScript_EffectMirrorCoat[]; -extern const u8 BattleScript_EffectSkullBash[]; -extern const u8 BattleScript_SkullBashEnd[]; -extern const u8 BattleScript_EffectTwister[]; -extern const u8 BattleScript_FlinchEffect[]; -extern const u8 BattleScript_EffectEarthquake[]; -extern const u8 BattleScript_82D9C44[]; -extern const u8 BattleScript_82D9C64[]; -extern const u8 BattleScript_82D9C73[]; -extern const u8 BattleScript_82D9CAC[]; -extern const u8 BattleScript_EffectFutureSight[]; -extern const u8 BattleScript_EffectGust[]; -extern const u8 BattleScript_EffectStomp[]; -extern const u8 BattleScript_EffectSolarbeam[]; -extern const u8 BattleScript_SolarbeamDecideTurn[]; -extern const u8 BattleScript_SolarbeamOnFirstTurn[]; -extern const u8 BattleScript_EffectThunder[]; -extern const u8 BattleScript_EffectTeleport[]; -extern const u8 BattleScript_EffectBeatUp[]; -extern const u8 BattleScript_BeatUpLoop[]; -extern const u8 BattleScript_BeatUpAttack[]; -extern const u8 BattleScript_BeatUpEnd[]; -extern const u8 BattleScript_EffectSemiInvulnerable[]; -extern const u8 BattleScript_FirstTurnBounce[]; -extern const u8 BattleScript_FirstTurnDive[]; -extern const u8 BattleScript_FirstTurnFly[]; -extern const u8 BattleScript_FirstTurnSemiInvulnerable[]; -extern const u8 BattleScript_SecondTurnSemiInvulnerable[]; -extern const u8 BattleScript_SemiInvulnerableTryHit[]; -extern const u8 BattleScript_SemiInvulnerableMiss[]; -extern const u8 BattleScript_EffectDefenseCurl[]; -extern const u8 BattleScript_DefenseCurlDoStatUpAnim[]; -extern const u8 BattleScript_EffectSoftboiled[]; -extern const u8 BattleScript_PresentHealTarget[]; -extern const u8 BattleScript_AlreadyAtFullHp[]; -extern const u8 BattleScript_EffectFakeOut[]; -extern const u8 BattleScript_ButItFailedAtkStringPpReduce[]; -extern const u8 BattleScript_ButItFailedPpReduce[]; extern const u8 BattleScript_ButItFailed[]; -extern const u8 BattleScript_NotAffected[]; -extern const u8 BattleScript_EffectUproar[]; -extern const u8 BattleScript_UproarHit[]; -extern const u8 BattleScript_EffectStockpile[]; -extern const u8 BattleScript_EffectSpitUp[]; -extern const u8 BattleScript_SpitUpFail[]; -extern const u8 BattleScript_82D9FA2[]; -extern const u8 BattleScript_EffectSwallow[]; -extern const u8 BattleScript_SwallowFail[]; -extern const u8 BattleScript_EffectHail[]; -extern const u8 BattleScript_EffectTorment[]; -extern const u8 BattleScript_EffectFlatter[]; -extern const u8 BattleScript_FlatterTryConfuse[]; -extern const u8 BattleScript_EffectWillOWisp[]; -extern const u8 BattleScript_WaterVeilPrevents[]; -extern const u8 BattleScript_AlreadyBurned[]; -extern const u8 BattleScript_EffectMemento[]; -extern const u8 BattleScript_82DA119[]; -extern const u8 BattleScript_82DA13C[]; -extern const u8 BattleScript_82DA148[]; -extern const u8 BattleScript_82DA153[]; -extern const u8 BattleScript_82DA15A[]; -extern const u8 BattleScript_EffectFacade[]; -extern const u8 BattleScript_FacadeDoubleDmg[]; -extern const u8 BattleScript_EffectFocusPunch[]; -extern const u8 BattleScript_EffectSmellingsalt[]; -extern const u8 BattleScript_82DA1BA[]; -extern const u8 BattleScript_EffectFollowMe[]; -extern const u8 BattleScript_EffectNaturePower[]; -extern const u8 BattleScript_EffectCharge[]; -extern const u8 BattleScript_EffectTaunt[]; -extern const u8 BattleScript_EffectHelpingHand[]; -extern const u8 BattleScript_EffectTrick[]; -extern const u8 BattleScript_EffectRolePlay[]; -extern const u8 BattleScript_EffectWish[]; -extern const u8 BattleScript_EffectAssist[]; -extern const u8 BattleScript_EffectIngrain[]; -extern const u8 BattleScript_EffectSuperpower[]; -extern const u8 BattleScript_EffectMagicCoat[]; -extern const u8 BattleScript_EffectRecycle[]; -extern const u8 BattleScript_EffectRevenge[]; -extern const u8 BattleScript_EffectBrickBreak[]; -extern const u8 BattleScript_82DA306[]; -extern const u8 BattleScript_82DA319[]; -extern const u8 BattleScript_EffectYawn[]; -extern const u8 BattleScript_82DA378[]; -extern const u8 BattleScript_82DA382[]; -extern const u8 BattleScript_EffectKnockOff[]; -extern const u8 BattleScript_EffectEndeavor[]; -extern const u8 BattleScript_EffectEruption[]; -extern const u8 BattleScript_EffectSkillSwap[]; -extern const u8 BattleScript_EffectImprison[]; -extern const u8 BattleScript_EffectRefresh[]; -extern const u8 BattleScript_EffectGrudge[]; -extern const u8 BattleScript_EffectSnatch[]; -extern const u8 BattleScript_EffectLowKick[]; -extern const u8 BattleScript_EffectSecretPower[]; -extern const u8 BattleScript_EffectDoubleEdge[]; -extern const u8 BattleScript_EffectTeeterDance[]; -extern const u8 BattleScript_82DA47B[]; -extern const u8 BattleScript_82DA4C7[]; -extern const u8 BattleScript_82DA4D0[]; -extern const u8 BattleScript_82DA4E5[]; -extern const u8 BattleScript_82DA4F3[]; -extern const u8 BattleScript_82DA501[]; -extern const u8 BattleScript_82DA50F[]; -extern const u8 BattleScript_82DA520[]; -extern const u8 BattleScript_EffectMudSport[]; -extern const u8 BattleScript_EffectPoisonFang[]; -extern const u8 BattleScript_EffectWeatherBall[]; -extern const u8 BattleScript_EffectOverheat[]; -extern const u8 BattleScript_EffectTickle[]; -extern const u8 BattleScript_TickleDoMoveAnim[]; -extern const u8 BattleScript_TickleTryLowerDef[]; -extern const u8 BattleScript_TickleEnd[]; -extern const u8 BattleScript_CantLowerMultipleStats[]; -extern const u8 BattleScript_EffectCosmicPower[]; -extern const u8 BattleScript_CosmicPowerDoMoveAnim[]; -extern const u8 BattleScript_CosmicPowerTrySpDef[]; -extern const u8 BattleScript_CosmicPowerEnd[]; -extern const u8 BattleScript_EffectSkyUppercut[]; -extern const u8 BattleScript_EffectBulkUp[]; -extern const u8 BattleScript_BulkUpDoMoveAnim[]; -extern const u8 BattleScript_BulkUpTryDef[]; -extern const u8 BattleScript_BulkUpEnd[]; -extern const u8 BattleScript_EffectCalmMind[]; -extern const u8 BattleScript_CalmMindDoMoveAnim[]; -extern const u8 BattleScript_CalmMindTrySpDef[]; -extern const u8 BattleScript_CalmMindEnd[]; -extern const u8 BattleScript_CantRaiseMultipleStats[]; -extern const u8 BattleScript_EffectDragonDance[]; -extern const u8 BattleScript_DragonDanceDoMoveAnim[]; -extern const u8 BattleScript_DragonDanceTrySpeed[]; -extern const u8 BattleScript_DragonDanceEnd[]; -extern const u8 BattleScript_EffectCamouflage[]; +extern const u8 BattleScript_StatUp[]; +extern const u8 BattleScript_StatDown[]; +extern const u8 BattleScript_AlreadyAtFullHp[]; +extern const u8 BattleScript_PresentHealTarget[]; +extern const u8 BattleScript_MoveUsedMustRecharge[]; extern const u8 BattleScript_FaintAttacker[]; extern const u8 BattleScript_FaintTarget[]; -extern const u8 BattleScript_82DA7C4[]; -extern const u8 BattleScript_82DA7CD[]; -extern const u8 BattleScript_82DA816[]; -extern const u8 BattleScript_82DA8D0[]; -extern const u8 BattleScript_82DA8F5[]; -extern const u8 BattleScript_82DA8F6[]; -extern const u8 BattleScript_82DA8FC[]; -extern const u8 BattleScript_82DA908[]; -extern const u8 BattleScript_82DA92C[]; +extern const u8 BattleScript_GiveExp[]; +extern const u8 BattleScript_HandleFaintedMon[]; extern const u8 BattleScript_LocalTrainerBattleWon[]; extern const u8 BattleScript_LocalTwoTrainersDefeated[]; extern const u8 BattleScript_LocalBattleWonLoseTexts[]; @@ -360,13 +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_LocalBattleLostPrintTrainersWinText[]; -extern const u8 BattleScript_LocalBattleLostDoTrainer2WinText[]; -extern const u8 BattleScript_LocalBattleLostEnd_[]; extern const u8 BattleScript_82DAA0B[]; extern const u8 BattleScript_82DAA31[]; extern const u8 BattleScript_LinkBattleWonOrLost[]; -extern const u8 BattleScript_LinkBattleWonOrLostWaitEnd[]; extern const u8 BattleScript_82DAA5C[]; extern const u8 BattleScript_82DAA83[]; extern const u8 BattleScript_FrontierTrainerBattleWon[]; @@ -390,17 +52,8 @@ extern const u8 BattleScript_82DAB77[]; extern const u8 BattleScript_82DABB8[]; extern const u8 BattleScript_Pausex20[]; extern const u8 BattleScript_LevelUp[]; -extern const u8 BattleScript_TryLearnMoveLoop[]; -extern const u8 BattleScript_AskToLearnMove[]; -extern const u8 BattleScript_ForgotAndLearnedNewMove[]; -extern const u8 BattleScript_LearnedNewMove[]; -extern const u8 BattleScript_LearnMoveReturn[]; extern const u8 BattleScript_RainContinuesOrEnds[]; -extern const u8 BattleScript_RainContinuesOrEndsEnd[]; extern const u8 BattleScript_DamagingWeatherContinues[]; -extern const u8 BattleScript_DamagingWeatherLoop[]; -extern const u8 BattleScript_DamagingWeatherLoopIncrement[]; -extern const u8 BattleScript_DamagingWeatherContinuesEnd[]; extern const u8 BattleScript_SandStormHailEnds[]; extern const u8 BattleScript_SunlightContinues[]; extern const u8 BattleScript_SunlightFaded[]; diff --git a/include/battle_util.h b/include/battle_util.h index b21b250c4..81eb85dc7 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -66,8 +66,8 @@ bool8 AreAllMovesUnusable(void); u8 GetImprisonedMovesCount(u8 bank, u16 move); u8 UpdateTurnCounters(void); u8 TurnBasedEffects(void); -bool8 sub_8041364(void); -bool8 sub_8041728(void); +bool8 HandleWishPerishSongOnTurnEnd(void); +bool8 HandleFaintedMonActions(void); void TryClearRageStatuses(void); u8 AtkCanceller_UnableToUseMove(void); bool8 sub_80423F4(u8 bank, u8 r1, u8 r2); @@ -79,6 +79,6 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn); void ClearFuryCutterDestinyBondGrudge(u8 bank); void HandleAction_RunBattleScript(void); u8 GetMoveTarget(u16 move, u8 useMoveTarget); -u8 IsPokeDisobedient(void); +u8 IsMonDisobedient(void); #endif // GUARD_BATTLE_UTIL_H diff --git a/src/battle_2.c b/src/battle_2.c index eead4d7a9..9bb41461d 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -3668,10 +3668,10 @@ static void TryDoEventsBeforeFirstTurn(void) *(&gBattleStruct->turnEffectsTracker) = 0; *(&gBattleStruct->turnEffectsBank) = 0; - *(&gBattleStruct->field_1A0) = 0; - *(&gBattleStruct->field_1A1) = 0; + *(&gBattleStruct->wishPerishSongState) = 0; + *(&gBattleStruct->wishPerishSongBank) = 0; gBattleScripting.atk49_state = 0; - gBattleStruct->field_4D = 0; + gBattleStruct->faintedActionsState = 0; gBattleStruct->turncountersTracker = 0; gBattleMoveFlags = 0; @@ -3701,8 +3701,8 @@ static void HandleEndTurn_ContinueBattle(void) } gBattleStruct->turnEffectsTracker = 0; gBattleStruct->turnEffectsBank = 0; - gBattleStruct->field_1A0 = 0; - gBattleStruct->field_1A1 = 0; + gBattleStruct->wishPerishSongState = 0; + gBattleStruct->wishPerishSongBank = 0; gBattleStruct->turncountersTracker = 0; gBattleMoveFlags = 0; } @@ -3720,10 +3720,10 @@ void BattleTurnPassed(void) if (TurnBasedEffects() != 0) return; } - if (sub_8041728() != 0) + if (HandleFaintedMonActions() != 0) return; - gBattleStruct->field_4D = 0; - if (sub_8041364() != 0) + gBattleStruct->faintedActionsState = 0; + if (HandleWishPerishSongOnTurnEnd() != 0) return; TurnValuesCleanUp(FALSE); @@ -5565,9 +5565,9 @@ static void HandleAction_Action9(void) static void HandleAction_Action11(void) { - if (!sub_8041728()) + if (!HandleFaintedMonActions()) { - gBattleStruct->field_4D = 0; + gBattleStruct->faintedActionsState = 0; gCurrentActionFuncId = ACTION_FINISHED; } } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c64fb99ef..54811a90d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1053,7 +1053,7 @@ static void atk00_attackcanceler(void) if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBankAttacker].status2 & STATUS2_MULTIPLETURNS)) { - i = IsPokeDisobedient(); // why use the 'i' variable...? + i = IsMonDisobedient(); // why use the 'i' variable...? switch (i) { case 0: diff --git a/src/battle_util.c b/src/battle_util.c index 5c305a4e4..c08833858 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -1113,23 +1113,23 @@ u8 TurnBasedEffects(void) return 0; } -bool8 sub_8041364(void) +bool8 HandleWishPerishSongOnTurnEnd(void) { gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); - switch (gBattleStruct->field_1A0) + switch (gBattleStruct->wishPerishSongState) { case 0: - while (gBattleStruct->field_1A1 < gNoOfAllBanks) + while (gBattleStruct->wishPerishSongBank < gNoOfAllBanks) { - gActiveBank = gBattleStruct->field_1A1; + gActiveBank = gBattleStruct->wishPerishSongBank; if (gAbsentBankFlags & gBitTable[gActiveBank]) { - gBattleStruct->field_1A1++; + gBattleStruct->wishPerishSongBank++; continue; } - gBattleStruct->field_1A1++; + gBattleStruct->wishPerishSongBank++; if (gWishFutureKnock.futureSightCounter[gActiveBank] != 0 && --gWishFutureKnock.futureSightCounter[gActiveBank] == 0 && gBattleMons[gActiveBank].hp != 0) @@ -1157,21 +1157,21 @@ bool8 sub_8041364(void) } // Why do I have to keep doing this to match? { - u8* var = &gBattleStruct->field_1A0; - *var = 1; - gBattleStruct->field_1A1 = 0; + u8 *state = &gBattleStruct->wishPerishSongState; + *state = 1; + gBattleStruct->wishPerishSongBank = 0; } // fall through case 1: - while (gBattleStruct->field_1A1 < gNoOfAllBanks) + while (gBattleStruct->wishPerishSongBank < gNoOfAllBanks) { - gActiveBank = gBankAttacker = gBanksByTurnOrder[gBattleStruct->field_1A1]; + gActiveBank = gBankAttacker = gBanksByTurnOrder[gBattleStruct->wishPerishSongBank]; if (gAbsentBankFlags & gBitTable[gActiveBank]) { - gBattleStruct->field_1A1++; + gBattleStruct->wishPerishSongBank++; continue; } - gBattleStruct->field_1A1++; + gBattleStruct->wishPerishSongBank++; if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG) { PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBank].perishSongTimer1); @@ -1192,9 +1192,9 @@ bool8 sub_8041364(void) } // Hm... { - u8* var = &gBattleStruct->field_1A0; - *var = 2; - gBattleStruct->field_1A1 = 0; + u8 *state = &gBattleStruct->wishPerishSongState; + *state = 2; + gBattleStruct->wishPerishSongBank = 0; } // fall through case 2: @@ -1209,7 +1209,7 @@ bool8 sub_8041364(void) gBattlescriptCurrInstr = BattleScript_82DB8F3; BattleScriptExecute(BattleScript_82DB8F3); - gBattleStruct->field_1A0++; + gBattleStruct->wishPerishSongState++; return TRUE; } break; @@ -1220,20 +1220,20 @@ bool8 sub_8041364(void) return FALSE; } -#define sub_8041728_MAX_CASE 7 +#define FAINTED_ACTIONS_MAX_CASE 7 -bool8 sub_8041728(void) +bool8 HandleFaintedMonActions(void) { if (gBattleTypeFlags & BATTLE_TYPE_SAFARI) return FALSE; do { int i; - switch (gBattleStruct->field_4D) + switch (gBattleStruct->faintedActionsState) { case 0: - gBattleStruct->field_4E = 0; - gBattleStruct->field_4D++; + gBattleStruct->faintedActionsBank = 0; + gBattleStruct->faintedActionsState++; for (i = 0; i < gNoOfAllBanks; i++) { if (gAbsentBankFlags & gBitTable[i] && !sub_80423F4(i, 6, 6)) @@ -1243,58 +1243,58 @@ bool8 sub_8041728(void) case 1: do { - gBank1 = gBankTarget = gBattleStruct->field_4E; - if (gBattleMons[gBattleStruct->field_4E].hp == 0 - && !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->field_4E]]) - && !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) + gBank1 = gBankTarget = gBattleStruct->faintedActionsBank; + if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 + && !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->faintedActionsBank]]) + && !(gAbsentBankFlags & gBitTable[gBattleStruct->faintedActionsBank])) { - BattleScriptExecute(BattleScript_82DA7C4); - gBattleStruct->field_4D = 2; + BattleScriptExecute(BattleScript_GiveExp); + gBattleStruct->faintedActionsState = 2; return TRUE; } - } while (++gBattleStruct->field_4E != gNoOfAllBanks); - gBattleStruct->field_4D = 3; + } while (++gBattleStruct->faintedActionsBank != gNoOfAllBanks); + gBattleStruct->faintedActionsState = 3; break; case 2: sub_803F9EC(gBank1); - if (++gBattleStruct->field_4E == gNoOfAllBanks) - gBattleStruct->field_4D = 3; + if (++gBattleStruct->faintedActionsBank == gNoOfAllBanks) + gBattleStruct->faintedActionsState = 3; else - gBattleStruct->field_4D = 1; + gBattleStruct->faintedActionsState = 1; break; case 3: - gBattleStruct->field_4E = 0; - gBattleStruct->field_4D++; + gBattleStruct->faintedActionsBank = 0; + gBattleStruct->faintedActionsState++; // fall through case 4: do { - gBank1 = gBankTarget = gBattleStruct->field_4E; - if (gBattleMons[gBattleStruct->field_4E].hp == 0 - && !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) + gBank1 = gBankTarget = gBattleStruct->faintedActionsBank; + if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0 + && !(gAbsentBankFlags & gBitTable[gBattleStruct->faintedActionsBank])) { - BattleScriptExecute(BattleScript_82DA7CD); - gBattleStruct->field_4D = 5; + BattleScriptExecute(BattleScript_HandleFaintedMon); + gBattleStruct->faintedActionsState = 5; return TRUE; } - } while (++gBattleStruct->field_4E != gNoOfAllBanks); - gBattleStruct->field_4D = 6; + } while (++gBattleStruct->faintedActionsBank != gNoOfAllBanks); + gBattleStruct->faintedActionsState = 6; break; case 5: - if (++gBattleStruct->field_4E == gNoOfAllBanks) - gBattleStruct->field_4D = 6; + if (++gBattleStruct->faintedActionsBank == gNoOfAllBanks) + gBattleStruct->faintedActionsState = 6; else - gBattleStruct->field_4D = 4; + 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)) return TRUE; - gBattleStruct->field_4D++; + gBattleStruct->faintedActionsState++; break; - case 7: + case FAINTED_ACTIONS_MAX_CASE: break; } - } while (gBattleStruct->field_4D != sub_8041728_MAX_CASE); + } while (gBattleStruct->faintedActionsState != FAINTED_ACTIONS_MAX_CASE); return FALSE; } @@ -3182,7 +3182,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn) && gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED && gBattleMons[gBankTarget].hp) { - gBattleCommunication[MOVE_EFFECT_BYTE] = 8; + gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH; BattleScriptPushCursor(); SetMoveEffect(0, 0); BattleScriptPop(); @@ -3318,7 +3318,7 @@ static bool32 HasObedientBitSet(u8 bank) return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_OBEDIENCE, NULL); } -u8 IsPokeDisobedient(void) +u8 IsMonDisobedient(void) { s32 rnd; s32 calc; diff --git a/src/battle_util2.c b/src/battle_util2.c index e119c85d7..4854bb5bb 100644 --- a/src/battle_util2.c +++ b/src/battle_util2.c @@ -6,19 +6,15 @@ #include "event_data.h" #include "abilities.h" #include "rng.h" +#include "battle_scripts.h" extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u8 gUnknown_0203CF00[]; -extern const u8* gBattlescriptCurrInstr; +extern const u8 *gBattlescriptCurrInstr; extern u8 gBattleCommunication[]; extern u8 gActiveBank; -extern const u8 BattleScript_MoveUsedWokeUp[]; -extern const u8 BattleScript_MoveUsedIsFrozen[]; -extern const u8 BattleScript_MoveUsedUnfroze[]; -extern const u8 BattleScript_MoveUsedIsAsleep[]; - extern void sub_81D55D0(void); extern void sub_81D5694(void); extern u8 pokemon_order_func(u8); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 68731a14a..452035b54 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -21,6 +21,7 @@ #include "songs.h" #include "overworld.h" #include "battle_message.h" +#include "battle_string_ids.h" #include "gpu_regs.h" #include "bg.h" #include "link.h" @@ -771,7 +772,7 @@ static void Task_EvolutionScene(u8 taskID) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(BGM_FANFA1); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskID].tState++; @@ -788,7 +789,7 @@ static void Task_EvolutionScene(u8 taskID) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BufferMoveToLearnIntoBattleTextBuff2(); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnMoveState++; } @@ -796,7 +797,7 @@ static void Task_EvolutionScene(u8 taskID) case 1: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnMoveState++; } @@ -804,7 +805,7 @@ static void Task_EvolutionScene(u8 taskID) case 2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tData7 = 5; gTasks[taskID].tData8 = 10; @@ -881,7 +882,7 @@ static void Task_EvolutionScene(u8 taskID) u16 move = GetMonData(mon, var + MON_DATA_MOVE1); if (IsHMMove2(move)) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnMoveState = 12; } @@ -897,14 +898,14 @@ static void Task_EvolutionScene(u8 taskID) } break; case 7: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnMoveState++; break; case 8: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tLearnMoveState++; } @@ -912,20 +913,20 @@ static void Task_EvolutionScene(u8 taskID) case 9: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tState = 20; } break; case 10: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tData7 = 11; gTasks[taskID].tData8 = 0; gTasks[taskID].tLearnMoveState = 3; break; case 11: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); gTasks[taskID].tState = 15; break; @@ -1116,7 +1117,7 @@ static void Task_TradeEvolutionScene(u8 taskID) { BufferMoveToLearnIntoBattleTextBuff2(); PlayFanfare(BGM_FANFA1); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskID].tState++; @@ -1133,7 +1134,7 @@ static void Task_TradeEvolutionScene(u8 taskID) if (!IsTextPrinterActive(0) && !IsSEPlaying()) { BufferMoveToLearnIntoBattleTextBuff2(); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState++; } @@ -1141,7 +1142,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 1: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState++; } @@ -1149,7 +1150,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 2: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tData7 = 5; gTasks[taskID].tData8 = 9; @@ -1170,7 +1171,7 @@ static void Task_TradeEvolutionScene(u8 taskID) { case 0: sEvoCursorPos = 0; - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; if (gTasks[taskID].tLearnMoveState == 5) @@ -1179,7 +1180,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 1: case -1: sEvoCursorPos = 1; - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; break; @@ -1215,7 +1216,7 @@ static void Task_TradeEvolutionScene(u8 taskID) u16 move = GetMonData(mon, var + MON_DATA_MOVE1); if (IsHMMove2(move)) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState = 11; } @@ -1225,7 +1226,7 @@ static void Task_TradeEvolutionScene(u8 taskID) RemoveMonPPBonus(mon, var); SetMonMoveSlot(mon, gMoveToLearn, var); - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState++; } @@ -1235,7 +1236,7 @@ static void Task_TradeEvolutionScene(u8 taskID) case 7: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tLearnMoveState++; } @@ -1243,20 +1244,20 @@ static void Task_TradeEvolutionScene(u8 taskID) case 8: if (!IsTextPrinterActive(0) && !IsSEPlaying()) { - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tState = 18; } break; case 9: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tData7 = 10; gTasks[taskID].tData8 = 0; gTasks[taskID].tLearnMoveState = 3; break; case 10: - BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); + BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]); sub_807F1A8(0, gDisplayedStringBattle, 1); gTasks[taskID].tState = 13; break; From e10aea9a5196f916ca6d56617b2d74a00f0a68d4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 2 Dec 2017 23:31:58 +0100 Subject: [PATCH 3/4] give some more labels to battle struct fields --- constants/battle_script_constants.inc | 4 +-- data/battle_scripts_1.s | 52 +++++++++++++-------------- data/battle_scripts_2.s | 40 ++++++++++----------- include/battle.h | 6 ++-- src/battle_2.c | 14 ++++---- src/battle_script_commands.c | 10 +++--- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/constants/battle_script_constants.inc b/constants/battle_script_constants.inc index fb0c39ab9..c4a16238a 100644 --- a/constants/battle_script_constants.inc +++ b/constants/battle_script_constants.inc @@ -146,8 +146,8 @@ .equiv sANIM_ARG2, gBattleScripting + 0x11 .equiv sTRIPLE_KICK_POWER, gBattleScripting + 0x12 .equiv sMOVEEND_STATE, gBattleScripting + 0x14 - .equiv sFIELD_15, gBattleScripting + 0x15 - .equiv sFIELD_16, gBattleScripting + 0x16 + .equiv sBANK_WITH_ABILITY, gBattleScripting + 0x15 + .equiv sMULTIHIT_EFFECT, gBattleScripting + 0x16 .equiv sBANK, gBattleScripting + 0x17 .equiv sANIM_TURN, gBattleScripting + 0x18 .equiv sANIM_TARGETS_HIT, gBattleScripting + 0x19 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 10de50082..2d06af55d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -624,19 +624,19 @@ BattleScript_EffectMultiHit:: ppreduce setmultihitcounter 0x0 initmultihitstring - setbyte sFIELD_16, 0x0 -BattleScript_82D8DFD:: - jumpifhasnohp ATTACKER, BattleScript_82D8E93 - jumpifhasnohp TARGET, BattleScript_82D8E74 - jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_82D8E1F - jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_82D8E74 -BattleScript_82D8E1F:: + setbyte sMULTIHIT_EFFECT, 0x0 +BattleScript_MultiHitLoop:: + jumpifhasnohp ATTACKER, BattleScript_MultiHitEnd + jumpifhasnohp TARGET, BattleScript_MultiHitPrintStrings + jumpifhalfword EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoMultiHit + jumpifstatus ATTACKER, STATUS_SLEEP, BattleScript_MultiHitPrintStrings +BattleScript_DoMultiHit:: movevaluescleanup - copybyte cEFFECT_CHOOSER, sFIELD_16 + copybyte cEFFECT_CHOOSER, sMULTIHIT_EFFECT critcalc damagecalc typecalc - jumpifmovehadnoeffect BattleScript_82D8E71 + jumpifmovehadnoeffect BattleScript_MultiHitNoMoreHits adjustnormaldamage attackanimation waitanimation @@ -652,19 +652,19 @@ BattleScript_82D8E1F:: addbyte sMULTIHIT_STRING + 4, 0x1 setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 - jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_82D8E74 - decrementmultihit BattleScript_82D8DFD - goto BattleScript_82D8E74 -BattleScript_82D8E71:: + jumpifbyte COMMON_BITS, gBattleMoveFlags, MOVESTATUS_ENDURED, BattleScript_MultiHitPrintStrings + decrementmultihit BattleScript_MultiHitLoop + goto BattleScript_MultiHitPrintStrings +BattleScript_MultiHitNoMoreHits:: pause 0x20 -BattleScript_82D8E74:: +BattleScript_MultiHitPrintStrings:: resultmessage waitmessage 0x40 - jumpifmovehadnoeffect BattleScript_82D8E93 + jumpifmovehadnoeffect BattleScript_MultiHitEnd copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6 printstring STRINGID_HITXTIMES waitmessage 0x40 -BattleScript_82D8E93:: +BattleScript_MultiHitEnd:: seteffectwithchance tryfaintmon TARGET, FALSE, NULL setbyte sMOVEEND_STATE, 0x2 @@ -862,8 +862,8 @@ BattleScript_EffectDoubleHit:: ppreduce setmultihitcounter 0x2 initmultihitstring - setbyte sFIELD_16, 0x0 - goto BattleScript_82D8DFD + setbyte sMULTIHIT_EFFECT, 0x0 + goto BattleScript_MultiHitLoop BattleScript_EffectRecoilIfMiss:: attackcanceler @@ -1094,12 +1094,12 @@ BattleScript_EffectConfuseHit:: BattleScript_EffectTwineedle:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE - setbyte sFIELD_16, 0x2 + setbyte sMULTIHIT_EFFECT, EFFECT_POISON attackstring ppreduce setmultihitcounter 0x2 initmultihitstring - goto BattleScript_82D8DFD + goto BattleScript_MultiHitLoop BattleScript_EffectSubstitute:: attackcanceler @@ -1952,7 +1952,7 @@ BattleScript_EffectTeleport:: jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed getifcantrunfrombattle ATTACKER jumpifbyte EQUAL, gBattleCommunication, 0x1, BattleScript_ButItFailed - jumpifbyte EQUAL, gBattleCommunication, 0x2, BattleScript_82DA382 + jumpifbyte EQUAL, gBattleCommunication, 0x2, BattleScript_PrintAbilityMadeIneffective attackanimation waitanimation printstring STRINGID_PKMNFLEDFROMBATTLE @@ -2474,8 +2474,8 @@ BattleScript_EffectYawn:: attackcanceler attackstring ppreduce - jumpifability TARGET, ABILITY_VITAL_SPIRIT, BattleScript_82DA378 - jumpifability TARGET, ABILITY_INSOMNIA, BattleScript_82DA378 + jumpifability TARGET, ABILITY_VITAL_SPIRIT, BattleScript_PrintBankAbilityMadeIneffective + jumpifability TARGET, ABILITY_INSOMNIA, BattleScript_PrintBankAbilityMadeIneffective jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_ButItFailed jumpifsideaffecting TARGET, SIDE_STATUS_SAFEGUARD, BattleScript_SafeguardProtected accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON @@ -2486,9 +2486,9 @@ BattleScript_EffectYawn:: printstring STRINGID_PKMNWASMADEDROWSY waitmessage 0x40 goto BattleScript_MoveEnd -BattleScript_82DA378:: - copybyte sBANK, sFIELD_15 -BattleScript_82DA382:: +BattleScript_PrintBankAbilityMadeIneffective:: + copybyte sBANK, sBANK_WITH_ABILITY +BattleScript_PrintAbilityMadeIneffective:: pause 0x20 printstring STRINGID_PKMNSXMADEITINEFFECTIVE waitmessage 0x40 diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 88991ccd0..b2718b986 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -24,13 +24,13 @@ gBattlescriptsForBallThrow:: @ 82DBD08 .4byte BattleScript_BallThrow .align 2 -gUnknown_082DBD3C:: @ 82DBD3C - .4byte BattleScript_82DBE12 - .4byte BattleScript_82DBE1C - .4byte BattleScript_82DBE1C - .4byte BattleScript_82DBE4B - .4byte BattleScript_82DBE6F - .4byte BattleScript_82DBE91 +gBattlescriptsForUsingItem:: @ 82DBD3C + .4byte BattleScript_PlayerUsesItem + .4byte BattleScript_OpponentUsesHealItem + .4byte BattleScript_OpponentUsesHealItem + .4byte BattleScript_OpponentUsesStatusCureItem + .4byte BattleScript_OpponentUsesXItem + .4byte BattleScript_OpponentUsesGuardSpecs .align 2 gBattlescriptsForRunningByItem:: @ 82DBD54 @@ -58,27 +58,27 @@ BattleScript_SafariBallThrow:: handleballthrow BattleScript_SuccessBallThrow:: - jumpifhalfword EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_82DBD92 + jumpifhalfword EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_PrintCaughtMonInfo incrementgamestat 0xB -BattleScript_82DBD92:: +BattleScript_PrintCaughtMonInfo:: printstring STRINGID_GOTCHAPKMNCAUGHT - trysetcaughtmondexflags BattleScript_82DBDA5 + trysetcaughtmondexflags BattleScript_TryNicknameCaughtMon printstring STRINGID_PKMNDATAADDEDTODEX waitstate setbyte gBattleCommunication, 0x0 displaydexinfo -BattleScript_82DBDA5:: +BattleScript_TryNicknameCaughtMon:: printstring STRINGID_GIVENICKNAMECAPTURED waitstate setbyte gBattleCommunication, 0x0 - trygivecaughtmonnick BattleScript_82DBDC2 + trygivecaughtmonnick BattleScript_GiveCaughtMonEnd givecaughtmon printfromtable gCaughtMonStringIds waitmessage 0x40 - goto BattleScript_82DBDC3 -BattleScript_82DBDC2:: + goto BattleScript_SuccessBallThrowEnd +BattleScript_GiveCaughtMonEnd:: givecaughtmon -BattleScript_82DBDC3:: +BattleScript_SuccessBallThrowEnd:: setbyte gBattleOutcome, CAUGHT finishturn @@ -106,12 +106,12 @@ BattleScript_TrainerBallBlock:: waitmessage 0x40 finishaction -BattleScript_82DBE12:: +BattleScript_PlayerUsesItem:: setbyte sMOVEEND_STATE, 0xF moveend 0x1, 0x0 end -BattleScript_82DBE1C:: +BattleScript_OpponentUsesHealItem:: printstring STRINGID_EMPTYSTRING3 pause 0x30 playse SE_KAIFUKU @@ -128,7 +128,7 @@ BattleScript_82DBE1C:: moveend 0x1, 0x0 finishaction -BattleScript_82DBE4B:: +BattleScript_OpponentUsesStatusCureItem:: printstring STRINGID_EMPTYSTRING3 pause 0x30 playse SE_KAIFUKU @@ -142,7 +142,7 @@ BattleScript_82DBE4B:: moveend 0x1, 0x0 finishaction -BattleScript_82DBE6F:: +BattleScript_OpponentUsesXItem:: printstring STRINGID_EMPTYSTRING3 pause 0x30 playse SE_KAIFUKU @@ -155,7 +155,7 @@ BattleScript_82DBE6F:: moveend 0x1, 0x0 finishaction -BattleScript_82DBE91:: +BattleScript_OpponentUsesGuardSpecs:: printstring STRINGID_EMPTYSTRING3 pause 0x30 playse SE_KAIFUKU diff --git a/include/battle.h b/include/battle.h index 08c998352..9330f94e9 100644 --- a/include/battle.h +++ b/include/battle.h @@ -616,7 +616,7 @@ struct BattleStruct u8 focusPunchBank; u8 field_49; u8 moneyMultiplier; - u8 field_4B; + u8 savedTurnActionNumber; u8 switchInAbilitiesCounter; u8 faintedActionsState; u8 faintedActionsBank; @@ -846,8 +846,8 @@ struct BattleScripting u8 animArg2; u16 tripleKickPower; u8 atk49_state; - u8 field_15; - u8 field_16; + u8 bankWithAbility; + u8 multihitMoveEffect; u8 bank; u8 animTurn; u8 animTargetsHit; diff --git a/src/battle_2.c b/src/battle_2.c index 9bb41461d..328eacd85 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -160,7 +160,7 @@ extern const u8 gStatStageRatios[][2]; extern const u8 * const gBattleScriptsForMoveEffects[]; extern const u8 * const gBattlescriptsForBallThrow[]; extern const u8 * const gBattlescriptsForRunningByItem[]; -extern const u8 * const gUnknown_082DBD3C[]; +extern const u8 * const gBattlescriptsForUsingItem[]; extern const u8 * const gBattlescriptsForSafariActions[]; // strings @@ -4692,7 +4692,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) gBattleMainFunc = RunTurnActionsFunctions; gBattleCommunication[3] = 0; gBattleCommunication[4] = 0; - gBattleScripting.field_16 = 0; + gBattleScripting.multihitMoveEffect = 0; gBattleResources->battleScriptsStack->size = 0; } @@ -4701,7 +4701,7 @@ static void RunTurnActionsFunctions(void) if (gBattleOutcome != 0) gCurrentActionFuncId = 12; - *(&gBattleStruct->field_4B) = gCurrentTurnActionNumber; + *(&gBattleStruct->savedTurnActionNumber) = gCurrentTurnActionNumber; sTurnActionsFuncsTable[gCurrentActionFuncId](); if (gCurrentTurnActionNumber >= gNoOfAllBanks) // everyone did their actions, turn finished @@ -4711,7 +4711,7 @@ static void RunTurnActionsFunctions(void) } else { - if (gBattleStruct->field_4B != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another bank + if (gBattleStruct->savedTurnActionNumber != gCurrentTurnActionNumber) // action turn has been done, clear hitmarker bits for another bank { gHitMarker &= ~(HITMARKER_NO_ATTACKSTRING); gHitMarker &= ~(HITMARKER_UNABLE_TO_USE_MOVE); @@ -5276,7 +5276,7 @@ static void HandleAction_UseItem(void) } else if (GetBankSide(gBankAttacker) == SIDE_PLAYER) { - gBattlescriptCurrInstr = gUnknown_082DBD3C[0]; + gBattlescriptCurrInstr = gBattlescriptsForUsingItem[0]; } else { @@ -5332,7 +5332,7 @@ static void HandleAction_UseItem(void) break; } - gBattlescriptCurrInstr = gUnknown_082DBD3C[*(gBattleStruct->AI_itemType + gBankAttacker / 2)]; + gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBankAttacker / 2)]; } gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; } @@ -5607,6 +5607,6 @@ static void HandleAction_ActionFinished(void) gBattleScripting.atk49_state = 0; gBattleCommunication[3] = 0; gBattleCommunication[4] = 0; - gBattleScripting.field_16 = 0; + gBattleScripting.multihitMoveEffect = 0; gBattleResources->battleScriptsStack->size = 0; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 54811a90d..60b08d2c2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3040,7 +3040,7 @@ static void atk15_seteffectwithchance(void) } gBattleCommunication[MOVE_EFFECT_BYTE] = 0; - gBattleScripting.field_16 = 0; + gBattleScripting.multihitMoveEffect = 0; } static void atk16_seteffectprimary(void) @@ -3064,7 +3064,7 @@ static void atk18_clearstatusfromeffect(void) gBattleCommunication[MOVE_EFFECT_BYTE] = 0; gBattlescriptCurrInstr += 2; - gBattleScripting.field_16 = 0; + gBattleScripting.multihitMoveEffect = 0; } static void atk19_tryfaintmon(void) @@ -3221,7 +3221,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jumpPtr; RecordAbilityBattle(bank - 1, gLastUsedAbility); - gBattleScripting.field_15 = bank - 1; + gBattleScripting.bankWithAbility = bank - 1; } else gBattlescriptCurrInstr += 7; @@ -3234,7 +3234,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jumpPtr; RecordAbilityBattle(bank - 1, gLastUsedAbility); - gBattleScripting.field_15 = bank - 1; + gBattleScripting.bankWithAbility = bank - 1; } else gBattlescriptCurrInstr += 7; @@ -3247,7 +3247,7 @@ static void atk1E_jumpifability(void) gLastUsedAbility = ability; gBattlescriptCurrInstr = jumpPtr; RecordAbilityBattle(bank, gLastUsedAbility); - gBattleScripting.field_15 = bank; + gBattleScripting.bankWithAbility = bank; } else gBattlescriptCurrInstr += 7; From 790df7159ec26194a71ed57216de27358999a061 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 3 Dec 2017 00:47:21 +0100 Subject: [PATCH 4/4] more battlescript labels --- constants/battle_script_constants.inc | 2 +- data/battle_scripts_1.s | 96 +++++++++++++-------------- data/battle_scripts_2.s | 6 +- include/battle.h | 4 +- include/battle_scripts.h | 19 +++--- src/battle_2.c | 20 +++--- src/battle_message.c | 4 +- src/battle_util.c | 10 +-- 8 files changed, 79 insertions(+), 82 deletions(-) diff --git a/constants/battle_script_constants.inc b/constants/battle_script_constants.inc index c4a16238a..fe0e7dddc 100644 --- a/constants/battle_script_constants.inc +++ b/constants/battle_script_constants.inc @@ -18,7 +18,7 @@ .set ANIM_ITEM_STEAL, 0x10 .set ANIM_SNATCH_MOVE, 0x11 .set ANIM_FUTURE_SIGHT_HIT, 0x12 - .set ANIM_x13, 0x13 + .set ANIM_DOOM_DESIRE_HIT, 0x13 .set ANIM_x14, 0x14 .set ANIM_INGRAIN_HEAL, 0x15 .set ANIM_WISH_HEAL, 0x16 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2d06af55d..3609af8fc 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -610,8 +610,8 @@ BattleScript_EffectRoar:: attackcanceler attackstring ppreduce - jumpifability TARGET, ABILITY_SUCTION_CUPS, BattleScript_82DB5B9 - jumpifstatus3 TARGET, STATUS3_ROOTED, BattleScript_82DB109 + jumpifability TARGET, ABILITY_SUCTION_CUPS, BattleScript_AbilityPreventsPhasingOut + jumpifstatus3 TARGET, STATUS3_ROOTED, BattleScript_PrintMonIsRooted accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE jumpifbattletype BATTLE_TYPE_ARENA, BattleScript_ButItFailed @@ -1710,7 +1710,7 @@ BattleScript_EffectMagnitude:: pause 0x20 printstring STRINGID_MAGNITUDESTRENGTH waitmessage 0x40 - goto BattleScript_82D9C44 + goto BattleScript_HitsAllWithUndergroundBonusLoop BattleScript_EffectBatonPass:: attackcanceler @@ -1857,17 +1857,17 @@ BattleScript_EffectEarthquake:: attackstring ppreduce selectfirstvalidtarget -BattleScript_82D9C44:: +BattleScript_HitsAllWithUndergroundBonusLoop:: movevaluescleanup - jumpifnostatus3 TARGET, STATUS3_UNDERGROUND, BattleScript_82D9C64 + jumpifnostatus3 TARGET, STATUS3_UNDERGROUND, BattleScript_HitsAllNoUndergroundBonus orword gHitMarker, HITMARKER_IGNORE_UNDERGROUND setbyte sDMG_MULTIPLIER, 0x2 - goto BattleScript_82D9C73 -BattleScript_82D9C64:: + goto BattleScript_DoHitAllWithUndergroundBonus +BattleScript_HitsAllNoUndergroundBonus:: bicword gHitMarker, HITMARKER_IGNORE_UNDERGROUND setbyte sDMG_MULTIPLIER, 0x1 -BattleScript_82D9C73:: - accuracycheck BattleScript_82D9CAC, ACC_CURR_MOVE +BattleScript_DoHitAllWithUndergroundBonus:: + accuracycheck BattleScript_HitAllWithUndergroundBonusMissed, ACC_CURR_MOVE critcalc damagecalc typecalc @@ -1888,9 +1888,9 @@ BattleScript_82D9C73:: tryfaintmon TARGET, FALSE, NULL setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 - jumpifnexttargetvalid BattleScript_82D9C44 + jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop end -BattleScript_82D9CAC:: +BattleScript_HitAllWithUndergroundBonusMissed:: pause 0x20 typecalc effectivenesssound @@ -1898,7 +1898,7 @@ BattleScript_82D9CAC:: waitmessage 0x40 setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 - jumpifnexttargetvalid BattleScript_82D9C44 + jumpifnexttargetvalid BattleScript_HitsAllWithUndergroundBonusLoop end BattleScript_EffectFutureSight:: @@ -2289,10 +2289,10 @@ BattleScript_EffectFocusPunch:: BattleScript_EffectSmellingsalt:: jumpifstatus2 TARGET, STATUS2_SUBSTITUTE, BattleScript_EffectHit setmoveeffect EFFECT_REMOVE_PARALYSIS | CERTAIN - jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_82DA1BA + jumpifstatus TARGET, STATUS_PARALYSIS, BattleScript_SmellingsaltDoubleDmg goto BattleScript_EffectHit -BattleScript_82DA1BA:: +BattleScript_SmellingsaltDoubleDmg:: setbyte sDMG_MULTIPLIER, 0x2 goto BattleScript_EffectHit @@ -3289,14 +3289,13 @@ BattleScript_LeechSeedTurnDrain:: healthbarupdate ATTACKER datahpupdate ATTACKER copyword gBattleMoveDamage, gHpDealt - jumpifability ATTACKER, ABILITY_LIQUID_OOZE, BattleScript_82DAD47 + jumpifability ATTACKER, ABILITY_LIQUID_OOZE, BattleScript_LeechSeedTurnPrintLiquidOoze manipulatedamage ATK80_DMG_CHANGE_SIGN setbyte cMULTISTRING_CHOOSER, 0x3 - goto BattleScript_82DAD4D - -BattleScript_82DAD47:: + goto BattleScript_LeechSeedTurnPrintAndUpdateHp +BattleScript_LeechSeedTurnPrintLiquidOoze:: setbyte cMULTISTRING_CHOOSER, 0x4 -BattleScript_82DAD4D:: +BattleScript_LeechSeedTurnPrintAndUpdateHp:: orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 healthbarupdate TARGET datahpupdate TARGET @@ -3387,9 +3386,9 @@ BattleScript_DisabledNoMore:: waitmessage 0x40 end2 -BattleScript_82DAE2A:: +BattleScript_SelectingDisabledMoveInPalace:: printstring STRINGID_PKMNMOVEISDISABLED -BattleScript_82DAE2D:: +BattleScript_SelectingUnusableMoveInPalace:: setbyte sMOVEEND_STATE, 0x0 moveend 0x2, 0x10 end @@ -3534,19 +3533,19 @@ BattleScript_SpikesFree:: BattleScript_MonTookFutureAttack:: printstring STRINGID_PKMNTOOKATTACK waitmessage 0x40 - jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB001 - accuracycheck BattleScript_82DB058, MOVE_FUTURE_SIGHT - goto BattleScript_82DB008 -BattleScript_82DB001:: - accuracycheck BattleScript_82DB058, MOVE_DOOM_DESIRE -BattleScript_82DB008:: + jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_CheckDoomDesireMiss + accuracycheck BattleScript_FutureAttackMiss, MOVE_FUTURE_SIGHT + goto BattleScript_FutureAttackAnimate +BattleScript_CheckDoomDesireMiss:: + accuracycheck BattleScript_FutureAttackMiss, MOVE_DOOM_DESIRE +BattleScript_FutureAttackAnimate:: adjustnormaldamage2 - jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_82DB020 + jumpifbyte NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_FutureHitAnimDoomDesire playanimation ATTACKER, ANIM_FUTURE_SIGHT_HIT, NULL - goto BattleScript_82DB027 -BattleScript_82DB020:: - playanimation ATTACKER, ANIM_x13, NULL -BattleScript_82DB027:: + goto BattleScript_DoFutureAttackHit +BattleScript_FutureHitAnimDoomDesire:: + playanimation ATTACKER, ANIM_DOOM_DESIRE_HIT, NULL +BattleScript_DoFutureAttackHit:: effectivenesssound hitanimation TARGET waitstate @@ -3555,15 +3554,16 @@ BattleScript_82DB027:: resultmessage waitmessage 0x40 tryfaintmon TARGET, FALSE, NULL - atk24 BattleScript_82DB03F -BattleScript_82DB03F:: + atk24 BattleScript_FutureAttackEnd +BattleScript_FutureAttackEnd:: setbyte sMOVEEND_STATE, 0x0 moveend 0x1, 0x0 setbyte sMOVEEND_STATE, 0xB moveend 0x2, 0xE setbyte gBattleMoveFlags, 0 end2 -BattleScript_82DB058:: + +BattleScript_FutureAttackMiss:: pause 0x20 setbyte gBattleMoveFlags, 0 orbyte gBattleMoveFlags, MOVESTATUS_FAILED @@ -3591,14 +3591,14 @@ BattleScript_SelectingTormentedMove:: printselectionstring STRINGID_PKMNCANTUSEMOVETORMENT endselectionscript -BattleScript_82DB08D:: +BattleScript_MoveUsedIsTormented:: printstring STRINGID_PKMNCANTUSEMOVETORMENT waitmessage 0x40 goto BattleScript_MoveEnd -BattleScript_82DB098:: +BattleScript_SelectingTormentedMoveInPalace:: printstring STRINGID_PKMNCANTUSEMOVETORMENT - goto BattleScript_82DAE2D + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_SelectingNotAllowedMoveTaunt:: printselectionstring STRINGID_PKMNCANTUSEMOVETAUNT @@ -3609,12 +3609,12 @@ BattleScript_MoveUsedIsTaunted:: waitmessage 0x40 goto BattleScript_MoveEnd -BattleScript_82DB0AF:: +BattleScript_SelectingNotAllowedMoveTauntInPalace:: printstring STRINGID_PKMNCANTUSEMOVETAUNT - goto BattleScript_82DAE2D + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_WishComesTrue:: - trywish 0x1, BattleScript_82DB0DE + trywish 0x1, BattleScript_WishButFullHp playanimation TARGET, ANIM_WISH_HEAL, NULL printstring STRINGID_PKMNWISHCAMETRUE waitmessage 0x40 @@ -3625,7 +3625,7 @@ BattleScript_WishComesTrue:: waitmessage 0x40 end2 -BattleScript_82DB0DE:: +BattleScript_WishButFullHp:: printstring STRINGID_PKMNWISHCAMETRUE waitmessage 0x40 pause 0x20 @@ -3642,7 +3642,7 @@ BattleScript_IngrainTurnHeal:: datahpupdate ATTACKER end2 -BattleScript_82DB109:: +BattleScript_PrintMonIsRooted:: pause 0x20 printstring STRINGID_PKMNANCHOREDITSELF waitmessage 0x40 @@ -3682,9 +3682,9 @@ BattleScript_SelectingImprisionedMove:: printselectionstring STRINGID_PKMNCANTUSEMOVESEALED endselectionscript -BattleScript_82DB185:: +BattleScript_SelectingImprisionedMoveInPalace:: printstring STRINGID_PKMNCANTUSEMOVESEALED - goto BattleScript_82DAE2D + goto BattleScript_SelectingUnusableMoveInPalace BattleScript_GrudgeTakesPp:: printstring STRINGID_PKMNLOSTPPGRUDGE @@ -4135,7 +4135,7 @@ BattleScript_FlashFireBoost:: waitmessage 0x40 goto BattleScript_MoveEnd -BattleScript_82DB5B9:: +BattleScript_AbilityPreventsPhasingOut:: pause 0x20 printstring STRINGID_PKMNANCHORSITSELFWITH waitmessage 0x40 @@ -4577,12 +4577,12 @@ BattleScript_AskIfWantsToForfeitMatch:: forfeityesnobox ATTACKER endselectionscript -BattleScript_82DB9C1:: +BattleScript_PrintPlayerForfeited:: printstring STRINGID_FORFEITEDMATCH waitmessage 0x40 end2 -BattleScript_82DB9C8:: +BattleScript_PrintPlayerForfeitedLinkBattle:: printstring STRINGID_FORFEITEDMATCH waitmessage 0x40 atk57 diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index b2718b986..8341b15fd 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -90,12 +90,12 @@ BattleScript_WallyBallThrow:: BattleScript_ShakeBallThrow:: printfromtable gBallEscapeStringIds waitmessage 0x40 - jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_82DBE01 - jumpifbyte NOT_EQUAL, gNumSafariBalls, 0x0, BattleScript_82DBE01 + jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd + jumpifbyte NOT_EQUAL, gNumSafariBalls, 0x0, BattleScript_ShakeBallThrowEnd printstring STRINGID_OUTOFSAFARIBALLS waitmessage 0x40 setbyte gBattleOutcome, OUT_OF_BALLS -BattleScript_82DBE01:: +BattleScript_ShakeBallThrowEnd:: finishaction BattleScript_TrainerBallBlock:: diff --git a/include/battle.h b/include/battle.h index 9330f94e9..f72c3d3a2 100644 --- a/include/battle.h +++ b/include/battle.h @@ -86,7 +86,7 @@ #define BATTLE_FORFEITED 0x9 #define BATTLE_OPPONENT_TELEPORTED 0xA -#define BATTLE_OUTCOME_BIT_x80 0x80 +#define OUTCOME_LINK_BATTLE_RUN 0x80 #define STATUS_NONE 0x0 #define STATUS_SLEEP 0x7 @@ -801,7 +801,7 @@ extern struct BattleStruct* gBattleStruct; #define B_ANIM_ITEM_STEAL 0x10 #define B_ANIM_SNATCH_MOVE 0x11 #define B_ANIM_FUTURE_SIGHT_HIT 0x12 -#define B_ANIM_x13 0x13 +#define B_ANIM_DOOM_DESIRE_HIT 0x13 #define B_ANIM_x14 0x14 #define B_ANIM_INGRAIN_HEAL 0x15 #define B_ANIM_WISH_HEAL 0x16 diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 2260e38d2..2e31a37c5 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -74,8 +74,8 @@ extern const u8 BattleScript_RageIsBuilding[]; extern const u8 BattleScript_MoveUsedIsDisabled[]; extern const u8 BattleScript_SelectingDisabledMove[]; extern const u8 BattleScript_DisabledNoMore[]; -extern const u8 BattleScript_82DAE2A[]; -extern const u8 BattleScript_82DAE2D[]; +extern const u8 BattleScript_SelectingDisabledMoveInPalace[]; +extern const u8 BattleScript_SelectingUnusableMoveInPalace[]; extern const u8 BattleScript_EncoredNoMore[]; extern const u8 BattleScript_DestinyBondTakesLife[]; extern const u8 BattleScript_SpikesOnAttacker[]; @@ -109,22 +109,20 @@ extern const u8 BattleScript_NoMovesLeft[]; extern const u8 BattleScript_SelectingMoveWithNoPP[]; extern const u8 BattleScript_NoPPForMove[]; extern const u8 BattleScript_SelectingTormentedMove[]; -extern const u8 BattleScript_82DB08D[]; -extern const u8 BattleScript_82DB098[]; +extern const u8 BattleScript_MoveUsedIsTormented[]; +extern const u8 BattleScript_SelectingTormentedMoveInPalace[]; extern const u8 BattleScript_SelectingNotAllowedMoveTaunt[]; extern const u8 BattleScript_MoveUsedIsTaunted[]; -extern const u8 BattleScript_82DB0AF[]; +extern const u8 BattleScript_SelectingNotAllowedMoveTauntInPalace[]; extern const u8 BattleScript_WishComesTrue[]; -extern const u8 BattleScript_82DB0DE[]; extern const u8 BattleScript_IngrainTurnHeal[]; -extern const u8 BattleScript_82DB109[]; 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[]; -extern const u8 BattleScript_82DB185[]; +extern const u8 BattleScript_SelectingImprisionedMoveInPalace[]; extern const u8 BattleScript_GrudgeTakesPp[]; extern const u8 BattleScript_MagicCoatBounce[]; extern const u8 BattleScript_SnatchedMove[]; @@ -203,7 +201,6 @@ extern const u8 BattleScript_MonMadeMoveUseless_PPLoss[]; extern const u8 BattleScript_MonMadeMoveUseless[]; extern const u8 BattleScript_FlashFireBoost_PPLoss[]; extern const u8 BattleScript_FlashFireBoost[]; -extern const u8 BattleScript_82DB5B9[]; extern const u8 BattleScript_AbilityNoStatLoss[]; extern const u8 BattleScript_BRNPrevention[]; extern const u8 BattleScript_PRLZPrevention[]; @@ -265,8 +262,8 @@ extern const u8 BattleScript_82DB8F3[]; extern const u8 BattleScript_82DB973[]; extern const u8 BattleScript_82DB992[]; extern const u8 BattleScript_AskIfWantsToForfeitMatch[]; -extern const u8 BattleScript_82DB9C1[]; -extern const u8 BattleScript_82DB9C8[]; +extern const u8 BattleScript_PrintPlayerForfeited[]; +extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[]; extern const u8 BattleScript_BallThrow[]; extern const u8 BattleScript_BallThrowByWally[]; extern const u8 BattleScript_SafariBallThrow[]; diff --git a/src/battle_2.c b/src/battle_2.c index 328eacd85..ad1c8a179 100644 --- a/src/battle_2.c +++ b/src/battle_2.c @@ -2872,7 +2872,7 @@ void SwitchInClearSetData(void) && (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0 && (gDisableStructs[i].bankWithSureHit == gActiveBank)) { - gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; + gStatuses3[i] &= ~(STATUS3_ALWAYS_HITS); gStatuses3[i] |= 0x10; } } @@ -4729,7 +4729,7 @@ static void HandleEndTurn_BattleWon(void) gBattleTextBuff1[0] = gBattleOutcome; gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; - gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); + gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); } else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_x4000000 | BATTLE_TYPE_EREADER_TRAINER)) @@ -4785,16 +4785,16 @@ static void HandleEndTurn_BattleLost(void) { if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER) { - if (gBattleOutcome & BATTLE_OUTCOME_BIT_x80) + if (gBattleOutcome & OUTCOME_LINK_BATTLE_RUN) { - gBattlescriptCurrInstr = BattleScript_82DB9C8; - gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); + gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeitedLinkBattle; + gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); gSaveBlock2Ptr->field_CA9_b = 1; } else { gBattlescriptCurrInstr = BattleScript_82DAA0B; - gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); + gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); } } else @@ -4802,7 +4802,7 @@ static void HandleEndTurn_BattleLost(void) gBattleTextBuff1[0] = gBattleOutcome; gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; - gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); + gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN); } } else @@ -4819,13 +4819,13 @@ static void HandleEndTurn_RanFromBattle(void) if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER && gBattleTypeFlags & BATTLE_TYPE_TRAINER) { - gBattlescriptCurrInstr = BattleScript_82DB9C1; + gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited; gBattleOutcome = BATTLE_FORFEITED; gSaveBlock2Ptr->field_CA9_b = 1; } else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) { - gBattlescriptCurrInstr = BattleScript_82DB9C1; + gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited; gBattleOutcome = BATTLE_FORFEITED; } else @@ -5439,7 +5439,7 @@ static void HandleAction_Run(void) } } - gBattleOutcome |= BATTLE_OUTCOME_BIT_x80; + gBattleOutcome |= OUTCOME_LINK_BATTLE_RUN; gSaveBlock2Ptr->field_CA9_b = 1; } else diff --git a/src/battle_message.c b/src/battle_message.c index 77f7cc722..cf5a55140 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1632,9 +1632,9 @@ void BufferStringBattle(u16 stringID) stringPtr = gText_AttackerUsedX; break; case STRINGID_BATTLEEND: // battle end - if (gBattleTextBuff1[0] & BATTLE_OUTCOME_BIT_x80) + if (gBattleTextBuff1[0] & OUTCOME_LINK_BATTLE_RUN) { - gBattleTextBuff1[0] &= ~(BATTLE_OUTCOME_BIT_x80); + gBattleTextBuff1[0] &= ~(OUTCOME_LINK_BATTLE_RUN); if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != BATTLE_DREW) gBattleTextBuff1[0] ^= (BATTLE_LOST | BATTLE_WON); diff --git a/src/battle_util.c b/src/battle_util.c index c08833858..b4268673c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -364,7 +364,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DAE2A; + gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingDisabledMoveInPalace; gProtectStructs[gActiveBank].flag_x10 = 1; } else @@ -379,7 +379,7 @@ u8 TrySetCantSelectMoveBattleScript(void) CancelMultiTurnMoves(gActiveBank); if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB098; + gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingTormentedMoveInPalace; gProtectStructs[gActiveBank].flag_x10 = 1; } else @@ -394,7 +394,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB0AF; + gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingNotAllowedMoveTauntInPalace; gProtectStructs[gActiveBank].flag_x10 = 1; } else @@ -409,7 +409,7 @@ u8 TrySetCantSelectMoveBattleScript(void) gCurrentMove = move; if (gBattleTypeFlags & BATTLE_TYPE_PALACE) { - gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB185; + gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingImprisionedMoveInPalace; gProtectStructs[gActiveBank].flag_x10 = 1; } else @@ -1313,7 +1313,7 @@ void TryClearRageStatuses(void) u8 AtkCanceller_UnableToUseMove(void) { u8 effect = 0; - s32* bideDmg = &gBattleScripting.bideDmg; + s32 *bideDmg = &gBattleScripting.bideDmg; do { switch (gBattleStruct->atkCancellerTracker)