MysteryZoneLeagueBrown_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 1
	dbw MAPCALLBACK_TILES, .set_blocks

.set_blocks
	checkevent EVENT_0
	sif false
		return
	changeblock 6, 12, $2C
	checkevent EVENT_1
	sif true
		changeblock 6, 4, $1
	return

MysteryZoneBrownBattle:
	setevent EVENT_FOUGHT_BROWN
	faceplayer
	checkevent EVENT_1
	sif false, then
		opentext
		writetext .before_battle_text
		winlosstext .battle_won_text, 0
		setlasttalked 255
		writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL
		loadtrainer BROWN, 1
		startbattle
		reloadmapafterbattle
		playmapmusic
		closetext
		setevent EVENT_1
		changeblock 6, 4, $1
		playsound SFX_WALL_OPEN
		reloadmappart
	sendif
	jumptext .defeated_text

.before_battle_text
	db TX_COMPRESSED, $6e, $1a, $b8

	db $80, $6e, $73, $21, $25, $32, $20, $ce, $3f, $a4
	db $04, $f0, $30, $d0, $3b, $0a, $d1

	db $e0, $15, $ac, $e0, $20, $b5, $19, $09, $30, $69, $07, $9a

	db $50, $14, $f0, $53, $c7, $f8, $34, $41, $dd

	db $28, $06, $e7, $de, $fe, $5a, $46, $88, $34, $4b, $49
	db $bc, $2a, $09, $16, $6b, $05, $31, $cf, $79, $68

	db $fc, $01, $d7, $e6, $f4, $24, $e6, $54, $3b, $4c, $b4
	db $9b, $c9, $3e, $88, $81, $c2, $5d, $41, $81, $b4, $9a
	db $c0, $61, $af, $85, $a4, $4b, $5e, $8c, $86, $b4
	db $7d, $e6, $56, $7b, $67, $99, $69, $1a
	db $15, $20, $d9, $59, $dc, $e9, $ef, $2d, $1f

	db $80, $0a, $82, $84, $d7, $ce, $0d, $10, $49, $61, $a8, $9f
	db $7b, $49, $98, $3b, $c5, $36, $08, $e9, $ea, $1a, $59
	db $aa, $b0, $c7, $cc, $ee, $02, $0b, $5e

	db $00, $eb, $08, $08, $2d, $4a, $b4, $97, $2c
	db $2f, $2b, $36, $42, $f9, $cd, $8f, $9b, $ea, $cd, $70, $38
	db $00, $0b, $4b, $9d, $3d, $e5, $a3, $fc, $04, $16
	db $9e, $7d, $a4, $5c, $c9, $e0, $7b, $73, $7b
	db $d0, $16, $95, $99, $c0, $e1, $1a, $44, $19, $26
	db $bc, $0e, $57, $c2, $48, $25, $b7, $7d, $3f

	db $00, $c7, $3b, $c5, $15, $9f, $23, $27
	db $1a, $78, $80

.battle_won_text
	db TX_COMPRESSED, $74, $46, $56, $79, $1a, $be, $9f
	db $1a, $68

.defeated_text
	db TX_COMPRESSED, $29, $3b, $72, $ad, $44, $40, $5f, $3b, $48, $c9
	db $cb, $c7, $d4, $1f

	db $10, $18, $e7, $78, $a2, $0c, $e0, $f0, $80, $82
	db $d3, $cc, $e9, $22, $74, $99, $e9, $ca, $93, $b7
	db $89, $53, $42, $26, $a4, $f7, $3c
	db $69, $a0

MysteryZoneBrownKillBridge:
	checkevent EVENT_0
	sif true
		end
	setevent EVENT_0
	refreshscreen $86
	playsound SFX_STRENGTH
	earthquake 80
	changeblock 6, 12, $2C
	reloadmappart
	closetext
	end

MysteryZoneLeagueBrown_MapEventHeader:: db 0, 0

.Warps: db 4
	warp_def 15, 6, 3, MYSTERY_ZONE_LEAGUE_LOBBY
	warp_def 15, 7, 3, MYSTERY_ZONE_LEAGUE_LOBBY
	warp_def 2, 6, 1, MYSTERY_ZONE_GOLD
	warp_def 2, 7, 2, MYSTERY_ZONE_GOLD

.CoordEvents: db 2
	xy_trigger 0, 11, 6, $0, MysteryZoneBrownKillBridge, $0, $0
	xy_trigger 0, 11, 7, $0, MysteryZoneBrownKillBridge, $0, $0

.BGEvents: db 0

.ObjectEvents: db 1
	person_event SPRITE_BROWN, 8, 6, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, MysteryZoneBrownBattle, -1

