PhloxLab2F_MapScriptHeader::

.Triggers: db 0

.Callbacks: db 1
	dbw MAPCALLBACK_TILES, .tiles

.tiles
	varblocks PhloxLabF2DoorBlocks
	return

PhloxLabF2DoorBlocks:
	db 17
	varblock1  2,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_1, $ff, $68
	varblock1 20, 20, EVENT_PHLOX_LAB_POKEMON_DOOR_1, $ff, $89
	varblock1  6,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_2, $ff, $68
	varblock1 10, 22, EVENT_PHLOX_LAB_POKEMON_DOOR_2, $ff, $87
	varblock1 10, 24, EVENT_PHLOX_LAB_POKEMON_DOOR_2, $ff, $87
	varblock1 10,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_3, $ff, $68
	varblock1 18,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_4, $ff, $65
	varblock1  4, 18, EVENT_PHLOX_LAB_POKEMON_DOOR_4, $ff, $89
	varblock1 22,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_5, $ff, $65
	varblock1 18, 14, EVENT_PHLOX_LAB_POKEMON_DOOR_5, $ff, $7b
	varblock1 18, 16, EVENT_PHLOX_LAB_POKEMON_DOOR_5, $ff, $5f
	varblock1 26,  2, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $65
	varblock2 18, 12, EVENT_PHLOX_LAB_POKEMON_DOOR_3, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $75, $ff, $79
	varblock2 20, 12, EVENT_PHLOX_LAB_POKEMON_DOOR_3, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $76, $ff, $7a
	varblock2 22, 12, EVENT_PHLOX_LAB_POKEMON_DOOR_3, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $76, $ff, $7a
	varblock2 24, 12, EVENT_PHLOX_LAB_POKEMON_DOOR_3, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $76, $ff, $7a
	varblock2 26, 12, EVENT_PHLOX_LAB_POKEMON_DOOR_3, EVENT_PHLOX_LAB_POKEMON_DOOR_6, $ff, $76, $ff, $7a

PhloxLabF2Door1:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_1
	sif true
		end
	checkitem CAGE_CARD_1
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_1
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_1
	setlasttalked 8
	scall PokemonExitRight
	playsound SFX_MEGA_PUNCH
	earthquake 80
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $05
	db $aa, $68

PhloxLabF2Door2:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_2
	sif true
		end
	checkitem CAGE_CARD_2
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_2
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_2
	setlasttalked 9
	scall PokemonExitRight
	playsound SFX_MOONLIGHT
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $1c
	db $da, $68

PhloxLabF2Door3:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_3
	sif true
		end
	checkitem CAGE_CARD_3
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_3
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_3
	setlasttalked 10
	scall PokemonExitRight
	playsound SFX_HYDRO_PUMP
	earthquake 80
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $05
	db $95, $34

PhloxLabF2Door4:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_4
	sif true
		end
	checkitem CAGE_CARD_4
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_4
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_4
	setlasttalked 11
	scall PokemonExitLeft
	playsound SFX_GS_INTRO_CHARIZARD_FIREBALL
	earthquake 80
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $29
	db $fd, $34

PhloxLabF2Door5:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_5
	sif true
		end
	checkitem CAGE_CARD_5
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_5
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_5
	setlasttalked 12
	scall PokemonExitLeft
	playwaitsfx SFX_THUNDERSHOCK
	playsound SFX_WALL_OPEN
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $05
	db $ba, $68

PhloxLabF2Door6:
	checkevent EVENT_PHLOX_LAB_POKEMON_DOOR_6
	sif true
		end
	checkitem CAGE_CARD_6
	sif false
		jumptext .door_text
	scall PhloxOpenDoorDialogue
	takeitem CAGE_CARD_6
	setevent EVENT_PHLOX_LAB_POKEMON_DOOR_6
	setlasttalked 13
	scall PokemonExitLeft
	playsound SFX_HYDRO_PUMP
	earthquake 80
	end

.door_text
	db TX_COMPRESSED, $e0, $08, $57, $04
	db $d2, $9a

