SoutherlyGym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

SoutherlyGymSign:
	db TX_COMPRESSED, $50, $16, $ad, $26, $be, $82, $8c, $20, $4f

	db $80, $c7, $3d, $c9, $ad, $c6, $0b, $96, $43, $45
	db $d3, $40

SoutherlyGymFlame:
	db TX_COMPRESSED, $29, $23, $44, $c3, $ba, $f9, $c1
	db $a1, $e5, $9e, $f7, $a0, $a2, $43, $7e

	db $00, $ea, $f1, $a2, $b3, $8d, $12, $a1, $a0, $e5
	db $85, $ea, $b7, $aa, $52, $d2, $b0, $b5, $ca, $60, $ef
	db $d4, $d0

SoutherlyGymGuide:
	checkflag ENGINE_BLAZEBADGE
	sif false
		jumptextfaceplayer .before_getting_badge_text
	jumptextfaceplayer .after_getting_badge_text

.after_getting_badge_text
	db TX_COMPRESSED, $72, $85, $a8, $ce, $be, $73, $05, $85
	db $f7, $81, $fb, $da, $70, $3f, $89, $69, $34

	db $a0, $1d, $22, $0e, $e2, $cf, $7b, $d0, $53
	db $50, $f0, $83, $42, $06, $f8, $d1, $63, $66, $6a
	db $15, $18, $31, $ac, $10, $48, $71, $1a, $09, $14
	db $b4, $d0

.before_getting_badge_text
	db TX_COMPRESSED, $6e, $10, $fe, $0d, $10, $77, $12, $1b, $83
	db $23, $c9, $35, $9f, $e0, $57, $2a, $4e, $dd

	db $28, $07, $58, $40, $41, $6a, $32, $16, $bb, $92, $53
	db $1e, $b3, $ef, $7f, $05, $cb, $21, $a2
	db $c0, $34, $83, $44, $53, $1a, $cc, $0d, $82, $10
	db $6f, $03, $95, $f0, $93

	db $88, $07, $3a, $06, $4e, $63, $09, $7a, $84, $40
	db $ad, $e1, $26, $b9, $03, $60, $84, $1c, $07, $2b, $e1
	db $20, $0a, $82, $d7, $73, $08, $1b, $95, $05, $6a
	db $4f, $54, $7d, $ec, $49, $ac
	db $fd, $4d

SoutherlyGym_Trainer_1:
	trainer EVENT_SOUTHERLY_GYM_TRAINER_1, HIKER, 12, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	opentext
	checkevent EVENT_SOUTHERLY_GYM_FLAME_2
	sif false, then
		writetext .before_removing_flame_text
		disappear 4
		setevent EVENT_SOUTHERLY_GYM_FLAME_2
	sendif
	jumptext .removed_flame_text

.before_battle_text
	db TX_COMPRESSED, $6d, $d2, $40, $41, $6a, $22, $f4, $99, $96, $93
	db $79, $27, $b7
	db $4b, $4d

.battle_won_text
	db TX_COMPRESSED, $72, $85, $a2, $e3, $96, $16, $b9, $49
	db $ad, $eb, $4e, $92, $02, $0b, $53, $a1, $0a, $97
	db $a9, $a0

.before_removing_flame_text
	db TX_COMPRESSED, $6e, $7d, $ef, $e2, $4d, $67, $f9, $d3, $b8, $f9
	db $bc, $ca, $cf, $6c, $e6, $c4, $24, $2b, $b6, $5a
	db $b5, $58, $05, $70, $10, $5a
	db $f5, $3c, $40

.removed_flame_text
	db TX_COMPRESSED, $29, $3b, $71, $09, $0b, $5d, $cc, $49, $f4
	db $43, $c0, $82, $d4, $e4, $ee, $2b, $d6, $54
	db $95, $24, $d6, $70, $f5, $03, $35
	db $fa, $9a

