label battle stuff

This commit is contained in:
DizzyEggg 2017-12-02 14:08:55 +01:00
parent 273474d57a
commit d75e7ace1d
10 changed files with 156 additions and 498 deletions

View File

@ -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

View File

@ -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

View File

@ -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];

View File

@ -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[];

View File

@ -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

View File

@ -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;
}
}

View File

@ -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:

View File

@ -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;

View File

@ -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);

View File

@ -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;