Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds OW_BERRY_IMMORTAL #5187

Merged
merged 9 commits into from
Aug 20, 2024
Merged
1 change: 1 addition & 0 deletions include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define OW_BERRY_GROWTH_RATE GEN_3 // Presets for how long each Berry plant takes to grow.
#define OW_BERRY_YIELD_RATE GEN_3 // Presets for how many Berries each plant can yield.
#define OW_BERRY_DRAIN_RATE GEN_6_ORAS // If OW_BERRY_MOISTURE is enabled, this setting changes how fast the soil dries out. GEN_4 uses a Berry-dependent drain rate, GEN_6_XY dries out in 24 hours (4 hours with the relevant Mulch) and GEN_6_ORAS dries out in 4 hours. Other values are illegal.
#define OW_BERRY_IMMORTAL FALSE // If enabled, once a Berry tree has grown a Berry, the tree will not disappear until picked by the player.

// Overworld Pokémon
#define OW_POKEMON_OBJECT_EVENTS TRUE // Adds Object Event fields for every species. Can be used for NPCs using the OBJ_EVENT_GFX_SPECIES macro (eg. OBJ_EVENT_GFX_SPECIES(BULBASAUR))
Expand Down
8 changes: 5 additions & 3 deletions src/berry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,8 @@ bool32 BerryTreeGrow(struct BerryTree *tree)
tree->stage = BERRY_STAGE_BERRIES;
break;
case BERRY_STAGE_BERRIES:
if (OW_BERRY_IMMORTAL)
break;
tree->watered = 0;
tree->berryYield = 0;
tree->stage = BERRY_STAGE_SPROUTED;
Expand All @@ -1842,16 +1844,16 @@ static u16 GetMulchAffectedGrowthRate(u16 berryDuration, u8 mulch, u8 stage)
void BerryTreeTimeUpdate(s32 minutes)
{
int i;
u8 drainVal;
u32 drainVal;
struct BerryTree *tree;

for (i = 0; i < BERRY_TREES_COUNT; i++)
{
tree = &gSaveBlock1Ptr->berryTrees[i];

if (tree->berry && tree->stage && !tree->stopGrowth)
if (tree->berry && tree->stage && !tree->stopGrowth && (!OW_BERRY_IMMORTAL || tree->stage != BERRY_STAGE_BERRIES))
{
if (minutes >= GetStageDurationByBerryType(tree->berry) * 71)
if ((!OW_BERRY_IMMORTAL) && (minutes >= GetStageDurationByBerryType(tree->berry) * 71))
{
*tree = gBlankBerryTree;
}
Expand Down
Loading