mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
f98a95b8ee
These are by far not always checked each week, and as such shouldn't be called that. Since they're almost always used through the `bit` instruction, it's very inconvenient to just make wDailyFlags a `dw` instead.
118 lines
1.7 KiB
NASM
118 lines
1.7 KiB
NASM
FruitTreeScript::
|
|
callasm GetCurTreeFruit
|
|
opentext
|
|
copybytetovar wCurFruit
|
|
itemtotext USE_SCRIPT_VAR, MEM_BUFFER_0
|
|
writetext FruitBearingTreeText
|
|
buttonsound
|
|
callasm TryResetFruitTrees
|
|
callasm CheckFruitTree
|
|
iffalse .fruit
|
|
writetext NothingHereText
|
|
waitbutton
|
|
jump .end
|
|
|
|
.fruit
|
|
writetext HeyItsFruitText
|
|
copybytetovar wCurFruit
|
|
giveitem ITEM_FROM_MEM
|
|
iffalse .packisfull
|
|
buttonsound
|
|
writetext ObtainedFruitText
|
|
callasm PickedFruitTree
|
|
specialsound
|
|
itemnotify
|
|
jump .end
|
|
|
|
.packisfull
|
|
buttonsound
|
|
writetext FruitPackIsFullText
|
|
waitbutton
|
|
|
|
.end
|
|
closetext
|
|
end
|
|
|
|
GetCurTreeFruit:
|
|
ld a, [wCurFruitTree]
|
|
dec a
|
|
call GetFruitTreeItem
|
|
ld [wCurFruit], a
|
|
ret
|
|
|
|
TryResetFruitTrees:
|
|
ld hl, wDailyFlags1
|
|
bit DAILYFLAGS1_ALL_FRUIT_TREES_F, [hl]
|
|
ret nz
|
|
jp ResetFruitTrees
|
|
|
|
CheckFruitTree:
|
|
ld b, 2
|
|
call GetFruitTreeFlag
|
|
ld a, c
|
|
ld [wScriptVar], a
|
|
ret
|
|
|
|
PickedFruitTree:
|
|
farcall StubbedTrainerRankings_FruitPicked
|
|
ld b, 1
|
|
jp GetFruitTreeFlag
|
|
|
|
ResetFruitTrees:
|
|
xor a
|
|
ld hl, wFruitTreeFlags
|
|
ld [hli], a
|
|
ld [hli], a
|
|
ld [hli], a
|
|
ld [hl], a
|
|
ld hl, wDailyFlags1
|
|
set DAILYFLAGS1_ALL_FRUIT_TREES_F, [hl]
|
|
ret
|
|
|
|
GetFruitTreeFlag:
|
|
push hl
|
|
push de
|
|
ld a, [wCurFruitTree]
|
|
dec a
|
|
ld e, a
|
|
ld d, 0
|
|
ld hl, wFruitTreeFlags
|
|
call FlagAction
|
|
pop de
|
|
pop hl
|
|
ret
|
|
|
|
GetFruitTreeItem:
|
|
push hl
|
|
push de
|
|
ld e, a
|
|
ld d, 0
|
|
ld hl, FruitTreeItems
|
|
add hl, de
|
|
ld a, [hl]
|
|
pop de
|
|
pop hl
|
|
ret
|
|
|
|
INCLUDE "data/items/fruit_trees.asm"
|
|
|
|
FruitBearingTreeText:
|
|
text_jump _FruitBearingTreeText
|
|
db "@"
|
|
|
|
HeyItsFruitText:
|
|
text_jump _HeyItsFruitText
|
|
db "@"
|
|
|
|
ObtainedFruitText:
|
|
text_jump _ObtainedFruitText
|
|
db "@"
|
|
|
|
FruitPackIsFullText:
|
|
text_jump _FruitPackIsFullText
|
|
db "@"
|
|
|
|
NothingHereText:
|
|
text_jump _NothingHereText
|
|
db "@"
|