Merge pull request #129 from DizzyEggg/dumb_naming

Name some battle labels
This commit is contained in:
Cameron Hall 2017-12-05 12:05:06 -06:00 committed by GitHub
commit fd75493bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 415 additions and 759 deletions

View File

@ -422,10 +422,10 @@
.byte \bank .byte \bank
.endm .endm
.macro switchinanim bank, param1 .macro switchinanim bank, dontclearsubstitutebit
.byte 0x4e .byte 0x4e
.byte \bank .byte \bank
.byte \param1 .byte \dontclearsubstitutebit
.endm .endm
.macro jumpifcantswitch bank, param1 .macro jumpifcantswitch bank, param1
@ -1387,3 +1387,15 @@
.macro jumpifnostatus3 bank, status, jumpptr .macro jumpifnostatus3 bank, status, jumpptr
jumpifstatus3condition \bank, \status, 0x1, \jumpptr jumpifstatus3condition \bank, \status, 0x1, \jumpptr
.endm .endm
.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

@ -18,7 +18,7 @@
.set ANIM_ITEM_STEAL, 0x10 .set ANIM_ITEM_STEAL, 0x10
.set ANIM_SNATCH_MOVE, 0x11 .set ANIM_SNATCH_MOVE, 0x11
.set ANIM_FUTURE_SIGHT_HIT, 0x12 .set ANIM_FUTURE_SIGHT_HIT, 0x12
.set ANIM_x13, 0x13 .set ANIM_DOOM_DESIRE_HIT, 0x13
.set ANIM_x14, 0x14 .set ANIM_x14, 0x14
.set ANIM_INGRAIN_HEAL, 0x15 .set ANIM_INGRAIN_HEAL, 0x15
.set ANIM_WISH_HEAL, 0x16 .set ANIM_WISH_HEAL, 0x16
@ -146,8 +146,8 @@
.equiv sANIM_ARG2, gBattleScripting + 0x11 .equiv sANIM_ARG2, gBattleScripting + 0x11
.equiv sTRIPLE_KICK_POWER, gBattleScripting + 0x12 .equiv sTRIPLE_KICK_POWER, gBattleScripting + 0x12
.equiv sMOVEEND_STATE, gBattleScripting + 0x14 .equiv sMOVEEND_STATE, gBattleScripting + 0x14
.equiv sFIELD_15, gBattleScripting + 0x15 .equiv sBANK_WITH_ABILITY, gBattleScripting + 0x15
.equiv sFIELD_16, gBattleScripting + 0x16 .equiv sMULTIHIT_EFFECT, gBattleScripting + 0x16
.equiv sBANK, gBattleScripting + 0x17 .equiv sBANK, gBattleScripting + 0x17
.equiv sANIM_TURN, gBattleScripting + 0x18 .equiv sANIM_TURN, gBattleScripting + 0x18
.equiv sANIM_TARGETS_HIT, gBattleScripting + 0x19 .equiv sANIM_TARGETS_HIT, gBattleScripting + 0x19

File diff suppressed because it is too large Load Diff

View File

@ -24,13 +24,13 @@ gBattlescriptsForBallThrow:: @ 82DBD08
.4byte BattleScript_BallThrow .4byte BattleScript_BallThrow
.align 2 .align 2
gUnknown_082DBD3C:: @ 82DBD3C gBattlescriptsForUsingItem:: @ 82DBD3C
.4byte BattleScript_82DBE12 .4byte BattleScript_PlayerUsesItem
.4byte BattleScript_82DBE1C .4byte BattleScript_OpponentUsesHealItem
.4byte BattleScript_82DBE1C .4byte BattleScript_OpponentUsesHealItem
.4byte BattleScript_82DBE4B .4byte BattleScript_OpponentUsesStatusCureItem
.4byte BattleScript_82DBE6F .4byte BattleScript_OpponentUsesXItem
.4byte BattleScript_82DBE91 .4byte BattleScript_OpponentUsesGuardSpecs
.align 2 .align 2
gBattlescriptsForRunningByItem:: @ 82DBD54 gBattlescriptsForRunningByItem:: @ 82DBD54
@ -58,27 +58,27 @@ BattleScript_SafariBallThrow::
handleballthrow handleballthrow
BattleScript_SuccessBallThrow:: BattleScript_SuccessBallThrow::
jumpifhalfword EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_82DBD92 jumpifhalfword EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_PrintCaughtMonInfo
incrementgamestat 0xB incrementgamestat 0xB
BattleScript_82DBD92:: BattleScript_PrintCaughtMonInfo::
printstring STRINGID_GOTCHAPKMNCAUGHT printstring STRINGID_GOTCHAPKMNCAUGHT
trysetcaughtmondexflags BattleScript_82DBDA5 trysetcaughtmondexflags BattleScript_TryNicknameCaughtMon
printstring STRINGID_PKMNDATAADDEDTODEX printstring STRINGID_PKMNDATAADDEDTODEX
waitstate waitstate
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0x0
displaydexinfo displaydexinfo
BattleScript_82DBDA5:: BattleScript_TryNicknameCaughtMon::
printstring STRINGID_GIVENICKNAMECAPTURED printstring STRINGID_GIVENICKNAMECAPTURED
waitstate waitstate
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0x0
trygivecaughtmonnick BattleScript_82DBDC2 trygivecaughtmonnick BattleScript_GiveCaughtMonEnd
givecaughtmon givecaughtmon
printfromtable gCaughtMonStringIds printfromtable gCaughtMonStringIds
waitmessage 0x40 waitmessage 0x40
goto BattleScript_82DBDC3 goto BattleScript_SuccessBallThrowEnd
BattleScript_82DBDC2:: BattleScript_GiveCaughtMonEnd::
givecaughtmon givecaughtmon
BattleScript_82DBDC3:: BattleScript_SuccessBallThrowEnd::
setbyte gBattleOutcome, CAUGHT setbyte gBattleOutcome, CAUGHT
finishturn finishturn
@ -90,12 +90,12 @@ BattleScript_WallyBallThrow::
BattleScript_ShakeBallThrow:: BattleScript_ShakeBallThrow::
printfromtable gBallEscapeStringIds printfromtable gBallEscapeStringIds
waitmessage 0x40 waitmessage 0x40
jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_82DBE01 jumpifword NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd
jumpifbyte NOT_EQUAL, gNumSafariBalls, 0x0, BattleScript_82DBE01 jumpifbyte NOT_EQUAL, gNumSafariBalls, 0x0, BattleScript_ShakeBallThrowEnd
printstring STRINGID_OUTOFSAFARIBALLS printstring STRINGID_OUTOFSAFARIBALLS
waitmessage 0x40 waitmessage 0x40
setbyte gBattleOutcome, OUT_OF_BALLS setbyte gBattleOutcome, OUT_OF_BALLS
BattleScript_82DBE01:: BattleScript_ShakeBallThrowEnd::
finishaction finishaction
BattleScript_TrainerBallBlock:: BattleScript_TrainerBallBlock::
@ -106,12 +106,12 @@ BattleScript_TrainerBallBlock::
waitmessage 0x40 waitmessage 0x40
finishaction finishaction
BattleScript_82DBE12:: BattleScript_PlayerUsesItem::
setbyte sMOVEEND_STATE, 0xF setbyte sMOVEEND_STATE, 0xF
moveend 0x1, 0x0 moveend 0x1, 0x0
end end
BattleScript_82DBE1C:: BattleScript_OpponentUsesHealItem::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
pause 0x30 pause 0x30
playse SE_KAIFUKU playse SE_KAIFUKU
@ -128,7 +128,7 @@ BattleScript_82DBE1C::
moveend 0x1, 0x0 moveend 0x1, 0x0
finishaction finishaction
BattleScript_82DBE4B:: BattleScript_OpponentUsesStatusCureItem::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
pause 0x30 pause 0x30
playse SE_KAIFUKU playse SE_KAIFUKU
@ -142,7 +142,7 @@ BattleScript_82DBE4B::
moveend 0x1, 0x0 moveend 0x1, 0x0
finishaction finishaction
BattleScript_82DBE6F:: BattleScript_OpponentUsesXItem::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
pause 0x30 pause 0x30
playse SE_KAIFUKU playse SE_KAIFUKU
@ -155,7 +155,7 @@ BattleScript_82DBE6F::
moveend 0x1, 0x0 moveend 0x1, 0x0
finishaction finishaction
BattleScript_82DBE91:: BattleScript_OpponentUsesGuardSpecs::
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
pause 0x30 pause 0x30
playse SE_KAIFUKU playse SE_KAIFUKU

