Misc battle script cleanup

This commit is contained in:
GriffinR 2021-04-03 12:38:07 -04:00
parent 9ea9ffde09
commit f4d8a91ba4
19 changed files with 238 additions and 224 deletions

View File

@ -1311,7 +1311,7 @@
various \battler, 15 various \battler, 15
.endm .endm
.macro arenajudmengtstring id:req .macro arenajudgmentstring id:req
various \id, VARIOUS_ARENA_JUDGMENT_STRING various \id, VARIOUS_ARENA_JUDGMENT_STRING
.endm .endm

View File

@ -1,3 +1,4 @@
#include "constants/global.h"
#include "constants/battle.h" #include "constants/battle.h"
#include "constants/pokemon.h" #include "constants/pokemon.h"
#include "constants/battle_script_commands.h" #include "constants/battle_script_commands.h"
@ -627,9 +628,9 @@ BattleScript_EffectMultiHit::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring attackstring
ppreduce ppreduce
setmultihitcounter 0x0 setmultihitcounter 0
initmultihitstring initmultihitstring
setbyte sMULTIHIT_EFFECT, 0x0 setbyte sMULTIHIT_EFFECT, 0
BattleScript_MultiHitLoop:: BattleScript_MultiHitLoop::
jumpifhasnohp BS_ATTACKER, BattleScript_MultiHitEnd jumpifhasnohp BS_ATTACKER, BattleScript_MultiHitEnd
jumpifhasnohp BS_TARGET, BattleScript_MultiHitPrintStrings jumpifhasnohp BS_TARGET, BattleScript_MultiHitPrintStrings
@ -654,7 +655,7 @@ BattleScript_DoMultiHit::
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
printstring STRINGID_EMPTYSTRING3 printstring STRINGID_EMPTYSTRING3
waitmessage 1 waitmessage 1
addbyte sMULTIHIT_STRING + 4, 0x1 addbyte sMULTIHIT_STRING + 4, 1
moveendto MOVEEND_NEXT_TARGET moveendto MOVEEND_NEXT_TARGET
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_MultiHitPrintStrings
decrementmultihit BattleScript_MultiHitLoop decrementmultihit BattleScript_MultiHitLoop
@ -665,7 +666,7 @@ BattleScript_MultiHitPrintStrings::
resultmessage resultmessage
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
jumpifmovehadnoeffect BattleScript_MultiHitEnd jumpifmovehadnoeffect BattleScript_MultiHitEnd
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6 copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
printstring STRINGID_HITXTIMES printstring STRINGID_HITXTIMES
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_MultiHitEnd:: BattleScript_MultiHitEnd::
@ -806,7 +807,7 @@ BattleScript_EffectRazorWind::
BattleScript_TwoTurnMovesSecondTurn:: BattleScript_TwoTurnMovesSecondTurn::
attackcanceler attackcanceler
setmoveeffect MOVE_EFFECT_CHARGING setmoveeffect MOVE_EFFECT_CHARGING
setbyte sB_ANIM_TURN, 0x1 setbyte sB_ANIM_TURN, 1
clearstatusfromeffect BS_ATTACKER clearstatusfromeffect BS_ATTACKER
orword gHitMarker, HITMARKER_NO_PPDEDUCT orword gHitMarker, HITMARKER_NO_PPDEDUCT
jumpifnotmove MOVE_SKY_ATTACK, BattleScript_HitFromAccCheck jumpifnotmove MOVE_SKY_ATTACK, BattleScript_HitFromAccCheck
@ -862,9 +863,9 @@ BattleScript_EffectDoubleHit::
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring attackstring
ppreduce ppreduce
setmultihitcounter 0x2 setmultihitcounter 2
initmultihitstring initmultihitstring
setbyte sMULTIHIT_EFFECT, 0x0 setbyte sMULTIHIT_EFFECT, 0
goto BattleScript_MultiHitLoop goto BattleScript_MultiHitLoop
BattleScript_EffectRecoilIfMiss:: BattleScript_EffectRecoilIfMiss::
@ -1099,7 +1100,7 @@ BattleScript_EffectTwineedle::
setbyte sMULTIHIT_EFFECT, MOVE_EFFECT_POISON setbyte sMULTIHIT_EFFECT, MOVE_EFFECT_POISON
attackstring attackstring
ppreduce ppreduce
setmultihitcounter 0x2 setmultihitcounter 2
initmultihitstring initmultihitstring
goto BattleScript_MultiHitLoop goto BattleScript_MultiHitLoop
@ -1171,8 +1172,8 @@ BattleScript_EffectMetronome::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
attackanimation attackanimation
waitanimation waitanimation
setbyte sB_ANIM_TURN, 0x0 setbyte sB_ANIM_TURN, 0
setbyte sB_ANIM_TARGETS_HIT, 0x0 setbyte sB_ANIM_TARGETS_HIT, 0
metronome metronome
BattleScript_EffectLeechSeed:: BattleScript_EffectLeechSeed::
@ -1348,8 +1349,8 @@ BattleScript_SleepTalkIsAsleep::
BattleScript_SleepTalkUsingMove:: BattleScript_SleepTalkUsingMove::
attackanimation attackanimation
waitanimation waitanimation
setbyte sB_ANIM_TURN, 0x0 setbyte sB_ANIM_TURN, 0
setbyte sB_ANIM_TARGETS_HIT, 0x0 setbyte sB_ANIM_TARGETS_HIT, 0
jumptocalledmove TRUE jumptocalledmove TRUE
BattleScript_EffectDestinyBond:: BattleScript_EffectDestinyBond::
@ -1406,9 +1407,9 @@ BattleScript_EffectTripleKick::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
sethword sTRIPLE_KICK_POWER, 0x0 sethword sTRIPLE_KICK_POWER, 0
initmultihitstring initmultihitstring
setmultihit 0x3 setmultihit 3
BattleScript_TripleKickLoop:: BattleScript_TripleKickLoop::
jumpifhasnohp BS_ATTACKER, BattleScript_TripleKickEnd jumpifhasnohp BS_ATTACKER, BattleScript_TripleKickEnd
jumpifhasnohp BS_TARGET, BattleScript_TripleKickNoMoreHits jumpifhasnohp BS_TARGET, BattleScript_TripleKickNoMoreHits
@ -1418,7 +1419,7 @@ BattleScript_DoTripleKickAttack::
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE
movevaluescleanup movevaluescleanup
addbyte sTRIPLE_KICK_POWER, 10 addbyte sTRIPLE_KICK_POWER, 10
addbyte sMULTIHIT_STRING + 4, 0x1 addbyte sMULTIHIT_STRING + 4, 1
copyhword gDynamicBasePower, sTRIPLE_KICK_POWER copyhword gDynamicBasePower, sTRIPLE_KICK_POWER
critcalc critcalc
damagecalc damagecalc
@ -1442,14 +1443,14 @@ BattleScript_DoTripleKickAttack::
goto BattleScript_TripleKickPrintStrings goto BattleScript_TripleKickPrintStrings
BattleScript_TripleKickNoMoreHits:: BattleScript_TripleKickNoMoreHits::
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickPrintStrings jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0, BattleScript_TripleKickPrintStrings
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
BattleScript_TripleKickPrintStrings:: BattleScript_TripleKickPrintStrings::
resultmessage resultmessage
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0x0, BattleScript_TripleKickEnd jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0, BattleScript_TripleKickEnd
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 0x6 copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
printstring STRINGID_HITXTIMES printstring STRINGID_HITXTIMES
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_TripleKickEnd:: BattleScript_TripleKickEnd::
@ -1510,7 +1511,7 @@ BattleScript_EffectCurse::
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_ButItFailed jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_DEF, MAX_STAT_STAGE, BattleScript_ButItFailed
BattleScript_CurseTrySpeed:: BattleScript_CurseTrySpeed::
copybyte gBattlerTarget, gBattlerAttacker copybyte gBattlerTarget, gBattlerAttacker
setbyte sB_ANIM_TURN, 0x1 setbyte sB_ANIM_TURN, 1
attackanimation attackanimation
waitanimation waitanimation
setstatchanger STAT_SPEED, 1, TRUE setstatchanger STAT_SPEED, 1, TRUE
@ -1540,7 +1541,7 @@ BattleScript_DoGhostCurse::
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
cursetarget BattleScript_ButItFailed cursetarget BattleScript_ButItFailed
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
setbyte sB_ANIM_TURN, 0x0 setbyte sB_ANIM_TURN, 0
attackanimation attackanimation
waitanimation waitanimation
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER
@ -1594,11 +1595,11 @@ BattleScript_EffectPerishSong::
waitanimation waitanimation
printstring STRINGID_FAINTINTHREE printstring STRINGID_FAINTINTHREE
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte sBATTLER, 0x0 setbyte sBATTLER, 0
BattleScript_PerishSongLoop:: BattleScript_PerishSongLoop::
jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement:: BattleScript_PerishSongLoopIncrement::
addbyte sBATTLER, 0x1 addbyte sBATTLER, 1
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
@ -1720,10 +1721,10 @@ BattleScript_EffectBatonPass::
jumpifcantswitch SWITCH_IGNORE_ESCAPE_PREVENTION | BS_ATTACKER, BattleScript_ButItFailed jumpifcantswitch SWITCH_IGNORE_ESCAPE_PREVENTION | BS_ATTACKER, BattleScript_ButItFailed
attackanimation attackanimation
waitanimation waitanimation
openpartyscreen 0x1, BattleScript_ButItFailed openpartyscreen BS_ATTACKER, BattleScript_ButItFailed
switchoutabilities BS_ATTACKER switchoutabilities BS_ATTACKER
waitstate waitstate
switchhandleorder BS_ATTACKER, 0x2 switchhandleorder BS_ATTACKER, 2
returntoball BS_ATTACKER returntoball BS_ATTACKER
getswitchedmondata BS_ATTACKER getswitchedmondata BS_ATTACKER
switchindataupdate BS_ATTACKER switchindataupdate BS_ATTACKER
@ -1949,8 +1950,8 @@ BattleScript_EffectTeleport::
ppreduce ppreduce
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed
getifcantrunfrombattle BS_ATTACKER getifcantrunfrombattle BS_ATTACKER
jumpifbyte CMP_EQUAL, gBattleCommunication, 0x1, BattleScript_ButItFailed jumpifbyte CMP_EQUAL, gBattleCommunication, 1, BattleScript_ButItFailed
jumpifbyte CMP_EQUAL, gBattleCommunication, 0x2, BattleScript_PrintAbilityMadeIneffective jumpifbyte CMP_EQUAL, gBattleCommunication, 2, BattleScript_PrintAbilityMadeIneffective
attackanimation attackanimation
waitanimation waitanimation
printstring STRINGID_PKMNFLEDFROMBATTLE printstring STRINGID_PKMNFLEDFROMBATTLE
@ -1964,13 +1965,13 @@ BattleScript_EffectBeatUp::
attackstring attackstring
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
ppreduce ppreduce
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0
BattleScript_BeatUpLoop:: BattleScript_BeatUpLoop::
movevaluescleanup movevaluescleanup
trydobeatup BattleScript_BeatUpEnd, BattleScript_ButItFailed trydobeatup BattleScript_BeatUpEnd, BattleScript_ButItFailed
printstring STRINGID_PKMNATTACK printstring STRINGID_PKMNATTACK
critcalc critcalc
jumpifbyte CMP_NOT_EQUAL, gCritMultiplier, 0x2, BattleScript_BeatUpAttack jumpifbyte CMP_NOT_EQUAL, gCritMultiplier, 2, BattleScript_BeatUpAttack
manipulatedamage DMG_DOUBLED manipulatedamage DMG_DOUBLED
BattleScript_BeatUpAttack:: BattleScript_BeatUpAttack::
adjustnormaldamage adjustnormaldamage
@ -2018,7 +2019,7 @@ BattleScript_FirstTurnSemiInvulnerable::
BattleScript_SecondTurnSemiInvulnerable:: BattleScript_SecondTurnSemiInvulnerable::
attackcanceler attackcanceler
setmoveeffect MOVE_EFFECT_CHARGING setmoveeffect MOVE_EFFECT_CHARGING
setbyte sB_ANIM_TURN, 0x1 setbyte sB_ANIM_TURN, 1
clearstatusfromeffect BS_ATTACKER clearstatusfromeffect BS_ATTACKER
orword gHitMarker, HITMARKER_NO_PPDEDUCT orword gHitMarker, HITMARKER_NO_PPDEDUCT
jumpifnotmove MOVE_BOUNCE, BattleScript_SemiInvulnerableTryHit jumpifnotmove MOVE_BOUNCE, BattleScript_SemiInvulnerableTryHit
@ -2379,7 +2380,7 @@ BattleScript_EffectWish::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
trywish 0x0, BattleScript_ButItFailed trywish 0, BattleScript_ButItFailed
attackanimation attackanimation
waitanimation waitanimation
goto BattleScript_MoveEnd goto BattleScript_MoveEnd
@ -2390,8 +2391,8 @@ BattleScript_EffectAssist::
assistattackselect BattleScript_ButItFailedPpReduce assistattackselect BattleScript_ButItFailedPpReduce
attackanimation attackanimation
waitanimation waitanimation
setbyte sB_ANIM_TURN, 0x0 setbyte sB_ANIM_TURN, 0
setbyte sB_ANIM_TARGETS_HIT, 0x0 setbyte sB_ANIM_TARGETS_HIT, 0
jumptocalledmove TRUE jumptocalledmove TRUE
BattleScript_EffectIngrain:: BattleScript_EffectIngrain::
@ -2445,12 +2446,12 @@ BattleScript_EffectBrickBreak::
damagecalc damagecalc
typecalc typecalc
adjustnormaldamage adjustnormaldamage
jumpifbyte CMP_EQUAL, sB_ANIM_TURN, 0x0, BattleScript_BrickBreakAnim jumpifbyte CMP_EQUAL, sB_ANIM_TURN, 0, BattleScript_BrickBreakAnim
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE bicbyte gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
BattleScript_BrickBreakAnim:: BattleScript_BrickBreakAnim::
attackanimation attackanimation
waitanimation waitanimation
jumpifbyte CMP_LESS_THAN, sB_ANIM_TURN, 0x2, BattleScript_BrickBreakDoHit jumpifbyte CMP_LESS_THAN, sB_ANIM_TURN, 2, BattleScript_BrickBreakDoHit
printstring STRINGID_THEWALLSHATTERED printstring STRINGID_THEWALLSHATTERED
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_BrickBreakDoHit:: BattleScript_BrickBreakDoHit::
@ -2592,7 +2593,7 @@ BattleScript_EffectTeeterDance::
attackcanceler attackcanceler
attackstring attackstring
ppreduce ppreduce
setbyte gBattlerTarget, 0x0 setbyte gBattlerTarget, 0
BattleScript_TeeterDanceLoop:: BattleScript_TeeterDanceLoop::
movevaluescleanup movevaluescleanup
setmoveeffect MOVE_EFFECT_CONFUSION setmoveeffect MOVE_EFFECT_CONFUSION
@ -2611,7 +2612,7 @@ BattleScript_TeeterDanceLoop::
BattleScript_TeeterDanceDoMoveEndIncrement:: BattleScript_TeeterDanceDoMoveEndIncrement::
moveendto MOVEEND_NEXT_TARGET moveendto MOVEEND_NEXT_TARGET
BattleScript_TeeterDanceLoopIncrement:: BattleScript_TeeterDanceLoopIncrement::
addbyte gBattlerTarget, 0x1 addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_TeeterDanceLoop
end end
@ -2714,7 +2715,7 @@ BattleScript_CosmicPowerDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, 0
setstatchanger STAT_DEF, 1, FALSE setstatchanger STAT_DEF, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerTrySpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CosmicPowerTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CosmicPowerTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CosmicPowerTrySpDef
@ -2743,7 +2744,7 @@ BattleScript_BulkUpDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF, 0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpTryDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_BulkUpTryDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_BulkUpTryDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_BulkUpTryDef
@ -2768,7 +2769,7 @@ BattleScript_CalmMindDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_SPATK | BIT_SPDEF, 0
setstatchanger STAT_SPATK, 1, FALSE setstatchanger STAT_SPATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindTrySpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_CalmMindTrySpDef
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CalmMindTrySpDef jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_CalmMindTrySpDef
@ -2800,7 +2801,7 @@ BattleScript_DragonDanceDoMoveAnim::
attackanimation attackanimation
waitanimation waitanimation
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_SPEED, 0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceTrySpeed statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_DragonDanceTrySpeed
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DragonDanceTrySpeed jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_DragonDanceTrySpeed
@ -2843,40 +2844,40 @@ BattleScript_FaintTarget::
return return
BattleScript_GiveExp:: BattleScript_GiveExp::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0
getexp BS_TARGET getexp BS_TARGET
end2 end2
BattleScript_HandleFaintedMon:: BattleScript_HandleFaintedMon::
atk24 BattleScript_82DA8F6 atk24 BattleScript_HandleFaintedMonMultiple
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonTryChooseAnother jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonTryChooseAnother
jumpifword CMP_NO_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonTryChooseAnother jumpifword CMP_NO_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonTryChooseAnother
printstring STRINGID_USENEXTPKMN printstring STRINGID_USENEXTPKMN
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0
yesnobox yesnobox
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x0, BattleScript_FaintedMonTryChooseAnother jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0, BattleScript_FaintedMonTryChooseAnother
jumpifplayerran BattleScript_FaintedMonEnd jumpifplayerran BattleScript_FaintedMonEnd
printstring STRINGID_CANTESCAPE2 printstring STRINGID_CANTESCAPE2
BattleScript_FaintedMonTryChooseAnother:: BattleScript_FaintedMonTryChooseAnother::
openpartyscreen 0x3, BattleScript_FaintedMonEnd openpartyscreen BS_FAINTED, BattleScript_FaintedMonEnd
switchhandleorder BS_FAINTED, 0x2 switchhandleorder BS_FAINTED, 2
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_RECORDED_LINK, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_RECORDED_LINK, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_x400000, BattleScript_FaintedMonChooseAnother
jumpifbyte CMP_EQUAL, sBATTLE_STYLE, 0x1, BattleScript_FaintedMonChooseAnother jumpifbyte CMP_EQUAL, sBATTLE_STYLE, OPTIONS_BATTLE_STYLE_SET, BattleScript_FaintedMonChooseAnother
jumpifcantswitch BS_PLAYER1, BattleScript_FaintedMonChooseAnother jumpifcantswitch BS_PLAYER1, BattleScript_FaintedMonChooseAnother
printstring STRINGID_ENEMYABOUTTOSWITCHPKMN printstring STRINGID_ENEMYABOUTTOSWITCHPKMN
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0
yesnobox yesnobox
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x1, BattleScript_FaintedMonChooseAnother jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 1, BattleScript_FaintedMonChooseAnother
setatktoplayer0 setatktoplayer0
openpartyscreen 0x81, BattleScript_FaintedMonChooseAnother openpartyscreen BS_ATTACKER | PARTY_SCREEN_OPTIONAL, BattleScript_FaintedMonChooseAnother
switchhandleorder BS_ATTACKER, 0x2 switchhandleorder BS_ATTACKER, 2
jumpifbyte CMP_EQUAL, gBattleCommunication, 0x6, BattleScript_FaintedMonChooseAnother jumpifbyte CMP_EQUAL, gBattleCommunication, PARTY_SIZE, BattleScript_FaintedMonChooseAnother
atknameinbuff1 atknameinbuff1
resetintimidatetracebits BS_ATTACKER resetintimidatetracebits BS_ATTACKER
hpthresholds2 BS_ATTACKER hpthresholds2 BS_ATTACKER
@ -2891,7 +2892,7 @@ BattleScript_FaintedMonTryChooseAnother::
hpthresholds BS_ATTACKER hpthresholds BS_ATTACKER
printstring STRINGID_SWITCHINMON printstring STRINGID_SWITCHINMON
hidepartystatussummary BS_ATTACKER hidepartystatussummary BS_ATTACKER
switchinanim BS_ATTACKER, 0x0 switchinanim BS_ATTACKER, 0
waitstate waitstate
switchineffects BS_ATTACKER switchineffects BS_ATTACKER
resetsentmonsvalue resetsentmonsvalue
@ -2911,14 +2912,14 @@ BattleScript_FaintedMonChooseAnother::
BattleScript_FaintedMonEnd:: BattleScript_FaintedMonEnd::
end2 end2
BattleScript_82DA8F6:: BattleScript_HandleFaintedMonMultiple::
openpartyscreen 0x5, BattleScript_82DA8FC openpartyscreen BS_UNK_5, BattleScript_HandleFaintedMonMultipleStart
BattleScript_82DA8FC:: BattleScript_HandleFaintedMonMultipleStart::
switchhandleorder BS_FAINTED, 0x0 switchhandleorder BS_FAINTED, 0
openpartyscreen 0x6, BattleScript_82DA92C openpartyscreen BS_UNK_6, BattleScript_HandleFaintedMonMultipleEnd
switchhandleorder BS_FAINTED, 0x0 switchhandleorder BS_FAINTED, 0
BattleScript_82DA908:: BattleScript_HandleFaintedMonLoop::
switchhandleorder BS_FAINTED, 0x3 switchhandleorder BS_FAINTED, 3
drawpartystatussummary BS_FAINTED drawpartystatussummary BS_FAINTED
getswitchedmondata BS_FAINTED getswitchedmondata BS_FAINTED
switchindataupdate BS_FAINTED switchindataupdate BS_FAINTED
@ -2928,8 +2929,8 @@ BattleScript_82DA908::
switchinanim BS_FAINTED, FALSE switchinanim BS_FAINTED, FALSE
waitstate waitstate
switchineffects 5 switchineffects 5
jumpifbytenotequal gBattlerFainted, gBattlersCount, BattleScript_82DA908 jumpifbytenotequal gBattlerFainted, gBattlersCount, BattleScript_HandleFaintedMonLoop
BattleScript_82DA92C:: BattleScript_HandleFaintedMonMultipleEnd::
end2 end2
BattleScript_LocalTrainerBattleWon:: BattleScript_LocalTrainerBattleWon::
@ -3105,10 +3106,10 @@ BattleScript_ActionSwitch::
printstring STRINGID_RETURNMON printstring STRINGID_RETURNMON
setbyte sDMG_MULTIPLIER, 2 setbyte sDMG_MULTIPLIER, 2
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_PursuitSwitchDmgSetMultihit
setmultihit 0x1 setmultihit 1
goto BattleScript_PursuitSwitchDmgLoop goto BattleScript_PursuitSwitchDmgLoop
BattleScript_PursuitSwitchDmgSetMultihit:: BattleScript_PursuitSwitchDmgSetMultihit::
setmultihit 0x2 setmultihit 2
BattleScript_PursuitSwitchDmgLoop:: BattleScript_PursuitSwitchDmgLoop::
jumpifnopursuitswitchdmg BattleScript_DoSwitchOut jumpifnopursuitswitchdmg BattleScript_DoSwitchOut
swapattackerwithtarget swapattackerwithtarget
@ -3122,7 +3123,7 @@ BattleScript_DoSwitchOut::
returnatktoball returnatktoball
waitstate waitstate
drawpartystatussummary BS_ATTACKER drawpartystatussummary BS_ATTACKER
switchhandleorder BS_ATTACKER, 0x1 switchhandleorder BS_ATTACKER, 1
getswitchedmondata BS_ATTACKER getswitchedmondata BS_ATTACKER
switchindataupdate BS_ATTACKER switchindataupdate BS_ATTACKER
hpthresholds BS_ATTACKER hpthresholds BS_ATTACKER
@ -3158,7 +3159,7 @@ BattleScript_PursuitDmgOnSwitchOut::
moveendfromto MOVEEND_ON_DAMAGE_ABILITIES, MOVEEND_CHOICE_MOVE moveendfromto MOVEEND_ON_DAMAGE_ABILITIES, MOVEEND_CHOICE_MOVE
getbattlerfainted BS_TARGET getbattlerfainted BS_TARGET
jumpifbyte CMP_EQUAL, gBattleCommunication, FALSE, BattleScript_PursuitDmgOnSwitchOutRet jumpifbyte CMP_EQUAL, gBattleCommunication, FALSE, BattleScript_PursuitDmgOnSwitchOutRet
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0
getexp BS_TARGET getexp BS_TARGET
BattleScript_PursuitDmgOnSwitchOutRet: BattleScript_PursuitDmgOnSwitchOutRet:
return return
@ -3170,7 +3171,7 @@ BattleScript_Pausex20::
BattleScript_LevelUp:: BattleScript_LevelUp::
fanfare MUS_LEVEL_UP fanfare MUS_LEVEL_UP
printstring STRINGID_PKMNGREWTOLV printstring STRINGID_PKMNGREWTOLV
setbyte sLVLBOX_STATE, 0x0 setbyte sLVLBOX_STATE, 0
drawlvlupbox drawlvlupbox
handlelearnnewmove BattleScript_LearnedNewMove, BattleScript_LearnMoveReturn, TRUE handlelearnnewmove BattleScript_LearnedNewMove, BattleScript_LearnMoveReturn, TRUE
goto BattleScript_AskToLearnMove goto BattleScript_AskToLearnMove
@ -3182,11 +3183,11 @@ BattleScript_AskToLearnMove::
printstring STRINGID_TRYTOLEARNMOVE2 printstring STRINGID_TRYTOLEARNMOVE2
printstring STRINGID_TRYTOLEARNMOVE3 printstring STRINGID_TRYTOLEARNMOVE3
waitstate waitstate
setbyte sLEARNMOVE_STATE, 0x0 setbyte sLEARNMOVE_STATE, 0
yesnoboxlearnmove BattleScript_ForgotAndLearnedNewMove yesnoboxlearnmove BattleScript_ForgotAndLearnedNewMove
printstring STRINGID_STOPLEARNINGMOVE printstring STRINGID_STOPLEARNINGMOVE
waitstate waitstate
setbyte sLEARNMOVE_STATE, 0x0 setbyte sLEARNMOVE_STATE, 0
yesnoboxstoplearningmove BattleScript_AskToLearnMove yesnoboxstoplearningmove BattleScript_AskToLearnMove
printstring STRINGID_DIDNOTLEARNMOVE printstring STRINGID_DIDNOTLEARNMOVE
goto BattleScript_TryLearnMoveLoop goto BattleScript_TryLearnMoveLoop
@ -3216,11 +3217,11 @@ BattleScript_DamagingWeatherContinues::
printfromtable gSandStormHailContinuesStringIds printfromtable gSandStormHailContinuesStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL playanimation2 BS_ATTACKER, sB_ANIM_ARG1, NULL
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0
BattleScript_DamagingWeatherLoop:: BattleScript_DamagingWeatherLoop::
copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 0x1 copyarraywithindex gBattlerAttacker, gBattlerByTurnOrder, gBattleCommunication, 1
weatherdamage weatherdamage
jumpifword CMP_EQUAL, gBattleMoveDamage, 0x0, BattleScript_DamagingWeatherLoopIncrement jumpifword CMP_EQUAL, gBattleMoveDamage, 0, BattleScript_DamagingWeatherLoopIncrement
printfromtable gSandStormHailDmgStringIds printfromtable gSandStormHailDmgStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
orword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE orword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
@ -3232,7 +3233,7 @@ BattleScript_DamagingWeatherLoop::
atk24 BattleScript_DamagingWeatherLoopIncrement atk24 BattleScript_DamagingWeatherLoopIncrement
BattleScript_DamagingWeatherLoopIncrement:: BattleScript_DamagingWeatherLoopIncrement::
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd
addbyte gBattleCommunication, 0x1 addbyte gBattleCommunication, 1
jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop jumpifbytenotequal gBattleCommunication, gBattlersCount, BattleScript_DamagingWeatherLoop
BattleScript_DamagingWeatherContinuesEnd:: BattleScript_DamagingWeatherContinuesEnd::
bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE bicword gHitMarker, HITMARKER_x20 | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_x100000 | HITMARKER_GRUDGE
@ -3315,7 +3316,7 @@ BattleScript_BideAttack::
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
copyword gBattleMoveDamage, sBIDE_DMG copyword gBattleMoveDamage, sBIDE_DMG
adjustsetdamage adjustsetdamage
setbyte sB_ANIM_TURN, 0x1 setbyte sB_ANIM_TURN, 1
attackanimation attackanimation
waitanimation waitanimation
effectivenesssound effectivenesssound
@ -3410,7 +3411,7 @@ BattleScript_SpikesOnAttacker::
return return
BattleScript_SpikesOnAttackerFainted:: BattleScript_SpikesOnAttackerFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0
getexp BS_ATTACKER getexp BS_ATTACKER
moveendall moveendall
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
@ -3425,7 +3426,7 @@ BattleScript_SpikesOnTarget::
return return
BattleScript_SpikesOnTargetFainted:: BattleScript_SpikesOnTargetFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0
getexp BS_TARGET getexp BS_TARGET
moveendall moveendall
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
@ -3440,7 +3441,7 @@ BattleScript_SpikesOnFaintedBattler::
return return
BattleScript_SpikesOnFaintedBattlerFainted:: BattleScript_SpikesOnFaintedBattlerFainted::
setbyte sGIVEEXP_STATE, 0x0 setbyte sGIVEEXP_STATE, 0
getexp BS_FAINTED getexp BS_FAINTED
moveendall moveendall
goto BattleScript_HandleFaintedMon goto BattleScript_HandleFaintedMon
@ -3472,7 +3473,7 @@ BattleScript_AllStatsUp::
jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_AllStatsUpRet jumpifstat BS_ATTACKER, CMP_EQUAL, STAT_SPDEF, MAX_STAT_STAGE, BattleScript_AllStatsUpRet
BattleScript_AllStatsUpAtk:: BattleScript_AllStatsUpAtk::
setbyte sSTAT_ANIM_PLAYED, FALSE setbyte sSTAT_ANIM_PLAYED, FALSE
playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0x0 playstatchangeanimation BS_ATTACKER, BIT_ATK | BIT_DEF | BIT_SPEED | BIT_SPATK | BIT_SPDEF, 0
setstatchanger STAT_ATK, 1, FALSE setstatchanger STAT_ATK, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpDef statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_AllStatsUpDef
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
@ -3602,7 +3603,7 @@ BattleScript_SelectingNotAllowedMoveTauntInPalace::
goto BattleScript_SelectingUnusableMoveInPalace goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_WishComesTrue:: BattleScript_WishComesTrue::
trywish 0x1, BattleScript_WishButFullHp trywish 1, BattleScript_WishButFullHp
playanimation BS_TARGET, B_ANIM_WISH_HEAL, NULL playanimation BS_TARGET, B_ANIM_WISH_HEAL, NULL
printstring STRINGID_PKMNWISHCAMETRUE printstring STRINGID_PKMNWISHCAMETRUE
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
@ -4012,10 +4013,10 @@ BattleScript_ShedSkinActivates::
end3 end3
BattleScript_WeatherFormChanges:: BattleScript_WeatherFormChanges::
setbyte sBATTLER, 0x0 setbyte sBATTLER, 0
BattleScript_WeatherFormChangesLoop:: BattleScript_WeatherFormChangesLoop::
trycastformdatachange trycastformdatachange
addbyte sBATTLER, 0x1 addbyte sBATTLER, 1
jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_WeatherFormChangesLoop
return return
@ -4037,7 +4038,7 @@ BattleScript_IntimidateActivatesEnd3::
BattleScript_PauseIntimidateActivates: BattleScript_PauseIntimidateActivates:
pause B_WAIT_TIME_SHORT pause B_WAIT_TIME_SHORT
BattleScript_IntimidateActivates:: BattleScript_IntimidateActivates::
setbyte gBattlerTarget, 0x0 setbyte gBattlerTarget, 0
setstatchanger STAT_ATK, 1, TRUE setstatchanger STAT_ATK, 1, TRUE
BattleScript_IntimidateActivatesLoop: BattleScript_IntimidateActivatesLoop:
trygetintimidatetarget BattleScript_IntimidateActivatesReturn trygetintimidatetarget BattleScript_IntimidateActivatesReturn
@ -4052,7 +4053,7 @@ BattleScript_IntimidateActivatesLoop:
printstring STRINGID_PKMNCUTSATTACKWITH printstring STRINGID_PKMNCUTSATTACKWITH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
BattleScript_IntimidateActivatesLoopIncrement: BattleScript_IntimidateActivatesLoopIncrement:
addbyte gBattlerTarget, 0x1 addbyte gBattlerTarget, 1
goto BattleScript_IntimidateActivatesLoop goto BattleScript_IntimidateActivatesLoop
BattleScript_IntimidateActivatesReturn: BattleScript_IntimidateActivatesReturn:
return return
@ -4466,18 +4467,19 @@ BattleScript_ArenaTurnBeginning::
pause 8 pause 8
playse SE_ARENA_TIMEUP1 playse SE_ARENA_TIMEUP1
various14 BS_ATTACKER various14 BS_ATTACKER
arenajudmengtstring 8 arenajudgmentstring B_MSG_REF_COMMENCE_BATTLE
arenawaitmessage 8 arenawaitmessage B_MSG_REF_COMMENCE_BATTLE
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
various15 BS_ATTACKER various15 BS_ATTACKER
volumeup volumeup
end2 end2
BattleScript_82DB8E0:: @ Unused battlescript @ Unused
BattleScript_ArenaNothingDecided::
playse SE_DING_DONG playse SE_DING_DONG
various14 BS_ATTACKER various14 BS_ATTACKER
arenajudmengtstring BS_TARGET arenajudgmentstring B_MSG_REF_NOTHING_IS_DECIDED
arenawaitmessage BS_TARGET arenawaitmessage B_MSG_REF_NOTHING_IS_DECIDED
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
various15 BS_ATTACKER various15 BS_ATTACKER
end2 end2
@ -4493,26 +4495,26 @@ BattleScript_ArenaDoJudgment::
playse SE_ARENA_TIMEUP1 playse SE_ARENA_TIMEUP1
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
various14 BS_ATTACKER various14 BS_ATTACKER
arenajudmengtstring 1 arenajudgmentstring B_MSG_REF_THATS_IT
arenawaitmessage 1 arenawaitmessage B_MSG_REF_THATS_IT
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
setbyte gBattleCommunication, 0x0 setbyte gBattleCommunication, 0
arenajudgmentwindow arenajudgmentwindow
pause B_WAIT_TIME_LONG pause B_WAIT_TIME_LONG
arenajudgmentwindow arenajudgmentwindow
arenajudmengtstring 2 arenajudgmentstring B_MSG_REF_JUDGE_MIND
arenawaitmessage 2 arenawaitmessage B_MSG_REF_JUDGE_MIND
arenajudgmentwindow arenajudgmentwindow
arenajudmengtstring 3 arenajudgmentstring B_MSG_REF_JUDGE_SKILL
arenawaitmessage 3 arenawaitmessage B_MSG_REF_JUDGE_SKILL
arenajudgmentwindow arenajudgmentwindow
arenajudmengtstring 4 arenajudgmentstring B_MSG_REF_JUDGE_BODY
arenawaitmessage 4 arenawaitmessage B_MSG_REF_JUDGE_BODY
arenajudgmentwindow arenajudgmentwindow
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x3, BattleScript_ArenaJudgmentPlayerLoses jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 3, BattleScript_ArenaJudgmentPlayerLoses
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0x4, BattleScript_ArenaJudgmentDraw jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 4, BattleScript_ArenaJudgmentDraw
arenajudmengtstring 5 arenajudgmentstring B_MSG_REF_PLAYER_WON
arenawaitmessage 5 arenawaitmessage B_MSG_REF_PLAYER_WON
arenajudgmentwindow arenajudgmentwindow
various15 BS_ATTACKER various15 BS_ATTACKER
printstring STRINGID_DEFEATEDOPPONENTBYREFEREE printstring STRINGID_DEFEATEDOPPONENTBYREFEREE
@ -4525,8 +4527,8 @@ BattleScript_ArenaDoJudgment::
end2 end2
BattleScript_ArenaJudgmentPlayerLoses: BattleScript_ArenaJudgmentPlayerLoses:
arenajudmengtstring 6 arenajudgmentstring B_MSG_REF_OPPONENT_WON
arenawaitmessage 6 arenawaitmessage B_MSG_REF_OPPONENT_WON
arenajudgmentwindow arenajudgmentwindow
various15 BS_ATTACKER various15 BS_ATTACKER
printstring STRINGID_LOSTTOOPPONENTBYREFEREE printstring STRINGID_LOSTTOOPPONENTBYREFEREE
@ -4539,8 +4541,8 @@ BattleScript_ArenaJudgmentPlayerLoses:
end2 end2
BattleScript_ArenaJudgmentDraw: BattleScript_ArenaJudgmentDraw:
arenajudmengtstring 7 arenajudgmentstring B_MSG_REF_DRAW
arenawaitmessage 7 arenawaitmessage B_MSG_REF_DRAW
arenajudgmentwindow arenajudgmentwindow
various15 BS_ATTACKER various15 BS_ATTACKER
printstring STRINGID_TIEDOPPONENTBYREFEREE printstring STRINGID_TIEDOPPONENTBYREFEREE

