PhloxLabB1F_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

phlox_lab_spinner: MACRO
	switch ((\1) * 10 + 4) - (\2)
ENDM

PhloxLabB1F_Item_1:
	db MAX_REVIVE, 1

PhloxLabB1F_Item_2:
	db RARE_CANDY, 2

PhloxLabB1FTrapLeft1:
	phlox_lab_spinner LEFT, 1
PhloxLabB1FTrapLeft2:
	phlox_lab_spinner LEFT, 2
PhloxLabB1FTrapLeft5:
	phlox_lab_spinner LEFT, 5
PhloxLabB1FTrapLeft7:
	phlox_lab_spinner LEFT, 7
PhloxLabB1FTrapLeft9:
	phlox_lab_spinner LEFT, 9
PhloxLabB1FTrapRight1:
	phlox_lab_spinner RIGHT, 1
PhloxLabB1FTrapRight5:
	phlox_lab_spinner RIGHT, 5
PhloxLabB1FTrapRight6:
	phlox_lab_spinner RIGHT, 6
PhloxLabB1FTrapRight9:
	phlox_lab_spinner RIGHT, 9
PhloxLabB1FTrapUp1:
	phlox_lab_spinner UP, 1
PhloxLabB1FTrapUp2:
	phlox_lab_spinner UP, 2
PhloxLabB1FTrapUp3:
	phlox_lab_spinner UP, 3
PhloxLabB1FTrapUp8:
	phlox_lab_spinner UP, 8
PhloxLabB1FTrapUp9:
	phlox_lab_spinner UP, 9
PhloxLabB1FTrapDown1:
	phlox_lab_spinner DOWN, 1
PhloxLabB1FTrapDown2:
	phlox_lab_spinner DOWN, 2
PhloxLabB1FTrapDown3:
	phlox_lab_spinner DOWN, 3
PhloxLabB1FTrapDown4:
	phlox_lab_spinner DOWN, 4

;fallthrough	
	sendif
	addhalfwordtovar .movement
	playsound SFX_SQUEAK
	applymovement 0, -1
	end

.movement
	rept 4
		turn_waterfall_down
	endr
	step_end
	rept 9
		turn_waterfall_up
	endr
	step_end
	rept 9
		turn_waterfall_left
	endr
	step_end
	rept 9
		turn_waterfall_right
	endr
	step_end

PhloxLabB1FGuard:
	faceplayer
	opentext
	checkevent EVENT_PHLOX_LAB_B1F_KEY
	sif true
		jumptext .already_battled_text
	writetext .before_battle_text
	winlosstext .battle_won_text, 0
	setlasttalked 255
	writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL
	loadtrainer OFFICER, 8
	startbattle
	reloadmapafterbattle
	playmapmusic
	opentext
	writetext .after_battle_text
	verbosegiveitem LAB_CARD, 1
	writetext .gave_lab_card_text
	setevent EVENT_PHLOX_LAB_B1F_KEY
	endtext

.before_battle_text
	ctxt "zzz<...>"

	para "Ah, uh, what?"

	para "What time is it?"

	para "Oh wait, are you"
	line "really supposed"
	cont "to be in here?"

	para "Trying to steal"
	line "equipment off of"

	para "private property,"
	line "are you now?"

	para "I'm afraid you have"
	line "to leave, pronto."

	para "<...>"

	para "Why do you just"
	line "stand there?"

	para "All silent?"

	para "You're not going"
	line "to play any mind"
	para "games on me,"
	line "this ends now!"
	sdone

.battle_won_text
	text "What?"
	done

.after_battle_text
	ctxt "OK, I'll be honest"
	line "with you here."

	para "I have nothing"
	line "else to defend"
	cont "myself with now."

	para "I have something"
	line "you might want<...>"

	para "I'll give it to you"
	line "if you just turn"
	cont "around and leave."

	para "When problems"
	line "happen here,"

	para "it's never ever"
	line "anybody's fault."
	sdone

.gave_lab_card_text
	ctxt "That should get"
	line "you into the lab,"

	para "where you won't be"
	line "my problem<...>"
	sdone

.already_battled_text
	ctxt "I don't have"
	line "anything else"

	para "but the clothes"
	line "on my back, and"

	para "I haven't washed"
	line "those in weeks."
	done

PhloxLabB1F_MapEventHeader ;filler
	db 0, 0

