	const_def 2 ; object constants
	const DAWN_TOWN_GYM_B1F_LEADER
	const DAWN_TOWN_GYM_B1F_ALAKAZAM
	const DAWN_TOWN_GYM_B1F_FRIEND

DawnTownGymB1F_MapScripts:
	db 2 ; scene scripts
	scene_script .StartLeaderBattle ; SCENE_DEFAULT
	scene_script .DummyScene ; SCENE_FINISHED

        db 1 ; callbacks
	callback MAPCALLBACK_OBJECTS, .HideLeader

.DummyScene:
	end

; Always hide leader/alakazam
; They will be shown if the map scene require it
.HideLeader:
	disappear DAWN_TOWN_GYM_B1F_LEADER
	disappear DAWN_TOWN_GYM_B1F_ALAKAZAM
	return

.StartLeaderBattle:
	applymovement DAWN_TOWN_GYM_B1F_LEADER, .HideObjectMovement
	applymovement DAWN_TOWN_GYM_B1F_ALAKAZAM, .HideObjectMovement
	appear DAWN_TOWN_GYM_B1F_LEADER
	applymovement DAWN_TOWN_GYM_B1F_LEADER, .SkyfallMovement
	earthquake 10
	appear DAWN_TOWN_GYM_B1F_ALAKAZAM
	applymovement DAWN_TOWN_GYM_B1F_ALAKAZAM, .SkyfallMovement
	earthquake 10
	follow DAWN_TOWN_GYM_B1F_LEADER, DAWN_TOWN_GYM_B1F_ALAKAZAM
	applymovement DAWN_TOWN_GYM_B1F_LEADER, .StartBattleMovement
	opentext
	writetext .StartBattleText
	waitbutton
	closetext
	winlosstext .WinText, .LossText
	loadtrainer SABRINA, AZMOV
        startbattle
        dontrestartmapmusic
        reloadmapafterbattle
        opentext
        writetext .AfterBattleText
	waitbutton
	turnobject DAWN_TOWN_GYM_B1F_LEADER, DOWN
        writetext .WeMoveText
	turnobject DAWN_TOWN_GYM_B1F_LEADER, LEFT
        writetext .SeeYouText
	applymovement DAWN_TOWN_GYM_B1F_ALAKAZAM, .AlakazamMovement
        waitbutton
        closetext
	special FadeBlackQuickly
	disappear DAWN_TOWN_GYM_B1F_LEADER
	disappear DAWN_TOWN_GYM_B1F_ALAKAZAM
	special FadeInQuickly
	setevent EVENT_BEAT_AZMOV
	setevent EVENT_DAWNTOWN_ENORA_OUTSIDE_VISIBLE
	clearevent EVENT_DAWNTOWN_ENORA_INSIDE_VISIBLE
	setscene SCENE_FINISHED
	setmapscene DAWN_TOWN_GYM, SCENE_FINISHED
	end

.HideObjectMovement:
	hide_object
	step_end
.SkyfallMovement:
	show_object
	skyfall
	step_end
.StartBattleMovement:
	slow_step LEFT
	step_end
.AlakazamMovement:
	step LEFT
	turn_head UP
	step_end

.StartBattleText:
	text "Let's settle this"
	line "quickly."
	done

.WinText:
	text "Gaaah<…>"
	para "To be fair, I did"
	line "not experience"
	cont "such a good battle"
	cont "in years!"
	done

.LossText:
	text "You're not even"
	line "worth 5 minutes"
	cont "of my time."
	done

.AfterBattleText:
	text "You're good."
	para "I could certainly"
	line "hire you, but I"
	cont "feel like you're"
	cont "too naive to fully"
	cont "understand the"
	cont "Rocket project."
	para "Oh, and you're"
	line "wasting your time"
	cont "with your friend."
	para "I've never seen"
	line "such a weakling"
	cont "before!"
	para "He can only hold"
	line "you back!"
	done
.WeMoveText:
	text "Alakazam! We move!"
	done
.SeeYouText:
	text "See you next time!"
	done

DawnTownGymB1FFriend:
	faceplayer
	opentext
	writetext .Text
	waitbutton
	closetext
	checkcode VAR_FACING
	ifequal UP, .RunAwayFromDown
.RunAwayFromLeft:
	applymovement PLAYER, .LookAroundMovement
	applymovement PLAYER, .RunAwayFromLeftMovement
	jump .done
.RunAwayFromDown:
	applymovement PLAYER, .LookAroundMovement
	applymovement PLAYER, .RunAwayFromDownMovement
.done:
	setmapscene DAWN_TOWN_GYM, SCENE_DAWN_TOWN_GYM_CREDITS
	warpcheck
	end
.Text:
	text "Hey <PLAYER>!"
	para "I'm so glad to see"
	line "you again!"
	para "They kidnapped me"
	line "and put me there"
	cont "to fight #MONs!"
	para "And you know what?"
	para "It made me realize"
	line "that this idea of"
	cont "a cool adventure"
	cont "is just BULLSHIT!"
	para "The world is just"
	line "too dangerous for"
	cont "us, right?"
	para "I can't imagine"
	line "what you had to"
	cont "go through to save"
	cont "me."
	para "It must have been"
	line "HORRIBLE!"
	para "I can't wait to"
	line "come back home and"
	cont "play video games"
	cont "all day!"
	para "So, shall we go?"
	para "<…>"
	done
.LookAroundMovement:
	turn_head LEFT
	step_sleep 50
	turn_head RIGHT
	step_sleep 50
	turn_head DOWN
	step_sleep 50
	step_end
.RunAwayFromLeftMovement:
	turn_head RIGHT
	step_sleep 50
	step LEFT
	fast_jump_step DOWN
	step_end
.RunAwayFromDownMovement:
	turn_head UP
	step_sleep 50
	fast_jump_step LEFT
	step DOWN
	step_end

DawnTownGymB1F_MapEvents:
	db 0, 0 ; filler

	db 2 ; warp events
	warp_event  6,  3, DAWN_TOWN_GYM_B1F, 1 ; hole
	warp_event 11,  4, DAWN_TOWN_GYM, 15

	db 0 ; coord events
	db 0 ; bg events
	db 3 ; object events
	object_event  8,  3, SPRITE_SABRINA, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_SCRIPT, 1, 0, 0
	object_event  9,  4, SPRITE_ALAKAZAM, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 1, 0, 0
	object_event 13,  2, SPRITE_BUGSY, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 1, DawnTownGymB1FFriend, EVENT_GYM_BUGSY_VISIBLE