View File

@ -95,7 +95,7 @@ BattleScript_ShakeBallThrow::
printfromtable gBallEscapeStringIds printfromtable gBallEscapeStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd
jumpifbyte CMP_NOT_EQUAL, gNumSafariBalls, 0x0, BattleScript_ShakeBallThrowEnd jumpifbyte CMP_NOT_EQUAL, gNumSafariBalls, 0, BattleScript_ShakeBallThrowEnd
printstring STRINGID_OUTOFSAFARIBALLS printstring STRINGID_OUTOFSAFARIBALLS
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte gBattleOutcome, B_OUTCOME_NO_SAFARI_BALLS setbyte gBattleOutcome, B_OUTCOME_NO_SAFARI_BALLS
@ -111,8 +111,7 @@ BattleScript_TrainerBallBlock::
finishaction finishaction
BattleScript_PlayerUsesItem:: BattleScript_PlayerUsesItem::
setbyte sMOVEEND_STATE, 0xF moveendcase MOVEEND_MIRROR_MOVE
moveend 0x1, 0x0
end end
BattleScript_OpponentUsesHealItem:: BattleScript_OpponentUsesHealItem::
@ -128,8 +127,7 @@ BattleScript_OpponentUsesHealItem::
printstring STRINGID_PKMNSITEMRESTOREDHEALTH printstring STRINGID_PKMNSITEMRESTOREDHEALTH
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
updatestatusicon BS_ATTACKER updatestatusicon BS_ATTACKER
setbyte sMOVEEND_STATE, 0xF moveendcase MOVEEND_MIRROR_MOVE
moveend 0x1, 0x0
finishaction finishaction
BattleScript_OpponentUsesStatusCureItem:: BattleScript_OpponentUsesStatusCureItem::
@ -142,8 +140,7 @@ BattleScript_OpponentUsesStatusCureItem::
printfromtable gTrainerItemCuredStatusStringIds printfromtable gTrainerItemCuredStatusStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
updatestatusicon BS_ATTACKER updatestatusicon BS_ATTACKER
setbyte sMOVEEND_STATE, 0xF moveendcase MOVEEND_MIRROR_MOVE
moveend 0x1, 0x0
finishaction finishaction
BattleScript_OpponentUsesXItem:: BattleScript_OpponentUsesXItem::
@ -155,8 +152,7 @@ BattleScript_OpponentUsesXItem::
useitemonopponent useitemonopponent
printfromtable gStatUpStringIds printfromtable gStatUpStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte sMOVEEND_STATE, 0xF moveendcase MOVEEND_MIRROR_MOVE
moveend 0x1, 0x0
finishaction finishaction
BattleScript_OpponentUsesGuardSpecs:: BattleScript_OpponentUsesGuardSpecs::
@ -168,8 +164,7 @@ BattleScript_OpponentUsesGuardSpecs::
useitemonopponent useitemonopponent
printfromtable gMistUsedStringIds printfromtable gMistUsedStringIds
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
setbyte sMOVEEND_STATE, 0xF moveendcase MOVEEND_MIRROR_MOVE
moveend 0x1, 0x0
finishaction finishaction
BattleScript_RunByUsingItem:: BattleScript_RunByUsingItem::

