StdScripts::
	dba PokeCenterNurseScript
	dba DifficultBookshelfScript
	dba PictureBookshelfScript
	dba MagazineBookshelfScript
	dba FastCurrentScript
	dba MerchandiseShelfScript
	dba TownMapScript
	dba MiningScript
	dba JumpingShoesScript
	dba HomepageScript
	dba SmeltingScript
	dba JewelingScript
	dba TrashCanScript
	dba StrengthBoulderScript
	dba SmashRockScript
	dba PokeCenterSignScript
	dba MartSignScript
	dba GenericDummyScript
	dba GenericDummyScript
	dba ElevatorButtonScript
	dba DayToTextScript
	dba InitializeEventsScript
	dba GymStatue1Script
	dba GymStatue2Script
	dba ReceiveItemScript
	dba ReceiveTogepiEggScript
	dba PCScript
	dba GameCornerCoinVendorScript
	dba HappinessCheckScript
	dba FieldMovePokepicScript

PokeCenterNurseScript:
; EVENT_WELCOMED_TO_POKECOM_CENTER is never set

	opentext
	checknite
	sif true, then
		farwritetext NurseNiteText
	selse
		checkmorn
		sif true, then
			farwritetext NurseMornText
		selse
			farwritetext NurseDayText
		sendif
	sendif
	buttonsound
	; only do this once
	farwritetext NurseAskHealText
	yesorno
	sif true, then
		farwritetext NurseTakePokemonText
		pause 20
		spriteface LAST_TALKED, LEFT
		pause 10
		special HealParty
		writebyte 0 ; Machine is at a Pokemon Center
		special HealMachineAnim
		waitsfx
		spriteface LAST_TALKED, DOWN
		pause 10
		special SpecialCheckPokerus
		sif true, then
			; already cleared earlier in the script
			setflag ENGINE_POKERUS
			farjumptext NursePokerusText
		sendif
		farwritetext NurseReturnPokemonText
		pause 20
	sendif
	farwritetext NurseGoodbyeText
	spriteface LAST_TALKED, UP
	pause 10
	spriteface LAST_TALKED, DOWN
	pause 10
	endtext

DifficultBookshelfScript:
	farjumptext DifficultBookshelfText

PictureBookshelfScript:
	farjumptext PictureBookshelfText

MagazineBookshelfScript:
	farjumptext MagazineBookshelfText

FastCurrentScript:
	farjumptext FastCurrentText

MerchandiseShelfScript:
	farjumptext MerchandiseShelfText

TownMapScript:
	opentext
	farwritetext TownMapText
	waitbutton
	special Special_TownMap
	closetext
	end

JumpingShoesScript:
	checkevent EVENT_JUMPING_SHOES
	sif false
		end
	playsound SFX_JUMP_OVER_LEDGE
	checkcode VAR_FACING
	anonjumptable
	dw .jumpDown
	dw .jumpUp
	dw .jumpLeft
	dw .jumpRight

.jumpDown
	applymovement 0, .jumpDownMove
	end

.jumpUp
	applymovement 0, .jumpUpMove
	end

.jumpLeft
	applymovement 0, .jumpLeftMove
	end

.jumpRight
	applymovement 0, .jumpRightMove
	end

.jumpDownMove:
	jump_step_down
	step_end

.jumpUpMove:
	jump_step_up
	step_end

.jumpLeftMove:
	jump_step_left
	step_end

.jumpRightMove:
	jump_step_right
	step_end

HomepageScript:
	farjumptext HomepageText

TrashCanScript:
	farjumptext TrashCanText

PCScript:
	opentext
	special PokemonCenterPC
	closetext
	end

ElevatorButtonScript:
	playsound SFX_READ_TEXT_2
	pause 15
	playsound SFX_ELEVATOR_END
	end

StrengthBoulderScript:
	farjump AskStrengthScript

SmashRockScript:
	farjump AskRockSmashScript

PokeCenterSignScript:
	farjumptext PokeCenterSignText

MartSignScript
	farjumptext MartSignText

DayToTextScript:
	checkcode VAR_WEEKDAY
	scriptstartasm
	ld a, [hScriptVar]
	ld hl, .day_offsets
	ld b, 0
	ld c, a
	add hl, bc
	ld c, [hl]
	ld hl, .day_names
	add hl, bc
	ld de, wStringBuffer3
	jr .handle_loop
.loop
	ld [de], a
	inc de
.handle_loop
	ld a, [hli]
	cp "@"
	jr nz, .loop
	ld hl, .day_text
	ld c, 4 ;b is still 0
	rst CopyBytes
	ld hl, 0
	ret
	
.day_names
	db "Sun@Mon@Tues@Wednes@Thurs@Fri@Satur@"
