TrainerHouse_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

TrainerHouse_Trainer_1:
	trainer EVENT_TRAINER_HOUSE_TRAINER_1, SUPER_NERD, 2, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $75, $37, $b5, $68, $24, $46, $42, $f9, $c4, $9a
	db $cd, $eb, $0c, $b5, $e8, $c9, $2a, $1d, $a6, $3e
	db $09, $50, $39, $5f, $09, $26, $0b, $19, $93, $28
	db $f5, $34

.battle_won_text
	db TX_COMPRESSED, $a7, $81, $84, $b6, $9f, $57, $d3, $a7
	db $82, $9a

.after_battle_text
	db TX_COMPRESSED, $c7, $08, $54, $91, $3a, $35, $23, $80, $82, $d1, $71
	db $bc, $40, $dc, $7c, $14, $c1, $63, $32, $67
	db $8d, $34

TrainerHouse_Trainer_2:
	trainer EVENT_TRAINER_HOUSE_TRAINER_2, SUPER_NERD, 1, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $63, $a0, $c3, $27, $33, $a1, $b4, $40
	db $e0, $f0, $39, $5f, $09, $22, $4f, $a2, $11, $01, $05
	db $a5, $59, $3d, $ec, $a8, $76, $98, $fb, $5d, $b1, $88, $e9
	db $aa, $c8, $f0, $c0, $d6, $64, $b9, $60, $84, $1a

	db $3c, $01, $cf, $db, $1b, $fb, $67, $d0, $5f, $80, $82
	db $d3, $c9, $d0, $63, $84, $0c, $67, $a7, $ab, $96, $08, $41
	db $aa, $a8, $f5, $48, $86, $84, $1a, $27, $4f, $0b
	db $e3, $4d

.battle_won_text
	db TX_COMPRESSED, $77, $57, $e0, $6a, $fc, $0d, $5c
	db $69, $a0

.after_battle_text
	db TX_COMPRESSED, $75, $14, $88, $1a, $a3, $e0, $a0, $39, $5f, $09
	db $1e, $b0, $42, $0e, $6f, $47, $c9, $1f, $32, $5a
	db $3d, $4d

TrainerHouse_Trainer_3:
	trainer EVENT_TRAINER_HOUSE_TRAINER_3, POKEMANIAC, 2, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $6e, $9d, $b8, $34, $41, $dd
	db $2d, $34

.battle_won_text
	db TX_COMPRESSED, $ac, $60, $8c, $cc, $f8
	db $d3, $40

.after_battle_text
	db TX_COMPRESSED, $61, $19, $89, $bf, $cc, $84, $94, $c8, $ad, $7b
	db $cb, $da, $ac, $2d, $5c, $1d, $f1
	db $a6, $80

TrainerHouse_Trainer_4:
	trainer EVENT_TRAINER_HOUSE_TRAINER_4, POKEMANIAC, 1, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptextfaceplayer .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $63, $bc

	db $40, $28, $48, $59, $52, $3c, $c0, $41, $6b
	db $ef, $64, $79, $25, $c7, $54
	db $b4, $d0

.battle_won_text
	db TX_COMPRESSED, $61, $6e, $a7, $8c, $75, $3a, $14, $5f
	db $17, $8a, $4e, $dc, $7f, $54, $8d, $11, $f3, $8f, $ee, $78
	db $d3, $40

.after_battle_text
	db TX_COMPRESSED, $72, $85, $a9, $ce, $83, $1c, $7c, $e6
	db $bc, $84, $85, $95, $28, $1c, $23, $e0, $a0, $6a, $27
	db $a9, $a0

TrainerHouseBoss:
	checkevent EVENT_RYU_GOT_CYNDAQUIL
	sif true
		jumptextfaceplayer .after_giving_cyndaquil
	faceplayer
	opentext
	checkevent EVENT_RYU_BEATEN
	sif false, then
		writetext .before_battle_text
		closetext
		winlosstext .battle_won_text, 0
		loadtrainer BLACKBELT_T, 1
		startbattle
		reloadmapafterbattle
		setevent EVENT_RYU_BEATEN
		opentext
	sendif
	writetext .after_battle_text
	buttonsound
	waitsfx
	checkcode VAR_PARTYCOUNT
	sif =, 6
		jumptextfaceplayer .party_full_text
	writetext .got_cyndaquil_text
	playwaitsfx SFX_CAUGHT_MON
	givepoke CYNDAQUIL, 10, ORAN_BERRY, 0
	setevent EVENT_RYU_GOT_CYNDAQUIL
	jumptext .after_giving_cyndaquil

