LaurelForestPokemonOnly_MapScriptHeader: ;trigger count
	db 0

 ;callback count
	db 1
	dbw MAPCALLBACK_TILES, .LaurelForestPokemonOnlyReloadBlocks

.LaurelForestPokemonOnlyReloadBlocks
	checkevent EVENT_POKEONLY_CHARMANDER_PUSHED_BOULDER_2
	sif true, then
		scall TriggerFillPond
		return
	sendif
	checkevent EVENT_POKEONLY_CHARMANDER_PUSHED_BOULDER_1
	sif false
		return
	changeblock 48, 26, $cf
	return

INCLUDE "maps/LaurelForestPokemonOnly_Triggers.ctf"
INCLUDE "maps/LaurelForestPokemonOnly_BlockingCharizard.ctf"
INCLUDE "maps/LaurelForestPokemonOnly_PikachuQuest.ctf"
INCLUDE "maps/LaurelForestPokemonOnly_CaterpieQuest.ctf"
INCLUDE "maps/LaurelForestPokemonOnly_CharmanderQuest.ctf"

TriggerFillPond:
	changeblock 48, 26, $85
	changeblock 46, 26, $5d
	changeblock 44, 26, $5d
	changeblock 44, 28, $5d
	changeblock 46, 28, $5d
	changeblock 46, 30, $5d
	changeblock 44, 30, $5d
	changeblock 44, 30, $5d
	changeblock 42, 30, $5d
	changeblock 40, 30, $5d
	changeblock 38, 30, $5d
	changeblock 36, 30, $5d
	changeblock 34, 26, $5d
	changeblock 36, 26, $5d
	changeblock 38, 26, $5d
	changeblock 40, 26, $5d
	changeblock 34, 28, $5d
	changeblock 36, 28, $5d
	changeblock 38, 28, $5d
	changeblock 40, 28, $5d
	changeblock 40, 32, $5d
	changeblock 42, 32, $5d
	changeblock 44, 32, $5d
	end

LaurelForestPokemonOnly_Item_GiantRock:
	db GIANT_ROCK, 1

LaurelForestPokemonOnly_Item_CuroShard:
	db CURO_SHARD, 1

LaurelForestOTName:
	db "Wild@F"
LaurelForestOTNameEnd:

LaurelForestPokemonOnlyGatekeepingClefairy:
	faceplayer
	opentext
	writetext .want_to_leave_text
	yesorno
	closetext
	sif false
		end
	callasm RemoveSecondPartyMember
	restorecustchar
	restoresecondpokemon
	clearflag ENGINE_POKEMON_MODE
	clearflag ENGINE_USE_TREASURE_BAG
	blackoutmod LAUREL_CITY
	warp LAUREL_FOREST_MAIN, 36, 4
	end

.want_to_leave_text
	db TX_COMPRESSED, $6f, $a4, $b9, $61, $9d, $3d, $06, $3a
	db $5a, $68

RemoveSecondPartyMember:
	ld hl, wPartyMonOT
	ld de, LaurelForestOTName
	ld c, LaurelForestOTNameEnd - LaurelForestOTName
	call StringCmp
	jr nz, .removesecond

	ld hl, wPartyMon2
	ld de, wPartyMon1
	ld bc, PARTYMON_STRUCT_LENGTH
	rst CopyBytes

	ld hl, wPartyMonOT + NAME_LENGTH
	ld de, wPartyMonOT
	ld bc, NAME_LENGTH
	rst CopyBytes

	ld hl, wPartyMonNicknames + PKMN_NAME_LENGTH
	ld de, wPartyMonNicknames
	ld bc, PKMN_NAME_LENGTH
	rst CopyBytes

	ld a, [wPartySpecies]
	ld b, a
	ld a, [wPartySpecies + 1]
	ld [wPartySpecies], a
	ld a, b
	jr .done

.removesecond
	ld a, [wPartySpecies + 1]
.done
	ld [hScriptVar], a
	ld a, $ff
	ld [wPartySpecies + 1], a
	ld a, 1
	ld [wPartyCount], a
	ld hl, PartyMon1HP
	ld a, [hli]
	or [hl]
	ret nz
	inc [hl]
	ret

LaurelForestPokemonOnly_NotEnoughRoomInParty:
	jumptext .text

.text
	db TX_COMPRESSED, $15, $d5, $23, $8f, $85, $67, $16, $10, $bf, $06
	db $47, $81, $05, $a5, $c1, $1a, $bb, $05
	db $c6, $9a

