SaffronFightingDojo_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

SaffronFightingDojo_Trainer_1:
	trainer EVENT_SAFFRON_FIGHTING_DOJO_TRAINER_1, BLACKBELT_T, 7, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $6e, $93, $59, $c7, $c7, $ca, $6e, $02, $0b
	db $4f, $32, $17, $ce, $60, $b0, $bf
	db $4b, $4d

.battle_won_text
	db TX_COMPRESSED, $6d, $d7, $ce, $58, $62, $0c, $d4, $a0, $5a
	db $b7, $82, $d2, $e3, $fa, $8b, $35, $fe, $25, $a4, $d2
	db $d3, $40

.after_battle_text
	db TX_COMPRESSED, $29, $27, $04, $2c, $6f, $9c, $c0, $7c, $a6, $cd, $68
	db $7b, $59, $58, $50, $89, $69, $39, $dd, $26
	db $5e, $b5, $e8, $c9, $12, $6b, $3f
	db $53, $40

SaffronFightingDojo_Trainer_2:
	trainer EVENT_SAFFRON_FIGHTING_DOJO_TRAINER_2, BLACKBELT_T, 8, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $e0, $0c, $04, $16, $a7, $46, $a4, $70, $10, $5a
	db $5b, $cf, $85, $ab, $4c, $0a, $e6, $03, $45
	db $a1, $56, $42, $32, $73, $2d, $27, $2f, $7a, $a4, $32, $73
	db $4b, $4d

.battle_won_text
	db TX_COMPRESSED, $75, $2f, $54, $8e, $0e, $e0, $ef, $14, $b4
	db $9b, $dd, $db, $b3, $5f
	db $a9, $a0

.after_battle_text
	db TX_COMPRESSED, $e1, $40, $26, $52, $36, $60, $80, $d4, $6b
	db $7b, $05, $8f, $94, $d9, $91, $11, $a4, $71
	db $a6, $80

SaffronFightingDojo_Trainer_3:
	trainer EVENT_SAFFRON_FIGHTING_DOJO_TRAINER_3, BLACKBELT_T, 9, .before_battle_text, .battle_won_text, $0000, .Script

.Script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	db TX_COMPRESSED, $ad, $67, $01, $05, $a8, $b3, $dc, $82, $96
	db $17, $b0, $d6, $4e, $5a, $4e, $3f, $a8, $b3, $5d
	db $2d, $34

.battle_won_text
	db TX_COMPRESSED, $72, $9a, $38

	db $80, $72, $85, $a9, $ab, $3e
	db $34, $d0

.after_battle_text
	db TX_COMPRESSED, $6f, $a3, $b9, $4c, $1f, $60, $20, $b5, $10
	db $66, $f0, $5a, $5c, $7f, $51, $66, $be
	db $34, $d0

SaffronFightingDojoMaster:
	faceplayer
	opentext
	checkevent EVENT_FIGHTING_DOJO_WIN
	sif false, then
		writetext .before_battle_text
		winlosstext .battle_won_text, 0
		setlasttalked 255
		writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL
		loadtrainer BLACKBELT_T, 10
		startbattle
		reloadmapafterbattle
		playmapmusic
		opentext
		setevent EVENT_FIGHTING_DOJO_WIN
	sendif
	checkevent EVENT_FIGHTING_DOJO_GOT_ITEM
	sif true
		jumptext .already_battled_text
	writetext .earned_item_text
	verbosegiveitem BLACKBELT, 1
	sif false
		jumptext .no_room_for_item_text
	setevent EVENT_FIGHTING_DOJO_GOT_ITEM
	jumptext .received_item_text

.already_battled_text
	db TX_COMPRESSED, $13, $06, $62, $23, $42, $25, $a4
	db $de, $b5, $e8, $c8, $32, $73
	db $f0, $0a, $cd, $9d, $69, $07, $1d, $4a, $87, $de
	db $bd, $61, $0f
	db $1a, $68

.before_battle_text
	db TX_COMPRESSED, $62, $60, $b8

	db $80, $74, $59, $04, $c0, $c1, $07, $f2, $d2
	db $6f, $09, $8d, $5e, $d9, $c1, $30, $32, $73

	db $c4, $03, $94, $2d, $71

	db $00, $25, $b7, $7d, $39, $63, $7c, $f8

	db $80, $63, $56, $ee, $af, $9e, $53
	db $c6, $9a

.battle_won_text
	db TX_COMPRESSED, $74, $59, $15, $9e, $d9, $93

	db $88, $06, $fb, $bb, $ab, $e7, $94, $f1
	db $a6, $80

.earned_item_text
	db TX_COMPRESSED, $74, $59, $19, $5b, $48, $49, $e7

	db $88, $07, $28, $5a, $87, $ab, $21, $e6, $5a, $46
	db $87, $95, $9f, $6f
	db $8d, $3c, $40

.received_item_text
	db TX_COMPRESSED, $75, $6e, $1e, $c7, $f5, $48, $e0, $20, $b4
	db $b7, $b0, $1f, $29, $b1, $93, $98, $0e, $57, $c2
	db $40, $06, $0c, $64, $8f, $85
	db $66, $f0, $80, $d4, $6b, $c1, $ae, $f1
	db $a6, $80

.no_room_for_item_text
	db TX_COMPRESSED, $72, $85, $a9, $80, $43, $d1, $a1, $31, $94, $8f, $b9
	db $fb, $cf, $ea, $91, $c4, $05, $f3, $8b, $08, $5f
	db $e3, $4d

SaffronFightingDojo_MapEventHeader ;filler
	db 0, 0

;warps
	db 2
	warp_def $f, $9, 1, SAFFRON_CITY
	warp_def $f, $a, 1, SAFFRON_CITY

	;xy triggers
	db 0

	;signposts
	db 0

	;people-events
	db 4
	person_event SPRITE_BLACK_BELT, 10, 4, $9, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_TRAINER, 3, SaffronFightingDojo_Trainer_1, -1
	person_event SPRITE_BLACK_BELT, 8, 7, $8, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_TRAINER, 3, SaffronFightingDojo_Trainer_2, -1
	person_event SPRITE_BLACK_BELT, 6, 4, $9, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_TRAINER, 3, SaffronFightingDojo_Trainer_3, -1
	person_event SPRITE_BLACK_BELT, 2, 5, $3, 0, 0, -1, -1, PAL_OW_BROWN, PERSONTYPE_SCRIPT, 0, SaffronFightingDojoMaster, -1

