JaeruGym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

JaeruGymTrash:
	db TX_COMPRESSED, $07, $84, $41, $f1, $80, $f0, $da, $46, $4e, $62, $4d
	db $66, $f2, $b6, $ae, $5a, $f5, $09
	db $f5, $34

JaeruGymStatue:
	db TX_COMPRESSED, $13, $3a, $6b, $6a, $14, $1a
	db $88, $f0, $39, $5f, $09, $23, $08, $13

	db $e0, $31, $cf, $72, $6b, $71, $8a, $04, $6a, $d4, $81
	db $53, $40

JaeruGymGuide:
	faceplayer
	checkflag ENGINE_SPARKYBADGE
	sif true
		jumptext .after_defeating_gym_text
	jumptext .before_defeating_gym_text

.before_defeating_gym_text
	db TX_COMPRESSED, $6e, $9d, $bc, $51, $a1, $14

	db $a0, $14, $08, $d5, $a9, $02, $89, $d4, $4e, $56, $1a
	db $88, $f3, $42, $20, $41, $8d, $72, $d2, $70, $11, $ea, $d1
	db $f0, $1a, $4c, $c6, $42, $40, $63, $5d, $9e, $62, $46
	db $87, $98, $40, $9f, $83, $25, $86, $69
	db $15, $07, $0c, $06, $c9

	db $f8, $00, $3c, $37, $10, $d2, $ce, $54, $9d, $b8, $91
	db $a1, $e4, $85, $f3, $8a, $da, $40, $c8, $68
	db $40, $0c, $84, $d1, $f8, $ad, $ab, $8e, $a6, $42, $4a
	db $63, $d5, $69, $2e, $58, $66, $03, $26, $60, $5a, $bf
	db $53, $40

.after_defeating_gym_text
	db TX_COMPRESSED, $6e, $93, $ab, $8c, $29, $3b, $72, $ad, $44, $d2
	db $3c, $7d, $36, $6d, $63, $c0, $10, $c9, $cc, $56, $16, $af
	db $88, $07, $57, $10, $d2, $ce, $3f, $b9, $38, $f9
	db $bc, $43, $58, $30, $5a, $47
	db $a9, $a0

JaeruGym_Trainer_1:
	trainer EVENT_JAERU_GYM_TRAINER_1, GENTLEMAN, 2, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $74, $59, $02, $48, $f8, $28, $ad, $67, $aa, $5e
	db $79, $84, $19, $a9, $3d, $cf, $e2, $90, $f3
	db $c6, $9a

.battle_won_text
	db TX_COMPRESSED, $12, $3b, $b3, $5c, $e4
	db $ed, $e0, $83, $1a, $ec, $6f, $9c, $c0, $2b, $96, $91, $a3
	db $8d, $34

.after_battle_text
	db TX_COMPRESSED, $75, $39, $3b, $82, $34, $79, $8f, $85
	db $66, $f5, $a7, $49, $01, $05, $af, $c4, $ea, $75, $3b
	db $c6, $9a

JaeruGym_Trainer_2:
	trainer EVENT_JAERU_GYM_TRAINER_2, COOLTRAINERM, 8, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $29, $27, $15, $85, $08, $83, $44, $20
	db $6d, $ed, $65, $93, $11, $63, $27, $31, $f3, $3b, $19, $39
	db $40, $05, $8f, $94, $dc, $20, $6a
	db $f3, $cc, $20, $cd, $ab, $41, $71
	db $a6, $80

.battle_won_text
	text "Fine!"
	done

.after_battle_text
	db TX_COMPRESSED, $29, $27, $15, $85, $08, $95, $04, $94, $c8, $ac
	db $de, $4e, $88, $10, $0a, $6a, $b0, $b5, $72, $d2, $34, $71
	db $a6, $80

JaeruGym_Trainer_3:
	trainer EVENT_JAERU_GYM_TRAINER_3, SUPER_NERD, 8, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $72, $85, $a9, $90, $92, $99, $2a, $0a, $d4
	db $9e, $49, $ac, $f8

	db $80, $12, $3e, $42, $43
	db $e3, $4d

.battle_won_text
	db TX_COMPRESSED, $28, $21, $8f, $b4, $ca, $60, $41, $8d, $76, $37, $cf
	db $8d, $34

