#include "constants/battle.h" #include "constants/battle_script_commands.h" #include "constants/battle_anim.h" #include "constants/battle_string_ids.h" #include "constants/battle_config.h" #include "constants/items.h" #include "constants/songs.h" #include "constants/game_stat.h" .include "asm/macros.inc" .include "asm/macros/battle_script.inc" .include "constants/constants.inc" .section script_data, "aw", %progbits .align 2 gBattlescriptsForBallThrow:: .4byte BattleScript_BallThrow @ ITEM_NONE .4byte BattleScript_BallThrow @ ITEM_MASTER_BALL .4byte BattleScript_BallThrow @ ITEM_ULTRA_BALL .4byte BattleScript_BallThrow @ ITEM_GREAT_BALL .4byte BattleScript_BallThrow @ ITEM_POKE_BALL .4byte BattleScript_SafariBallThrow @ ITEM_SAFARI_BALL .4byte BattleScript_BallThrow @ ITEM_NET_BALL .4byte BattleScript_BallThrow @ ITEM_DIVE_BALL .4byte BattleScript_BallThrow @ ITEM_NEST_BALL .4byte BattleScript_BallThrow @ ITEM_REPEAT_BALL .4byte BattleScript_BallThrow @ ITEM_TIMER_BALL .4byte BattleScript_BallThrow @ ITEM_LUXURY_BALL .4byte BattleScript_BallThrow @ ITEM_DUSK_BALL .4byte BattleScript_BallThrow @ ITEM_HEAL_BALL .4byte BattleScript_BallThrow @ ITEM_QUICK_BALL .4byte BattleScript_BallThrow @ ITEM_CHERISH_BALL .4byte BattleScript_BallThrow @ ITEM_FAST_BALL .4byte BattleScript_BallThrow @ ITEM_LEVEL_BALL .4byte BattleScript_BallThrow @ ITEM_LURE_BALL .4byte BattleScript_BallThrow @ ITEM_HEAVY_BALL .4byte BattleScript_BallThrow @ ITEM_LOVE_BALL .4byte BattleScript_BallThrow @ ITEM_FRIEND_BALL .4byte BattleScript_BallThrow @ ITEM_MOON_BALL .4byte BattleScript_BallThrow @ ITEM_SPORT_BALL .4byte BattleScript_BallThrow @ ITEM_PARK_BALL .4byte BattleScript_BallThrow @ ITEM_DREAM_BALL .4byte BattleScript_BallThrow @ ITEM_BEAST_BALL .4byte BattleScript_BallThrow @ ITEM_PREMIER_BALL .align 2 gBattlescriptsForUsingItem:: .4byte BattleScript_PlayerUsesItem .4byte BattleScript_OpponentUsesHealItem @ AI_ITEM_FULL_RESTORE .4byte BattleScript_OpponentUsesHealItem @ AI_ITEM_HEAL_HP .4byte BattleScript_OpponentUsesStatusCureItem @ AI_ITEM_CURE_CONDITION .4byte BattleScript_OpponentUsesXItem @ AI_ITEM_X_STAT .4byte BattleScript_OpponentUsesGuardSpec @ AI_ITEM_GUARD_SPEC .align 2 gBattlescriptsForRunningByItem:: .4byte BattleScript_RunByUsingItem .align 2 gBattlescriptsForSafariActions:: .4byte BattleScript_ActionWatchesCarefully .4byte BattleScript_ActionGetNear .4byte BattleScript_ActionThrowPokeblock .4byte BattleScript_ActionWallyThrow BattleScript_BallThrow:: jumpifword CMP_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_WALLY_TUTORIAL, BattleScript_BallThrowByWally printstring STRINGID_PLAYERUSEDITEM handleballthrow BattleScript_BallThrowByWally:: printstring STRINGID_WALLYUSEDITEM handleballthrow BattleScript_SafariBallThrow:: printstring STRINGID_PLAYERUSEDITEM updatestatusicon BS_ATTACKER handleballthrow BattleScript_SuccessBallThrow:: setbyte sMON_CAUGHT, TRUE jumpifhalfword CMP_EQUAL, gLastUsedItem, ITEM_SAFARI_BALL, BattleScript_PrintCaughtMonInfo incrementgamestat GAME_STAT_POKEMON_CAPTURES BattleScript_PrintCaughtMonInfo:: printstring STRINGID_GOTCHAPKMNCAUGHT jumpifbyte CMP_NOT_EQUAL, sEXP_CATCH, TRUE, BattleScript_TryPrintCaughtMonInfo setbyte sGIVEEXP_STATE, 0 getexp BS_TARGET sethword gBattle_BG2_X, 0 BattleScript_TryPrintCaughtMonInfo: trysetcaughtmondexflags BattleScript_TryNicknameCaughtMon printstring STRINGID_PKMNDATAADDEDTODEX waitstate setbyte gBattleCommunication, 0 displaydexinfo BattleScript_TryNicknameCaughtMon:: printstring STRINGID_GIVENICKNAMECAPTURED waitstate setbyte gBattleCommunication, 0 trygivecaughtmonnick BattleScript_GiveCaughtMonEnd givecaughtmon printfromtable gCaughtMonStringIds waitmessage B_WAIT_TIME_LONG goto BattleScript_SuccessBallThrowEnd BattleScript_GiveCaughtMonEnd:: givecaughtmon BattleScript_SuccessBallThrowEnd:: setbyte gBattleOutcome, B_OUTCOME_CAUGHT finishturn BattleScript_WallyBallThrow:: printstring STRINGID_GOTCHAPKMNCAUGHT2 setbyte gBattleOutcome, B_OUTCOME_CAUGHT finishturn BattleScript_ShakeBallThrow:: printfromtable gBallEscapeStringIds waitmessage B_WAIT_TIME_LONG jumpifword CMP_NO_COMMON_BITS, gBattleTypeFlags, BATTLE_TYPE_SAFARI, BattleScript_ShakeBallThrowEnd jumpifbyte CMP_NOT_EQUAL, gNumSafariBalls, 0, BattleScript_ShakeBallThrowEnd printstring STRINGID_OUTOFSAFARIBALLS waitmessage B_WAIT_TIME_LONG setbyte gBattleOutcome, B_OUTCOME_NO_SAFARI_BALLS BattleScript_ShakeBallThrowEnd:: finishaction BattleScript_TrainerBallBlock:: waitmessage B_WAIT_TIME_LONG printstring STRINGID_TRAINERBLOCKEDBALL waitmessage B_WAIT_TIME_LONG printstring STRINGID_DONTBEATHIEF waitmessage B_WAIT_TIME_LONG finishaction BattleScript_PlayerUsesItem:: moveendcase MOVEEND_MIRROR_MOVE end BattleScript_OpponentUsesHealItem:: printstring STRINGID_EMPTYSTRING3 pause B_WAIT_TIME_MED playse SE_USE_ITEM printstring STRINGID_TRAINER1USEDITEM waitmessage B_WAIT_TIME_LONG bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT useitemonopponent orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER printstring STRINGID_PKMNSITEMRESTOREDHEALTH waitmessage B_WAIT_TIME_LONG updatestatusicon BS_ATTACKER moveendcase MOVEEND_MIRROR_MOVE finishaction BattleScript_OpponentUsesStatusCureItem:: printstring STRINGID_EMPTYSTRING3 pause B_WAIT_TIME_MED playse SE_USE_ITEM printstring STRINGID_TRAINER1USEDITEM waitmessage B_WAIT_TIME_LONG useitemonopponent printfromtable gTrainerItemCuredStatusStringIds waitmessage B_WAIT_TIME_LONG updatestatusicon BS_ATTACKER moveendcase MOVEEND_MIRROR_MOVE finishaction BattleScript_OpponentUsesXItem:: printstring STRINGID_EMPTYSTRING3 pause B_WAIT_TIME_MED playse SE_USE_ITEM printstring STRINGID_TRAINER1USEDITEM waitmessage B_WAIT_TIME_LONG useitemonopponent printfromtable gStatUpStringIds waitmessage B_WAIT_TIME_LONG moveendcase MOVEEND_MIRROR_MOVE finishaction BattleScript_OpponentUsesGuardSpec:: printstring STRINGID_EMPTYSTRING3 pause B_WAIT_TIME_MED playse SE_USE_ITEM printstring STRINGID_TRAINER1USEDITEM waitmessage B_WAIT_TIME_LONG useitemonopponent printfromtable gMistUsedStringIds waitmessage B_WAIT_TIME_LONG moveendcase MOVEEND_MIRROR_MOVE finishaction BattleScript_RunByUsingItem:: playse SE_FLEE setbyte gBattleOutcome, B_OUTCOME_RAN finishturn BattleScript_ActionWatchesCarefully: printstring STRINGID_PKMNWATCHINGCAREFULLY waitmessage B_WAIT_TIME_LONG end2 BattleScript_ActionGetNear: printfromtable gSafariGetNearStringIds waitmessage B_WAIT_TIME_LONG end2 BattleScript_ActionThrowPokeblock: printstring STRINGID_THREWPOKEBLOCKATPKMN waitmessage B_WAIT_TIME_LONG playanimation BS_ATTACKER, B_ANIM_POKEBLOCK_THROW, NULL printfromtable gSafariPokeblockResultStringIds waitmessage B_WAIT_TIME_LONG end2 BattleScript_ActionWallyThrow: printstring STRINGID_RETURNMON waitmessage B_WAIT_TIME_LONG returnatktoball waitstate trainerslidein BS_TARGET waitstate printstring STRINGID_YOUTHROWABALLNOWRIGHT waitmessage B_WAIT_TIME_LONG end2 BattleScript_TrainerSlideMsgRet:: handletrainerslidemsg BS_SCRIPTING, 0 trainerslidein 1 handletrainerslidemsg BS_SCRIPTING, 1 waitstate trainerslideout 1 handletrainerslidemsg BS_SCRIPTING, 2 waitstate return BattleScript_TrainerSlideMsgEnd2:: call BattleScript_TrainerSlideMsgRet end2