View File

@ -86,7 +86,7 @@
#define BATTLE_FORFEITED 0x9 #define BATTLE_FORFEITED 0x9
#define BATTLE_OPPONENT_TELEPORTED 0xA #define BATTLE_OPPONENT_TELEPORTED 0xA
#define BATTLE_OUTCOME_BIT_x80 0x80 #define OUTCOME_LINK_BATTLE_RUN 0x80
#define STATUS_NONE 0x0 #define STATUS_NONE 0x0
#define STATUS_SLEEP 0x7 #define STATUS_SLEEP 0x7
@ -616,10 +616,10 @@ struct BattleStruct
u8 focusPunchBank; u8 focusPunchBank;
u8 field_49; u8 field_49;
u8 moneyMultiplier; u8 moneyMultiplier;
u8 field_4B; u8 savedTurnActionNumber;
u8 switchInAbilitiesCounter; u8 switchInAbilitiesCounter;
u8 field_4D; u8 faintedActionsState;
u8 field_4E; u8 faintedActionsBank;
u8 field_4F; u8 field_4F;
u16 expValue; u16 expValue;
u8 field_52; u8 field_52;
@ -691,8 +691,8 @@ struct BattleStruct
u8 field_182; u8 field_182;
u8 field_183; u8 field_183;
struct BattleEnigmaBerry battleEnigmaBerry; struct BattleEnigmaBerry battleEnigmaBerry;
u8 field_1A0; u8 wishPerishSongState;
u8 field_1A1; u8 wishPerishSongBank;
bool8 overworldWeatherDone; bool8 overworldWeatherDone;
u8 atkCancellerTracker; u8 atkCancellerTracker;
u8 field_1A4[96]; u8 field_1A4[96];
@ -801,7 +801,7 @@ extern struct BattleStruct* gBattleStruct;
#define B_ANIM_ITEM_STEAL 0x10 #define B_ANIM_ITEM_STEAL 0x10
#define B_ANIM_SNATCH_MOVE 0x11 #define B_ANIM_SNATCH_MOVE 0x11
#define B_ANIM_FUTURE_SIGHT_HIT 0x12 #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_x14 0x14
#define B_ANIM_INGRAIN_HEAL 0x15 #define B_ANIM_INGRAIN_HEAL 0x15
#define B_ANIM_WISH_HEAL 0x16 #define B_ANIM_WISH_HEAL 0x16
@ -846,8 +846,8 @@ struct BattleScripting
u8 animArg2; u8 animArg2;
u16 tripleKickPower; u16 tripleKickPower;
u8 atk49_state; u8 atk49_state;
u8 field_15; u8 bankWithAbility;
u8 field_16; u8 multihitMoveEffect;
u8 bank; u8 bank;
u8 animTurn; u8 animTurn;
u8 animTargetsHit; u8 animTargetsHit;

View File