View File

@ -156,7 +156,7 @@ enum
CONTROLLER_CLEARUNKFLAG, CONTROLLER_CLEARUNKFLAG,
CONTROLLER_TOGGLEUNKFLAG, CONTROLLER_TOGGLEUNKFLAG,
CONTROLLER_HITANIMATION, CONTROLLER_HITANIMATION,
CONTROLLER_42, CONTROLLER_CANTSWITCH,
CONTROLLER_PLAYSE, CONTROLLER_PLAYSE,
CONTROLLER_PLAYFANFAREORBGM, CONTROLLER_PLAYFANFAREORBGM,
CONTROLLER_FAINTINGCRY, CONTROLLER_FAINTINGCRY,
@ -227,7 +227,7 @@ void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused
void BtlController_EmitClearUnkFlag(u8 bufferId); // unused void BtlController_EmitClearUnkFlag(u8 bufferId); // unused
void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused
void BtlController_EmitHitAnimation(u8 bufferId); void BtlController_EmitHitAnimation(u8 bufferId);
void BtlController_EmitCmd42(u8 bufferId); void BtlController_EmitCantSwitch(u8 bufferId);
void BtlController_EmitPlaySE(u8 bufferId, u16 songId); void BtlController_EmitPlaySE(u8 bufferId, u16 songId);
void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM); void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM);
void BtlController_EmitFaintingCry(u8 bufferId); void BtlController_EmitFaintingCry(u8 bufferId);