.day_offsets
	db 0, 4, 8, 13, 20, 26, 30
.day_text
	db "day@"

;PRISM: This needs a couple
InitializeEventsScript:
	wildoff
	setevent EVENT_NO_POKEDEX_YET
	setevent EVENT_LAUREL_CITY_HIDDEN_TOTODILE
	setevent EVENT_BROOKLYN_NOT_IN_FOREST
	setevent EVENT_AGGRON_NOT_IN_MAGMA
	setevent EVENT_MAGMA_POLICE
	setevent EVENT_NOBU_NOT_IN_HOUSE
	setevent EVENT_SAXIFRAGE_LIGHT_OFF_1
	setevent EVENT_SAXIFRAGE_LIGHT_OFF_2
	setevent EVENT_SAXIFRAGE_LIGHT_OFF_3
	setevent EVENT_BLUE_NOT_ON_FIRST_FLOOR
	setevent EVENT_PHLOX_LAB_OFFICER
	setevent EVENT_FAMBACO
	setevent EVENT_INITIALIZED_EVENTS
	return

GymStatue1Script:
	mapnametotext $0
	farjumptext GymStatue_CityGymText

GymStatue2Script:
	mapnametotext $0
	opentext
	farwritetext GymStatue_CityGymText
	buttonsound
	farjumptext GymStatue_WinningTrainersText

ReceiveItemScript:
	waitsfx
	farwritetext STDReceivedItemText
	playwaitsfx SFX_ITEM
	end

ReceiveTogepiEggScript:
	waitsfx
	farwritetext STDReceivedItemText
	playwaitsfx SFX_GET_EGG_FROM_DAYCARE_LADY
	end

GameCornerCoinVendorScript:
	faceplayer
	opentext
	farwritetext CoinVendor_WelcomeText
	buttonsound
	checkitem COIN_CASE
	sif false
		farjumptext CoinVendor_NoCoinCaseText
	farwritetext CoinVendor_IntroText
.loop
	special Special_DisplayMoneyAndCoinBalance
	loadmenudata .MenuDataHeader
	verticalmenu
	closewindow
	sif >, 2
.cancel
		farjumptext CoinVendor_CancelText
	anonjumptable
	dw .cancel
	dw .Buy50
	dw .Buy500

.Buy50
	checkcoins 9949
	sif false
		farjumptext CoinVendor_CoinCaseFullText
	checkmoney $0, 1000
	sif =, 2
		farjumptext CoinVendor_NotEnoughMoneyText
	givecoins 50
	takemoney $0, 1000
	waitsfx
	playsound SFX_TRANSACTION
	farwritetext CoinVendor_Buy50CoinsText
	jump .loop

.Buy500
	checkcoins 9499
	sif false
		farjumptext CoinVendor_CoinCaseFullText
	checkmoney $0, 10000
	sif =, 2
		farjumptext CoinVendor_NotEnoughMoneyText
	givecoins 500
	takemoney $0, 10000
	waitsfx
	playsound SFX_TRANSACTION
	farwritetext CoinVendor_Buy500CoinsText
	jump .loop

.MenuDataHeader
	db $40 ; flags
	db 04, 00 ; start coords
	db 11, 15 ; end coords
	dw .MenuData2
	db 1 ; default option

.MenuData2
	db $80 ; flags
	db 3 ; items
	db " 50 :  ¥1000@"
	db "500 : ¥10000@"
	db "CANCEL@"

HappinessCheckScript:
	faceplayer
	opentext
	special GetFirstPokemonHappiness
	sif <, 50
		farjumptext HappinessText1
	sif <, 150
		farjumptext HappinessText2
	farjumptext HappinessText3

MiningScript:
	farjump Mining

SmeltingScript:
	farjump Smelting

JewelingScript:
	farjump Jeweling

TalkToTrainerScript::
	faceplayer
	trainerflagaction CHECK_FLAG
	sif true
		scripttalkafter
	loadmemtrainer
	encountermusic
	jump StartBattleWithMapTrainerScript

SeenByTrainerScript::
	loadmemtrainer
	encountermusic
	showemote EMOTE_SHOCK, LAST_TALKED, 30, 0
	callasm TrainerWalkToPlayer
	applymovement2 MovementBuffer
	writepersonxy LAST_TALKED
	faceperson PLAYER, LAST_TALKED
	; fallthrough

StartBattleWithMapTrainerScript:
	opentext
	trainertext $0
	waitbutton
	closetext
	loadmemtrainer
	startbattle
	reloadmapafterbattle
	trainerflagaction SET_FLAG
	callasm FreezeTrainerFacing
	loadvar wRunningTrainerBattleScript, -1
	scripttalkafter