@ -1,356 +1,22 @@
#ifndef GUARD_BATTLE_SCRIPTS_H #ifndef GUARD_BATTLE_SCRIPTS_H
#define 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_HitFromCritCalc[];
extern const u8 BattleScript_HitFromAtkAnimation[];
extern const u8 BattleScript_MoveEnd[]; extern const u8 BattleScript_MoveEnd[];
extern const u8 BattleScript_MakeMoveMissed[]; extern const u8 BattleScript_MakeMoveMissed[];
extern const u8 BattleScript_PrintMoveMissed[]; extern const u8 BattleScript_PrintMoveMissed[];
extern const u8 BattleScript_MoveMissedPause[]; extern const u8 BattleScript_MoveMissedPause[];
extern const u8 BattleScript_MoveMissed[]; 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_ButItFailed[];
extern const u8 BattleScript_NotAffected[]; extern const u8 BattleScript_StatUp[];
extern const u8 BattleScript_EffectUproar[]; extern const u8 BattleScript_StatDown[];
extern const u8 BattleScript_UproarHit[]; extern const u8 BattleScript_AlreadyAtFullHp[];
extern const u8 BattleScript_EffectStockpile[]; extern const u8 BattleScript_PresentHealTarget[];
extern const u8 BattleScript_EffectSpitUp[]; extern const u8 BattleScript_MoveUsedMustRecharge[];
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_FaintAttacker[]; extern const u8 BattleScript_FaintAttacker[];
extern const u8 BattleScript_FaintTarget[]; extern const u8 BattleScript_FaintTarget[];
extern const u8 BattleScript_82DA7C4[]; extern const u8 BattleScript_GiveExp[];
extern const u8 BattleScript_82DA7CD[]; extern const u8 BattleScript_HandleFaintedMon[];
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_LocalTrainerBattleWon[]; extern const u8 BattleScript_LocalTrainerBattleWon[];
extern const u8 BattleScript_LocalTwoTrainersDefeated[]; extern const u8 BattleScript_LocalTwoTrainersDefeated[];
extern const u8 BattleScript_LocalBattleWonLoseTexts[]; extern const u8 BattleScript_LocalBattleWonLoseTexts[];
@ -360,13 +26,9 @@ extern const u8 BattleScript_LocalBattleLost[];
extern const u8 BattleScript_LocalBattleLostPrintWhiteOut[]; extern const u8 BattleScript_LocalBattleLostPrintWhiteOut[];
extern const u8 BattleScript_LocalBattleLostEnd[]; extern const u8 BattleScript_LocalBattleLostEnd[];
extern const u8 BattleScript_CheckDomeDrew[]; 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_82DAA0B[];
extern const u8 BattleScript_82DAA31[]; extern const u8 BattleScript_82DAA31[];
extern const u8 BattleScript_LinkBattleWonOrLost[]; extern const u8 BattleScript_LinkBattleWonOrLost[];
extern const u8 BattleScript_LinkBattleWonOrLostWaitEnd[];
extern const u8 BattleScript_82DAA5C[]; extern const u8 BattleScript_82DAA5C[];
extern const u8 BattleScript_82DAA83[]; extern const u8 BattleScript_82DAA83[];
extern const u8 BattleScript_FrontierTrainerBattleWon[]; extern const u8 BattleScript_FrontierTrainerBattleWon[];
@ -390,17 +52,8 @@ extern const u8 BattleScript_82DAB77[];
extern const u8 BattleScript_82DABB8[]; extern const u8 BattleScript_82DABB8[];
extern const u8 BattleScript_Pausex20[]; extern const u8 BattleScript_Pausex20[];
extern const u8 BattleScript_LevelUp[]; 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_RainContinuesOrEnds[];
extern const u8 BattleScript_RainContinuesOrEndsEnd[];
extern const u8 BattleScript_DamagingWeatherContinues[]; 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_SandStormHailEnds[];
extern const u8 BattleScript_SunlightContinues[]; extern const u8 BattleScript_SunlightContinues[];
extern const u8 BattleScript_SunlightFaded[]; extern const u8 BattleScript_SunlightFaded[];
@ -414,15 +67,15 @@ extern const u8 BattleScript_82DAD4D[];
extern const u8 BattleScript_BideStoringEnergy[]; extern const u8 BattleScript_BideStoringEnergy[];
extern const u8 BattleScript_BideAttack[]; extern const u8 BattleScript_BideAttack[];
extern const u8 BattleScript_BideNoEnergyToAttack[]; extern const u8 BattleScript_BideNoEnergyToAttack[];
extern const u8 BattleScript_82DADD8[]; extern const u8 BattleScript_SuccessForceOut[];
extern const u8 BattleScript_82DADF1[]; extern const u8 BattleScript_82DADF1[];
extern const u8 BattleScript_MistProtected[]; extern const u8 BattleScript_MistProtected[];
extern const u8 BattleScript_RageIsBuilding[]; extern const u8 BattleScript_RageIsBuilding[];
extern const u8 BattleScript_MoveUsedIsDisabled[]; extern const u8 BattleScript_MoveUsedIsDisabled[];
extern const u8 BattleScript_SelectingDisabledMove[]; extern const u8 BattleScript_SelectingDisabledMove[];
extern const u8 BattleScript_DisabledNoMore[]; extern const u8 BattleScript_DisabledNoMore[];
extern const u8 BattleScript_82DAE2A[]; extern const u8 BattleScript_SelectingDisabledMoveInPalace[];
extern const u8 BattleScript_82DAE2D[]; extern const u8 BattleScript_SelectingUnusableMoveInPalace[];
extern const u8 BattleScript_EncoredNoMore[]; extern const u8 BattleScript_EncoredNoMore[];
extern const u8 BattleScript_DestinyBondTakesLife[]; extern const u8 BattleScript_DestinyBondTakesLife[];
extern const u8 BattleScript_SpikesOnAttacker[]; extern const u8 BattleScript_SpikesOnAttacker[];
@ -456,22 +109,20 @@ extern const u8 BattleScript_NoMovesLeft[];
extern const u8 BattleScript_SelectingMoveWithNoPP[]; extern const u8 BattleScript_SelectingMoveWithNoPP[];
extern const u8 BattleScript_NoPPForMove[]; extern const u8 BattleScript_NoPPForMove[];
extern const u8 BattleScript_SelectingTormentedMove[]; extern const u8 BattleScript_SelectingTormentedMove[];
extern const u8 BattleScript_82DB08D[]; extern const u8 BattleScript_MoveUsedIsTormented[];
extern const u8 BattleScript_82DB098[]; extern const u8 BattleScript_SelectingTormentedMoveInPalace[];
extern const u8 BattleScript_SelectingNotAllowedMoveTaunt[]; extern const u8 BattleScript_SelectingNotAllowedMoveTaunt[];
extern const u8 BattleScript_MoveUsedIsTaunted[]; extern const u8 BattleScript_MoveUsedIsTaunted[];
extern const u8 BattleScript_82DB0AF[]; extern const u8 BattleScript_SelectingNotAllowedMoveTauntInPalace[];
extern const u8 BattleScript_WishComesTrue[]; extern const u8 BattleScript_WishComesTrue[];
extern const u8 BattleScript_82DB0DE[];
extern const u8 BattleScript_IngrainTurnHeal[]; extern const u8 BattleScript_IngrainTurnHeal[];
extern const u8 BattleScript_82DB109[];
extern const u8 BattleScript_AtkDefDown[]; extern const u8 BattleScript_AtkDefDown[];
extern const u8 BattleScript_82DB144[]; extern const u8 BattleScript_82DB144[];
extern const u8 BattleScript_82DB167[]; extern const u8 BattleScript_82DB167[];
extern const u8 BattleScript_KnockedOff[]; extern const u8 BattleScript_KnockedOff[];
extern const u8 BattleScript_MoveUsedIsImprisoned[]; extern const u8 BattleScript_MoveUsedIsImprisoned[];
extern const u8 BattleScript_SelectingImprisionedMove[]; extern const u8 BattleScript_SelectingImprisionedMove[];
extern const u8 BattleScript_82DB185[]; extern const u8 BattleScript_SelectingImprisionedMoveInPalace[];
extern const u8 BattleScript_GrudgeTakesPp[]; extern const u8 BattleScript_GrudgeTakesPp[];
extern const u8 BattleScript_MagicCoatBounce[]; extern const u8 BattleScript_MagicCoatBounce[];
extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_SnatchedMove[];
@ -550,7 +201,6 @@ extern const u8 BattleScript_MonMadeMoveUseless_PPLoss[];
extern const u8 BattleScript_MonMadeMoveUseless[]; extern const u8 BattleScript_MonMadeMoveUseless[];
extern const u8 BattleScript_FlashFireBoost_PPLoss[]; extern const u8 BattleScript_FlashFireBoost_PPLoss[];
extern const u8 BattleScript_FlashFireBoost[]; extern const u8 BattleScript_FlashFireBoost[];
extern const u8 BattleScript_82DB5B9[];
extern const u8 BattleScript_AbilityNoStatLoss[]; extern const u8 BattleScript_AbilityNoStatLoss[];
extern const u8 BattleScript_BRNPrevention[]; extern const u8 BattleScript_BRNPrevention[];
extern const u8 BattleScript_PRLZPrevention[]; extern const u8 BattleScript_PRLZPrevention[];
@ -612,8 +262,8 @@ extern const u8 BattleScript_82DB8F3[];
extern const u8 BattleScript_82DB973[]; extern const u8 BattleScript_82DB973[];
extern const u8 BattleScript_82DB992[]; extern const u8 BattleScript_82DB992[];
extern const u8 BattleScript_AskIfWantsToForfeitMatch[]; extern const u8 BattleScript_AskIfWantsToForfeitMatch[];
extern const u8 BattleScript_82DB9C1[]; extern const u8 BattleScript_PrintPlayerForfeited[];
extern const u8 BattleScript_82DB9C8[]; extern const u8 BattleScript_PrintPlayerForfeitedLinkBattle[];
extern const u8 BattleScript_BallThrow[]; extern const u8 BattleScript_BallThrow[];
extern const u8 BattleScript_BallThrowByWally[]; extern const u8 BattleScript_BallThrowByWally[];
extern const u8 BattleScript_SafariBallThrow[]; extern const u8 BattleScript_SafariBallThrow[];

