HeathGym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

HeathGymHiddenItem:
	dw EVENT_HEATH_GYM_HIDDENITEM_GOLD_TOKEN
	db GOLD_TOKEN

HeathGymGuide:
	checkflag ENGINE_NATUREBADGE
	sif false
		jumptextfaceplayer .before_badge_text
	jumptextfaceplayer .after_badge_text

.before_badge_text
	db TX_COMPRESSED, $72, $87, $f1, $94, $ef, $7a, $64, $e4, $d7

	db $c4, $03, $90, $64, $a7, $07, $2f, $54, $8d, $11, $23
	db $43, $cc, $20, $4f, $cc, $73, $dc, $9a, $e6, $5a, $b1, $9a
	db $15, $03, $1a, $c1, $44, $1a, $c6, $16, $91, $d0, $5e

	db $00, $c4, $e0, $d1, $1f, $0d, $8c, $1b, $6c
	db $f2, $f2, $b0, $50, $9b, $6d, $2c, $ff, $34, $99
	db $55, $69, $38, $4d, $b6, $97, $bd, $95, $05, $7d
	db $ca, $a4, $34, $b5, $85, $a2, $64, $64, $e6, $24, $6f
	db $fa, $9a

.after_badge_text
	db TX_COMPRESSED, $6e, $7d, $ec, $c8, $48, $7c

	db $40, $39, $06, $4a, $70, $70, $68, $9b, $1f, $d4, $59
	db $ad, $e0, $e1, $30, $0b, $2d, $23, $f1, $5b, $57, $01, $05
	db $a5, $4a, $cd, $16, $79, $89, $1b, $fc
	db $69, $a0

HeathGym_Trainer_1:
	trainer EVENT_HEATH_GYM_TRAINER_1, BEAUTY, 1, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $62, $69, $3e

	db $20, $1c, $a1, $6a, $33, $a4, $a6, $45, $67, $b7, $1f
	db $04, $f3, $09, $7a, $84, $40, $72, $be, $12, $71
	db $a6, $80

.battle_won_text
	db TX_COMPRESSED, $74, $59, $08, $1b, $8d, $20, $f3, $2c
	db $2f, $61, $a3, $eb, $4b, $3e
	db $34, $d0

.after_battle_text
	db TX_COMPRESSED, $17, $03, $1a, $c1, $5a, $46, $4e, $66, $f6, $ad, $04
	db $87, $b9, $09, $a2, $08, $35, $e0, $6c, $df, $41
	db $2a, $c0, $2b, $8f, $9c, $19, $27, $47, $81, $d3

	db $c0, $00, $5d, $4e, $b2, $62, $2e, $5a, $46, $89, $63, $7c
	db $fd, $4d

HeathGym_Trainer_2:
	trainer EVENT_HEATH_GYM_TRAINER_2, YOUNGSTER, 3, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $61, $2f, $50, $80, $36, $08, $41, $c0, $72, $be, $12
	db $3d, $ab, $38, $80, $c6, $89, $93, $5a, $f6, $cf, $3e

	db $01, $8e, $10, $a9, $71
	db $a6, $80

.battle_won_text
	db TX_COMPRESSED, $72, $85, $a8, $21, $61, $06, $3c, $c4, $86
	db $a7, $ac, $2d, $72, $98, $08, $2d, $4a, $8d, $67, $4f
	db $05, $34

.after_battle_text
	db TX_COMPRESSED, $29, $23, $44, $45, $e8, $24, $45, $67, $75, $19
	db $91, $e0, $41, $6a, $69, $33, $1f, $3a, $78

	db $00, $3a, $2c, $81, $27, $41, $44, $9a, $ce, $60, $15
	db $bd, $69, $38, $cb, $56, $73, $91, $af, $a8
	db $e3, $4d

HeathGym_Trainer_3:
	trainer EVENT_HEATH_GYM_TRAINER_3, SCHOOLBOY, 1, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $29, $23, $44, $43, $29, $08, $7b, $06
	db $87, $9f, $05, $30, $d0, $60, $ac, $76, $71, $48, $64, $cf
	db $1a, $68

.battle_won_text
	db TX_COMPRESSED, $73, $ad, $7c, $f3, $ca, $78
	db $d3, $40

.after_battle_text
	db TX_COMPRESSED, $75, $19, $0b, $5d, $cc, $e9, $ea, $c9
	db $35, $eb, $48, $c9, $cc, $0a, $e5, $d4, $1e
	db $34, $d0

HeathGym_Trainer_4:
	trainer EVENT_HEATH_GYM_TRAINER_4, TWINS, 1, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $ad, $f0, $4e, $31, $88, $f8

	db $80, $6f, $a4, $b9, $61, $8f, $99, $dc, $0b, $4b
	db $78, $1c, $af, $84, $94
	db $b4, $d0

.battle_won_text
	db TX_COMPRESSED, $ad, $f0, $50, $4f, $05, $74, $13
	db $8b, $ce, $6c, $de, $74, $64, $45, $c1, $6a, $9e

	db $00, $0a, $7a, $35, $d2
	db $d3, $40

.after_battle_text
	db TX_COMPRESSED, $ad, $f0, $4e, $31, $ca, $16, $a6, $ac, $e2, $cf
	db $7a, $f7, $21, $0e, $78, $c2, $b5, $48, $e3, $3a, $b3
	db $f5, $34

HeathGym_Trainer_4_OutOfRangeTwin:
	db TX_COMPRESSED, $15, $d0, $4e, $33, $84, $d6, $9d, $10, $89, $51
	db $bc, $84, $85, $ae, $e6, $6a, $14, $a3, $90, $64, $a7
	db $06, $aa, $c3, $12, $7d, $11, $1a, $44, $7c, $2b, $3f
	db $53, $40

