Route57Gym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

Route57GymSignpost1:
Route57GymSignpost2:
	jumptext .text

.text
	db TX_COMPRESSED, $07, $85, $6f, $ef, $63, $08, $13

	db $e0, $31, $cf, $72, $6b, $71, $82, $64
	db $27, $4d

Route57GymLeader:
	faceplayer
	opentext
	checkflag ENGINE_WHITEBADGE
	sif true
		jumptext .already_defeated_text
	writetext .before_battle_text
	winlosstext .battle_won_text, 0
	setlasttalked 255
	writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL ;no pun intended
	loadtrainer JOE, 1
	startbattle
	reloadmapafterbattle
	playmapmusic
	opentext
	writetext .received_badge_text
	playwaitsfx SFX_TCG2_DIDDLY_5
	setflag ENGINE_WHITEBADGE
	playmusic MUSIC_GYM
	writetext .after_badge_text
	givetm 15 + RECEIVED_TM
	jumptext .after_TM_text

.before_battle_text
	db TX_COMPRESSED, $62, $7d, $e8, $65, $a4, $d6, $7f, $8f, $82
	db $78, $9a, $f9, $c1, $a2, $09, $90, $9f, $e5, $a4

	db $c0, $03, $c2, $b7, $f7, $b1, $84, $09, $f9, $d3, $dc, $9a
	db $de, $0e, $11, $c8, $3a, $70, $24

	db $e2, $01, $d4, $d7, $e2, $03, $08, $15, $bf, $bd
	db $fb, $d6, $9d, $b9, $bd, $ec, $0e, $12, $d2

	db $60, $35, $59, $02, $b7, $f7, $b0, $41, $84, $47
	db $4d, $ee, $9e, $17, $1f, $05, $18, $40, $9f

	db $f0, $02, $92, $34, $41, $1d, $d6, $4e, $0d, $10, $81
	db $a9, $ed, $ef, $63, $e3, $21, $cd, $26, $60, $31, $ac
	db $12, $a2, $05, $6f, $ef

	db $7c, $01, $b9, $f7, $bf, $9a, $b3, $80, $82
	db $d3, $cb, $3d, $c8, $29, $80, $57
	db $35, $50, $3c, $2b, $7f, $7b, $04, $b6, $ef, $a7
	db $4b, $4f, $10

.battle_won_text
	db TX_COMPRESSED, $29, $23, $44, $1a, $26, $ab, $20, $56, $fe, $f7

	db $88, $07, $28, $5a, $9a, $b3, $8a, $43, $ef, $46, $4e, $63, $e0
	db $9e, $20, $56, $fe, $f6, $03, $0d, $59, $a3

	db $88, $0e, $1e, $9e, $a0, $ff, $2f, $54, $8e, $5a, $46
	db $87, $95, $ee, $79, $39, $a4, $cc, $e9, $e8, $31, $f1
	db $a6, $80

.received_badge_text
	db TX_COMPRESSED, $a7, $8e, $2c, $d9, $31, $83, $1e
	db $5e, $6e, $91, $d9, $c1, $2d, $cf, $27
	db $ea, $68

.after_badge_text
	db TX_COMPRESSED, $2b, $54, $8e, $20, $2f, $9c, $0e, $12, $d2
	db $6f, $10, $2b, $7f, $7b, $12, $17, $ce, $54, $3b
	db $4a, $a0, $41, $6b
	db $8d, $3c, $40

.after_TM_text
	db TX_COMPRESSED, $28, $54, $5a, $16, $e0, $d1, $18, $82, $10, $6b
	db $78, $48, $f5, $fe

	db $20, $2b, $88, $b5, $84, $9c, $fe, $2b, $6a
	db $de, $20, $56, $fe, $f6, $6d, $de, $b2, $a5
	db $c6, $9a

.already_defeated_text
	db TX_COMPRESSED, $74, $59, $15, $98, $c9, $cc, $20, $56, $fe, $f7
	db $8d, $34

Route57Gym_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $13, $a, 2, ROUTE_57
	warp_def $13, $b, 2, ROUTE_57

	;xy triggers
	db 0

	;signposts
	db 2
	signpost 17, 8, SIGNPOST_READ, Route57GymSignpost1
	signpost 17, 13, SIGNPOST_READ, Route57GymSignpost2

	;people-events
	db 1
	person_event SPRITE_BLAINE, 16, 10, SPRITEMOVEDATA_00, 0, 0, -1, -1, PAL_OW_RED, 0, 0, Route57GymLeader, -1