View File

@ -66,8 +66,8 @@ bool8 AreAllMovesUnusable(void);
u8 GetImprisonedMovesCount(u8 bank, u16 move); u8 GetImprisonedMovesCount(u8 bank, u16 move);
u8 UpdateTurnCounters(void); u8 UpdateTurnCounters(void);
u8 TurnBasedEffects(void); u8 TurnBasedEffects(void);
bool8 sub_8041364(void); bool8 HandleWishPerishSongOnTurnEnd(void);
bool8 sub_8041728(void); bool8 HandleFaintedMonActions(void);
void TryClearRageStatuses(void); void TryClearRageStatuses(void);
u8 AtkCanceller_UnableToUseMove(void); u8 AtkCanceller_UnableToUseMove(void);
bool8 sub_80423F4(u8 bank, u8 r1, u8 r2); 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 ClearFuryCutterDestinyBondGrudge(u8 bank);
void HandleAction_RunBattleScript(void); void HandleAction_RunBattleScript(void);
u8 GetMoveTarget(u16 move, u8 useMoveTarget); u8 GetMoveTarget(u16 move, u8 useMoveTarget);
u8 IsPokeDisobedient(void); u8 IsMonDisobedient(void);
#endif // GUARD_BATTLE_UTIL_H #endif // GUARD_BATTLE_UTIL_H

View File

@ -160,7 +160,7 @@ extern const u8 gStatStageRatios[][2];
extern const u8 * const gBattleScriptsForMoveEffects[]; extern const u8 * const gBattleScriptsForMoveEffects[];
extern const u8 * const gBattlescriptsForBallThrow[]; extern const u8 * const gBattlescriptsForBallThrow[];
extern const u8 * const gBattlescriptsForRunningByItem[]; extern const u8 * const gBattlescriptsForRunningByItem[];
extern const u8 * const gUnknown_082DBD3C[]; extern const u8 * const gBattlescriptsForUsingItem[];
extern const u8 * const gBattlescriptsForSafariActions[]; extern const u8 * const gBattlescriptsForSafariActions[];
// strings // strings
@ -2872,7 +2872,7 @@ void SwitchInClearSetData(void)
&& (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0 && (gStatuses3[i] & STATUS3_ALWAYS_HITS) != 0
&& (gDisableStructs[i].bankWithSureHit == gActiveBank)) && (gDisableStructs[i].bankWithSureHit == gActiveBank))
{ {
gStatuses3[i] &= ~STATUS3_ALWAYS_HITS; gStatuses3[i] &= ~(STATUS3_ALWAYS_HITS);
gStatuses3[i] |= 0x10; gStatuses3[i] |= 0x10;
} }
} }
@ -3668,10 +3668,10 @@ static void TryDoEventsBeforeFirstTurn(void)
*(&gBattleStruct->turnEffectsTracker) = 0; *(&gBattleStruct->turnEffectsTracker) = 0;
*(&gBattleStruct->turnEffectsBank) = 0; *(&gBattleStruct->turnEffectsBank) = 0;
*(&gBattleStruct->field_1A0) = 0; *(&gBattleStruct->wishPerishSongState) = 0;
*(&gBattleStruct->field_1A1) = 0; *(&gBattleStruct->wishPerishSongBank) = 0;
gBattleScripting.atk49_state = 0; gBattleScripting.atk49_state = 0;
gBattleStruct->field_4D = 0; gBattleStruct->faintedActionsState = 0;
gBattleStruct->turncountersTracker = 0; gBattleStruct->turncountersTracker = 0;
gBattleMoveFlags = 0; gBattleMoveFlags = 0;
@ -3701,8 +3701,8 @@ static void HandleEndTurn_ContinueBattle(void)
} }
gBattleStruct->turnEffectsTracker = 0; gBattleStruct->turnEffectsTracker = 0;
gBattleStruct->turnEffectsBank = 0; gBattleStruct->turnEffectsBank = 0;
gBattleStruct->field_1A0 = 0; gBattleStruct->wishPerishSongState = 0;
gBattleStruct->field_1A1 = 0; gBattleStruct->wishPerishSongBank = 0;
gBattleStruct->turncountersTracker = 0; gBattleStruct->turncountersTracker = 0;
gBattleMoveFlags = 0; gBattleMoveFlags = 0;
} }
@ -3720,10 +3720,10 @@ void BattleTurnPassed(void)
if (TurnBasedEffects() != 0) if (TurnBasedEffects() != 0)
return; return;
} }
if (sub_8041728() != 0) if (HandleFaintedMonActions() != 0)
return; return;
gBattleStruct->field_4D = 0; gBattleStruct->faintedActionsState = 0;
if (sub_8041364() != 0) if (HandleWishPerishSongOnTurnEnd() != 0)
return; return;
TurnValuesCleanUp(FALSE); TurnValuesCleanUp(FALSE);
@ -4692,7 +4692,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void)
gBattleMainFunc = RunTurnActionsFunctions; gBattleMainFunc = RunTurnActionsFunctions;
gBattleCommunication[3] = 0; gBattleCommunication[3] = 0;
gBattleCommunication[4] = 0; gBattleCommunication[4] = 0;
gBattleScripting.field_16 = 0; gBattleScripting.multihitMoveEffect = 0;
gBattleResources->battleScriptsStack->size = 0; gBattleResources->battleScriptsStack->size = 0;
} }
@ -4701,7 +4701,7 @@ static void RunTurnActionsFunctions(void)
if (gBattleOutcome != 0) if (gBattleOutcome != 0)
gCurrentActionFuncId = 12; gCurrentActionFuncId = 12;
*(&gBattleStruct->field_4B) = gCurrentTurnActionNumber; *(&gBattleStruct->savedTurnActionNumber) = gCurrentTurnActionNumber;
sTurnActionsFuncsTable[gCurrentActionFuncId](); sTurnActionsFuncsTable[gCurrentActionFuncId]();
if (gCurrentTurnActionNumber >= gNoOfAllBanks) // everyone did their actions, turn finished if (gCurrentTurnActionNumber >= gNoOfAllBanks) // everyone did their actions, turn finished
@ -4711,7 +4711,7 @@ static void RunTurnActionsFunctions(void)
} }
else 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_NO_ATTACKSTRING);
gHitMarker &= ~(HITMARKER_UNABLE_TO_USE_MOVE); gHitMarker &= ~(HITMARKER_UNABLE_TO_USE_MOVE);
@ -4729,7 +4729,7 @@ static void HandleEndTurn_BattleWon(void)
gBattleTextBuff1[0] = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome;
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1);
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
} }
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
&& gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_x4000000 | BATTLE_TYPE_EREADER_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 (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
{ {
if (gBattleOutcome & BATTLE_OUTCOME_BIT_x80) if (gBattleOutcome & OUTCOME_LINK_BATTLE_RUN)
{ {
gBattlescriptCurrInstr = BattleScript_82DB9C8; gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeitedLinkBattle;
gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
gSaveBlock2Ptr->field_CA9_b = 1; gSaveBlock2Ptr->field_CA9_b = 1;
} }
else else
{ {
gBattlescriptCurrInstr = BattleScript_82DAA0B; gBattlescriptCurrInstr = BattleScript_82DAA0B;
gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
} }
} }
else else
@ -4802,7 +4802,7 @@ static void HandleEndTurn_BattleLost(void)
gBattleTextBuff1[0] = gBattleOutcome; gBattleTextBuff1[0] = gBattleOutcome;
gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1); gBankAttacker = GetBankByIdentity(IDENTITY_PLAYER_MON1);
gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost; gBattlescriptCurrInstr = BattleScript_LinkBattleWonOrLost;
gBattleOutcome &= ~(BATTLE_OUTCOME_BIT_x80); gBattleOutcome &= ~(OUTCOME_LINK_BATTLE_RUN);
} }
} }
else else
@ -4819,13 +4819,13 @@ static void HandleEndTurn_RanFromBattle(void)
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER && gBattleTypeFlags & BATTLE_TYPE_TRAINER) if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER && gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{ {
gBattlescriptCurrInstr = BattleScript_82DB9C1; gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited;
gBattleOutcome = BATTLE_FORFEITED; gBattleOutcome = BATTLE_FORFEITED;
gSaveBlock2Ptr->field_CA9_b = 1; gSaveBlock2Ptr->field_CA9_b = 1;
} }
else if (gBattleTypeFlags & BATTLE_TYPE_x4000000) else if (gBattleTypeFlags & BATTLE_TYPE_x4000000)
{ {
gBattlescriptCurrInstr = BattleScript_82DB9C1; gBattlescriptCurrInstr = BattleScript_PrintPlayerForfeited;
gBattleOutcome = BATTLE_FORFEITED; gBattleOutcome = BATTLE_FORFEITED;
} }
else else
@ -5276,7 +5276,7 @@ static void HandleAction_UseItem(void)
} }
else if (GetBankSide(gBankAttacker) == SIDE_PLAYER) else if (GetBankSide(gBankAttacker) == SIDE_PLAYER)
{ {
gBattlescriptCurrInstr = gUnknown_082DBD3C[0]; gBattlescriptCurrInstr = gBattlescriptsForUsingItem[0];
} }
else else
{ {
@ -5332,7 +5332,7 @@ static void HandleAction_UseItem(void)
break; break;
} }
gBattlescriptCurrInstr = gUnknown_082DBD3C[*(gBattleStruct->AI_itemType + gBankAttacker / 2)]; gBattlescriptCurrInstr = gBattlescriptsForUsingItem[*(gBattleStruct->AI_itemType + gBankAttacker / 2)];
} }
gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT; gCurrentActionFuncId = ACTION_RUN_BATTLESCRIPT;
} }
@ -5439,7 +5439,7 @@ static void HandleAction_Run(void)
} }
} }
gBattleOutcome |= BATTLE_OUTCOME_BIT_x80; gBattleOutcome |= OUTCOME_LINK_BATTLE_RUN;
gSaveBlock2Ptr->field_CA9_b = 1; gSaveBlock2Ptr->field_CA9_b = 1;
} }
else else
@ -5565,9 +5565,9 @@ static void HandleAction_Action9(void)
static void HandleAction_Action11(void) static void HandleAction_Action11(void)
{ {
if (!sub_8041728()) if (!HandleFaintedMonActions())
{ {
gBattleStruct->field_4D = 0; gBattleStruct->faintedActionsState = 0;
gCurrentActionFuncId = ACTION_FINISHED; gCurrentActionFuncId = ACTION_FINISHED;
} }
} }
@ -5607,6 +5607,6 @@ static void HandleAction_ActionFinished(void)
gBattleScripting.atk49_state = 0; gBattleScripting.atk49_state = 0;
gBattleCommunication[3] = 0; gBattleCommunication[3] = 0;
gBattleCommunication[4] = 0; gBattleCommunication[4] = 0;
gBattleScripting.field_16 = 0; gBattleScripting.multihitMoveEffect = 0;
gBattleResources->battleScriptsStack->size = 0; gBattleResources->battleScriptsStack->size = 0;
} }

