shithub: pokecrystal

ref: b071dd364f715165d6eec99ebbd1e4aed4b84bde
dir: /maps/BattleTowerBattleRoom.asm/

View raw version
const_value set 2
	const BATTLETOWERBATTLEROOM_YOUNGSTER
	const BATTLETOWERBATTLEROOM_RECEPTIONIST

BattleTowerBattleRoom_MapScripts:
.SceneScripts:
	db 2
	scene_script .EnterBattleRoom
	scene_script .DummyScene

.MapCallbacks:
	db 0

.EnterBattleRoom: ; 0x9f419
	disappear BATTLETOWERBATTLEROOM_YOUNGSTER
	priorityjump Script_BattleRoom
	setscene 1
.DummyScene:
	end

Script_BattleRoom: ; 0x9f421
	applymovement PLAYER, MovementData_BattleTowerBattleRoomPlayerWalksIn
; beat all 7 opponents in a row
Script_BattleRoomLoop: ; 0x9f425
	writebyte BATTLETOWERBATTLEROOM_YOUNGSTER
	special Special_LoadOpponentTrainerAndPokemonWithOTSprite
	appear BATTLETOWERBATTLEROOM_YOUNGSTER
	warpsound
	waitsfx
	applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksIn
	opentext
	battletowertext BATTLETOWERTEXT_INTRO
	buttonsound
	closetext
	special Special_BattleTowerBattle ; calls predef startbattle
	special Special_FadeOutPalettes
	reloadmap
	if_not_equal $0, Script_FailedBattleTowerChallenge
	copybytetovar wNrOfBeatenBattleTowerTrainers ; wcf64
	if_equal BATTLETOWER_NROFTRAINERS, Script_BeatenAllTrainers
	applymovement BATTLETOWERBATTLEROOM_YOUNGSTER, MovementData_BattleTowerBattleRoomOpponentWalksOut
	warpsound
	disappear BATTLETOWERBATTLEROOM_YOUNGSTER
	applymovement BATTLETOWERBATTLEROOM_RECEPTIONIST, MovementData_BattleTowerBattleRoomReceptionistWalksToPlayer
	applymovement PLAYER, MovementData_BattleTowerBattleRoomPlayerTurnsToFaceReceptionist
	opentext
	writetext Text_YourPkmnWillBeHealedToFullHealth
	waitbutton
	closetext
	playmusic MUSIC_HEAL
	special Special_FadeOutPalettes
	special Special_LoadMapPalettes
	pause 60
	special Special_FadeInPalettes
	special RestartMapMusic
	opentext
	writetext Text_NextUpOpponentNo
	yesorno
	iffalse Script_DontBattleNextOpponent
Script_ContinueAndBattleNextOpponent: ; 0x9f477
	closetext
	applymovement PLAYER, MovementData_BattleTowerBattleRoomPlayerTurnsToFaceNextOpponent
	applymovement BATTLETOWERBATTLEROOM_RECEPTIONIST, MovementData_BattleTowerBattleRoomReceptionistWalksAway
	jump Script_BattleRoomLoop

Script_DontBattleNextOpponent: ; 0x9f483
	writetext Text_SaveAndEndTheSession
	yesorno
	iffalse Script_DontSaveAndEndTheSession
	writebyte BATTLETOWERACTION_SAVELEVELGROUP ; save level group
	special Special_BattleTowerAction
	writebyte BATTLETOWERACTION_SAVEOPTIONS ; choose reward
	special Special_BattleTowerAction
	writebyte BATTLETOWERACTION_SAVE_AND_QUIT ; quicksave
	special Special_BattleTowerAction
	playsound SFX_SAVE
	waitsfx
	special Special_FadeOutPalettes
	special Reset
Script_DontSaveAndEndTheSession: ; 0x9f4a3
	writetext Text_CancelYourBattleRoomChallenge
	yesorno
	iffalse Script_ContinueAndBattleNextOpponent
	writebyte BATTLETOWERACTION_CHALLENGECANCELED
	special Special_BattleTowerAction
	writebyte BATTLETOWERACTION_06
	special Special_BattleTowerAction
	closetext
	special Special_FadeOutPalettes
	warpfacing UP, BATTLE_TOWER_1F, 7, 7
	opentext
	jump Script_BattleTowerHopeToServeYouAgain

Script_FailedBattleTowerChallenge:
	pause 60
	special Special_BattleTowerFade
	warpfacing UP, BATTLE_TOWER_1F, 7, 7
	writebyte BATTLETOWERACTION_CHALLENGECANCELED
	special Special_BattleTowerAction
	opentext
	writetext Text_ThanksForVisiting
	waitbutton
	closetext
	end

Script_BeatenAllTrainers: ; 0x9f4d9
	pause 60
	special Special_BattleTowerFade
	warpfacing UP, BATTLE_TOWER_1F, 7, 7
Script_BeatenAllTrainers2:
	opentext
	writetext Text_CongratulationsYouveBeatenAllTheTrainers
	jump Script_GivePlayerHisPrize

UnreferencedScript_0x9f4eb:
	writebyte BATTLETOWERACTION_CHALLENGECANCELED
	special Special_BattleTowerAction
	opentext
	writetext Text_TooMuchTimeElapsedNoRegister
	waitbutton
	closetext
	end

UnreferencedScript_0x9f4f7:
	writebyte BATTLETOWERACTION_CHALLENGECANCELED
	special Special_BattleTowerAction
	writebyte BATTLETOWERACTION_06
	special Special_BattleTowerAction
	opentext
	writetext Text_ThanksForVisiting
	writetext Text_WeHopeToServeYouAgain
	waitbutton
	closetext
	end

Text_ReturnedAfterSave_Mobile:
	text "You'll be returned"
	line "after you SAVE."
	done

BattleTowerBattleRoom_MapEvents:
	; filler
	db 0, 0

.Warps:
	db 2
	warp_def 3, 7, 4, BATTLE_TOWER_HALLWAY
	warp_def 4, 7, 4, BATTLE_TOWER_HALLWAY

.CoordEvents:
	db 0

.BGEvents:
	db 0

.ObjectEvents:
	db 2
	object_event 4, 0, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, EVENT_BATTLE_TOWER_BATTLE_ROOM_YOUNGSTER
	object_event 1, 6, SPRITE_RECEPTIONIST, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, ObjectEvent, -1