View File

@ -39,8 +39,10 @@
#define BS_ATTACKER 1 #define BS_ATTACKER 1
#define BS_EFFECT_BATTLER 2 #define BS_EFFECT_BATTLER 2
#define BS_FAINTED 3 #define BS_FAINTED 3
#define BS_BATTLER_0 7
#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon #define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon
#define BS_UNK_5 5
#define BS_UNK_6 6
#define BS_BATTLER_0 7
#define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability #define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability
#define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability #define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability
#define BS_SCRIPTING 10 #define BS_SCRIPTING 10
@ -55,12 +57,12 @@
#define ACC_CURR_MOVE 0 #define ACC_CURR_MOVE 0
// compare operands // compare operands
#define CMP_EQUAL 0x0 #define CMP_EQUAL 0
#define CMP_NOT_EQUAL 0x1 #define CMP_NOT_EQUAL 1
#define CMP_GREATER_THAN 0x2 #define CMP_GREATER_THAN 2
#define CMP_LESS_THAN 0x3 #define CMP_LESS_THAN 3
#define CMP_COMMON_BITS 0x4 #define CMP_COMMON_BITS 4
#define CMP_NO_COMMON_BITS 0x5 #define CMP_NO_COMMON_BITS 5
// Cmd_various // Cmd_various
#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0 #define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
@ -93,27 +95,29 @@
#define DMG_DOUBLED 2 #define DMG_DOUBLED 2
// Cmd_jumpifcantswitch // Cmd_jumpifcantswitch
#define SWITCH_IGNORE_ESCAPE_PREVENTION 0x80 #define SWITCH_IGNORE_ESCAPE_PREVENTION (1 << 7)
// Cmd_statbuffchange // Cmd_statbuffchange
#define STAT_BUFF_ALLOW_PTR 0x1 // If set, allow use of jumpptr. Set in every use of statbuffchange #define STAT_BUFF_ALLOW_PTR (1 << 0) // If set, allow use of jumpptr. Set in every use of statbuffchange
#define STAT_BUFF_NOT_PROTECT_AFFECTED 0x20 #define STAT_BUFF_NOT_PROTECT_AFFECTED (1 << 5)
// stat change flags for Cmd_playstatchangeanimation // stat change flags for Cmd_playstatchangeanimation
#define STAT_CHANGE_NEGATIVE 0x1 #define STAT_CHANGE_NEGATIVE (1 << 0)
#define STAT_CHANGE_BY_TWO 0x2 #define STAT_CHANGE_BY_TWO (1 << 1)
#define STAT_CHANGE_MULTIPLE_STATS 0x4 #define STAT_CHANGE_MULTIPLE_STATS (1 << 2)
#define STAT_CHANGE_CANT_PREVENT 0x8 #define STAT_CHANGE_CANT_PREVENT (1 << 3)
// stat flags for Cmd_playstatchangeanimation // stat flags for Cmd_playstatchangeanimation
#define BIT_HP 0x1 #define BIT_HP (1 << 0)
#define BIT_ATK 0x2 #define BIT_ATK (1 << 1)
#define BIT_DEF 0x4 #define BIT_DEF (1 << 2)
#define BIT_SPEED 0x8 #define BIT_SPEED (1 << 3)
#define BIT_SPATK 0x10 #define BIT_SPATK (1 << 4)
#define BIT_SPDEF 0x20 #define BIT_SPDEF (1 << 5)
#define BIT_ACC 0x40 #define BIT_ACC (1 << 6)
#define BIT_EVASION 0x80 #define BIT_EVASION (1 << 7)
#define PARTY_SCREEN_OPTIONAL (1 << 7) // Flag for first argument to openpartyscreen
// cases for Cmd_moveend // cases for Cmd_moveend
#define MOVEEND_RAGE 0 #define MOVEEND_RAGE 0