.after_battle_text
	db TX_COMPRESSED, $12, $db, $be, $9a, $25, $43, $b4, $c7
	db $cd, $ed, $59, $c2, $06, $a8, $11, $16, $30, $93, $7b

	db $e0, $0e, $72, $0c, $24, $8b, $6b, $a6, $8f
	db $53, $40

JaeruGymLeader:
	faceplayer
	checkflag ENGINE_SPARKYBADGE
	sif true
		jumptext .already_defeated_text
	showtext .introduction_text
	winlosstext .battle_won_text, 0
	loadtrainer SPARKY, 1
	startbattle
	reloadmapafterbattle
	opentext
	writetext .get_badge_text
	playwaitsfx SFX_TCG2_DIDDLY_5
	playmusic MUSIC_GYM
	waitsfx
	setflag ENGINE_SPARKYBADGE
	jumptext .after_badge_text

.introduction_text
	db TX_COMPRESSED, $50, $23, $56, $a4, $09, $c6, $37, $4e, $dc, $c8
	db $5e, $04, $16, $a5, $5a, $4b, $a5, $8e, $8b

	db $00, $54, $15, $a9, $0c, $9c, $c0
	db $91, $e0, $b5, $68, $0b, $4b, $64, $64, $e6, $3e
	db $09, $55, $41, $5a, $91, $ad, $1e

	db $01, $c0, $12, $53, $25, $9f, $7b, $2d, $26
	db $fb, $d6, $9d, $bf, $c1, $1d, $3d, $41

	db $f8, $03, $b4, $fe, $6c, $57, $b7, $7d, $3a

	db $50, $0e, $a2, $1a, $10, $20, $28, $3f
	db $53, $c4

.battle_won_text
	db TX_COMPRESSED, $53, $19, $0f, $f0, $10, $5a, $9c, $9d, $cb, $49
	db $bc, $a0, $46, $ad, $48, $14, $12, $dc, $f2, $65, $f0, $81

	db $a8, $07, $4e, $e3, $e7, $39, $3b, $8a, $f5, $95, $29, $61
	db $7a, $a0, $ad, $4b
	db $d4, $d0

.get_badge_text
	db TX_COMPRESSED, $a7, $8e, $2c, $d9, $31, $83, $1e
	db $5e, $50, $23, $56, $a4, $0a, $09, $6e, $79, $3e
	db $34, $d0

.after_badge_text
	db TX_COMPRESSED, $29, $23, $44, $57, $b9, $e4
	db $de, $19, $19, $59, $ea, $0d, $12, $d2
	db $60, $10, $20, $cf, $30, $38, $40, $41, $69
	db $6f, $03, $95, $f0, $93

	db $c0, $1c, $e8, $39, $69, $db, $96, $19, $c9
	db $db, $c1, $6a, $e0, $70, $89, $35, $9f
	db $a9, $a0

.already_defeated_text
	db TX_COMPRESSED, $50, $23, $56, $a4, $09, $c6, $37, $4e, $dd

	db $28, $07, $45, $91, $5b, $48, $05
	db $c6, $9a

JaeruGym_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $11, $4, 3, JAERU_CITY
	warp_def $11, $5, 3, JAERU_CITY

	;xy triggers
	db 0

	;signposts
	db 5
	signpost 11, 9, SIGNPOST_TEXT, JaeruGymTrash
	signpost 9, 3, SIGNPOST_TEXT, JaeruGymTrash
	signpost 0, 9, SIGNPOST_TEXT, JaeruGymTrash
	signpost 15, 3, SIGNPOST_TEXT, JaeruGymStatue
	signpost 15, 6, SIGNPOST_TEXT, JaeruGymStatue

	;people-events
	db 5
	person_event SPRITE_SPARKY, 2, 0, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 8 + PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, JaeruGymLeader, -1
	person_event SPRITE_GENTLEMAN, 10, 6, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 8 + PAL_OW_BLUE, PERSONTYPE_TRAINER, 4, JaeruGym_Trainer_1, -1
	person_event SPRITE_COOLTRAINER_M, 7, 2, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TRAINER, 3, JaeruGym_Trainer_2, -1
	person_event SPRITE_SUPER_NERD, 11, 4, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 8 + PAL_OW_BROWN, PERSONTYPE_TRAINER, 4, JaeruGym_Trainer_3, -1
	person_event SPRITE_GYM_GUY, 15, 7, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 8 + PAL_OW_BLUE, PERSONTYPE_SCRIPT, 1, JaeruGymGuide, -1