HeathGymLeader:
	faceplayer
	checkflag ENGINE_NATUREBADGE
	sif true
		jumptext .already_defeated_text
	showtext .introduction_text
	winlosstext .battle_won_text, 0
	loadtrainer RINJI, RINJI_GYM
	startbattle
	reloadmapafterbattle
	setflag ENGINE_NATUREBADGE
	opentext
	writetext .got_badge_text
	playwaitsfx SFX_TCG2_DIDDLY_5
	waitbutton
	playmapmusic
	writetext .after_badge_text
	playmusic MUSIC_LAUREL_FOREST
	buttonsound
	givetm 57 + RECEIVED_TM
	jumptext .got_TM_text

.introduction_text
	db TX_COMPRESSED, $74, $59, $1c, $83, $25, $38, $3f

	db $00, $75, $35, $f8, $12, $1c, $a8, $76, $99, $69
	db $37, $89, $b6, $d2, $cf, $f3, $49, $98, $4d, $b6, $96
	db $6a, $86, $88, $12, $1c, $a8, $76, $98, $f9

	db $f8, $03, $10, $d5, $35, $58, $5a, $b8, $08, $2d, $52

	db $80, $e0, $0c, $04, $16, $a6, $06, $7d, $96, $93
	db $78, $9b, $6d, $2c, $e6, $ac, $2d, $13, $30, $10, $5a, $a5

	db $00, $e5, $0b, $51, $f6, $91, $73, $a7, $ab
	db $23, $d6, $19, $d1, $83, $1c, $a8, $76, $98, $3b
	db $fa, $a2, $06, $e5, $38, $d2, $2e, $0c, $90, $77
	db $ea, $78, $80

.battle_won_text
	db TX_COMPRESSED, $62, $fb, $f4, $f0

	db $00, $75, $12, $11, $07, $01, $05, $a9, $d3, $d5, $90
	db $f2, $f5, $86, $68, $81, $0b, $36, $47, $b6, $72, $d2
	db $6a, $aa, $0a, $fb, $99, $a8, $83, $b8, $34

	db $78, $01, $5a, $a4, $72, $d2, $34, $45, $7b, $9e
	db $4d, $ea, $87, $69, $80, $82, $d7
	db $a9, $a0

.got_badge_text
	db TX_COMPRESSED, $a7, $8e, $72, $1b
	db $78, $1f, $b6, $d2, $ce, $09, $6e, $79, $3f
	db $53, $40

.after_badge_text
	db TX_COMPRESSED, $07, $ed, $b4, $b3, $82, $5b, $9e, $4e, $54, $3e
	db $f5, $e7, $f5, $48, $e5, $a4, $e1, $36, $da, $59
	db $aa, $d1, $02, $16, $6c, $8f, $6c, $e0, $20, $b5, $1a
	db $10, $aa, $c3, $3a, $60, $c7, $d9, $4f, $c5, $8f

	db $00, $af, $a8, $0f, $e5, $ea, $91, $cb, $48, $d1
	db $ea, $68

.got_TM_text
	db TX_COMPRESSED, $28, $54, $5b, $a7, $b1, $90, $92, $f4, $64
	db $43, $ce, $4d, $13, $61, $5c, $c7, $3d, $c3

	db $88, $02, $92, $70, $40, $6a, $35, $c0
	db $e0, $f1, $36, $da, $59, $ca, $87, $de, $cd, $1e
	db $55, $02, $0b, $52, $a1, $da, $65, $a4, $68
	
	db $f0, $07, $57, $37, $a8, $0c, $4e, $a2
	db $6b, $ca, $ce, $ec, $d7, $19, $4e, $91, $93, $81
	db $c1, $53, $2b, $1d, $8d, $9d, $ec, $48, $ed, $1c
	db $69, $a0

.already_defeated_text
	db TX_COMPRESSED, $29, $23, $44, $59, $f2, $30, $92, $55, $a8
	db $78, $24, $64, $e6, $f7, $b0, $9b, $6d, $2c
	db $fe, $a9, $5b, $57, $07, $78, $a6, $f5, $f0, $a2
	db $d5, $6f, $7b, $39, $09, $0e, $10, $35

	db $78, $03, $9c, $9a, $cb, $26, $22, $f5, $5f, $4f
	db $8d, $34

HeathGym_MapEventHeader:: db 0, 0

.Warps: db 2
	warp_def 3, 9, 1, HEATH_GYM_GATE
	warp_def 15, 35, 1, HEATH_GYM_HOUSE

.CoordEvents: db 0

.BGEvents: db 1
	signpost 9, 33, SIGNPOST_ITEM, HeathGymHiddenItem

.ObjectEvents: db 7
	person_event SPRITE_BUGSY, 6, 5, SPRITEMOVEDATA_SPINRANDOM_SLOW, 1, 1, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, HeathGymLeader, -1
	person_event SPRITE_BEAUTY, 24, 35, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 2, HeathGym_Trainer_1, -1
	person_event SPRITE_YOUNGSTER, 32, 11, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 3, HeathGym_Trainer_2, -1
	person_event SPRITE_SCHOOLBOY, 20, 6, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 3, HeathGym_Trainer_3, -1
	person_event SPRITE_TWIN, 16, 24, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, PERSONTYPE_TRAINER, 1, HeathGym_Trainer_4, -1
	person_event SPRITE_TWIN, 16, 25, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, PERSONTYPE_TEXTFP, 1, HeathGym_Trainer_4_OutOfRangeTwin, -1
	person_event SPRITE_GYM_GUY, 4, 17, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, PERSONTYPE_SCRIPT, 0, HeathGymGuide, -1