PhloxOpenDoorDialogue:
	opentext
	writetext .open_door_text
	playsound SFX_ENTER_DOOR
	end

.open_door_text
	db TX_COMPRESSED, $29, $27, $1b, $77, $93, $8d, $ba, $bc
	db $bc, $11, $06, $43, $cc, $b4, $9c, $c8, $42, $be
	db $34, $f1, $00

PokemonExitRight:
	varblocks PhloxLabF2DoorBlocks
	closetext
	applymovement PLAYER, .player_step_aside
	applymovement LAST_TALKED, .mon_walk_away_1
	spriteface PLAYER, RIGHT
	applymovement LAST_TALKED, .mon_walk_away_2
	disappear LAST_TALKED
	end

.player_step_aside
	step_right
	turn_head_left
	step_end

.mon_walk_away_1
	step_left
	rept 4
		step_down
	endr
	step_right
	step_end

.mon_walk_away_2
	rept 7
		step_right
	endr
	step_end

PokemonExitLeft:
	varblocks PhloxLabF2DoorBlocks
	closetext
	applymovement PLAYER, .player_step_aside
	applymovement LAST_TALKED, .mon_walk_away_1
	spriteface PLAYER, LEFT
	applymovement LAST_TALKED, .mon_walk_away_2
	disappear LAST_TALKED
	end

.player_step_aside
	step_left
	turn_head_right
	step_end

.mon_walk_away_1
	step_down
	step_right
	step_down
	step_down
	step_down
	step_left
	step_end

.mon_walk_away_2
	rept 7
		step_left
	endr
	step_end

PhloxLabF2ElectricPanel:
	jumptext .text

.text
	db TX_COMPRESSED, $75, $78, $a6, $92, $1f, $4d, $9b, $58, $d9, $de
	db $bc, $23, $48, $7d

	db $f0, $0c, $70, $85, $49, $11, $90, $be, $23, $a3, $67, $6c, $f3

	db $e0, $02, $ba, $09, $59, $c1, $de, $28, $d2, $0f, $32
	db $c2, $f3, $44, $e8, $59, $52, $96, $91, $a2, $64, $21, $5d
	db $2d, $34

PhloxLabF2Trainer1:
	trainer EVENT_PHLOX_LAB_F2_TRAINER_1, SCIENTIST, 8, .before_battle_text, .battle_won_text

	db TX_COMPRESSED, $12, $31, $93, $99, $aa, $fa, $72
	db $c2, $f2, $cc, $18, $d6, $83, $86, $4e, $46, $43, $35
	db $80, $d6, $6d, $ad, $ec, $07, $2b, $e1, $24, $1a
	db $1e, $c1, $a2, $71, $85, $2c, $14, $1d, $f1
	db $a6, $80

.before_battle_text
	db TX_COMPRESSED, $29, $23, $44, $1a, $09, $4c, $8f, $82
	db $7a, $a0, $af, $b9, $fc, $56, $d5, $c7, $45
	db $8a, $b0, $19, $0e, $9e

	db $00, $0e, $a6, $bf, $2d, $27, $16, $60, $c6, $b4
	db $1b, $c6, $4e, $46, $43, $35, $c0, $e1, $2d
	db $26, $aa, $a0, $af, $b9, $e3, $2b, $44, $a8, $e2, $91, $03, $57
	db $a9, $a0

.battle_won_text
	db TX_COMPRESSED, $07, $86, $a8, $ea, $10, $cf, $32
	db $c2, $f2, $cc, $18, $d6, $83, $86, $4e, $46, $43, $35
	db $aa, $04, $16, $97, $35, $58, $fa, $3b, $19, $a3
	db $8d, $34

PhloxLabF2Trainer2:
	trainer EVENT_PHLOX_LAB_F2_TRAINER_2, SCIENTIST, 9, .before_battle_text, .battle_won_text

	db TX_COMPRESSED, $2b, $54, $8d, $13, $67, $47, $81, $d8, $df
	db $37, $ac, $31, $95, $9e, $d9, $cd, $9c, $84, $39
	db $54, $b3, $10, $d5, $ed, $8c, $24

	db $f0, $07, $57, $2f, $54, $8d, $13, $63, $e1, $7c, $c9
	db $6f, $58, $66, $4d, $16, $b0, $82, $83, $bf
	db $53, $40