View File

@ -12,7 +12,6 @@
#define AIScriptRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24) #define AIScriptRead32(ptr) ((ptr)[0] | (ptr)[1] << 8 | (ptr)[2] << 16 | (ptr)[3] << 24)
#define AIScriptRead16(ptr) ((ptr)[0] | (ptr)[1] << 8) #define AIScriptRead16(ptr) ((ptr)[0] | (ptr)[1] << 8)
#define AIScriptRead8(ptr) ((ptr)[0])
#define AIScriptReadPtr(ptr) (const u8*) AIScriptRead32(ptr) #define AIScriptReadPtr(ptr) (const u8*) AIScriptRead32(ptr)
#define AI_ACTION_DONE 0x0001 #define AI_ACTION_DONE 0x0001

View File

@ -1632,9 +1632,9 @@ void BufferStringBattle(u16 stringID)
stringPtr = gText_AttackerUsedX; stringPtr = gText_AttackerUsedX;
break; break;
case STRINGID_BATTLEEND: // battle end 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) if (GetBankSide(gActiveBank) == SIDE_OPPONENT && gBattleTextBuff1[0] != BATTLE_DREW)
gBattleTextBuff1[0] ^= (BATTLE_LOST | BATTLE_WON); gBattleTextBuff1[0] ^= (BATTLE_LOST | BATTLE_WON);

View File