LaurelForestPokemonOnly_MapEventHeader ;filler
	db 0, 0

;warps
	db 4
	warp_def $38, $25, 1, LAUREL_FOREST_BEACH
	warp_def $39, $25, 2, LAUREL_FOREST_BEACH
	warp_def $5, $37, 1, LAUREL_FOREST_LAB
	warp_def $15, $30, 1, LAUREL_FOREST_CHARIZARD_CAVE

	;xy triggers
	db 6
	xy_trigger 0, 55, 06, $0, LaurelForestPokemonOnly_Pikachu_BerriesArentOutsideForest, EVENT_POKEONLY_PIKACHU_IN_PARTY
	xy_trigger 0, 55, 06, $0, LaurelForestPokemonOnly_Butterfree_NoWayBabyWanderedOutsideForest, EVENT_POKEONLY_MOTHERBUTTERFREE_IN_PARTY
	xy_trigger 0, 55, 06, $0, LaurelForestPokemonOnly_Caterpie_MommyIsntOutsideForest, EVENT_POKEONLY_CATERPIE_IN_PARTY
	xy_trigger 0, 06, 55, $0, LaurelForestPokemonOnly_Pikachu_BerriesArentInLab, EVENT_POKEONLY_PIKACHU_IN_PARTY
	xy_trigger 0, 06, 55, $0, LaurelForestPokemonOnly_Butterfree_NoWayBabyWanderedInsideLab, EVENT_POKEONLY_MOTHERBUTTERFREE_IN_PARTY
	xy_trigger 0, 06, 55, $0, LaurelForestPokemonOnly_Caterpie_MommyIsntInLab, EVENT_POKEONLY_CATERPIE_IN_PARTY

	;signposts
	db 1
	signpost 16, 27, SIGNPOST_READ, LaurelForestPokemonOnlyFlammableStump

	;people-events
	db 13
	person_event SPRITE_DRAGON, 10, 50, SPRITEMOVEDATA_00, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyBrainwashedCharizard, EVENT_POKEONLY_BRAINWASHED_CHARIZARD
	person_event SPRITE_CHARMANDER, 28, 50, SPRITEMOVEDATA_WANDER, 0, 0, -1, -1, PAL_OW_RED, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyCharmander, EVENT_POKEONLY_CHARMANDER_PUSHED_BOULDER_2
	person_event SPRITE_BUTTERFREE, 30, 12, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyMotherButterfree, EVENT_POKEONLY_MOTHERBUTTERFREE_IN_PARTY
	person_event SPRITE_METAPOD, 31, 14, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyRescuedMetapod, EVENT_POKEONLY_METAPOD_NOT_IN_NEST
	person_event SPRITE_CATERPIE, 52, 34, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyCaterpie, EVENT_POKEONLY_CATERPIE_PICKED_UP
	person_event SPRITE_POKE_BALL, 15, 4, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 0, LaurelForestPokemonOnly_Item_CuroShard, EVENT_LAUREL_POKEMONONLY_CUROSHARD
	person_event SPRITE_FRUIT_TREE, 57, 22, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyFruitTree, -1
	person_event SPRITE_PIKACHU, 51, 47, SPRITEMOVEDATA_WANDER, 0, 0, -1, -1, PAL_OW_YELLOW, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyPikachu, EVENT_POKEONLY_PIKACHU_IN_PARTY
	person_event SPRITE_BUTTERFREE, 32, 14, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_BLUE, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyRescuedButterfree, EVENT_POKEONLY_CHILD_BUTTERFREE_NOT_IN_NEST
	person_event SPRITE_FAIRY, 56, 2, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyGatekeepingClefairy, -1
	person_event SPRITE_POKE_BALL, 24, 12, SPRITEMOVEDATA_ITEM_TREE, 0, 0, -1, -1, PAL_OW_PURPLE, PERSONTYPE_ITEMBALL, 0, LaurelForestPokemonOnly_Item_GiantRock, EVENT_LAUREL_POKEMONONLY_BOULDER_1
	person_event SPRITE_FIRE, 16, 27, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, 0, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyFire, EVENT_POKEONLY_FIRE_OUT
	person_event SPRITE_CATERPIE, 30, 14, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_OW_GREEN, PERSONTYPE_SCRIPT, 0, LaurelForestPokemonOnlyRescuedCaterpie, EVENT_POKEONLY_CATERPIE_NOT_IN_NEST