View File

@ -421,12 +421,6 @@
#define B_MSG_LEECH_SEED_DRAIN 3 #define B_MSG_LEECH_SEED_DRAIN 3
#define B_MSG_LEECH_SEED_OOZE 4 #define B_MSG_LEECH_SEED_OOZE 4
// gBattlePalaceFlavorTextTable
#define B_MSG_GLINT_IN_EYE 0
#define B_MSG_GETTING_IN_POS 1
#define B_MSG_GROWL_DEEPLY 2
#define B_MSG_EAGER_FOR_MORE 3
// gFirstTurnOfTwoStringIds // gFirstTurnOfTwoStringIds
#define B_MSG_TURN1_RAZOR_WIND 0 #define B_MSG_TURN1_RAZOR_WIND 0
#define B_MSG_TURN1_SOLAR_BEAM 1 #define B_MSG_TURN1_SOLAR_BEAM 1
@ -586,4 +580,21 @@
#define B_MSG_DEFROSTED 0 #define B_MSG_DEFROSTED 0
#define B_MSG_DEFROSTED_BY_MOVE 1 #define B_MSG_DEFROSTED_BY_MOVE 1
// gBattlePalaceFlavorTextTable
#define B_MSG_GLINT_IN_EYE 0
#define B_MSG_GETTING_IN_POS 1
#define B_MSG_GROWL_DEEPLY 2
#define B_MSG_EAGER_FOR_MORE 3
// gRefereeStringsTable
#define B_MSG_REF_NOTHING_IS_DECIDED 0
#define B_MSG_REF_THATS_IT 1
#define B_MSG_REF_JUDGE_MIND 2
#define B_MSG_REF_JUDGE_SKILL 3
#define B_MSG_REF_JUDGE_BODY 4
#define B_MSG_REF_PLAYER_WON 5
#define B_MSG_REF_OPPONENT_WON 6
#define B_MSG_REF_DRAW 7
#define B_MSG_REF_COMMENCE_BATTLE 8
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -74,7 +74,7 @@ static void LinkOpponentHandleSetUnkVar(void);
static void LinkOpponentHandleClearUnkFlag(void); static void LinkOpponentHandleClearUnkFlag(void);
static void LinkOpponentHandleToggleUnkFlag(void); static void LinkOpponentHandleToggleUnkFlag(void);
static void LinkOpponentHandleHitAnimation(void); static void LinkOpponentHandleHitAnimation(void);
static void LinkOpponentHandleCmd42(void); static void LinkOpponentHandleCantSwitch(void);
static void LinkOpponentHandlePlaySE(void); static void LinkOpponentHandlePlaySE(void);
static void LinkOpponentHandlePlayFanfareOrBGM(void); static void LinkOpponentHandlePlayFanfareOrBGM(void);
static void LinkOpponentHandleFaintingCry(void); static void LinkOpponentHandleFaintingCry(void);
@ -146,7 +146,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation,
[CONTROLLER_42] = LinkOpponentHandleCmd42, [CONTROLLER_CANTSWITCH] = LinkOpponentHandleCantSwitch,
[CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry,
@ -1647,7 +1647,7 @@ static void LinkOpponentHandleHitAnimation(void)
} }
} }
static void LinkOpponentHandleCmd42(void) static void LinkOpponentHandleCantSwitch(void)
{ {
LinkOpponentBufferExecCompleted(); LinkOpponentBufferExecCompleted();
} }