@ -1053,7 +1053,7 @@ static void atk00_attackcanceler(void)
if (!(gHitMarker & HITMARKER_OBEYS) && !(gBattleMons[gBankAttacker].status2 & STATUS2_MULTIPLETURNS)) 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) switch (i)
{ {
case 0: case 0:
@ -3040,7 +3040,7 @@ static void atk15_seteffectwithchance(void)
} }
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
gBattleScripting.field_16 = 0; gBattleScripting.multihitMoveEffect = 0;
} }
static void atk16_seteffectprimary(void) static void atk16_seteffectprimary(void)
@ -3064,7 +3064,7 @@ static void atk18_clearstatusfromeffect(void)
gBattleCommunication[MOVE_EFFECT_BYTE] = 0; gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
gBattlescriptCurrInstr += 2; gBattlescriptCurrInstr += 2;
gBattleScripting.field_16 = 0; gBattleScripting.multihitMoveEffect = 0;
} }
static void atk19_tryfaintmon(void) static void atk19_tryfaintmon(void)
@ -3221,7 +3221,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability; gLastUsedAbility = ability;
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;
RecordAbilityBattle(bank - 1, gLastUsedAbility); RecordAbilityBattle(bank - 1, gLastUsedAbility);
gBattleScripting.field_15 = bank - 1; gBattleScripting.bankWithAbility = bank - 1;
} }
else else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;
@ -3234,7 +3234,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability; gLastUsedAbility = ability;
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;
RecordAbilityBattle(bank - 1, gLastUsedAbility); RecordAbilityBattle(bank - 1, gLastUsedAbility);
gBattleScripting.field_15 = bank - 1; gBattleScripting.bankWithAbility = bank - 1;
} }
else else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;
@ -3247,7 +3247,7 @@ static void atk1E_jumpifability(void)
gLastUsedAbility = ability; gLastUsedAbility = ability;
gBattlescriptCurrInstr = jumpPtr; gBattlescriptCurrInstr = jumpPtr;
RecordAbilityBattle(bank, gLastUsedAbility); RecordAbilityBattle(bank, gLastUsedAbility);
gBattleScripting.field_15 = bank; gBattleScripting.bankWithAbility = bank;
} }
else else
gBattlescriptCurrInstr += 7; gBattlescriptCurrInstr += 7;
@ -6383,7 +6383,7 @@ static void atk62(void)
static void atk63_jumptorandomattack(void) static void atk63_jumptorandomattack(void)
{ {
if (gBattlescriptCurrInstr[1] != 0) if (gBattlescriptCurrInstr[1])
gCurrentMove = gRandomMove; gCurrentMove = gRandomMove;
else else
gChosenMove = gCurrentMove = gRandomMove; gChosenMove = gCurrentMove = gRandomMove;
@ -7790,7 +7790,7 @@ static void atk8E_initmultihitstring(void)
gBattlescriptCurrInstr++; gBattlescriptCurrInstr++;
} }
static bool8 sub_8051064(void) static bool8 TryDoForceSwitchOut(void)
{ {
if (gBattleMons[gBankAttacker].level >= gBattleMons[gBankTarget].level) if (gBattleMons[gBankAttacker].level >= gBattleMons[gBankTarget].level)
{ {
@ -7807,7 +7807,7 @@ static bool8 sub_8051064(void)
*(gBattleStruct->field_58 + gBankTarget) = gBattlePartyID[gBankTarget]; *(gBattleStruct->field_58 + gBankTarget) = gBattlePartyID[gBankTarget];
} }
gBattlescriptCurrInstr = BattleScript_82DADD8; gBattlescriptCurrInstr = BattleScript_SuccessForceOut;
return TRUE; return TRUE;
} }
@ -7935,7 +7935,7 @@ static void atk8F_forcerandomswitch(void)
} }
else else
{ {
if (sub_8051064()) if (TryDoForceSwitchOut())
{ {
do do
{ {
@ -7968,7 +7968,7 @@ static void atk8F_forcerandomswitch(void)
} }
else else
{ {
sub_8051064(); TryDoForceSwitchOut();
} }
} }
@ -9306,7 +9306,7 @@ static void atkBA_jumpifnopursuitswitchdmg(void)
gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2); gBankTarget = GetBankByIdentity(IDENTITY_PLAYER_MON2);
} }
if (gActionForBanks[gBankTarget] == 0 if (gActionForBanks[gBankTarget] == ACTION_USE_MOVE
&& gBankAttacker == *(gBattleStruct->moveTarget + gBankTarget) && gBankAttacker == *(gBattleStruct->moveTarget + gBankTarget)
&& !(gBattleMons[gBankTarget].status1 & (STATUS_SLEEP | STATUS_FREEZE)) && !(gBattleMons[gBankTarget].status1 & (STATUS_SLEEP | STATUS_FREEZE))
&& gBattleMons[gBankAttacker].hp && gBattleMons[gBankAttacker].hp

View File

@ -364,7 +364,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move; gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DAE2A; gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingDisabledMoveInPalace;
gProtectStructs[gActiveBank].flag_x10 = 1; gProtectStructs[gActiveBank].flag_x10 = 1;
} }
else else
@ -379,7 +379,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
CancelMultiTurnMoves(gActiveBank); CancelMultiTurnMoves(gActiveBank);
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB098; gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingTormentedMoveInPalace;
gProtectStructs[gActiveBank].flag_x10 = 1; gProtectStructs[gActiveBank].flag_x10 = 1;
} }
else else
@ -394,7 +394,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move; gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB0AF; gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingNotAllowedMoveTauntInPalace;
gProtectStructs[gActiveBank].flag_x10 = 1; gProtectStructs[gActiveBank].flag_x10 = 1;
} }
else else
@ -409,7 +409,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
gCurrentMove = move; gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE) if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{ {
gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_82DB185; gPalaceSelectionBattleScripts[gActiveBank] = BattleScript_SelectingImprisionedMoveInPalace;
gProtectStructs[gActiveBank].flag_x10 = 1; gProtectStructs[gActiveBank].flag_x10 = 1;
} }
else else
@ -1113,23 +1113,23 @@ u8 TurnBasedEffects(void)
return 0; return 0;
} }
bool8 sub_8041364(void) bool8 HandleWishPerishSongOnTurnEnd(void)
{ {
gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20); gHitMarker |= (HITMARKER_GRUDGE | HITMARKER_x20);
switch (gBattleStruct->field_1A0) switch (gBattleStruct->wishPerishSongState)
{ {
case 0: case 0:
while (gBattleStruct->field_1A1 < gNoOfAllBanks) while (gBattleStruct->wishPerishSongBank < gNoOfAllBanks)
{ {
gActiveBank = gBattleStruct->field_1A1; gActiveBank = gBattleStruct->wishPerishSongBank;
if (gAbsentBankFlags & gBitTable[gActiveBank]) if (gAbsentBankFlags & gBitTable[gActiveBank])
{ {
gBattleStruct->field_1A1++; gBattleStruct->wishPerishSongBank++;
continue; continue;
} }
gBattleStruct->field_1A1++; gBattleStruct->wishPerishSongBank++;
if (gWishFutureKnock.futureSightCounter[gActiveBank] != 0 if (gWishFutureKnock.futureSightCounter[gActiveBank] != 0
&& --gWishFutureKnock.futureSightCounter[gActiveBank] == 0 && --gWishFutureKnock.futureSightCounter[gActiveBank] == 0
&& gBattleMons[gActiveBank].hp != 0) && gBattleMons[gActiveBank].hp != 0)
@ -1157,21 +1157,21 @@ bool8 sub_8041364(void)
} }
// Why do I have to keep doing this to match? // Why do I have to keep doing this to match?
{ {
u8* var = &gBattleStruct->field_1A0; u8 *state = &gBattleStruct->wishPerishSongState;
*var = 1; *state = 1;
gBattleStruct->field_1A1 = 0; gBattleStruct->wishPerishSongBank = 0;
} }
// fall through // fall through
case 1: 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]) if (gAbsentBankFlags & gBitTable[gActiveBank])
{ {
gBattleStruct->field_1A1++; gBattleStruct->wishPerishSongBank++;
continue; continue;
} }
gBattleStruct->field_1A1++; gBattleStruct->wishPerishSongBank++;
if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG) if (gStatuses3[gActiveBank] & STATUS3_PERISH_SONG)
{ {
PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBank].perishSongTimer1); PREPARE_BYTE_NUMBER_BUFFER(gBattleTextBuff1, 1, gDisableStructs[gActiveBank].perishSongTimer1);
@ -1192,9 +1192,9 @@ bool8 sub_8041364(void)
} }
// Hm... // Hm...
{ {
u8* var = &gBattleStruct->field_1A0; u8 *state = &gBattleStruct->wishPerishSongState;
*var = 2; *state = 2;
gBattleStruct->field_1A1 = 0; gBattleStruct->wishPerishSongBank = 0;
} }
// fall through // fall through
case 2: case 2:
@ -1209,7 +1209,7 @@ bool8 sub_8041364(void)
gBattlescriptCurrInstr = BattleScript_82DB8F3; gBattlescriptCurrInstr = BattleScript_82DB8F3;
BattleScriptExecute(BattleScript_82DB8F3); BattleScriptExecute(BattleScript_82DB8F3);
gBattleStruct->field_1A0++; gBattleStruct->wishPerishSongState++;
return TRUE; return TRUE;
} }
break; break;
@ -1220,20 +1220,20 @@ bool8 sub_8041364(void)
return FALSE; 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) if (gBattleTypeFlags & BATTLE_TYPE_SAFARI)
return FALSE; return FALSE;
do do
{ {
int i; int i;
switch (gBattleStruct->field_4D) switch (gBattleStruct->faintedActionsState)
{ {
case 0: case 0:
gBattleStruct->field_4E = 0; gBattleStruct->faintedActionsBank = 0;
gBattleStruct->field_4D++; gBattleStruct->faintedActionsState++;
for (i = 0; i < gNoOfAllBanks; i++) for (i = 0; i < gNoOfAllBanks; i++)
{ {
if (gAbsentBankFlags & gBitTable[i] && !sub_80423F4(i, 6, 6)) if (gAbsentBankFlags & gBitTable[i] && !sub_80423F4(i, 6, 6))
@ -1243,58 +1243,58 @@ bool8 sub_8041728(void)
case 1: case 1:
do do
{ {
gBank1 = gBankTarget = gBattleStruct->field_4E; gBank1 = gBankTarget = gBattleStruct->faintedActionsBank;
if (gBattleMons[gBattleStruct->field_4E].hp == 0 if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0
&& !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->field_4E]]) && !(gBattleStruct->field_DF & gBitTable[gBattlePartyID[gBattleStruct->faintedActionsBank]])
&& !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) && !(gAbsentBankFlags & gBitTable[gBattleStruct->faintedActionsBank]))
{ {
BattleScriptExecute(BattleScript_82DA7C4); BattleScriptExecute(BattleScript_GiveExp);
gBattleStruct->field_4D = 2; gBattleStruct->faintedActionsState = 2;
return TRUE; return TRUE;
} }
} while (++gBattleStruct->field_4E != gNoOfAllBanks); } while (++gBattleStruct->faintedActionsBank != gNoOfAllBanks);
gBattleStruct->field_4D = 3; gBattleStruct->faintedActionsState = 3;
break; break;
case 2: case 2:
sub_803F9EC(gBank1); sub_803F9EC(gBank1);
if (++gBattleStruct->field_4E == gNoOfAllBanks) if (++gBattleStruct->faintedActionsBank == gNoOfAllBanks)
gBattleStruct->field_4D = 3; gBattleStruct->faintedActionsState = 3;
else else
gBattleStruct->field_4D = 1; gBattleStruct->faintedActionsState = 1;
break; break;
case 3: case 3:
gBattleStruct->field_4E = 0; gBattleStruct->faintedActionsBank = 0;
gBattleStruct->field_4D++; gBattleStruct->faintedActionsState++;
// fall through // fall through
case 4: case 4:
do do
{ {
gBank1 = gBankTarget = gBattleStruct->field_4E; gBank1 = gBankTarget = gBattleStruct->faintedActionsBank;
if (gBattleMons[gBattleStruct->field_4E].hp == 0 if (gBattleMons[gBattleStruct->faintedActionsBank].hp == 0
&& !(gAbsentBankFlags & gBitTable[gBattleStruct->field_4E])) && !(gAbsentBankFlags & gBitTable[gBattleStruct->faintedActionsBank]))
{ {
BattleScriptExecute(BattleScript_82DA7CD); BattleScriptExecute(BattleScript_HandleFaintedMon);
gBattleStruct->field_4D = 5; gBattleStruct->faintedActionsState = 5;
return TRUE; return TRUE;
} }
} while (++gBattleStruct->field_4E != gNoOfAllBanks); } while (++gBattleStruct->faintedActionsBank != gNoOfAllBanks);
gBattleStruct->field_4D = 6; gBattleStruct->faintedActionsState = 6;
break; break;
case 5: case 5:
if (++gBattleStruct->field_4E == gNoOfAllBanks) if (++gBattleStruct->faintedActionsBank == gNoOfAllBanks)
gBattleStruct->field_4D = 6; gBattleStruct->faintedActionsState = 6;
else else
gBattleStruct->field_4D = 4; gBattleStruct->faintedActionsState = 4;
break; break;
case 6: case 6:
if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, 1) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0)) if (AbilityBattleEffects(ABILITYEFFECT_INTIMIDATE1, 0, 0, 0, 0) || AbilityBattleEffects(ABILITYEFFECT_TRACE, 0, 0, 0, 0) || ItemBattleEffects(1, 0, 1) || AbilityBattleEffects(ABILITYEFFECT_FORECAST, 0, 0, 0, 0))
return TRUE; return TRUE;
gBattleStruct->field_4D++; gBattleStruct->faintedActionsState++;
break; break;
case 7: case FAINTED_ACTIONS_MAX_CASE:
break; break;
} }
} while (gBattleStruct->field_4D != sub_8041728_MAX_CASE); } while (gBattleStruct->faintedActionsState != FAINTED_ACTIONS_MAX_CASE);
return FALSE; return FALSE;
} }
@ -1313,7 +1313,7 @@ void TryClearRageStatuses(void)
u8 AtkCanceller_UnableToUseMove(void) u8 AtkCanceller_UnableToUseMove(void)
{ {
u8 effect = 0; u8 effect = 0;
s32* bideDmg = &gBattleScripting.bideDmg; s32 *bideDmg = &gBattleScripting.bideDmg;
do do
{ {
switch (gBattleStruct->atkCancellerTracker) switch (gBattleStruct->atkCancellerTracker)
@ -3182,7 +3182,7 @@ u8 ItemBattleEffects(u8 caseID, u8 bank, bool8 moveTurn)
&& gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED && gBattleMoves[gCurrentMove].flags & FLAG_KINGSROCK_AFFECTED
&& gBattleMons[gBankTarget].hp) && gBattleMons[gBankTarget].hp)
{ {
gBattleCommunication[MOVE_EFFECT_BYTE] = 8; gBattleCommunication[MOVE_EFFECT_BYTE] = MOVE_EFFECT_FLINCH;
BattleScriptPushCursor(); BattleScriptPushCursor();
SetMoveEffect(0, 0); SetMoveEffect(0, 0);
BattleScriptPop(); BattleScriptPop();
@ -3318,7 +3318,7 @@ static bool32 HasObedientBitSet(u8 bank)
return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_OBEDIENCE, NULL); return GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_OBEDIENCE, NULL);
} }
u8 IsPokeDisobedient(void) u8 IsMonDisobedient(void)
{ {
s32 rnd; s32 rnd;
s32 calc; s32 calc;

View File

@ -6,19 +6,15 @@
#include "event_data.h" #include "event_data.h"
#include "abilities.h" #include "abilities.h"
#include "rng.h" #include "rng.h"
#include "battle_scripts.h"
extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT]; extern struct BattlePokemon gBattleMons[BATTLE_BANKS_COUNT];
extern u16 gBattlePartyID[BATTLE_BANKS_COUNT]; extern u16 gBattlePartyID[BATTLE_BANKS_COUNT];
extern u8 gUnknown_0203CF00[]; extern u8 gUnknown_0203CF00[];
extern const u8* gBattlescriptCurrInstr; extern const u8 *gBattlescriptCurrInstr;
extern u8 gBattleCommunication[]; extern u8 gBattleCommunication[];
extern u8 gActiveBank; 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_81D55D0(void);
extern void sub_81D5694(void); extern void sub_81D5694(void);
extern u8 pokemon_order_func(u8); extern u8 pokemon_order_func(u8);

View File

@ -21,6 +21,7 @@
#include "songs.h" #include "songs.h"
#include "overworld.h" #include "overworld.h"
#include "battle_message.h" #include "battle_message.h"
#include "battle_string_ids.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "bg.h" #include "bg.h"
#include "link.h" #include "link.h"
@ -771,7 +772,7 @@ static void Task_EvolutionScene(u8 taskID)
{ {
BufferMoveToLearnIntoBattleTextBuff2(); BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(BGM_FANFA1); PlayFanfare(BGM_FANFA1);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskID].tState++; gTasks[taskID].tState++;
@ -788,7 +789,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BufferMoveToLearnIntoBattleTextBuff2(); BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -796,7 +797,7 @@ static void Task_EvolutionScene(u8 taskID)
case 1: case 1:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -804,7 +805,7 @@ static void Task_EvolutionScene(u8 taskID)
case 2: case 2:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tData7 = 5; gTasks[taskID].tData7 = 5;
gTasks[taskID].tData8 = 10; gTasks[taskID].tData8 = 10;
@ -881,7 +882,7 @@ static void Task_EvolutionScene(u8 taskID)
u16 move = GetMonData(mon, var + MON_DATA_MOVE1); u16 move = GetMonData(mon, var + MON_DATA_MOVE1);
if (IsHMMove2(move)) if (IsHMMove2(move))
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState = 12; gTasks[taskID].tLearnMoveState = 12;
} }
@ -897,14 +898,14 @@ static void Task_EvolutionScene(u8 taskID)
} }
break; break;
case 7: case 7:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
break; break;
case 8: case 8:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -912,20 +913,20 @@ static void Task_EvolutionScene(u8 taskID)
case 9: case 9:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tState = 20; gTasks[taskID].tState = 20;
} }
break; break;
case 10: case 10:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tData7 = 11; gTasks[taskID].tData7 = 11;
gTasks[taskID].tData8 = 0; gTasks[taskID].tData8 = 0;
gTasks[taskID].tLearnMoveState = 3; gTasks[taskID].tLearnMoveState = 3;
break; break;
case 11: case 11:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0); BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
gTasks[taskID].tState = 15; gTasks[taskID].tState = 15;
break; break;
@ -1116,7 +1117,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
{ {
BufferMoveToLearnIntoBattleTextBuff2(); BufferMoveToLearnIntoBattleTextBuff2();
PlayFanfare(BGM_FANFA1); PlayFanfare(BGM_FANFA1);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNLEARNEDMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter
gTasks[taskID].tState++; gTasks[taskID].tState++;
@ -1133,7 +1134,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BufferMoveToLearnIntoBattleTextBuff2(); BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -1141,7 +1142,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 1: case 1:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE2 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -1149,7 +1150,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 2: case 2:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tData7 = 5; gTasks[taskID].tData7 = 5;
gTasks[taskID].tData8 = 9; gTasks[taskID].tData8 = 9;
@ -1170,7 +1171,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
{ {
case 0: case 0:
sEvoCursorPos = 0; sEvoCursorPos = 0;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7; gTasks[taskID].tLearnMoveState = gTasks[taskID].tData7;
if (gTasks[taskID].tLearnMoveState == 5) if (gTasks[taskID].tLearnMoveState == 5)
@ -1179,7 +1180,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 1: case 1:
case -1: case -1:
sEvoCursorPos = 1; sEvoCursorPos = 1;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8; gTasks[taskID].tLearnMoveState = gTasks[taskID].tData8;
break; break;
@ -1215,7 +1216,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
u16 move = GetMonData(mon, var + MON_DATA_MOVE1); u16 move = GetMonData(mon, var + MON_DATA_MOVE1);
if (IsHMMove2(move)) if (IsHMMove2(move))
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_HMMOVESCANTBEFORGOTTEN - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState = 11; gTasks[taskID].tLearnMoveState = 11;
} }
@ -1225,7 +1226,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
RemoveMonPPBonus(mon, var); RemoveMonPPBonus(mon, var);
SetMonMoveSlot(mon, gMoveToLearn, var); SetMonMoveSlot(mon, gMoveToLearn, var);
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_123POOF - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -1235,7 +1236,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 7: case 7:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_PKMNFORGOTMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tLearnMoveState++; gTasks[taskID].tLearnMoveState++;
} }
@ -1243,20 +1244,20 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 8: case 8:
if (!IsTextPrinterActive(0) && !IsSEPlaying()) if (!IsTextPrinterActive(0) && !IsSEPlaying())
{ {
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_ANDELLIPSIS - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tState = 18; gTasks[taskID].tState = 18;
} }
break; break;
case 9: case 9:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tData7 = 10; gTasks[taskID].tData7 = 10;
gTasks[taskID].tData8 = 0; gTasks[taskID].tData8 = 0;
gTasks[taskID].tLearnMoveState = 3; gTasks[taskID].tLearnMoveState = 3;
break; break;
case 10: case 10:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_ID_ADDER]);
sub_807F1A8(0, gDisplayedStringBattle, 1); sub_807F1A8(0, gDisplayedStringBattle, 1);
gTasks[taskID].tState = 13; gTasks[taskID].tState = 13;
break; break;