;warps
	db 7
	warp_def $b, $3, 4, PHLOX_LAB_B1F
	warp_def $9, $21, 3, PHLOX_LAB_B1F
	dummy_warp $15, $19
	dummy_warp $b, $f
	warp_def $b, $13, 3, PHLOX_LAB_B1F
	warp_def $15, $1c, 8, ACQUA_LABBASEMENTPATH
	warp_def $15, $1d, 8, ACQUA_LABBASEMENTPATH

	;xy triggers
	db 49
	xy_trigger 0, $13, $1b, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $12, $1b, $0, PhloxLabB1FTrapLeft2, $0, $0
	xy_trigger 0, $d, $5, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $10, $16, $0, PhloxLabB1FTrapUp3, $0, $0
	xy_trigger 0, $e, $16, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $c, $16, $0, PhloxLabB1FTrapUp8, $0, $0
	xy_trigger 0, $d, $15, $0, PhloxLabB1FTrapLeft9, $0, $0
	xy_trigger 0, $b, $d, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $d, $b, $0, PhloxLabB1FTrapLeft7, $0, $0
	xy_trigger 0, $c, $5, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $b, $c, $0, PhloxLabB1FTrapUp9, $0, $0
	xy_trigger 0, $c, $a, $0, PhloxLabB1FTrapUp8, $0, $0
	xy_trigger 0, $c, $3, $0, PhloxLabB1FTrapRight1, $0, $0
	xy_trigger 0, $c, $2, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $c, $1, $0, PhloxLabB1FTrapRight1, $0, $0
	xy_trigger 0, $9, $0, $0, PhloxLabB1FTrapDown3, $0, $0
	xy_trigger 0, $4, $0, $0, PhloxLabB1FTrapDown3, $0, $0
	xy_trigger 0, $3, $2, $0, PhloxLabB1FTrapLeft2, $0, $0
	xy_trigger 0, $2, $3, $0, PhloxLabB1FTrapDown1, $0, $0
	xy_trigger 0, $2, $4, $0, PhloxLabB1FTrapDown1, $0, $0
	xy_trigger 0, $2, $6, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $2, $8, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $2, $9, $0, PhloxLabB1FTrapLeft2, $0, $0
	xy_trigger 0, $2, $d, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $3, $d, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $4, $15, $0, PhloxLabB1FTrapLeft9, $0, $0
	xy_trigger 0, $5, $16, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $1, $10, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $4, $b, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $4, $9, $0, PhloxLabB1FTrapLeft5, $0, $0
	xy_trigger 0, $4, $5, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $3, $5, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $3, $7, $0, PhloxLabB1FTrapDown2, $0, $0
	xy_trigger 0, $3, $a, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $6, $a, $0, PhloxLabB1FTrapUp2, $0, $0
	xy_trigger 0, $5, $a, $0, PhloxLabB1FTrapUp1, $0, $0
	xy_trigger 0, $7, $b, $0, PhloxLabB1FTrapRight9, $0, $0
	xy_trigger 0, $9, $9, $0, PhloxLabB1FTrapRight1, $0, $0
	xy_trigger 0, $7, $9, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $6, $8, $0, PhloxLabB1FTrapRight1, $0, $0
	xy_trigger 0, $7, $17, $0, PhloxLabB1FTrapRight5, $0, $0
	xy_trigger 0, $8, $6, $0, PhloxLabB1FTrapRight1, $0, $0
	xy_trigger 0, $9, $5, $0, PhloxLabB1FTrapRight5, $0, $0
	xy_trigger 0, $9, $3, $0, PhloxLabB1FTrapLeft2, $0, $0
	xy_trigger 0, $9, $2, $0, PhloxLabB1FTrapLeft1, $0, $0
	xy_trigger 0, $8, $1, $0, PhloxLabB1FTrapRight6, $0, $0
	xy_trigger 0, $7, $3, $0, PhloxLabB1FTrapLeft2, $0, $0
	xy_trigger 0, $8, $4, $0, PhloxLabB1FTrapDown1, $0, $0
	xy_trigger 0, $5, $4, $0, PhloxLabB1FTrapDown4, $0, $0

	;signposts
	db 0

	;people-events
	db 3
	person_event SPRITE_POKE_BALL, 10, 17, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_RED, 1, 0, PhloxLabB1F_Item_1, EVENT_PHLOX_LAB_B1F_ITEM_1
	person_event SPRITE_POKE_BALL, 5, 11, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_RED, 1, 0, PhloxLabB1F_Item_2, EVENT_PHLOX_LAB_B1F_ITEM_2
	person_event SPRITE_OFFICER, 11, 24, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_GREEN, 0, 0, PhloxLabB1FGuard, -1
