CastroGym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

CastroGymNPC1:
	checkflag ENGINE_FISTBADGE
	iftrue CastroGym_17011a
	applymovement 2, CastroGymNPC1_Movement1
	faceplayer
	opentext
	writetext CastroGymNPC1_Text_17024f
	waitbutton
	closetext
	winlosstext CastroGymNPC1Text_1702bb, 0
	loadtrainer KOJI, 1
	startbattle
	reloadmapafterbattle
	variablesprite SPRITE_CASTRO_GYM_1, SPRITE_LASS
	variablesprite SPRITE_CASTRO_GYM_2, SPRITE_LASS
	variablesprite SPRITE_CASTRO_GYM_3, SPRITE_LASS
	variablesprite SPRITE_CASTRO_GYM_4, SPRITE_YOUNGSTER
	special RunCallback_04
	opentext
	writetext CastroGymNPC1_Text_170305
	playwaitsfx SFX_GET_BADGE
	setflag ENGINE_FISTBADGE
	jump CastroGym_17011c

CastroGymNPC1_Movement1:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

CastroGymNPC2:
	checkevent EVENT_MORAGA_GYM_TRAINER_3
	iftrue CastroGym_170146
	applymovement 3, CastroGymNPC2_Movement1
	faceplayer
	variablesprite SPRITE_CASTRO_GYM_1, SPRITE_LASS
	special RunCallback_04
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_3
	iftrue CastroGym_170169
	writetext CastroGymNPC2_Text_170400
	waitbutton
	closetext
	winlosstext CastroGymNPC2Text_170440, 0
	loadtrainer LASS, 9
	startbattle
	iftrue CastroGym_170164
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_3
	end

CastroGymNPC2_Movement1:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

CastroGymNPC3:
	checkevent EVENT_MORAGA_GYM_TRAINER_2
	iftrue CastroGym_170180
	applymovement 4, CastroGymNPC3_Movement1
	faceplayer
	variablesprite SPRITE_CASTRO_GYM_2, SPRITE_LASS
	special RunCallback_04
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_2
	iftrue CastroGym_1701a3
	writetext CastroGymNPC3_Text_170480
	waitbutton
	closetext
	winlosstext CastroGymNPC3Text_170495, 0
	loadtrainer LASS, 10
	startbattle
	iftrue CastroGym_17019e
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_2
	end

CastroGymNPC3_Movement1:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

CastroGymNPC4:
	checkevent EVENT_ROUTE_66_TRAINER_2
	iftrue CastroGym_1701ba
	applymovement 5, CastroGymNPC4_Movement1
	faceplayer
	variablesprite SPRITE_CASTRO_GYM_3, SPRITE_LASS
	special RunCallback_04
	faceplayer
	opentext
	checkevent EVENT_ROUTE_66_TRAINER_2
	iftrue CastroGym_1701dd
	writetext CastroGymNPC4_Text_1704d5
	waitbutton
	closetext
	winlosstext CastroGymNPC4Text_17050b, 0
	loadtrainer PICNICKER, 5
	startbattle
	iftrue CastroGym_1701d8
	reloadmapafterbattle
	setevent EVENT_ROUTE_66_TRAINER_2
	end

CastroGymNPC4_Movement1:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

CastroGymNPC5:
	checkevent EVENT_MORAGA_GYM_TRAINER_1
	iftrue CastroGym_1701f4
	applymovement 6, CastroGymNPC5_Movement1
	faceplayer
	variablesprite SPRITE_CASTRO_GYM_4, SPRITE_YOUNGSTER
	special RunCallback_04
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_1
	iftrue CastroGym_170217
	writetext CastroGymNPC5_Text_170542
	waitbutton
	closetext
	winlosstext CastroGymNPC5Text_17056a, 0
	loadtrainer CAMPER, 6
	startbattle
	iftrue CastroGym_170212
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_1
	end

CastroGymNPC5_Movement1:
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	turn_head_left
	turn_head_up
	turn_head_right
	turn_head_down
	step_end

CastroGymNPC6:
	jumptextfaceplayer CastroGymNPC6_Text_1705ba

CastroGym_17011a:
	faceplayer
	opentext
	checkevent EVENT_CASTRO_GYM_TM_RECEIVED
	iftrue CastroGym_17012f
	writetext CastroGym_17011a_Text_17031c
	buttonsound
	givetm TM_COUNTER + RECEIVED_TM
	setevent EVENT_CASTRO_GYM_TM_RECEIVED
	jumptext CastroGym_17011a_Text_17038e