View File

@ -72,7 +72,7 @@ static void LinkPartnerHandleSetUnkVar(void);
static void LinkPartnerHandleClearUnkFlag(void); static void LinkPartnerHandleClearUnkFlag(void);
static void LinkPartnerHandleToggleUnkFlag(void); static void LinkPartnerHandleToggleUnkFlag(void);
static void LinkPartnerHandleHitAnimation(void); static void LinkPartnerHandleHitAnimation(void);
static void LinkPartnerHandleCmd42(void); static void LinkPartnerHandleCantSwitch(void);
static void LinkPartnerHandlePlaySE(void); static void LinkPartnerHandlePlaySE(void);
static void LinkPartnerHandlePlayFanfareOrBGM(void); static void LinkPartnerHandlePlayFanfareOrBGM(void);
static void LinkPartnerHandleFaintingCry(void); static void LinkPartnerHandleFaintingCry(void);
@ -143,7 +143,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = LinkPartnerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = LinkPartnerHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation, [CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation,
[CONTROLLER_42] = LinkPartnerHandleCmd42, [CONTROLLER_CANTSWITCH] = LinkPartnerHandleCantSwitch,
[CONTROLLER_PLAYSE] = LinkPartnerHandlePlaySE, [CONTROLLER_PLAYSE] = LinkPartnerHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = LinkPartnerHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = LinkPartnerHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = LinkPartnerHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = LinkPartnerHandleFaintingCry,
@ -1477,7 +1477,7 @@ static void LinkPartnerHandleHitAnimation(void)
} }
} }
static void LinkPartnerHandleCmd42(void) static void LinkPartnerHandleCantSwitch(void)
{ {
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }

View File

@ -79,7 +79,7 @@ static void OpponentHandleSetUnkVar(void);
static void OpponentHandleClearUnkFlag(void); static void OpponentHandleClearUnkFlag(void);
static void OpponentHandleToggleUnkFlag(void); static void OpponentHandleToggleUnkFlag(void);
static void OpponentHandleHitAnimation(void); static void OpponentHandleHitAnimation(void);
static void OpponentHandleCmd42(void); static void OpponentHandleCantSwitch(void);
static void OpponentHandlePlaySE(void); static void OpponentHandlePlaySE(void);
static void OpponentHandlePlayFanfareOrBGM(void); static void OpponentHandlePlayFanfareOrBGM(void);
static void OpponentHandleFaintingCry(void); static void OpponentHandleFaintingCry(void);
@ -151,7 +151,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = OpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = OpponentHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation,
[CONTROLLER_42] = OpponentHandleCmd42, [CONTROLLER_CANTSWITCH] = OpponentHandleCantSwitch,
[CONTROLLER_PLAYSE] = OpponentHandlePlaySE, [CONTROLLER_PLAYSE] = OpponentHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = OpponentHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = OpponentHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = OpponentHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = OpponentHandleFaintingCry,
@ -1813,7 +1813,7 @@ static void OpponentHandleHitAnimation(void)
} }
} }
static void OpponentHandleCmd42(void) static void OpponentHandleCantSwitch(void)
{ {
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }

View File

@ -80,7 +80,7 @@ static void PlayerHandleSetUnkVar(void);
static void PlayerHandleClearUnkFlag(void); static void PlayerHandleClearUnkFlag(void);
static void PlayerHandleToggleUnkFlag(void); static void PlayerHandleToggleUnkFlag(void);
static void PlayerHandleHitAnimation(void); static void PlayerHandleHitAnimation(void);
static void PlayerHandleCmd42(void); static void PlayerHandleCantSwitch(void);
static void PlayerHandlePlaySE(void); static void PlayerHandlePlaySE(void);
static void PlayerHandlePlayFanfareOrBGM(void); static void PlayerHandlePlayFanfareOrBGM(void);
static void PlayerHandleFaintingCry(void); static void PlayerHandleFaintingCry(void);
@ -167,7 +167,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = PlayerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = PlayerHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation, [CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation,
[CONTROLLER_42] = PlayerHandleCmd42, [CONTROLLER_CANTSWITCH] = PlayerHandleCantSwitch,
[CONTROLLER_PLAYSE] = PlayerHandlePlaySE, [CONTROLLER_PLAYSE] = PlayerHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = PlayerHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = PlayerHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = PlayerHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = PlayerHandleFaintingCry,
@ -2890,7 +2890,7 @@ static void PlayerHandleHitAnimation(void)
} }
} }
static void PlayerHandleCmd42(void) static void PlayerHandleCantSwitch(void)
{ {
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }

View File

@ -70,7 +70,7 @@ static void PlayerPartnerHandleSetUnkVar(void);
static void PlayerPartnerHandleClearUnkFlag(void); static void PlayerPartnerHandleClearUnkFlag(void);
static void PlayerPartnerHandleToggleUnkFlag(void); static void PlayerPartnerHandleToggleUnkFlag(void);
static void PlayerPartnerHandleHitAnimation(void); static void PlayerPartnerHandleHitAnimation(void);
static void PlayerPartnerHandleCmd42(void); static void PlayerPartnerHandleCantSwitch(void);
static void PlayerPartnerHandlePlaySE(void); static void PlayerPartnerHandlePlaySE(void);
static void PlayerPartnerHandlePlayFanfareOrBGM(void); static void PlayerPartnerHandlePlayFanfareOrBGM(void);
static void PlayerPartnerHandleFaintingCry(void); static void PlayerPartnerHandleFaintingCry(void);
@ -146,7 +146,7 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = PlayerPartnerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = PlayerPartnerHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation, [CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation,
[CONTROLLER_42] = PlayerPartnerHandleCmd42, [CONTROLLER_CANTSWITCH] = PlayerPartnerHandleCantSwitch,
[CONTROLLER_PLAYSE] = PlayerPartnerHandlePlaySE, [CONTROLLER_PLAYSE] = PlayerPartnerHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = PlayerPartnerHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = PlayerPartnerHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = PlayerPartnerHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = PlayerPartnerHandleFaintingCry,
@ -1727,7 +1727,7 @@ static void PlayerPartnerHandleHitAnimation(void)
} }
} }
static void PlayerPartnerHandleCmd42(void) static void PlayerPartnerHandleCantSwitch(void)
{ {
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }

View File

@ -74,7 +74,7 @@ static void RecordedOpponentHandleSetUnkVar(void);
static void RecordedOpponentHandleClearUnkFlag(void); static void RecordedOpponentHandleClearUnkFlag(void);
static void RecordedOpponentHandleToggleUnkFlag(void); static void RecordedOpponentHandleToggleUnkFlag(void);
static void RecordedOpponentHandleHitAnimation(void); static void RecordedOpponentHandleHitAnimation(void);
static void RecordedOpponentHandleCmd42(void); static void RecordedOpponentHandleCantSwitch(void);
static void RecordedOpponentHandlePlaySE(void); static void RecordedOpponentHandlePlaySE(void);
static void RecordedOpponentHandlePlayFanfareOrBGM(void); static void RecordedOpponentHandlePlayFanfareOrBGM(void);
static void RecordedOpponentHandleFaintingCry(void); static void RecordedOpponentHandleFaintingCry(void);
@ -146,7 +146,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
[CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation,
[CONTROLLER_42] = RecordedOpponentHandleCmd42, [CONTROLLER_CANTSWITCH] = RecordedOpponentHandleCantSwitch,
[CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry,
@ -1587,7 +1587,7 @@ static void RecordedOpponentHandleHitAnimation(void)
} }
} }
static void RecordedOpponentHandleCmd42(void) static void RecordedOpponentHandleCantSwitch(void)
{ {
RecordedOpponentBufferExecCompleted(); RecordedOpponentBufferExecCompleted();
} }