.before_battle_text
	db TX_COMPRESSED, $75, $84, $04, $16, $a2, $1a, $65, $93, $3c
	db $fd, $e7, $c1, $46, $75, $66, $6b, $95, $0f, $bd
	db $54, $ac, $e2, $da, $19, $0f, $33, $00, $ac, $c1, $8d, $7c
	db $69, $a0

.battle_won_text
	db TX_COMPRESSED, $af, $bd, $8f, $82, $89, $08, $83, $47, $e6, $f7
	db $af, $3e, $0a, $65, $67, $af, $a3, $f2, $d2, $60
	db $80, $6b, $e1, $68, $97, $2c, $30, $81, $b4, $8c, $9c
	db $bc, $32, $4b, $49, $c3, $26
	db $7d, $4d

PhloxLabF2PaletteGreen:
	trainer EVENT_PHLOX_LAB_F2_GREEN_PALETTE, PATROLLER, 18, .before_battle_text, .battle_won_text

	db TX_COMPRESSED, $61, $06, $04, $9e

	db $00, $52, $46, $45, $29, $aa, $c2, $d5, $ca, $92
	db $17, $81, $05, $a2, $e3, $89, $69, $76, $32, $73
	db $ea, $68

.before_battle_text
	db TX_COMPRESSED, $17, $10, $2d, $72, $98, $1c, $20, $20, $b5

	db $c4, $01, $47, $de, $c7, $cf

	db $c0, $1b, $a7, $6e, $0d, $10, $10, $5a, $5c, $e4, $3b
	db $d7, $86, $49, $d1, $e0, $7f, $89, $69, $34

	db $a0, $05, $41, $4e, $43, $bd, $83, $24, $e8, $f0, $38, $34
	db $3d, $61, $8a, $ce, $60, $32, $69, $19, $1e, $f7, $a0
	db $95, $22, $f5, $5f, $4f, $f3, $00, $ae, $04, $8c, $9f

	db $80, $56, $4c, $c4, $9a, $cf, $14, $04, $16
	db $be, $f5, $ac, $10, $c9, $cc, $b0, $cb, $d5, $23, $9b, $de
	db $aa, $0e, $12, $d3, $b7, $36, $ad, $05

	db $e0, $1c, $01, $80, $82, $d4, $b4, $8c, $8a, $51
	db $d3, $cc, $ea, $ce, $5a, $76, $e0, $ef
	db $12, $a6, $88, $76, $91, $b3, $bd, $fc, $4b, $49, $a5

	db $01, $c2, $61, $11, $d3, $9a, $b0, $b4, $4c, $cb, $49
	db $bd, $50, $57, $dc, $cc, $86, $34, $43, $b4, $8d, $9d
	db $ea, $ab, $48, $c9, $ca, $25, $86, $21, $a5, $83, $0c, $18

	db $fc, $01, $d9, $19, $39, $69, $0a, $0e, $72, $b3, $3c, $82
	db $78, $41, $84, $47, $4e, $5a, $46, $45, $29, $69, $30
	db $40, $08, $67, $98, $16, $97, $04, $2c, $39, $69, $9b
	db $7a, $c3, $19, $0b, $e2, $0e, $ce, $0c
	db $8a, $81, $ca, $f8, $49, $15, $ed, $df, $4d, $14, $f0

	db $00, $75, $2a, $1f, $7b, $13, $a0, $c7, $37, $bd
	db $7a, $d2, $71, $f0, $90, $c1, $47, $50, $86, $79
	db $01, $61, $9c, $9d, $c3, $06, $35, $82, $b4, $8c, $9c
	db $bc, $ea, $18, $31, $ae, $55, $a4, $b3, $cf

	db $80, $39, $42, $d4, $d5, $9c, $20, $6e, $72, $11, $93
	db $97, $ac, $33, $90, $cd, $20, $29, $83, $4b, $b4, $9a
	db $fd, $4d