CastroGym_17011c:
	checkevent EVENT_CASTRO_GYM_TM_RECEIVED
	iftrue CastroGym_17012f
	writetext CastroGym_17011a_Text_17031c
	buttonsound
	givetm TM_COUNTER + RECEIVED_TM
	setevent EVENT_CASTRO_GYM_TM_RECEIVED
	jumptext CastroGym_17011a_Text_17038e

CastroGym_170146:
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_3
	iftrue CastroGym_170169
	writetext CastroGymNPC2_Text_170400
	waitbutton
	closetext
	winlosstext CastroGymNPC2Text_170440, 0
	loadtrainer LASS, 9
	startbattle
	iftrue CastroGym_170164
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_3
	end

CastroGym_170169:
	jumptext CastroGym_170169_Text_170453

CastroGym_170164:
	variablesprite SPRITE_CASTRO_GYM_1, SPRITE_KOJI
	reloadmapafterbattle
	end

CastroGym_170180:
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_2
	iftrue CastroGym_1701a3
	writetext CastroGymNPC3_Text_170480
	waitbutton
	closetext
	winlosstext CastroGymNPC3Text_170495, 0
	loadtrainer LASS, 10
	startbattle
	iftrue CastroGym_17019e
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_2
	end

CastroGym_1701a3:
	writetext CastroGym_1701a3_Text_1704b3
	endtext

CastroGym_17019e:
	variablesprite SPRITE_CASTRO_GYM_2, SPRITE_KOJI
	reloadmapafterbattle
	end

CastroGym_1701ba:
	faceplayer
	opentext
	checkevent EVENT_ROUTE_66_TRAINER_2
	iftrue CastroGym_1701dd
	writetext CastroGymNPC4_Text_1704d5
	waitbutton
	closetext
	winlosstext CastroGymNPC4Text_17050b, 0
	loadtrainer PICNICKER, 5
	startbattle
	iftrue CastroGym_1701d8
	reloadmapafterbattle
	setevent EVENT_ROUTE_66_TRAINER_2
	end

CastroGym_1701dd:
	jumptext CastroGym_1701dd_Text_170526

CastroGym_1701d8:
	variablesprite SPRITE_CASTRO_GYM_3, SPRITE_KOJI
	reloadmapafterbattle
	end

CastroGym_1701f4:
	faceplayer
	opentext
	checkevent EVENT_MORAGA_GYM_TRAINER_1
	iftrue CastroGym_170217
	writetext CastroGymNPC5_Text_170542
	waitbutton
	closetext
	winlosstext CastroGymNPC5Text_17056a, 0
	loadtrainer CAMPER, 6
	startbattle
	iftrue CastroGym_170212
	reloadmapafterbattle
	setevent EVENT_MORAGA_GYM_TRAINER_1
	end

CastroGym_170217:
	writetext CastroGym_170217_Text_17058b
	endtext

CastroGym_170212:
	variablesprite SPRITE_CASTRO_GYM_4, SPRITE_KOJI
	reloadmapafterbattle
	end

CastroGym_17012f:
	jumptextfaceplayer CastroGym_17011a_Text_17038e

CastroGymNPC1_Text_17024f:
	db TX_COMPRESSED, $ad, $f8, $ea, $09, $80, $d3, $83, $a5

	db $00, $dd, $20, $a0, $23, $44, $75, $35, $fe
	db $34, $d0

CastroGymNPC1Text_1702bb:
	db TX_COMPRESSED, $6e, $7d, $ec, $c8, $48, $7c

	db $40, $31, $35, $9f

	db $10, $05, $24, $e2, $98, $d1, $70, $4b, $73, $c9, $f1
	db $a6, $80

CastroGymNPC1_Text_170305:
	db TX_COMPRESSED, $a7, $8e, $2c, $d9, $31, $83, $1e
	db $5e, $53, $1a, $2e, $09, $6e, $79, $3f
	db $53, $40

CastroGymNPC2_Text_170400:
	db TX_COMPRESSED, $13, $3a, $23, $48, $68
	db $37, $82, $40, $bf, $b6, $11, $01, $31
	db $ea, $a1, $a2, $20, $31, $4b, $6a, $d1, $8f
	db $8d, $34