View File

@ -70,7 +70,7 @@ static void RecordedPlayerHandleSetUnkVar(void);
static void RecordedPlayerHandleClearUnkFlag(void); static void RecordedPlayerHandleClearUnkFlag(void);
static void RecordedPlayerHandleToggleUnkFlag(void); static void RecordedPlayerHandleToggleUnkFlag(void);
static void RecordedPlayerHandleHitAnimation(void); static void RecordedPlayerHandleHitAnimation(void);
static void RecordedPlayerHandleCmd42(void); static void RecordedPlayerHandleCantSwitch(void);
static void RecordedPlayerHandlePlaySE(void); static void RecordedPlayerHandlePlaySE(void);
static void RecordedPlayerHandlePlayFanfareOrBGM(void); static void RecordedPlayerHandlePlayFanfareOrBGM(void);
static void RecordedPlayerHandleFaintingCry(void); static void RecordedPlayerHandleFaintingCry(void);
@ -141,7 +141,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
[CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation,
[CONTROLLER_42] = RecordedPlayerHandleCmd42, [CONTROLLER_CANTSWITCH] = RecordedPlayerHandleCantSwitch,
[CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry,
@ -1610,7 +1610,7 @@ static void RecordedPlayerHandleHitAnimation(void)
} }
} }
static void RecordedPlayerHandleCmd42(void) static void RecordedPlayerHandleCantSwitch(void)
{ {
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }

View File

@ -67,7 +67,7 @@ static void SafariHandleSetUnkVar(void);
static void SafariHandleClearUnkFlag(void); static void SafariHandleClearUnkFlag(void);
static void SafariHandleToggleUnkFlag(void); static void SafariHandleToggleUnkFlag(void);
static void SafariHandleHitAnimation(void); static void SafariHandleHitAnimation(void);
static void SafariHandleCmd42(void); static void SafariHandleCantSwitch(void);
static void SafariHandlePlaySE(void); static void SafariHandlePlaySE(void);
static void SafariHandlePlayFanfareOrBGM(void); static void SafariHandlePlayFanfareOrBGM(void);
static void SafariHandleFaintingCry(void); static void SafariHandleFaintingCry(void);
@ -131,7 +131,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = SafariHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = SafariHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = SafariHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = SafariHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = SafariHandleHitAnimation, [CONTROLLER_HITANIMATION] = SafariHandleHitAnimation,
[CONTROLLER_42] = SafariHandleCmd42, [CONTROLLER_CANTSWITCH] = SafariHandleCantSwitch,
[CONTROLLER_PLAYSE] = SafariHandlePlaySE, [CONTROLLER_PLAYSE] = SafariHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = SafariHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = SafariHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry,
@ -580,7 +580,7 @@ static void SafariHandleHitAnimation(void)
SafariBufferExecCompleted(); SafariBufferExecCompleted();
} }
static void SafariHandleCmd42(void) static void SafariHandleCantSwitch(void)
{ {
SafariBufferExecCompleted(); SafariBufferExecCompleted();
} }

View File

@ -75,7 +75,7 @@ static void WallyHandleSetUnkVar(void);
static void WallyHandleClearUnkFlag(void); static void WallyHandleClearUnkFlag(void);
static void WallyHandleToggleUnkFlag(void); static void WallyHandleToggleUnkFlag(void);
static void WallyHandleHitAnimation(void); static void WallyHandleHitAnimation(void);
static void WallyHandleCmd42(void); static void WallyHandleCantSwitch(void);
static void WallyHandlePlaySE(void); static void WallyHandlePlaySE(void);
static void WallyHandlePlayFanfareOrBGM(void); static void WallyHandlePlayFanfareOrBGM(void);
static void WallyHandleFaintingCry(void); static void WallyHandleFaintingCry(void);
@ -144,7 +144,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CLEARUNKFLAG] = WallyHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = WallyHandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = WallyHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = WallyHandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = WallyHandleHitAnimation, [CONTROLLER_HITANIMATION] = WallyHandleHitAnimation,
[CONTROLLER_42] = WallyHandleCmd42, [CONTROLLER_CANTSWITCH] = WallyHandleCantSwitch,
[CONTROLLER_PLAYSE] = WallyHandlePlaySE, [CONTROLLER_PLAYSE] = WallyHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = WallyHandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = WallyHandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry,
@ -1385,7 +1385,7 @@ static void WallyHandleHitAnimation(void)
} }
} }
static void WallyHandleCmd42(void) static void WallyHandleCantSwitch(void)
{ {
WallyBufferExecCompleted(); WallyBufferExecCompleted();
} }

View File

@ -1385,12 +1385,12 @@ void BtlController_EmitHitAnimation(u8 bufferId)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
} }
void BtlController_EmitCmd42(u8 bufferId) void BtlController_EmitCantSwitch(u8 bufferId)
{ {
sBattleBuffersTransferData[0] = CONTROLLER_42; sBattleBuffersTransferData[0] = CONTROLLER_CANTSWITCH;
sBattleBuffersTransferData[1] = CONTROLLER_42; sBattleBuffersTransferData[1] = CONTROLLER_CANTSWITCH;
sBattleBuffersTransferData[2] = CONTROLLER_42; sBattleBuffersTransferData[2] = CONTROLLER_CANTSWITCH;
sBattleBuffersTransferData[3] = CONTROLLER_42; sBattleBuffersTransferData[3] = CONTROLLER_CANTSWITCH;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
} }

View File

