AzaleaGym_MapScriptHeader;trigger count
	db 0
 ;callback count
	db 0

AzaleaGymSign:
	ctxt "Azalea Town"
	line "#mon Gym"

	para "Leader: Bugsy"
	done

AzaleaGym_Item:
	db IRON, 1

AzaleaGym_Trainer_1:
	trainer EVENT_AZALEA_GYM_TRAINER_1, LASS, 4, .before_battle_text, AzaleaGym_OhMyGoodnessText, $0000, .script

.script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	ctxt "There's no way we're"
	line "letting you battle"
	cont "the leader!"
	done

.after_battle_text
	ctxt "You really built a"
	line "strong team."

	para "I admire that."
	done

AzaleaGym_Trainer_2:
	trainer EVENT_AZALEA_GYM_TRAINER_2, BUG_CATCHER, 8, .before_battle_text, .battle_won_text, $0000, .script

.script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	ctxt "Bug #mon evolve"
	line "young."

	para "So they get"
	line "stronger faster."
	done

.battle_won_text
	ctxt "However, just"
	line "evolving isn't"
	cont "enough!"
	done

.after_battle_text
	ctxt "I guess I'd better"
	line "train a bit more!"
	done

AzaleaGym_Trainer_3:
	trainer EVENT_AZALEA_GYM_TRAINER_3, BUG_CATCHER, 7, .before_battle_text, .battle_won_text, $0000, .script

.script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	ctxt "Bug #mon are"
	line "rad!"

	para "Here's the proof"
	line "coming at ya!"
	done

.battle_won_text
	ctxt "Well, you're tough,"
	line "that's for sure."
	done

.after_battle_text
	ctxt "I met a cool girl"
	line "who loves bug"
	cont "#mon."
	done

AzaleaGym_Trainer_4:
	trainer EVENT_AZALEA_GYM_TRAINER_4, LASS, 5, .before_battle_text, AzaleaGym_OhMyGoodnessText, $0000, .script

.script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	ctxt "Wait!"

	para "Don't rush to"
	line "Bugsy, battle us"
	cont "first!"
	done

.after_battle_text
	ctxt "I'm ashamed of my"
	line "loss."
	done

AzaleaGym_Trainer_5:
	trainer EVENT_AZALEA_GYM_TRAINER_5, BUG_CATCHER, 9, .before_battle_text, .battle_won_text, $0000, .script

.script
	end_if_just_battled
	jumptext .after_battle_text

.before_battle_text
	ctxt "I grew up with my"
	line "#mon."

	para "I couldn't imagine"
	line "it any other way."
	done

.battle_won_text
	ctxt "Urrgggh!"
	done

.after_battle_text
	ctxt "All we can do is"
	line "grow and get"
	cont "better as a team."
	done

AzaleaGymBugsy:
	faceplayer
	opentext
	checkflag ENGINE_HIVEBADGE
	sif true
		jumptext .after_battle_text
	writetext .before_battle_text
	winlosstext .battle_won_text, 0
	setlasttalked 255
	writecode VAR_BATTLETYPE, BATTLETYPE_NORMAL
	loadtrainer BUGSY, 1
	startbattle
	reloadmapafterbattle
	playmapmusic
	opentext
	writetext .received_badge_text
	playwaitsfx SFX_TCG2_DIDDLY_5
	setflag ENGINE_HIVEBADGE
	playmusic MUSIC_GYM
	writetext .before_giving_TM_text
	givetm TM_MEGAHORN + RECEIVED_TM
	jumptext .after_giving_TM_text

.before_battle_text
	ctxt "I'm Bugsy."

	para "I never lose when"
	line "it comes to bug"
	cont "#mon!"

	para "You can consider"
	line "me the authority"
	cont "on bug #mon!"

	para "I've learned a"
	line "lot over the"
	para "years - let me"
	line "show you."
	done

.battle_won_text
	ctxt "You are amazing!"

	para "There will always"
	line "be something new"
	para "to learn about"
	line "bug #mon!"

	para "Please take the"
	line "Hive Badge!"
	done

.received_badge_text
	ctxt "<PLAYER> received"
	line "Hive Badge."
	done

.before_giving_TM_text
	ctxt "Please take this"
	line "gift as well;"
	cont "you deserve it."
	sdone

.after_giving_TM_text
	ctxt "This bug TM works"
	line "for all #mon"
	cont "with horns."

	para "That way, even"
	line "more #mon can"
	para "harness the"
	line "power of bugs!"
	done

.after_battle_text
	ctxt "Bug #mon are"
	line "deep."

	para "There's an"
	line "endless amount"

	para "of mysteries to"
	line "be explored."
	done

AzaleaGymGuide:
	ctxt "Yo, challenger!"

	para "Bugsy's knowledge"
	line "of insect #mon"
	cont "is enormous!"

	para "Try taking them"
	line "down with fire and"
	cont "flying #mon!"
	done

AzaleaGym_OhMyGoodnessText:
	; this is used by more than one trainer
	ctxt "Oh my goodness<...>"
	done

AzaleaGym_MapEventHeader:: db 0, 0

.Warps
	db 2
	warp_def $f, $4, 4, AZALEA_TOWN
	warp_def $f, $5, 4, AZALEA_TOWN

.CoordEvents
	db 0

.BGEvents
	db 2
	signpost 13, 3, SIGNPOST_TEXT, AzaleaGymSign
	signpost 13, 6, SIGNPOST_TEXT, AzaleaGymSign

.ObjectEvents
	db 8
	person_event SPRITE_P0, -3, -3, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_ITEMBALL, 1, AzaleaGym_Item, EVENT_AZALEA_GYM_ITEM_1
	person_event SPRITE_LASS, 10, 4, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TRAINER, 1, AzaleaGym_Trainer_1, -1
	person_event SPRITE_BUG_CATCHER, 3, 5, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 1, AzaleaGym_Trainer_2, -1
	person_event SPRITE_BUG_CATCHER, 2, 8, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 1, AzaleaGym_Trainer_3, -1
	person_event SPRITE_LASS, 10, 5, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_TRAINER, 1, AzaleaGym_Trainer_4, -1
	person_event SPRITE_BUGSY, 7, 5, SPRITEMOVEDATA_WANDER, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, AzaleaGymBugsy, -1
	person_event SPRITE_BUG_CATCHER, 8, 1, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_TRAINER, 3, AzaleaGym_Trainer_5, -1
	person_event SPRITE_GYM_GUY, 13, 7, SPRITEMOVEDATA_00, 0, 0, -1, -1, 0, PERSONTYPE_TEXTFP, 0, AzaleaGymGuide, -1