CastroGymNPC2Text_170440:
	db TX_COMPRESSED, $62, $35, $8e, $24, $6b, $1f
	db $1a, $68

CastroGymNPC3_Text_170480:
	db TX_COMPRESSED, $6e, $7d, $ef, $e0, $20, $b5, $19, $48, $50
	db $6f, $34, $4a, $86, $83, $e8, $2f
	db $53, $40

CastroGymNPC3Text_170495:
	db TX_COMPRESSED, $ad, $95, $2e
	db $34, $d0

CastroGymNPC4_Text_1704d5:
	db TX_COMPRESSED, $13, $01, $a7, $07, $06, $88, $90, $df

	db $80, $70, $2c, $d0, $81, $93, $99, $d1, $a9, $1c, $48, $df
	db $78, $68, $a7

	db $80, $05, $41, $26, $4d, $78, $35, $de
	db $34, $d0

CastroGymNPC4Text_17050b:
	db TX_COMPRESSED, $6f, $a8, $25, $32, $21, $a1, $02, $02, $83
	db $cb, $d6, $18, $9d, $10, $20, $c9
	db $c6, $9a

CastroGymNPC5_Text_170542:
	db TX_COMPRESSED, $07, $8c, $94, $e6, $a2, $6a, $ce, $20
	db $2f, $32, $10, $f7
	db $8d, $34

CastroGymNPC5Text_17056a:
	db TX_COMPRESSED, $07, $86, $e2, $14, $87, $de, $9e
	db $5e, $32, $05, $ae, $53
	db $c6, $9a

CastroGymNPC6_Text_1705ba:
	db TX_COMPRESSED, $6e, $9d, $b8, $d0, $8a

	db $50, $15, $f7, $b2, $d2, $68, $38, $52, $f4, $64, $35
	db $a1, $ee, $84, $2a, $52, $d2, $71, $1a, $f9, $fe, $2b, $6a

	db $c0, $04, $9d, $05, $02, $43, $83, $44, $b4
	db $9b, $dd, $3d, $c9, $af
	db $8d, $34

CastroGym_17011a_Text_17031c:
	db TX_COMPRESSED, $62, $6b, $3e

	db $20, $0a, $d5, $23, $85, $0a, $f1
	db $a6, $80

CastroGym_17011a_Text_17038e:
	db TX_COMPRESSED, $63, $a9

	db $e2, $00, $a4, $ed, $ca, $b5, $12, $9c, $08, $2c, $1a
	db $eb, $c8, $11, $ab, $58, $c9, $cf
	db $1a, $68

CastroGym_170169_Text_170453:
	db TX_COMPRESSED, $73, $d5, $bb, $bb
	db $c6, $9a

CastroGym_1701a3_Text_1704b3:
	db TX_COMPRESSED, $72, $85, $a8, $9d, $06, $38, $f8, $56
	db $6f, $32, $9d, $23, $26, $8f
	db $53, $40

CastroGym_1701dd_Text_170526:
	db TX_COMPRESSED, $6d, $d2, $53, $25, $5a, $3b, $98, $05
	db $6f, $31, $de, $f4, $35, $19, $93
	db $8d, $34

CastroGym_170217_Text_17058b:
	db TX_COMPRESSED, $28, $6f, $9c, $b0, $c4, $5b, $59
	db $04, $f1, $06, $4a, $71, $ab, $43, $50, $64, $45, $9e
	db $e5, $50, $70, $82, $16, $76, $64, $c8, $c9, $cf
	db $a9, $a0

CastroGym_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $11, $3, 1, CASTRO_VALLEY
	warp_def $11, $4, 1, CASTRO_VALLEY

	;xy triggers
	db 0

	;signposts
	db 0

	;people-events
	db 6
	person_event SPRITE_KOJI, 10, 8, SPRITEMOVEDATA_SPINRANDOM_SLOW, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC1, -1
	person_event SPRITE_KOJI, 13, 2, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC2, -1
	person_event SPRITE_KOJI, 7, 4, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC3, -1
	person_event SPRITE_KOJI, 6, 26, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC4, -1
	person_event SPRITE_KOJI, 1, 6, SPRITEMOVEDATA_SPINRANDOM_FAST, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC5, -1
	person_event SPRITE_GYM_GUY, 15, 7, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 8 + PAL_OW_BLUE, 0, 0, CastroGymNPC6, -1