SoutherlyGym_Trainer_2:
	trainer EVENT_SOUTHERLY_GYM_TRAINER_2, FIREBREATHER, 6, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	opentext
	checkevent EVENT_SOUTHERLY_GYM_FLAME_1
	sif false, then
		writetext .before_removing_flame_text
		disappear 3
		setevent EVENT_SOUTHERLY_GYM_FLAME_1
	sendif
	jumptext .removed_flame_text

.before_battle_text
	db TX_COMPRESSED, $74, $59, $2d, $27, $11, $6b, $09, $39, $34
	db $5b, $cc, $20, $4f, $c7, $c6, $41, $84, $9c

	db $40, $09, $1e, $dc, $7c, $e6, $93, $31, $d3, $87
	db $af, $74, $ee, $02, $0b, $53, $01, $f2, $9b
	db $54, $2e, $59, $0d, $17
	db $ea, $68

.battle_won_text
	db TX_COMPRESSED, $e0, $0d, $44, $9a, $4c, $c0, $b5, $7c
	db $69, $a0

.before_removing_flame_text
	db TX_COMPRESSED, $74, $e1, $ec, $e4, $ee, $2c, $79, $81
	db $c1, $eb, $49, $cc, $06, $b3, $98, $05, $70, $10, $5a
	db $f5, $3c, $40

.removed_flame_text
	db TX_COMPRESSED, $72, $85, $a8, $8b, $1f, $7b, $2a, $09, $29, $91, $59
	db $bd, $aa, $fa, $72, $c3, $32, $78, $1e
	db $da, $a1, $72, $c8, $68, $be
	db $34, $d0

SoutherlyGym_Trainer_3:
	trainer EVENT_SOUTHERLY_GYM_TRAINER_3, CAMPER, 7, .before_battle_text, .battle_won_text

	db TX_COMPRESSED, $e1, $30, $88, $e9, $c1, $92, $5a, $46
	db $87, $b5, $67, $b3, $56, $71, $f0, $ac
	db $c0, $60, $b1, $99, $33, $d0, $52, $d3, $a4
	db $7a, $a4, $9a, $ce, $02, $0b, $51, $90, $be
	db $6a, $b0, $58, $5f
	db $f5, $34

.before_battle_text
	db TX_COMPRESSED, $ad, $67, $01, $05, $a8, $21, $66, $23, $56, $79
	db $7a, $c3, $0e, $9d, $10, $6b, $19, $91, $93
	db $01, $69, $1a, $f2, $07, $27, $ca, $cc
	db $de, $56, $d2, $c8, $8a
	db $5a, $68

.battle_won_text
	db TX_COMPRESSED, $6e, $90, $ef, $e1, $03, $08, $67, $99, $80
	db $56, $f2, $42, $8b, $1f, $47, $60, $b8
	db $d3, $40

SoutherlyGym_Trainer_4:
	trainer EVENT_SOUTHERLY_GYM_TRAINER_4, FIREBREATHER, 5, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	opentext
	checkevent EVENT_SOUTHERLY_GYM_FLAME_3
	sif false, then
		writetext .before_removing_flame_text
		disappear 5
		setevent EVENT_SOUTHERLY_GYM_FLAME_3
	sendif
	jumptext .removed_flame_text

.before_battle_text
	db TX_COMPRESSED, $74, $e1, $ec, $49, $f4, $44, $04, $16, $a7, $27
	db $6f, $58, $65, $a4, $e7, $4f, $72, $6b, $83
	db $c1, $50, $20, $b5, $15, $9e, $dc, $7c
	db $fd, $4d

.battle_won_text
	db TX_COMPRESSED, $29, $3b, $72, $ad, $44, $d8, $90
	db $db, $ca, $f6, $ef, $a7
	db $c6, $9a

