	const_def 2 ; object constants
	const BLACK_POND_FISHER
	const BLACK_POND_MERCHANT_WIFE
	const BLACK_POND_DEALER
	const BLACK_POND_DEALER_EEVEE

BlackPondCreek_MapScripts:
	db 0 ; scene scripts
        db 3 ; callbacks
	callback MAPCALLBACK_NEWMAP, .FlyPoint
	callback MAPCALLBACK_TILES, .CollapseBridge
	callback MAPCALLBACK_OBJECTS, .InitObjectsCallback

.FlyPoint:
	setflag ENGINE_FLYPOINT_BLACKPOND
	return

.InitObjectsCallback:
	checkevent EVENT_GOT_EEVEE
	iftrue .HideEevee
	checkevent EVENT_BEAT_BLAKE
	iftrue .HideDealer
	checktime NITE
	iftrue .ShowDealer
.HideEevee:
	disappear BLACK_POND_DEALER_EEVEE
	; FALLTHROUGH
.HideDealer:
	disappear BLACK_POND_DEALER
	return

.ShowDealer:
	appear BLACK_POND_DEALER
	appear BLACK_POND_DEALER_EEVEE
	return

; Replace bridge blocks by collapsed ones until it's fixed, so the player
; cannot cross the river
.CollapseBridge:
	checkevent EVENT_BRIDGE_FIXED
	iftrue .Skip
	changeblock 26, 10, $39
	changeblock 26, 12, $31
.Skip:
	return

BlackPondFisherScript:
	faceplayer BLACK_POND_FISHER
	opentext
	writetext .Text
	waitbutton
	closetext
	turnobject BLACK_POND_FISHER, RIGHT
	end

.Text:
	text "I miss the good"
	line "old time."
	para "Sailing overseas"
	line "fishing #MON…"
	para "<…>"
	para "I want to eat a"
	line "Goldeen now!"
	done

BlackPondMerchantWifeScript:
	faceplayer BLACK_POND_MERCHANT_WIFE
	opentext
	checkevent EVENT_BLACKPOND_PRICES_HIGH
	iftrue .YellAtHusband

.HelloThere:
	writetext .CasualText
	waitbutton
	closetext
	end

.YellAtHusband:
	writetext .YellText
	waitbutton
	closetext
	follow BLACK_POND_MERCHANT_WIFE, PLAYER
	applymovement BLACK_POND_MERCHANT_WIFE, .BackToShop
	stopfollow
	disappear BLACK_POND_MERCHANT_WIFE
	setmapscene BLACK_POND_SHOP, SCENE_BLACK_POND_SHOP_WIFE_BACK
	warp BLACK_POND_SHOP, 1, 5
        end

.BackToShop:
	step LEFT
	rept 3
		step UP
		endr
	step_end

.CasualText:
	text "My husband and I"
	line "sell stuff we find"
	cont "on the floor, or"
	cont "buy from the farm"
	cont "across the bridge."
	para "Go take a look!"
	done

.YellText:
	text "Did you check the"
	line "items at the shop?"
	para "<…>"
	para "HOW MUCH?!"
	done

BlackPondDealerScript:
	faceplayer BLACK_POND_DEALER
	opentext
	checkevent EVENT_MET_ENORA
	iftrue .WantBattle
	writetext .EeveeOfferText
	special PlaceMoneyTopRight
	yesorno
	iftrue .StealMoney
	writetext .MoveOutText
	waitbutton
	closetext
	end

.WantBattle:
	writetext .WantBattleText
	waitbutton
	winlosstext BlackPondDealerWinText, BlackPondDealerLossText
	loadtrainer GRUNTM, BLAKE
	startbattle
	dontrestartmapmusic
	reloadmapafterbattle
	opentext
	writetext .AfterBattleText
	waitbutton
	closetext
	special FadeBlackQuickly
	disappear BLACK_POND_DEALER
	special FadeInQuickly
	setevent EVENT_BEAT_BLAKE
	end

.StealMoney:
	checkmoney YOUR_MONEY, 100000
	ifequal HAVE_LESS, .NotEnoughMoney
	takemoney YOUR_MONEY, 100000
	waitbutton
	writetext .StealMoneyText
	jump .done

.NotEnoughMoney:
	writetext .NotEnoughMoneyText
.done:
	waitbutton
	closetext
	end

.WantBattleText:
	text "Hey, if you don't"
	line "wanna buy, move!"
	para "What? You wanna"
	line "fight?"
	para "HAHAHAHAHAHA"
	para "I'll kick your"
	line "ass!"
	done

.AfterBattleText:
	text "You junk!"
	para "I'll report that"
	line "to the gang!"
	para "This is not over!"
	done

.EeveeOfferText:
	text "Hey pssst<…>"
	para "Want an EEVEE?"
	line "It's only 100000¥?"
	done

.MoveOutText:
	text "THEN MOVE OUT!!"
	done

.NotEnoughMoneyText:
	text "You don't have the"
	line "cash, move out!"
	done

.StealMoneyText:
	text "Hehehe<…>"
	line "The EEVEE?"
	para "I have the money!"
	line "Why would I give"
	cont "it to you?"
	done

BlackPondEeveeScript:
	opentext
	cry EEVEE
	writetext .BlackPondEeveeText
	yesorno
	iffalse .done
	checkcode VAR_PARTYCOUNT
	ifequal PARTY_LENGTH, .partyfull
	givepoke EEVEE, 30, EVERSTONE
	disappear BLACK_POND_DEALER_EEVEE
.done:
	closetext
	end

.partyfull:
        writetext .AnotherMonText
        waitbutton
        closetext
        end

.BlackPondEeveeText:
	text "This EEVEE seems"
	line "very lonely."
	para "Take it with you?"
	done

.AnotherMonText:
        text "You can't carry"
        line "another #MON…"
        done

BlackPondDealerWinText:
	text "What the<…>?"
	done
BlackPondDealerLossText:
	text "Boom!"
	line "Now piss off!"
	done

BlackPondCreek_MapEvents:
	db 0, 0 ; filler

	db 6 ; warp events
	warp_event  4,  6, BLACK_POND_GATE, 3
	warp_event  4,  7, BLACK_POND_GATE, 4
	warp_event 15,  3, BLACK_POND_NURSERY, 1
	warp_event 11,  5, BLACK_POND_SHOP, 1
	warp_event 21,  9, BLACK_POND_CONTAINER, 1
	warp_event 15, 15, BLACK_POND_FISHER_HOUSE, 1

	db 0 ; coord events

	db 0 ; bg events

	db 4 ; object events
	object_event 25, 17, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, BlackPondFisherScript, 0
	object_event 12,  7, SPRITE_TEACHER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 2, 3, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, BlackPondMerchantWifeScript, EVENT_BLACKPOND_SHOP_WIFE_OUTSIDE_VISIBLE
	object_event  6,  3, SPRITE_SAILOR, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, BlackPondDealerScript, EVENT_BLACKPOND_DEALER_VISIBLE
	object_event  7,  2, SPRITE_EEVEE, SPRITEMOVEDATA_POKEMON, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, BlackPondEeveeScript, EVENT_BLACKPOND_EEVEE_VISIBLE