@ -1401,9 +1401,9 @@ static const u8 sText_RefThatsIt[] = _("REFEREE: That's it! We will now go to\nj
static const u8 sText_RefJudgeMind[] = _("REFEREE: Judging category 1, Mind!\nThe POKéMON showing the most guts!\p"); static const u8 sText_RefJudgeMind[] = _("REFEREE: Judging category 1, Mind!\nThe POKéMON showing the most guts!\p");
static const u8 sText_RefJudgeSkill[] = _("REFEREE: Judging category 2, Skill!\nThe POKéMON using moves the best!\p"); static const u8 sText_RefJudgeSkill[] = _("REFEREE: Judging category 2, Skill!\nThe POKéMON using moves the best!\p");
static const u8 sText_RefJudgeBody[] = _("REFEREE: Judging category 3, Body!\nThe POKéMON with the most vitality!\p"); static const u8 sText_RefJudgeBody[] = _("REFEREE: Judging category 3, Body!\nThe POKéMON with the most vitality!\p");
static const u8 sText_RefJudgement1[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_PLAYER_NAME}'s {B_PLAYER_MON1_NAME}!\p"); static const u8 sText_RefPlayerWon[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_PLAYER_NAME}'s {B_PLAYER_MON1_NAME}!\p");
static const u8 sText_RefJudgement2[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_TRAINER1_NAME}'s {B_OPPONENT_MON1_NAME}!\p"); static const u8 sText_RefOpponentWon[] = _("REFEREE: Judgment: {B_BUFF1} to {B_BUFF2}!\nThe winner is {B_TRAINER1_NAME}'s {B_OPPONENT_MON1_NAME}!\p");
static const u8 sText_RefJudgement3[] = _("REFEREE: Judgment: 3 to 3!\nWe have a draw!\p"); static const u8 sText_RefDraw[] = _("REFEREE: Judgment: 3 to 3!\nWe have a draw!\p");
static const u8 sText_DefeatedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} defeated the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_DefeatedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} defeated the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!");
static const u8 sText_LostToOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} lost to the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_LostToOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} lost to the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!");
static const u8 sText_TiedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} tied the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!"); static const u8 sText_TiedOpponentByReferee[] = _("{B_PLAYER_MON1_NAME} tied the opponent\n{B_OPPONENT_MON1_NAME} in a REFEREE's decision!");
@ -1411,15 +1411,15 @@ static const u8 sText_RefCommenceBattle[] = _("REFEREE: {B_PLAYER_MON1_NAME} VS
const u8 * const gRefereeStringsTable[] = const u8 * const gRefereeStringsTable[] =
{ {
sText_RefIfNothingIsDecided, [B_MSG_REF_NOTHING_IS_DECIDED] = sText_RefIfNothingIsDecided,
sText_RefThatsIt, [B_MSG_REF_THATS_IT] = sText_RefThatsIt,
sText_RefJudgeMind, [B_MSG_REF_JUDGE_MIND] = sText_RefJudgeMind,
sText_RefJudgeSkill, [B_MSG_REF_JUDGE_SKILL] = sText_RefJudgeSkill,
sText_RefJudgeBody, [B_MSG_REF_JUDGE_BODY] = sText_RefJudgeBody,
sText_RefJudgement1, [B_MSG_REF_PLAYER_WON] = sText_RefPlayerWon,
sText_RefJudgement2, [B_MSG_REF_OPPONENT_WON] = sText_RefOpponentWon,
sText_RefJudgement3, [B_MSG_REF_DRAW] = sText_RefDraw,
sText_RefCommenceBattle, [B_MSG_REF_COMMENCE_BATTLE] = sText_RefCommenceBattle,
}; };
static const u8 sText_QuestionForfeitMatch[] = _("Would you like to forfeit the match\nand quit now?"); static const u8 sText_QuestionForfeitMatch[] = _("Would you like to forfeit the match\nand quit now?");

View File

@ -4801,7 +4801,9 @@ static void Cmd_jumpifcantswitch(void)
} }
} }
static void sub_804CF10(u8 slotId) // Opens the party screen to choose a new Pokémon to send out
// slotId is the Pokémon to replace
static void ChooseMonToSendOut(u8 slotId)
{ {
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler]; *(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
@ -4822,7 +4824,7 @@ static void Cmd_openpartyscreen(void)
flags = 0; flags = 0;
jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2); jumpPtr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
if (gBattlescriptCurrInstr[1] == 5) if (gBattlescriptCurrInstr[1] == BS_UNK_5)
{ {
if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI)) != BATTLE_TYPE_DOUBLE) if ((gBattleTypeFlags & (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI)) != BATTLE_TYPE_DOUBLE)
{ {
@ -4830,7 +4832,7 @@ static void Cmd_openpartyscreen(void)
{ {
if (gHitMarker & HITMARKER_FAINTED(gActiveBattler)) if (gHitMarker & HITMARKER_FAINTED(gActiveBattler))
{ {
if (HasNoMonsToSwitch(gActiveBattler, 6, 6)) if (HasNoMonsToSwitch(gActiveBattler, PARTY_SIZE, PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
@ -4839,7 +4841,7 @@ static void Cmd_openpartyscreen(void)
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(PARTY_SIZE); ChooseMonToSendOut(PARTY_SIZE);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
} }
@ -4859,16 +4861,16 @@ static void Cmd_openpartyscreen(void)
if (gBitTable[0] & hitmarkerFaintBits) if (gBitTable[0] & hitmarkerFaintBits)
{ {
gActiveBattler = 0; gActiveBattler = 0;
if (HasNoMonsToSwitch(0, 6, 6)) if (HasNoMonsToSwitch(0, PARTY_SIZE, PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[2]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[2]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
else else
@ -4881,16 +4883,16 @@ static void Cmd_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits)) if (gBitTable[2] & hitmarkerFaintBits && !(gBitTable[0] & hitmarkerFaintBits))
{ {
gActiveBattler = 2; gActiveBattler = 2;
if (HasNoMonsToSwitch(2, 6, 6)) if (HasNoMonsToSwitch(2, PARTY_SIZE, PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
else if (!(flags & 1)) else if (!(flags & 1))
@ -4902,16 +4904,16 @@ static void Cmd_openpartyscreen(void)
if (gBitTable[1] & hitmarkerFaintBits) if (gBitTable[1] & hitmarkerFaintBits)
{ {
gActiveBattler = 1; gActiveBattler = 1;
if (HasNoMonsToSwitch(1, 6, 6)) if (HasNoMonsToSwitch(1, PARTY_SIZE, PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[3]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[3]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
else else
@ -4924,16 +4926,16 @@ static void Cmd_openpartyscreen(void)
if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits)) if (gBitTable[3] & hitmarkerFaintBits && !(gBitTable[1] & hitmarkerFaintBits))
{ {
gActiveBattler = 3; gActiveBattler = 3;
if (HasNoMonsToSwitch(3, 6, 6)) if (HasNoMonsToSwitch(3, PARTY_SIZE, PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
else if (!(flags & 2)) else if (!(flags & 2))
@ -4977,7 +4979,7 @@ static void Cmd_openpartyscreen(void)
} }
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
} }
else if (gBattlescriptCurrInstr[1] == 6) else if (gBattlescriptCurrInstr[1] == BS_UNK_6)
{ {
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI)) if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{ {
@ -4987,32 +4989,32 @@ static void Cmd_openpartyscreen(void)
if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits) if (gBitTable[2] & hitmarkerFaintBits && gBitTable[0] & hitmarkerFaintBits)
{ {
gActiveBattler = 2; gActiveBattler = 2;
if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], 6)) if (HasNoMonsToSwitch(2, gBattleBufferB[0][1], PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[0]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[0]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
} }
if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1]) if (gBitTable[3] & hitmarkerFaintBits && hitmarkerFaintBits & gBitTable[1])
{ {
gActiveBattler = 3; gActiveBattler = 3;
if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], 6)) if (HasNoMonsToSwitch(3, gBattleBufferB[1][1], PARTY_SIZE))
{ {
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler)); gHitMarker &= ~(HITMARKER_FAINTED(gActiveBattler));
BtlController_EmitCmd42(0); BtlController_EmitCantSwitch(0);
MarkBattlerForControllerExec(gActiveBattler); MarkBattlerForControllerExec(gActiveBattler);
} }
else if (!gSpecialStatuses[gActiveBattler].flag40) else if (!gSpecialStatuses[gActiveBattler].flag40)
{ {
sub_804CF10(gBattleStruct->monToSwitchIntoId[1]); ChooseMonToSendOut(gBattleStruct->monToSwitchIntoId[1]);
gSpecialStatuses[gActiveBattler].flag40 = 1; gSpecialStatuses[gActiveBattler].flag40 = 1;
} }
} }
@ -5040,17 +5042,17 @@ static void Cmd_openpartyscreen(void)
} }
else else
{ {
if (gBattlescriptCurrInstr[1] & 0x80) if (gBattlescriptCurrInstr[1] & PARTY_SCREEN_OPTIONAL)
hitmarkerFaintBits = PARTY_ACTION_CHOOSE_MON; // Used here as the caseId for the EmitChoose function. hitmarkerFaintBits = PARTY_ACTION_CHOOSE_MON; // Used here as the caseId for the EmitChoose function.
else else
hitmarkerFaintBits = PARTY_ACTION_SEND_OUT; hitmarkerFaintBits = PARTY_ACTION_SEND_OUT;
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80)); battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(PARTY_SCREEN_OPTIONAL));
if (gSpecialStatuses[battlerId].flag40) if (gSpecialStatuses[battlerId].flag40)
{ {
gBattlescriptCurrInstr += 6; gBattlescriptCurrInstr += 6;
} }
else if (HasNoMonsToSwitch(battlerId, 6, 6)) else if (HasNoMonsToSwitch(battlerId, PARTY_SIZE, PARTY_SIZE))
{ {
gActiveBattler = battlerId; gActiveBattler = battlerId;
gAbsentBattlerFlags |= gBitTable[gActiveBattler]; gAbsentBattlerFlags |= gBitTable[gActiveBattler];
@ -6372,10 +6374,10 @@ static void Cmd_various(void)
break; break;
case VARIOUS_ARENA_JUDGMENT_STRING: case VARIOUS_ARENA_JUDGMENT_STRING:
BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]); BattleStringExpandPlaceholdersToDisplayedString(gRefereeStringsTable[gBattlescriptCurrInstr[1]]);
BattlePutTextOnWindow(gDisplayedStringBattle, 0x16); BattlePutTextOnWindow(gDisplayedStringBattle, 22);
break; break;
case VARIOUS_ARENA_WAIT_STRING: case VARIOUS_ARENA_WAIT_STRING:
if (IsTextPrinterActive(0x16)) if (IsTextPrinterActive(22))
return; return;
break; break;
case VARIOUS_WAIT_CRY: case VARIOUS_WAIT_CRY:
@ -7313,7 +7315,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to
do do
{ {
while ((moveChecked = Random() & 3) >= validMoves); while ((moveChecked = Random() & (MAX_MON_MOVES - 1)) >= validMoves);
moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type; moveType = gBattleMoves[gBattleMons[gBattlerAttacker].moves[moveChecked]].type;
@ -8138,7 +8140,7 @@ static void Cmd_trychoosesleeptalkmove(void)
do do
{ {
movePosition = Random() & 3; movePosition = Random() & (MAX_MON_MOVES - 1);
} while ((gBitTable[movePosition] & unusableMovesBits)); } while ((gBitTable[movePosition] & unusableMovesBits));
gCalledMove = gBattleMons[gBattlerAttacker].moves[movePosition]; gCalledMove = gBattleMons[gBattlerAttacker].moves[movePosition];

View File

@ -1874,7 +1874,7 @@ bool8 HandleFaintedMonActions(void)
gBattleStruct->faintedActionsState++; gBattleStruct->faintedActionsState++;
for (i = 0; i < gBattlersCount; i++) for (i = 0; i < gBattlersCount; i++)
{ {
if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, 6, 6)) if (gAbsentBattlerFlags & gBitTable[i] && !HasNoMonsToSwitch(i, PARTY_SIZE, PARTY_SIZE))
gAbsentBattlerFlags &= ~(gBitTable[i]); gAbsentBattlerFlags &= ~(gBitTable[i]);
} }
// fall through // fall through