.before_removing_flame_text
	db TX_COMPRESSED, $74, $e1, $ec, $c8, $5a, $41, $cb, $49
	db $bc, $43, $d5, $ab, $05, $30, $1a, $cf
	db $d4, $f1, $00

.removed_flame_text
	db TX_COMPRESSED, $61, $04, $39, $9d, $69, $95, $29, $50, $ed
	db $2f, $5a, $4e, $2c, $d1, $70, $38, $40, $41, $69
	db $6a, $95, $ed, $df, $4d, $1c
	db $69, $a0

SoutherlyGymLeader:
	faceplayer
	checkflag ENGINE_BLAZEBADGE
	sif true
		jumptext .already_defeated_text
	showtext .introduction_text
	winlosstext .battle_won_text, 0
	loadtrainer ERNEST, ERNEST_GYM
	startbattle
	reloadmapafterbattle
	playmapmusic
	opentext
	writetext .got_badge_text
	playwaitsfx SFX_TCG2_DIDDLY_5
	playmusic MUSIC_GYM
	writetext .have_a_TM_text
	givetm TM_FIRE_BLAST + RECEIVED_TM
	setflag ENGINE_BLAZEBADGE
	jumptext .after_TM_text

.already_defeated_text
	db TX_COMPRESSED, $75, $84, $04, $16, $8b, $8e, $74, $21, $52, $19, $39
	db $7b, $00, $ae, $3e, $15, $9c, $0e, $13
	db $40, $32, $9d, $ef, $4c, $9c, $9f, $e5, $a4
	db $de, $d1, $ac, $40, $57, $71, $f1, $f2, $9b, $8a
	db $cc, $06, $ab, $e9, $cb, $0c, $bd, $52, $38, $08, $2d
	db $3d, $61, $9b, $04, $77, $59, $39, $50, $ed
	db $2a, $91, $6b, $09, $39, $35, $c2, $97, $a3, $21, $ad, $1e

	db $00, $e5, $0b, $4e, $1e, $c2, $19, $e6
	db $6b, $c8, $10, $6c, $8f, $7b, $2c, $6c, $a9, $1d
	db $80, $b0, $ce, $4e, $e5, $a4, $d6, $7f
	db $7a, $d2, $16, $b9, $4f

	db $80, $14, $9d, $b9, $ab, $3d, $83, $44, $40
	db $5e, $3a, $75, $9e, $b4, $81, $83, $1f, $e5, $a7
	db $6c, $01, $83, $19, $23, $a9, $90, $92, $99, $14, $88, $1a
	db $9e, $a9, $26, $b3, $83, $b8, $34
	db $7a, $9a

.introduction_text
	db TX_COMPRESSED, $62, $7d, $e8, $7f, $01, $05, $a2, $72, $8b, $35, $f1

	db $00, $ea, $5a, $46, $45, $28, $e9, $80, $e2, $4f, $57
	db $97, $83, $84, $04, $16, $a2, $b3, $c0, $2b, $3f

	db $00, $c7, $d2, $32, $70, $68, $80, $82, $d2
	db $de, $c3, $6d, $26, $bf, $c5, $8f, $94, $dd

	db $28, $06, $e7, $de, $fe, $3a, $2c, $96, $93, $8c, $20, $4f
	db $bd, $8e, $7b, $93, $5c, $d5, $85, $a2
	db $65, $55, $a4, $d0, $70, $46, $ae, $d1

	db $e0, $0e, $b0, $80, $82, $d4, $c9, $e0, $7b, $71, $f3
	db $fb, $ce, $9c, $3d, $89, $d2, $66, $04, $18
	db $d6, $aa, $d2, $70, $4b, $ba, $26, $ce, $09, $6e, $79, $3f

	db $00, $c7, $3b, $c5, $32, $19, $69, $1a, $38
	db $d3, $c4