.battle_won_text
	db TX_COMPRESSED, $e1, $35, $a0, $68, $b3, $25, $c6, $52, $3e, $e7

	db $88, $07, $28, $5a, $9b, $da, $b4, $12, $25, $5a, $4b
	db $7a, $c3, $32, $19, $69, $38, $b1, $f2, $9b
	db $55, $69, $19, $39, $fc, $c8, $49, $4c, $80, $82, $d7

	db $80, $09, $35, $73, $96, $8d, $08, $95, $27, $6e

	db $94, $01, $49, $38, $b3, $45, $c0, $e1, $2d
	db $26, $f5, $41, $5f, $73, $2a, $09, $29, $91, $9d, $59
	db $aa, $d5, $61, $6a, $e0, $20, $b4, $b8, $43, $3c, $a3

	db $c0, $18, $43, $06, $19, $39, $9c, $9d, $a2, $02, $0b
	db $4f, $10, $35, $24, $d6, $70, $64, $9d, $1e, $07

	db $e0, $05, $6a, $90, $c9, $cc, $1a, $25, $a4, $e0, $49, $d0
	db $4f, $55, $a0, $a5, $86, $21, $a5, $83, $0c, $18, $e0
	db $c8, $aa, $d2, $34, $4a, $82, $be, $e6, $58, $73, $a0
	db $bd, $4d

PhloxLab2F_MapEventHeader:: db 0, 0

.Warps: db 2
	warp_def 2, 14, 3, PHLOX_LAB_1F
	warp_def 10, 26, 1, PHLOX_LAB_3F

.CoordEvents: db 0

.BGEvents: db 7
	signpost 3, 2, SIGNPOST_UP, PhloxLabF2Door1
	signpost 3, 6, SIGNPOST_UP, PhloxLabF2Door2
	signpost 3, 10, SIGNPOST_UP, PhloxLabF2Door3
	signpost 3, 19, SIGNPOST_UP, PhloxLabF2Door4
	signpost 3, 23, SIGNPOST_UP, PhloxLabF2Door5
	signpost 3, 27, SIGNPOST_UP, PhloxLabF2Door6
	signpost 15, 17, SIGNPOST_UP, PhloxLabF2ElectricPanel

.ObjectEvents: db 15
	person_event SPRITE_POKE_BALL, 22, 27, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_1, EVENT_PHLOX_F2_CARDKEY_1
	person_event SPRITE_POKE_BALL, 25, 4, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_2, EVENT_PHLOX_F2_CARDKEY_2
	person_event SPRITE_POKE_BALL, 1, 25, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_3, EVENT_PHLOX_F2_CARDKEY_3
	person_event SPRITE_POKE_BALL, 11, 8, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_4, EVENT_PHLOX_F2_CARDKEY_4
	person_event SPRITE_POKE_BALL, 19, 10, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_5, EVENT_PHLOX_F2_CARDKEY_5
	person_event SPRITE_POKE_BALL, 25, 15, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 1, CAGE_CARD_6, EVENT_PHLOX_F2_CARDKEY_6
	person_event SPRITE_HITMONCHAN, 1, 3, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_1
	person_event SPRITE_GLACEON, 1, 7, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_2
	person_event SPRITE_BLASTOISE, 1, 11, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_3
	person_event SPRITE_MAGMORTAR, 1, 18, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_4
	person_event SPRITE_AMPHAROS, 1, 22, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_5
	person_event SPRITE_MILOTIC, 1, 26, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, ObjectEvent, EVENT_PHLOX_LAB_POKEMON_DOOR_6
	person_event SPRITE_SCIENTIST, 16, 10, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_GENERICTRAINER, 2, PhloxLabF2Trainer1, EVENT_PHLOX_LAB_CEO
	person_event SPRITE_SCIENTIST, 22, 9, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_GENERICTRAINER, 3, PhloxLabF2Trainer2, EVENT_PHLOX_LAB_CEO
	person_event SPRITE_PALETTE_PATROLLER, 19, 23, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_GENERICTRAINER, 4, PhloxLabF2PaletteGreen, EVENT_PHLOX_LAB_CEO