.after_giving_cyndaquil
	db TX_COMPRESSED, $6d, $04, $4c, $e8, $b3, $68, $7d, $83, $44
	db $d7, $97, $ab, $38, $a6, $35, $98, $1b, $04, $20

	db $fc, $01, $d1, $64, $4e, $88, $10, $0a, $02, $0b
	db $4f, $27, $41, $8e, $0e, $e1, $03, $57, $e2, $b6
	db $ad, $53, $a2, $c8, $b6, $88, $41, $93, $98, $16
	db $ad, $50, $70, $80, $e5, $7c, $24, $96
	db $15, $5c, $8c, $18, $e3, $29, $de, $f4, $c9, $c9, $ad, $1e

	db $00, $ea, $6f, $6a, $d0, $48, $9d, $0a, $0f
	db $8d, $34

.before_battle_text
	db TX_COMPRESSED, $61, $2c, $ce, $c6, $4e, $51, $f8, $ea, $72, $30, $63
	db $7b, $91, $e1, $68, $96, $19, $7b, $d3, $25, $9e
	db $55, $14, $bd, $19, $0d, $68

	db $f0, $0e, $00, $c0, $41, $6a, $27, $41, $8e, $54, $9d
	db $b7, $87, $72, $f5, $48, $d1, $4b, $0a, $49, $92, $9e

	db $00, $1c, $2b, $08, $31, $c1, $df
	db $1a, $78, $80

.battle_won_text
	db TX_COMPRESSED, $6f, $bb, $ba, $be, $79, $4f
	db $17, $9d, $16, $45, $67, $b6, $64
	db $e3, $4d

.after_battle_text
	db TX_COMPRESSED, $6d, $09, $39, $5e, $db, $5d, $db, $18, $48, $8f
	db $bc, $08, $2d, $43, $d5, $90, $f3, $2d, $23
	db $42, $ae, $47, $85

	db $f8, $03, $a9, $80, $5a, $26, $65, $a4, $68
	db $78, $1c, $af, $84, $9f, $9a, $4c, $c1
	db $da, $a2, $19, $e5, $13, $60, $20, $b4, $4e
	db $55, $14, $bd, $19, $0d, $71, $0d, $32, $99, $a8
	db $54, $08, $2d, $2d, $07, $dc, $38
	db $d3, $40

.got_cyndaquil_text
	db TX_COMPRESSED, $a7, $8e, $72, $1b
	db $79, $b4, $11, $33, $a2, $cd, $a1, $f7
	db $8d, $34

.party_full_text
	db TX_COMPRESSED, $72, $85, $a8, $9d, $06, $38, $40, $c5, $84, $2f
	db $bc, $32, $40, $41, $69, $70, $46, $ae, $c1, $71

	db $00, $da, $17, $ce, $2b, $d6, $54, $a5, $49, $32
	db $3c, $08, $2d, $44, $e8, $31, $c5, $84, $2f, $cd, $26
	db $55, $5a, $4c, $91, $d3, $87, $b3, $91, $83, $1c, $04, $16
	db $95, $02, $0b, $4b, $82, $16, $31, $36, $7e
	db $a6, $80

TrainerHouse_MapEventHeader ;filler
	db 0, 0

;warps
	db 8
	warp_def $7, $3, 9, OXALIS_CITY
	warp_def $e, $1, 2, TRAINER_HOUSE_B1F
	warp_def $0, $4, 1, TRAINER_HOUSE_B1F
	warp_def $e, $7, 3, TRAINER_HOUSE_B1F
	warp_def $2d, $4, 8, OXALIS_CITY
	warp_def $7, $4, 9, OXALIS_CITY
	warp_def $26, $4, 4, TRAINER_HOUSE_B1F
	warp_def $2d, $3, 8, OXALIS_CITY

	;xy triggers
	db 0

	;signposts
	db 0

	;people-events
	db 5
	person_event SPRITE_SUPER_NERD, 29, 6, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 8 + PAL_OW_BROWN, PERSONTYPE_TRAINER, 5, TrainerHouse_Trainer_1, -1
	person_event SPRITE_SUPER_NERD, 27, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 8 + PAL_OW_BROWN, PERSONTYPE_TRAINER, 5, TrainerHouse_Trainer_2, -1
	person_event SPRITE_POKEMANIAC, 25, 6, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 8 + PAL_OW_PURPLE, PERSONTYPE_TRAINER, 5, TrainerHouse_Trainer_3, -1
	person_event SPRITE_POKEMANIAC, 23, 1, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 8 + PAL_OW_PURPLE, PERSONTYPE_TRAINER, 5, TrainerHouse_Trainer_4, -1
	person_event SPRITE_BLACK_BELT, 31, 4, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, 8 + PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, TrainerHouseBoss, -1