.battle_won_text
	db TX_COMPRESSED, $29, $27, $30, $1a, $ce, $0c, $91, $f0
	db $4f, $03, $95, $f0, $93, $14, $c0, $7c, $a6, $c6, $4e
	db $40, $20, $40, $d6, $3b, $89, $d4, $45, $66, $64
	db $79, $67, $96, $99, $3c, $cb, $0c, $7c, $d6
	db $6a, $8d, $f5, $66, $b4

	db $78, $03, $94, $2d, $4d, $59, $cb, $5b, $5d
	db $04, $f5, $41, $5d, $a4, $14, $0e, $12, $d2, $34
	db $2a, $57, $b9, $e4, $f8
	db $d3, $40

.got_badge_text
	db TX_COMPRESSED, $76, $ae, $f4, $64, $3c, $cb, $49
	db $bc, $25, $dd, $13, $67, $04, $b7, $3c, $9f
	db $1a, $68

.have_a_TM_text
	db TX_COMPRESSED, $62, $6b, $3c, $53, $62, $b0, $91, $a4, $42, $85
	db $5e, $c0, $2b, $80, $82, $d7
	db $1a, $78, $80

.after_TM_text
	db TX_COMPRESSED, $28, $54, $59, $53, $e8, $c8, $49, $7a, $32
	db $21, $e5, $31, $ac, $e0, $97, $75, $17

	db $c4, $03, $ab, $c5, $36, $2b, $69, $64, $19, $39, $89, $0d
	db $bd, $80, $d6, $71, $f0, $83, $1c, $b4, $ed, $c4, $ea
	db $00, $6c, $65, $3a, $46, $4e, $58, $62, $b6, $96
	db $47, $ad, $27, $02, $20, $40, $48, $64, $bf

	db $00, $75, $78, $a0, $df, $7c, $c8, $83, $e8
	db $27, $91, $6b, $09, $39, $fc, $a7, $1a, $45, $ce, $8d, $48
	db $c0, $02, $0b, $53, $49, $98, $08, $2d
	db $2d, $ec, $36, $d2, $6b, $9a, $b3
	db $f5, $34

SoutherlyGym_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def 19, 8, 5, SOUTHERLY_CITY
	warp_def 19, 9, 5, SOUTHERLY_CITY

	;xy triggers
	db 0

	;signposts
	db 2
	signpost 17, 11, SIGNPOST_TEXT, SoutherlyGymSign
	signpost 17, 6, SIGNPOST_TEXT, SoutherlyGymSign

	;people-events
	db 10
	person_event SPRITE_P0, -3, -3, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_ITEMBALL, 1, FIRE_RING, EVENT_SOUTHERLY_GYM_ITEM_FIRE_RING
	person_event SPRITE_FIRE, 3, 11, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TEXT, 0, SoutherlyGymFlame, EVENT_SOUTHERLY_GYM_FLAME_1
	person_event SPRITE_FIRE, 12, 10, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TEXT, 0, SoutherlyGymFlame, EVENT_SOUTHERLY_GYM_FLAME_2
	person_event SPRITE_FIRE, 8, 7, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TEXT, 0, SoutherlyGymFlame, EVENT_SOUTHERLY_GYM_FLAME_3
	person_event SPRITE_GYM_GUY, 17, 10, SPRITEMOVEDATA_00, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, SoutherlyGymGuide, -1
	person_event SPRITE_FISHER, 13, 13, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 1, SoutherlyGym_Trainer_1, -1
	person_event SPRITE_FISHER, 0, 13, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, PERSONTYPE_TRAINER, 1, SoutherlyGym_Trainer_2, -1
	person_event SPRITE_YOUNGSTER, 6, 6, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_GENERICTRAINER, 1, SoutherlyGym_Trainer_3, -1
	person_event SPRITE_FISHER, 4, 5, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, PERSONTYPE_TRAINER, 1, SoutherlyGym_Trainer_4, -1
	person_event SPRITE_COOLTRAINER_M, 0, 8, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, SoutherlyGymLeader, -1

