ORAS drain rate

This commit is contained in:
Bassoonian 2023-12-08 12:03:16 +01:00
parent 1e0b895ecb
commit ffb16c0dd5
2 changed files with 11 additions and 6 deletions

View File

@ -15,12 +15,11 @@
// Berry settings
// These generational defines only make a distinction for Berries!
#define GEN_6_XY GEN_6
#define GEN_6_ORAS (GEN_6 + 0.5)
#define GEN_6_ORAS GEN_LATEST + 1
#define OW_BERRY_MUTATIONS FALSE // If enabled, Berry plants can mutate based on berries planted next to them.
#define OW_BERRY_MOISTURE FALSE // If enabled, Berry watering is not a matter of watering it once per stage, but rather of keeping the soil moist.
#define OW_BERRY_ALWAYS_WATERABLE FALSE // If OW_BERRY_MOISTURE is enabled, this setting allows the player to continuously water soil; dry soil will cause a decrease in Berry Yield (like Gen4). When off, soil can only be watered when dry and watering increases yield (like Gen6).
#define OW_BERRY_VARIABLE_DRAIN_RATE FALSE // If OW_BERRY_MOISTURE is enabled, this setting uses the Gen4 drain rates for different berries.
#define OW_BERRY_MULCH_USAGE FALSE // If enabled, Mulch can be used on soil to fertilize it. Otherwise, it is considered unusable. Note that moisture effects only work with OW_BERRY_MOISTURE enabled!
#define OW_BERRY_WEEDS FALSE // If enabled, weeds may grow on Berry plants that the player needs to take care of. Without OW_BERRY_MOISTURE, weeding bonuses are rounded down.
#define OW_BERRY_PESTS FALSE // If enabled, pests may approach Berry plants that the player needs to take care of. Without OW_BERRY_MOISTURE, pest bonuses are rounded down.
@ -28,6 +27,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.
// Out-of-battle Ability effects
#define OW_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same Nature, as opposed to 50% previously. Stationary Pokémon are excluded in Gen3. In Gen6, all No Eggs Discovered gift Pokémon will have the same Nature, while in Gen7 all gift Pokémon will, regardless of Egg Group - In Gen 8, no gift Pokémon are affected. In Gen9, this ability has no out-of-battle effect.

View File

@ -170,16 +170,21 @@ static const u8 sBerryDescriptionPart2_Kee[] = _("first, then extremely bitter."
static const u8 sBerryDescriptionPart1_Maranga[] = _("Its outside is very bitter, but its");
static const u8 sBerryDescriptionPart2_Maranga[] = _("inside tastes like a sweet drink.");
#if OW_BERRY_GROWTH_RATE < GEN_3 || OW_BERRY_GROWTH_RATE > GEN_7
// Check include/config/overworld.h configs and throw an error if illegal
#if OW_BERRY_GROWTH_RATE < GEN_3 || (OW_BERRY_GROWTH_RATE > GEN_7 && OW_BERRY_GROWTH_RATE != GEN_6_ORAS)
#error "OW_BERRY_GROWTH_RATE must be between GEN_3 and GEN_7!"
#endif
#if OW_BERRY_YIELD_RATE < GEN_3 || OW_BERRY_YIELD_RATE > GEN_6
#if OW_BERRY_YIELD_RATE < GEN_3 || (OW_BERRY_YIELD_RATE > GEN_6 && OW_BERRY_GROWTH_RATE != GEN_6_ORAS)
#error "OW_BERRY_YIELD_RATE must be between GEN_3 and GEN_6!"
#elif OW_BERRY_YIELD_RATE == GEN_5
#error "OW_BERRY_YIELD_RATE can not be GEN_5!"
#endif
#if OW_BERRY_MOISTURE && OW_BERRY_DRAIN_RATE != GEN_4 && OW_BERRY_DRAIN_RATE != GEN_6_XY && OW_BERRY_DRAIN_RATE != GEN_6_ORAS
#error "OW_BERRY_DRAIN_RATE must be GEN_5, GEN_6_XY or GEN_6_ORAS!"
#endif
#define GROWTH_DURATION(g3, g4, g5, xy, oras, g7) OW_BERRY_GROWTH_RATE == GEN_3 ? g3 : OW_BERRY_GROWTH_RATE == GEN_4 ? g4 : OW_BERRY_GROWTH_RATE == GEN_5 ? g5 : OW_BERRY_GROWTH_RATE == GEN_6_XY ? xy : OW_BERRY_GROWTH_RATE == GEN_6_ORAS ? oras : g7
#define YIELD_RATE(g3, g4, xy, oras) GROWTH_DURATION(g3, g4, 0, xy, oras, 0)
@ -1991,7 +1996,7 @@ void BerryTreeTimeUpdate(s32 minutes)
{
if (OW_BERRY_MOISTURE)
{
drainVal = OW_BERRY_VARIABLE_DRAIN_RATE ? GetDrainRateByBerryType(tree->berry) : 4;
drainVal = (OW_BERRY_DRAIN_RATE == GEN_4) ? GetDrainRateByBerryType(tree->berry) : (OW_BERRY_DRAIN_RATE == GEN_6_XY) ? 4 : 25;
if (OW_BERRY_MULCH_USAGE)
{
if (tree->mulch == ITEM_TO_MULCH(ITEM_GROWTH_MULCH))
@ -2012,7 +2017,7 @@ void BerryTreeTimeUpdate(s32 minutes)
tree->moistureLevel = 0;
else
tree->moistureLevel -= drainVal;
if (!OW_BERRY_VARIABLE_DRAIN_RATE && tree->moistureLevel <= 4) // Without variable drain rate (and without mulches), this needs to trigger after 24 hours, hence the extra check
if (OW_BERRY_DRAIN_RATE == GEN_6_XY && tree->moistureLevel <= 4) // Without variable drain rate (and without mulches), this needs to trigger after 24 hours, hence the extra check
tree->moistureLevel = 0;
}
if (tree->moistureClock == 120)