#include "global.h" #include "berry.h" #include "event_data.h" #include "event_object_movement.h" #include "event_scripts.h" #include "field_control_avatar.h" #include "fieldmap.h" #include "item.h" #include "item_menu.h" #include "main.h" #include "random.h" #include "script_pokemon_util.h" #include "string_util.h" #include "text.h" #include "constants/event_object_movement.h" #include "constants/items.h" static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry); static u16 BerryTypeToItemId(u16 berry); static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree); static u8 GetNumStagesWateredByBerryTreeId(u8 id); static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water); static u8 CalcBerryYield(struct BerryTree *tree); static u8 GetBerryCountByBerryTreeId(u8 id); static u16 GetStageDurationByBerryType(u8); static u16 GetDrainRateByBerryType(u8); static void SetTreeMutations(u8 id, u8 berry); static u8 GetTreeMutationValue(u8 id); static u16 GetBerryPestSpecies(u8 berryId); static void TryForWeeds(struct BerryTree *tree); static void TryForPests(struct BerryTree *tree); //.rodata static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers."); static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red Berry is very spicy."); static const u8 sBerryDescriptionPart1_Chesto[] = _("The Berry's thick skin and fruit are"); static const u8 sBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over."); static const u8 sBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious."); static const u8 sBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care."); static const u8 sBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,"); static const u8 sBerryDescriptionPart2_Rawst[] = _("the Berry seems to grow very bitter."); static const u8 sBerryDescriptionPart1_Aspear[] = _("The hard Berry is dense with a rich"); static const u8 sBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour."); static const u8 sBerryDescriptionPart1_Leppa[] = _("Grows slower than Cheri and others."); static const u8 sBerryDescriptionPart2_Leppa[] = _("The smaller the Berry, the tastier."); static const u8 sBerryDescriptionPart1_Oran[] = _("A peculiar Berry with a mix of flavors."); static const u8 sBerryDescriptionPart2_Oran[] = _("Berries grow in half a day."); static const u8 sBerryDescriptionPart1_Persim[] = _("Loves sunlight. The Berry's color"); static const u8 sBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun."); static const u8 sBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving"); static const u8 sBerryDescriptionPart2_Lum[] = _("care, it may grow two Berries."); static const u8 sBerryDescriptionPart1_Sitrus[] = _("Closely related to Oran. The large"); static const u8 sBerryDescriptionPart2_Sitrus[] = _("Berry has a well-rounded flavor."); static const u8 sBerryDescriptionPart1_Figy[] = _("The Berry, which looks chewed up,"); static const u8 sBerryDescriptionPart2_Figy[] = _("brims with spicy substances."); static const u8 sBerryDescriptionPart1_Wiki[] = _("The Berry is said to have grown lumpy"); static const u8 sBerryDescriptionPart2_Wiki[] = _("to help Pokémon grip it."); static const u8 sBerryDescriptionPart1_Mago[] = _("The Berry turns curvy as it grows."); static const u8 sBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier."); static const u8 sBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its"); static const u8 sBerryDescriptionPart2_Aguav[] = _("ability to grow without light."); static const u8 sBerryDescriptionPart1_Iapapa[] = _("The Berry is very big and sour."); static const u8 sBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow."); static const u8 sBerryDescriptionPart1_Razz[] = _("The red Berry tastes slightly spicy."); static const u8 sBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours."); static const u8 sBerryDescriptionPart1_Bluk[] = _("The Berry is blue on the outside, but"); static const u8 sBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten."); static const u8 sBerryDescriptionPart1_Nanab[] = _("This Berry was the seventh"); static const u8 sBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet."); static const u8 sBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a"); static const u8 sBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour."); static const u8 sBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold."); static const u8 sBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour."); static const u8 sBerryDescriptionPart1_Pomeg[] = _("However much it is watered,"); static const u8 sBerryDescriptionPart2_Pomeg[] = _("it only grows up to six Berries."); static const u8 sBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root."); static const u8 sBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower."); static const u8 sBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in"); static const u8 sBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall."); static const u8 sBerryDescriptionPart1_Hondew[] = _("A Berry that is very valuable and"); static const u8 sBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious."); static const u8 sBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round"); static const u8 sBerryDescriptionPart2_Grepa[] = _("shape, the Berry is unimaginably sour."); static const u8 sBerryDescriptionPart1_Tamato[] = _("The Berry is lip-bendingly spicy."); static const u8 sBerryDescriptionPart2_Tamato[] = _("It takes time to grow."); static const u8 sBerryDescriptionPart1_Cornn[] = _("A Berry from an ancient era. May not"); static const u8 sBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity."); static const u8 sBerryDescriptionPart1_Magost[] = _("A Berry that is widely said to have"); static const u8 sBerryDescriptionPart2_Magost[] = _("a finely balanced flavor."); static const u8 sBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with"); static const u8 sBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter."); static const u8 sBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it"); static const u8 sBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days."); static const u8 sBerryDescriptionPart1_Spelon[] = _("The vividly red Berry is very spicy."); static const u8 sBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance."); static const u8 sBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere."); static const u8 sBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere."); static const u8 sBerryDescriptionPart1_Watmel[] = _("A huge Berry, with some over 20"); static const u8 sBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet."); static const u8 sBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so"); static const u8 sBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is."); static const u8 sBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but"); static const u8 sBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow."); static const u8 sBerryDescriptionPart1_Chilan[] = _("It can be made into a whistle that"); static const u8 sBerryDescriptionPart2_Chilan[] = _("produces an indescribable sound."); static const u8 sBerryDescriptionPart1_Occa[] = _("Said to grow in the tropics once,"); static const u8 sBerryDescriptionPart2_Occa[] = _("it boasts an intensely hot spiciness."); static const u8 sBerryDescriptionPart1_Passho[] = _("Its flesh is dotted with many tiny"); static const u8 sBerryDescriptionPart2_Passho[] = _("bubbles that keep it afloat in water."); static const u8 sBerryDescriptionPart1_Wacan[] = _("Energy drawn from lightning strikes"); static const u8 sBerryDescriptionPart2_Wacan[] = _("makes this Berry grow big and rich."); static const u8 sBerryDescriptionPart1_Rindo[] = _("This berry has a vegetable-like flavor,"); static const u8 sBerryDescriptionPart2_Rindo[] = _("but is rich in health-promoting fiber."); static const u8 sBerryDescriptionPart1_Yache[] = _("This Berry has a refreshing dry and"); static const u8 sBerryDescriptionPart2_Yache[] = _("sour flavor. Tastes better chilled."); static const u8 sBerryDescriptionPart1_Chople[] = _("Contains a substance that generates"); static const u8 sBerryDescriptionPart2_Chople[] = _("heat. Can even fire up a chilly heart."); static const u8 sBerryDescriptionPart1_Kebia[] = _("Brilliant green on the outside, inside"); static const u8 sBerryDescriptionPart2_Kebia[] = _("it is packed with black-colored flesh."); static const u8 sBerryDescriptionPart1_Shuca[] = _("The sweet pulp has just the hint of a"); static const u8 sBerryDescriptionPart2_Shuca[] = _("a hard-edged and fragrant bite to it."); static const u8 sBerryDescriptionPart1_Coba[] = _("This Berry is said to be a cross of"); static const u8 sBerryDescriptionPart2_Coba[] = _("two Berries blown in from far away."); static const u8 sBerryDescriptionPart1_Payapa[] = _("Said to sense human emotions, it swells"); static const u8 sBerryDescriptionPart2_Payapa[] = _("roundly when a person approaches."); static const u8 sBerryDescriptionPart1_Tanga[] = _("It grows a flower at the tip that lures"); static const u8 sBerryDescriptionPart2_Tanga[] = _("Bug Pokémon with its stringy petals."); static const u8 sBerryDescriptionPart1_Charti[] = _("Often used for pickles because of its"); static const u8 sBerryDescriptionPart2_Charti[] = _("dry flavor. Sometimes eaten raw."); static const u8 sBerryDescriptionPart1_Kasib[] = _("Old superstitions say it has an odd"); static const u8 sBerryDescriptionPart2_Kasib[] = _("power. A popular good-luck charm."); static const u8 sBerryDescriptionPart1_Haban[] = _("Less bitter if enough of this Berry"); static const u8 sBerryDescriptionPart2_Haban[] = _("is boiled down. Makes a good jam."); static const u8 sBerryDescriptionPart1_Colbur[] = _("Tiny hooks on the surface latch onto"); static const u8 sBerryDescriptionPart2_Colbur[] = _("Pokémon to reach far-off places."); static const u8 sBerryDescriptionPart1_Babiri[] = _("Very tough with a strong flavor. It"); static const u8 sBerryDescriptionPart2_Babiri[] = _("was used to make medicine in the past."); static const u8 sBerryDescriptionPart1_Roseli[] = _("In nature, they grow in wide rings"); static const u8 sBerryDescriptionPart2_Roseli[] = _("for reasons that are still unknown."); static const u8 sBerryDescriptionPart1_Liechi[] = _("A mysterious Berry. It is rumored to"); static const u8 sBerryDescriptionPart2_Liechi[] = _("contain the power of the sea."); static const u8 sBerryDescriptionPart1_Ganlon[] = _("A mysterious Berry. It is rumored to"); static const u8 sBerryDescriptionPart2_Ganlon[] = _("contain the power of the land."); static const u8 sBerryDescriptionPart1_Salac[] = _("A mysterious Berry. It is rumored to"); static const u8 sBerryDescriptionPart2_Salac[] = _("contain the power of the sky."); static const u8 sBerryDescriptionPart1_Petaya[] = _("A mysterious Berry. It is rumored to"); static const u8 sBerryDescriptionPart2_Petaya[] = _("contain the power of all living things."); static const u8 sBerryDescriptionPart1_Apicot[] = _("A very mystifying Berry. No telling"); static const u8 sBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used."); static const u8 sBerryDescriptionPart1_Lansat[] = _("Said to be a legendary Berry."); static const u8 sBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy."); static const u8 sBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the"); static const u8 sBerryDescriptionPart2_Starf[] = _("world's edge. Considered a mirage."); static const u8 sBerryDescriptionPart1_Enigma[] = _("A completely enigmatic Berry."); static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars."); static const u8 sBerryDescriptionPart1_Micle[] = _("It makes other food eaten at the"); static const u8 sBerryDescriptionPart2_Micle[] = _("same time taste sweet."); static const u8 sBerryDescriptionPart1_Custap[] = _("The flesh underneath the Custap"); static const u8 sBerryDescriptionPart2_Custap[] = _("Berry's skin is sweet and creamy soft."); static const u8 sBerryDescriptionPart1_Jaboca[] = _("The drupelets that make up this berry"); static const u8 sBerryDescriptionPart2_Jaboca[] = _("pop rythmically if handled roughly."); static const u8 sBerryDescriptionPart1_Rowap[] = _("People once worked top-shaped pieces"); static const u8 sBerryDescriptionPart2_Rowap[] = _("of this berry free to use as toys."); static const u8 sBerryDescriptionPart1_Kee[] = _("A berry that is incredibly spicy at"); 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."); const struct Berry gBerries[] = { [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Cheri"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 20, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Cheri, .description2 = sBerryDescriptionPart2_Cheri, .growthDuration = 12, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 15, }, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = { .name = _("Chesto"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_PURPLE, .size = 80, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Chesto, .description2 = sBerryDescriptionPart2_Chesto, .growthDuration = 12, .spicy = 0, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 15, }, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Pecha"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_PINK, .size = 40, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Pecha, .description2 = sBerryDescriptionPart2_Pecha, .growthDuration = 12, .spicy = 0, .dry = 0, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 15, }, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = { .name = _("Rawst"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_GREEN, .size = 32, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Rawst, .description2 = sBerryDescriptionPart2_Rawst, .growthDuration = 12, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 10, .sour = 0, .smoothness = 25, .drainRate = 15, }, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = { .name = _("Aspear"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_YELLOW, .size = 50, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Aspear, .description2 = sBerryDescriptionPart2_Aspear, .growthDuration = 12, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 0, .sour = 10, .smoothness = 25, .drainRate = 15, }, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Leppa"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_RED, .size = 28, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Leppa, .description2 = sBerryDescriptionPart2_Leppa, .growthDuration = 16, .spicy = 10, .dry = 0, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 15, }, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Oran"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_BLUE, .size = 35, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Oran, .description2 = sBerryDescriptionPart2_Oran, .growthDuration = 12, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 15, }, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = { .name = _("Persim"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PINK, .size = 47, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Persim, .description2 = sBerryDescriptionPart2_Persim, .growthDuration = 12, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 15, }, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = { .name = _("Lum"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_GREEN, .size = 34, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Lum, .description2 = sBerryDescriptionPart2_Lum, .growthDuration = 48, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 8, }, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = { .name = _("Sitrus"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_YELLOW, .size = 95, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Sitrus, .description2 = sBerryDescriptionPart2_Sitrus, .growthDuration = 24, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 7, }, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = { .name = _("Figy"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 100, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Figy, .description2 = sBerryDescriptionPart2_Figy, .growthDuration = 24, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 10, }, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Wiki"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PURPLE, .size = 115, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Wiki, .description2 = sBerryDescriptionPart2_Wiki, .growthDuration = 24, .spicy = 0, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 10, }, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = { .name = _("Mago"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PINK, .size = 126, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Mago, .description2 = sBerryDescriptionPart2_Mago, .growthDuration = 24, .spicy = 0, .dry = 0, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 25, .drainRate = 10, }, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = { .name = _("Aguav"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_GREEN, .size = 64, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Aguav, .description2 = sBerryDescriptionPart2_Aguav, .growthDuration = 24, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 10, .sour = 0, .smoothness = 25, .drainRate = 10, }, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Iapapa"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_YELLOW, .size = 223, .maxYield = 3, .minYield = 2, .description1 = sBerryDescriptionPart1_Iapapa, .description2 = sBerryDescriptionPart2_Iapapa, .growthDuration = 24, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 0, .sour = 10, .smoothness = 25, .drainRate = 10, }, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = { .name = _("Razz"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_RED, .size = 120, .maxYield = 6, .minYield = 3, .description1 = sBerryDescriptionPart1_Razz, .description2 = sBerryDescriptionPart2_Razz, .growthDuration = 4, .spicy = 10, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 20, .drainRate = 35, }, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = { .name = _("Bluk"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_PURPLE, .size = 108, .maxYield = 6, .minYield = 3, .description1 = sBerryDescriptionPart1_Bluk, .description2 = sBerryDescriptionPart2_Bluk, .growthDuration = 4, .spicy = 0, .dry = 10, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 20, .drainRate = 35, }, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = { .name = _("Nanab"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_PINK, .size = 77, .maxYield = 6, .minYield = 3, .description1 = sBerryDescriptionPart1_Nanab, .description2 = sBerryDescriptionPart2_Nanab, .growthDuration = 4, .spicy = 0, .dry = 0, .sweet = 10, .bitter = 10, .sour = 0, .smoothness = 20, .drainRate = 35, }, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = { .name = _("Wepear"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_GREEN, .size = 74, .maxYield = 6, .minYield = 3, .description1 = sBerryDescriptionPart1_Wepear, .description2 = sBerryDescriptionPart2_Wepear, .growthDuration = 4, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 35, }, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = { .name = _("Pinap"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_YELLOW, .size = 80, .maxYield = 6, .minYield = 3, .description1 = sBerryDescriptionPart1_Pinap, .description2 = sBerryDescriptionPart2_Pinap, .growthDuration = 4, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 10, .smoothness = 20, .drainRate = 35, }, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = { .name = _("Pomeg"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_RED, .size = 135, .maxYield = 6, .minYield = 2, .description1 = sBerryDescriptionPart1_Pomeg, .description2 = sBerryDescriptionPart2_Pomeg, .growthDuration = 12, .spicy = 10, .dry = 0, .sweet = 10, .bitter = 10, .sour = 0, .smoothness = 20, .drainRate = 8, }, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = { .name = _("Kelpsy"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_BLUE, .size = 150, .maxYield = 6, .minYield = 2, .description1 = sBerryDescriptionPart1_Kelpsy, .description2 = sBerryDescriptionPart2_Kelpsy, .growthDuration = 12, .spicy = 0, .dry = 10, .sweet = 0, .bitter = 10, .sour = 10, .smoothness = 20, .drainRate = 8, }, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = { .name = _("Qualot"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_YELLOW, .size = 110, .maxYield = 6, .minYield = 2, .description1 = sBerryDescriptionPart1_Qualot, .description2 = sBerryDescriptionPart2_Qualot, .growthDuration = 12, .spicy = 10, .dry = 0, .sweet = 10, .bitter = 0, .sour = 10, .smoothness = 20, .drainRate = 8, }, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = { .name = _("Hondew"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_GREEN, .size = 162, .maxYield = 6, .minYield = 2, .description1 = sBerryDescriptionPart1_Hondew, .description2 = sBerryDescriptionPart2_Hondew, .growthDuration = 12, .spicy = 10, .dry = 10, .sweet = 0, .bitter = 10, .sour = 0, .smoothness = 20, .drainRate = 8, }, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Grepa"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_YELLOW, .size = 149, .maxYield = 6, .minYield = 2, .description1 = sBerryDescriptionPart1_Grepa, .description2 = sBerryDescriptionPart2_Grepa, .growthDuration = 12, .spicy = 0, .dry = 10, .sweet = 10, .bitter = 0, .sour = 10, .smoothness = 20, .drainRate = 8, }, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = { .name = _("Tamato"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 200, .maxYield = 4, .minYield = 2, .description1 = sBerryDescriptionPart1_Tamato, .description2 = sBerryDescriptionPart2_Tamato, .growthDuration = 24, .spicy = 20, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 30, .drainRate = 8, }, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Cornn"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PURPLE, .size = 75, .maxYield = 4, .minYield = 2, .description1 = sBerryDescriptionPart1_Cornn, .description2 = sBerryDescriptionPart2_Cornn, .growthDuration = 24, .spicy = 0, .dry = 20, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 30, .drainRate = 10, }, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = { .name = _("Magost"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PINK, .size = 140, .maxYield = 4, .minYield = 2, .description1 = sBerryDescriptionPart1_Magost, .description2 = sBerryDescriptionPart2_Magost, .growthDuration = 24, .spicy = 0, .dry = 0, .sweet = 20, .bitter = 10, .sour = 0, .smoothness = 30, .drainRate = 10, }, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Rabuta"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_GREEN, .size = 226, .maxYield = 4, .minYield = 2, .description1 = sBerryDescriptionPart1_Rabuta, .description2 = sBerryDescriptionPart2_Rabuta, .growthDuration = 24, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 20, .sour = 10, .smoothness = 30, .drainRate = 10, }, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = { .name = _("Nomel"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_YELLOW, .size = 285, .maxYield = 4, .minYield = 2, .description1 = sBerryDescriptionPart1_Nomel, .description2 = sBerryDescriptionPart2_Nomel, .growthDuration = 24, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 20, .smoothness = 30, .drainRate = 10, }, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = { .name = _("Spelon"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 133, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Spelon, .description2 = sBerryDescriptionPart2_Spelon, .growthDuration = 72, .spicy = 40, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 70, .drainRate = 8, }, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Pamtre"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_PURPLE, .size = 244, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Pamtre, .description2 = sBerryDescriptionPart2_Pamtre, .growthDuration = 72, .spicy = 0, .dry = 40, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 70, .drainRate = 8, }, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = { .name = _("Watmel"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_PINK, .size = 250, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Watmel, .description2 = sBerryDescriptionPart2_Watmel, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 40, .bitter = 10, .sour = 0, .smoothness = 70, .drainRate = 8, }, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Durin"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_GREEN, .size = 280, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Durin, .description2 = sBerryDescriptionPart2_Durin, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 40, .sour = 10, .smoothness = 70, .drainRate = 8, }, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Belue"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_PURPLE, .size = 300, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Belue, .description2 = sBerryDescriptionPart2_Belue, .growthDuration = 72, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 40, .smoothness = 70, .drainRate = 8, }, [ITEM_CHILAN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Chilan"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_YELLOW, .size = 34, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Chilan, .description2 = sBerryDescriptionPart2_Chilan, .growthDuration = 72, .spicy = 0, .dry = 25, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_OCCA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Occa"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_RED, .size = 90, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Occa, .description2 = sBerryDescriptionPart2_Occa, .growthDuration = 72, .spicy = 15, .dry = 0, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_PASSHO_BERRY - FIRST_BERRY_INDEX] = { .name = _("Passho"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_BLUE, .size = 33, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Passho, .description2 = sBerryDescriptionPart2_Passho, .growthDuration = 72, .spicy = 0, .dry = 15, .sweet = 0, .bitter = 10, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_WACAN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Wacan"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_YELLOW, .size = 250, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Wacan, .description2 = sBerryDescriptionPart2_Wacan, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 15, .bitter = 0, .sour = 10, .smoothness = 30, .drainRate = 6, }, [ITEM_RINDO_BERRY - FIRST_BERRY_INDEX] = { .name = _("Rindo"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_GREEN, .size = 156, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Rindo, .description2 = sBerryDescriptionPart2_Rindo, .growthDuration = 72, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 15, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_YACHE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Yache"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_BLUE, .size = 135, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Yache, .description2 = sBerryDescriptionPart2_Yache, .growthDuration = 72, .spicy = 0, .dry = 10, .sweet = 0, .bitter = 0, .sour = 15, .smoothness = 30, .drainRate = 6, }, [ITEM_CHOPLE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Chople"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 77, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Chople, .description2 = sBerryDescriptionPart2_Chople, .growthDuration = 72, .spicy = 15, .dry = 0, .sweet = 0, .bitter = 10, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_KEBIA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Kebia"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_GREEN, .size = 90, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Kebia, .description2 = sBerryDescriptionPart2_Kebia, .growthDuration = 72, .spicy = 0, .dry = 15, .sweet = 0, .bitter = 0, .sour = 10, .smoothness = 30, .drainRate = 6, }, [ITEM_SHUCA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Shuca"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_YELLOW, .size = 42, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Shuca, .description2 = sBerryDescriptionPart2_Shuca, .growthDuration = 72, .spicy = 10, .dry = 0, .sweet = 15, .bitter = 0, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_COBA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Coba"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_BLUE, .size = 278, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Coba, .description2 = sBerryDescriptionPart2_Coba, .growthDuration = 72, .spicy = 0, .dry = 10, .sweet = 0, .bitter = 15, .sour = 0, .smoothness = 30, .drainRate = 6, }, [ITEM_PAYAPA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Payapa"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_PURPLE, .size = 252, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Payapa, .description2 = sBerryDescriptionPart2_Payapa, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 10, .bitter = 0, .sour = 15, .smoothness = 30, .drainRate = 6, }, [ITEM_TANGA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Tanga"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_GREEN, .size = 42, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Tanga, .description2 = sBerryDescriptionPart2_Tanga, .growthDuration = 72, .spicy = 20, .dry = 0, .sweet = 0, .bitter = 0, .sour = 10, .smoothness = 35, .drainRate = 6, }, [ITEM_CHARTI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Charti"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_YELLOW, .size = 28, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Charti, .description2 = sBerryDescriptionPart2_Charti, .growthDuration = 72, .spicy = 10, .dry = 20, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_KASIB_BERRY - FIRST_BERRY_INDEX] = { .name = _("Kasib"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PURPLE, .size = 144, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Kasib, .description2 = sBerryDescriptionPart2_Kasib, .growthDuration = 72, .spicy = 0, .dry = 10, .sweet = 20, .bitter = 0, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_HABAN_BERRY - FIRST_BERRY_INDEX] = { .name = _("Haban"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 23, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Haban, .description2 = sBerryDescriptionPart2_Haban, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 10, .bitter = 20, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_COLBUR_BERRY - FIRST_BERRY_INDEX] = { .name = _("Colbur"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_PURPLE, .size = 39, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Colbur, .description2 = sBerryDescriptionPart2_Colbur, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 10, .sour = 20, .smoothness = 35, .drainRate = 6, }, [ITEM_BABIRI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Babiri"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_GREEN, .size = 265, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Babiri, .description2 = sBerryDescriptionPart2_Babiri, .growthDuration = 72, .spicy = 25, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_ROSELI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Roseli"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PINK, .size = 35, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Roseli, .description2 = sBerryDescriptionPart2_Roseli, .growthDuration = 72, .spicy = 0, .dry = 0, .sweet = 25, .bitter = 10, .sour = 0, .smoothness = 35, .drainRate = 6, }, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = { .name = _("Liechi"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_RED, .size = 111, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Liechi, .description2 = sBerryDescriptionPart2_Liechi, .growthDuration = 96, .spicy = 40, .dry = 0, .sweet = 40, .bitter = 0, .sour = 10, .smoothness = 80, .drainRate = 4, }, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = { .name = _("Ganlon"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_PURPLE, .size = 33, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Ganlon, .description2 = sBerryDescriptionPart2_Ganlon, .growthDuration = 96, .spicy = 0, .dry = 40, .sweet = 0, .bitter = 40, .sour = 0, .smoothness = 80, .drainRate = 4, }, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = { .name = _("Salac"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_GREEN, .size = 95, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Salac, .description2 = sBerryDescriptionPart2_Salac, .growthDuration = 96, .spicy = 0, .dry = 0, .sweet = 40, .bitter = 0, .sour = 40, .smoothness = 80, .drainRate = 4, }, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Petaya"), .firmness = BERRY_FIRMNESS_VERY_HARD, .color = BERRY_COLOR_PINK, .size = 237, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Petaya, .description2 = sBerryDescriptionPart2_Petaya, .growthDuration = 96, .spicy = 40, .dry = 0, .sweet = 0, .bitter = 40, .sour = 0, .smoothness = 80, .drainRate = 4, }, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = { .name = _("Apicot"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_BLUE, .size = 75, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Apicot, .description2 = sBerryDescriptionPart2_Apicot, .growthDuration = 96, .spicy = 0, .dry = 40, .sweet = 0, .bitter = 0, .sour = 40, .smoothness = 80, .drainRate = 4, }, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = { .name = _("Lansat"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_RED, .size = 97, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Lansat, .description2 = sBerryDescriptionPart2_Lansat, .growthDuration = 96, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 30, .drainRate = 4, }, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = { .name = _("Starf"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_GREEN, .size = 153, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Starf, .description2 = sBerryDescriptionPart2_Starf, .growthDuration = 96, .spicy = 10, .dry = 10, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 30, .drainRate = 4, }, [ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Enigma"), .firmness = BERRY_FIRMNESS_HARD, .color = BERRY_COLOR_PURPLE, .size = 155, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Enigma, .description2 = sBerryDescriptionPart2_Enigma, .growthDuration = 96, .spicy = 40, .dry = 10, .sweet = 0, .bitter = 0, .sour = 0, .smoothness = 60, .drainRate = 7, }, [ITEM_MICLE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Micle"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_GREEN, .size = 41, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Micle, .description2 = sBerryDescriptionPart2_Micle, .growthDuration = 96, .spicy = 0, .dry = 40, .sweet = 10, .bitter = 0, .sour = 0, .smoothness = 60, .drainRate = 7, }, [ITEM_CUSTAP_BERRY - FIRST_BERRY_INDEX] = { .name = _("Custap"), .firmness = BERRY_FIRMNESS_SUPER_HARD, .color = BERRY_COLOR_RED, .size = 267, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Custap, .description2 = sBerryDescriptionPart2_Custap, .growthDuration = 96, .spicy = 0, .dry = 0, .sweet = 40, .bitter = 10, .sour = 0, .smoothness = 60, .drainRate = 7, }, [ITEM_JABOCA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Jaboca"), .firmness = BERRY_FIRMNESS_SOFT, .color = BERRY_COLOR_YELLOW, .size = 33, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Jaboca, .description2 = sBerryDescriptionPart2_Jaboca, .growthDuration = 96, .spicy = 0, .dry = 0, .sweet = 0, .bitter = 40, .sour = 10, .smoothness = 60, .drainRate = 7, }, [ITEM_ROWAP_BERRY - FIRST_BERRY_INDEX] = { .name = _("Rowap"), .firmness = BERRY_FIRMNESS_VERY_SOFT, .color = BERRY_COLOR_BLUE, .size = 52, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Rowap, .description2 = sBerryDescriptionPart2_Rowap, .growthDuration = 96, .spicy = 10, .dry = 0, .sweet = 0, .bitter = 0, .sour = 40, .smoothness = 60, .drainRate = 7, }, [ITEM_KEE_BERRY - FIRST_BERRY_INDEX] = { .name = _("Kee"), .firmness = BERRY_FIRMNESS_UNKNOWN, .color = BERRY_COLOR_YELLOW, .size = 0, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Kee, .description2 = sBerryDescriptionPart2_Kee, .growthDuration = 96, .spicy = 30, .dry = 30, .sweet = 10, .bitter = 10, .sour = 10, .smoothness = 60, .drainRate = 7, }, [ITEM_MARANGA_BERRY - FIRST_BERRY_INDEX] = { .name = _("Marnga"), // "Maranga" is too long .firmness = BERRY_FIRMNESS_UNKNOWN, .color = BERRY_COLOR_BLUE, .size = 0, .maxYield = 5, .minYield = 2, .description1 = sBerryDescriptionPart1_Maranga, .description2 = sBerryDescriptionPart2_Maranga, .growthDuration = 96, .spicy = 10, .dry = 10, .sweet = 30, .bitter = 30, .sour = 10, .smoothness = 60, .drainRate = 7, }, [ITEM_ENIGMA_BERRY_E_READER - FIRST_BERRY_INDEX] = { .name = _("Enigma"), .firmness = BERRY_FIRMNESS_UNKNOWN, .color = BERRY_COLOR_PURPLE, .size = 0, .maxYield = 2, .minYield = 1, .description1 = sBerryDescriptionPart1_Enigma, .description2 = sBerryDescriptionPart2_Enigma, .growthDuration = 96, .spicy = 40, .dry = 40, .sweet = 40, .bitter = 40, .sour = 40, .smoothness = 40, .drainRate = 7, }, }; const struct BerryCrushBerryData gBerryCrush_BerryData[] = { [ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 20}, [ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 20}, [ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 20}, [ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 20}, [ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 20}, [ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 30}, [ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 30}, [ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 30}, [ITEM_LUM_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 30}, [ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 50, .powder = 30}, [ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 60, .powder = 50}, [ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 60, .powder = 50}, [ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 60, .powder = 50}, [ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 60, .powder = 50}, [ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 60, .powder = 50}, [ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 80, .powder = 70}, [ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 80, .powder = 70}, [ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 80, .powder = 70}, [ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 80, .powder = 70}, [ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 80, .powder = 70}, [ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 100, .powder = 100}, [ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 100, .powder = 100}, [ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 100, .powder = 100}, [ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 100, .powder = 100}, [ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 100, .powder = 100}, [ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 130, .powder = 150}, [ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 130, .powder = 150}, [ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 130, .powder = 150}, [ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 130, .powder = 150}, [ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 130, .powder = 150}, [ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 160, .powder = 250}, [ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 160, .powder = 250}, [ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 160, .powder = 250}, [ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 160, .powder = 250}, [ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 160, .powder = 250}, [ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 180, .powder = 500}, [ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 180, .powder = 500}, [ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 180, .powder = 500}, [ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 180, .powder = 500}, [ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 180, .powder = 500}, [ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 200, .powder = 750}, [ITEM_STARF_BERRY - FIRST_BERRY_INDEX] = {.difficulty = 200, .powder = 750}, [ITEM_ENIGMA_BERRY_E_READER - FIRST_BERRY_INDEX] = {.difficulty = 150, .powder = 200} }; const struct BerryTree gBlankBerryTree = {}; // unused void ClearEnigmaBerries(void) { CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry)); } void SetEnigmaBerry(u8 *src) { u32 i; u8 *dest = (u8 *)&gSaveBlock1Ptr->enigmaBerry; for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++) dest[i] = src[i]; } static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry) { u32 i; u32 checksum; u8 *dest; dest = (u8 *)enigmaBerry; checksum = 0; for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry) - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++) checksum += dest[i]; return checksum; } bool32 IsEnigmaBerryValid(void) { if (!gSaveBlock1Ptr->enigmaBerry.berry.growthDuration) return FALSE; if (!gSaveBlock1Ptr->enigmaBerry.berry.maxYield) return FALSE; if (GetEnigmaBerryChecksum(&gSaveBlock1Ptr->enigmaBerry) != gSaveBlock1Ptr->enigmaBerry.checksum) return FALSE; return TRUE; } const struct Berry *GetBerryInfo(u8 berry) { if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY_E_READER) && IsEnigmaBerryValid()) return (struct Berry *)(&gSaveBlock1Ptr->enigmaBerry.berry); else { if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX)) berry = ITEM_TO_BERRY(FIRST_BERRY_INDEX); return &gBerries[berry - 1]; } } struct BerryTree *GetBerryTreeInfo(u8 id) { return &gSaveBlock1Ptr->berryTrees[id]; } bool32 ObjectEventInteractionWaterBerryTree(void) { struct BerryTree *tree = GetBerryTreeInfo(GetObjectEventBerryTreeId(gSelectedObjectEvent)); #if OW_BERRY_MOISTURE == TRUE tree->moistureLevel = 100; return TRUE; #else switch (tree->stage) { case BERRY_STAGE_PLANTED: tree->watered |= (1 << 0); break; case BERRY_STAGE_SPROUTED: tree->watered |= (1 << 1); break; case BERRY_STAGE_TALLER: case BERRY_STAGE_TRUNK: case BERRY_STAGE_BUDDING: tree->watered |= (1 << 2); break; case BERRY_STAGE_FLOWERING: tree->watered |= (1 << 3); break; default: return FALSE; } return TRUE; #endif } bool8 IsPlayerFacingEmptyBerryTreePatch(void) { if (GetObjectEventScriptPointerPlayerFacing() == BerryTreeScript && GetStageByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent)) == BERRY_STAGE_NO_BERRY) return TRUE; else return FALSE; } bool8 TryToWaterBerryTree(void) { if (GetObjectEventScriptPointerPlayerFacing() != BerryTreeScript) return FALSE; else return ObjectEventInteractionWaterBerryTree(); } void ClearBerryTrees(void) { int i; for (i = 0; i < BERRY_TREES_COUNT; i++) gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree; } bool32 BerryTreeGrow(struct BerryTree *tree) { if (tree->stopGrowth) return FALSE; switch (tree->stage) { case BERRY_STAGE_NO_BERRY: return FALSE; case BERRY_STAGE_FLOWERING: tree->berryYield = tree->berryYield + CalcBerryYield(tree); case BERRY_STAGE_PLANTED: case BERRY_STAGE_SPROUTED: case BERRY_STAGE_TRUNK: case BERRY_STAGE_BUDDING: tree->stage++; break; case BERRY_STAGE_TALLER: if (OW_BERRY_SIX_STAGES) tree->stage = BERRY_STAGE_TRUNK; else tree->stage++; break; case BERRY_STAGE_BERRIES: tree->watered = 0; tree->berryYield = 0; tree->stage = BERRY_STAGE_SPROUTED; tree->moistureLevel = 100; if (++tree->regrowthCount == ((tree->mulch == ITEM_TO_MULCH(ITEM_GOOEY_MULCH)) ? 15 : 10)) *tree = gBlankBerryTree; break; } return TRUE; } static u16 GetMulchAffectedGrowthRate(u16 berryDuration, u8 mulch, u8 stage) { if (stage == BERRY_STAGE_BERRIES) return berryDuration; if (mulch == ITEM_TO_MULCH(ITEM_GROWTH_MULCH)) return berryDuration / 4 * 3; if (mulch == ITEM_TO_MULCH(ITEM_DAMP_MULCH)) return berryDuration / 2 * 3; return berryDuration; } void BerryTreeTimeUpdate(s32 minutes) { int i; u8 drainVal; struct BerryTree *tree; for (i = 0; i < BERRY_TREES_COUNT; i++) { tree = &gSaveBlock1Ptr->berryTrees[i]; if (tree->berry && tree->stage && !tree->stopGrowth) { if (minutes >= GetStageDurationByBerryType(tree->berry) * 71) { *tree = gBlankBerryTree; } else { s32 time = minutes; // Check moisture gradient, pests and weeds while (time > 0 && tree->stage != BERRY_STAGE_BERRIES) { tree->moistureClock += 1; time -= 1; if (tree->moistureClock % 60 == 0) { if (OW_BERRY_MOISTURE == TRUE) { drainVal = OW_BERRY_VARIABLE_DRAIN_RATE ? GetDrainRateByBerryType(tree->berry) : 4; if (OW_BERRY_MULCH_USAGE) { if (tree->mulch == ITEM_TO_MULCH(ITEM_GROWTH_MULCH)) drainVal *= 2; if (tree->mulch == ITEM_TO_MULCH(ITEM_DAMP_MULCH)) drainVal /= 2; if (tree->mulch == ITEM_TO_MULCH(ITEM_BOOST_MULCH) || tree->mulch == ITEM_TO_MULCH(ITEM_AMAZE_MULCH)) drainVal = 25; } if (tree->moistureLevel == 0 || (!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 tree->watered++; else if (tree->moistureLevel <= drainVal) tree->moistureLevel = 0; else tree->moistureLevel -= drainVal; } if (tree->moistureClock == 120) { TryForWeeds(tree); TryForPests(tree); tree->moistureClock = 0; } } } // Check Berry growth time = minutes; while (time != 0) { if (tree->minutesUntilNextStage > time) { tree->minutesUntilNextStage -= time; break; } time -= tree->minutesUntilNextStage; tree->minutesUntilNextStage = GetMulchAffectedGrowthRate(GetStageDurationByBerryType(tree->berry), tree->mulch, tree->stage); if (!BerryTreeGrow(tree)) break; if (tree->stage == BERRY_STAGE_BERRIES) tree->minutesUntilNextStage *= ((tree->mulch == ITEM_TO_MULCH(ITEM_STABLE_MULCH)) ? 6 : 4); } } } } } void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 allowGrowth) { struct BerryTree *tree = GetBerryTreeInfo(id); tree->berry = berry; tree->minutesUntilNextStage = GetMulchAffectedGrowthRate(GetStageDurationByBerryType(berry), tree->mulch, stage); tree->stage = stage; tree->moistureLevel = 100; if (stage == BERRY_STAGE_BERRIES) { tree->berryYield = tree->berryYield + CalcBerryYield(tree); tree->minutesUntilNextStage *= ((tree->mulch == ITEM_TO_MULCH(ITEM_STABLE_MULCH)) ? 6 : 4); } // Stop growth, to keep tree at this stage until the player has seen it // allowGrowth is always true for berry trees the player has planted if (!allowGrowth) tree->stopGrowth = TRUE; SetTreeMutations(id, berry); } void RemoveBerryTree(u8 id) { gSaveBlock1Ptr->berryTrees[id] = gBlankBerryTree; } u8 GetBerryTypeByBerryTreeId(u8 id) { return gSaveBlock1Ptr->berryTrees[id].berry; } u8 GetStageByBerryTreeId(u8 id) { return gSaveBlock1Ptr->berryTrees[id].stage; } u8 GetMulchByBerryTreeId(u8 id) { return gSaveBlock1Ptr->berryTrees[id].mulch; } u8 ItemIdToBerryType(u16 item) { u16 berry = item - FIRST_BERRY_INDEX; if (berry > LAST_BERRY_INDEX - FIRST_BERRY_INDEX) return ITEM_TO_BERRY(FIRST_BERRY_INDEX); else return ITEM_TO_BERRY(item); } static u16 BerryTypeToItemId(u16 berry) { u16 item = berry - 1; if (item > LAST_BERRY_INDEX - FIRST_BERRY_INDEX) return FIRST_BERRY_INDEX; else return berry + FIRST_BERRY_INDEX - 1; } void GetBerryNameByBerryType(u8 berry, u8 *string) { memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH); string[BERRY_NAME_LENGTH] = EOS; } void GetBerryCountStringByBerryType(u8 berry, u8 *dest, u32 berryCount) { GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount); } void AllowBerryTreeGrowth(u8 id) { GetBerryTreeInfo(id)->stopGrowth = FALSE; } static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree) { u8 count = 0; if (tree->watered & (1 << 0)) count++; if (tree->watered & (1 << 1)) count++; if (tree->watered & (1 << 2)) count++; if (tree->watered & (1 << 3)) count++; return count; } static u8 GetNumStagesWateredByBerryTreeId(u8 id) { return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id)); } // Berries can be watered at 4 stages of growth. This function is likely meant // to divide the berry yield range equally into quartiles. If you watered the // tree n times, your yield is a random number in the nth quartile. // // However, this function actually skews towards higher berry yields, because // it rounds `extraYield` to the nearest whole number. // // See resulting yields: https://gist.github.com/hondew/2a099dbe54aa91414decdbfaa524327d, // and bug fix: https://gist.github.com/hondew/0f0164e5b9dadfd72d24f30f2c049a0b. static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water) { u32 randMin; u32 randMax; u32 rand; u32 extraYield; if (water == 0) return min; else { randMin = (max - min) * (water - 1); randMax = (max - min) * (water); rand = randMin + Random() % (randMax - randMin + 1); // Round upwards if ((rand % NUM_WATER_STAGES) >= NUM_WATER_STAGES / 2) extraYield = rand / NUM_WATER_STAGES + 1; else extraYield = rand / NUM_WATER_STAGES; return extraYield + min; } } static u8 CalcBerryYield(struct BerryTree *tree) { const struct Berry *berry = GetBerryInfo(tree->berry); u8 min = berry->minYield; u8 max = berry->maxYield; u8 result = CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree)); if (OW_BERRY_MULCH_USAGE && (tree->mulch == ITEM_TO_MULCH(ITEM_RICH_MULCH) || tree->mulch == ITEM_TO_MULCH(ITEM_AMAZE_MULCH))) result += 2; return result; } static u8 GetBerryCountByBerryTreeId(u8 id) { return gSaveBlock1Ptr->berryTrees[id].berryYield; } static u16 GetStageDurationByBerryType(u8 berry) { return GetBerryInfo(berry)->growthDuration * 60 / (OW_BERRY_SIX_STAGES ? 6 : 4); } static u16 GetDrainRateByBerryType(u8 berry) { return GetBerryInfo(berry)->drainRate; } void ObjectEventInteractionGetBerryTreeData(void) { u8 id; u8 berry; u8 localId; u8 group; u8 num; id = GetObjectEventBerryTreeId(gSelectedObjectEvent); berry = GetBerryTypeByBerryTreeId(id); AllowBerryTreeGrowth(id); localId = gSpecialVar_LastTalked; num = gSaveBlock1Ptr->location.mapNum; group = gSaveBlock1Ptr->location.mapGroup; if (IsBerryTreeSparkling(localId, num, group)) gSpecialVar_0x8004 = BERRY_STAGE_SPARKLING; else gSpecialVar_0x8004 = GetStageByBerryTreeId(id); gSpecialVar_0x8005 = GetNumStagesWateredByBerryTreeId(id); gSpecialVar_0x8006 = GetBerryCountByBerryTreeId(id); GetBerryCountStringByBerryType(berry, gStringVar1, gSpecialVar_0x8006); } void ObjectEventInteractionGetBerryName(void) { u8 berryType = GetBerryTypeByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent)); GetBerryNameByBerryType(berryType, gStringVar1); } void ObjectEventInteractionGetBerryCountString(void) { u8 treeId = GetObjectEventBerryTreeId(gSelectedObjectEvent); u8 berry = GetBerryTypeByBerryTreeId(treeId); u8 count = GetBerryCountByBerryTreeId(treeId); GetBerryCountStringByBerryType(berry, gStringVar1, count); berry = GetTreeMutationValue(treeId); if (berry > 0) { count = 1; GetBerryCountStringByBerryType(berry, gStringVar3, count); gSpecialVar_Result = TRUE; } else gSpecialVar_Result = FALSE; } void Bag_ChooseBerry(void) { SetMainCallback2(CB2_ChooseBerry); } void Bag_ChooseMulch(void) { SetMainCallback2(CB2_ChooseMulch); } void ObjectEventInteractionPlantBerryTree(void) { u8 berry = ItemIdToBerryType(gSpecialVar_ItemId); PlantBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent), berry, BERRY_STAGE_PLANTED, TRUE); ObjectEventInteractionGetBerryTreeData(); } void ObjectEventInteractionApplyMulch(void) { u8 mulch = ITEM_TO_MULCH(gSpecialVar_ItemId); gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].mulch = mulch; StringExpandPlaceholders(gStringVar1, gItems[gSpecialVar_ItemId].name); } void ObjectEventInteractionPickBerryTree(void) { u8 id = GetObjectEventBerryTreeId(gSelectedObjectEvent); u8 berry = GetBerryTypeByBerryTreeId(id); u8 mutation = GetTreeMutationValue(id); if (!OW_BERRY_MUTATIONS || mutation == 0) { gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id)); return; } gSpecialVar_0x8004 = (CheckBagHasSpace(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id)) && CheckBagHasSpace(BerryTypeToItemId(mutation), 1)) + 2; if (gSpecialVar_0x8004 == 3) { AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id)); AddBagItem(BerryTypeToItemId(mutation), 1); } } void ObjectEventInteractionRemoveBerryTree(void) { RemoveBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent)); SetBerryTreeJustPicked(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); } void ObjectEventInteractionPullBerryWeed(void) { gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].weeds = FALSE; } void ObjectEventInteractionClearBerryPests(void) { gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].pests = FALSE; } bool8 PlayerHasBerries(void) { return IsBagPocketNonEmpty(POCKET_BERRIES); } bool8 ObjectEventInteractionBerryHasWeed(void) { return gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].weeds; } bool8 ObjectEventInteractionBerryHasPests(void) { u16 species; if (!OW_BERRY_PESTS || !gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].pests) return FALSE; species = GetBerryPestSpecies(gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].berry); if (species == SPECIES_NONE) return FALSE; CreateScriptedWildMon(species, 14 + Random() % 3, ITEM_NONE); gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(gSelectedObjectEvent)].pests = FALSE; return TRUE; } // Berry tree growth is frozen at their initial stage (usually, fully grown) until the player has seen the tree // For all berry trees on screen, allow normal growth void SetBerryTreesSeen(void) { u16 cam_left; u16 cam_top; s16 left; s16 top; s16 right; s16 bottom; int i; GetCameraCoords(&cam_left, &cam_top); left = cam_left; top = cam_top + 3; right = cam_left + 14; bottom = top + 8; for (i = 0; i < OBJECT_EVENTS_COUNT; i++) { if (gObjectEvents[i].active && gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) { s16 x = gObjectEvents[i].currentCoords.x; s16 y = gObjectEvents[i].currentCoords.y; if (left <= x && x <= right && top <= y && y <= bottom) AllowBerryTreeGrowth(gObjectEvents[i].trainerRange_berryTreeId); } } } bool8 PlayerHasMulch(void) { if (!OW_BERRY_MULCH_USAGE) return FALSE; if (CheckBagHasItem(ITEM_GROWTH_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_DAMP_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_STABLE_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_GOOEY_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_RICH_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_SURPRISE_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_BOOST_MULCH, 1)) return TRUE; if (CheckBagHasItem(ITEM_AMAZE_MULCH, 1)) return TRUE; return FALSE; } #if OW_BERRY_MUTATIONS == TRUE #define BERRY_MUTATION_CHANCE 25 static const u8 sBerryMutations[][3] = { {ITEM_TO_BERRY(ITEM_IAPAPA_BERRY), ITEM_TO_BERRY(ITEM_MAGO_BERRY), ITEM_TO_BERRY(ITEM_POMEG_BERRY)}, {ITEM_TO_BERRY(ITEM_CHESTO_BERRY), ITEM_TO_BERRY(ITEM_PERSIM_BERRY), ITEM_TO_BERRY(ITEM_KELPSY_BERRY)}, {ITEM_TO_BERRY(ITEM_ORAN_BERRY), ITEM_TO_BERRY(ITEM_PECHA_BERRY), ITEM_TO_BERRY(ITEM_QUALOT_BERRY)}, {ITEM_TO_BERRY(ITEM_CHESTO_BERRY), ITEM_TO_BERRY(ITEM_PERSIM_BERRY), ITEM_TO_BERRY(ITEM_KELPSY_BERRY)}, {ITEM_TO_BERRY(ITEM_ASPEAR_BERRY), ITEM_TO_BERRY(ITEM_LEPPA_BERRY), ITEM_TO_BERRY(ITEM_HONDEW_BERRY)}, {ITEM_TO_BERRY(ITEM_AGUAV_BERRY), ITEM_TO_BERRY(ITEM_FIGY_BERRY), ITEM_TO_BERRY(ITEM_GREPA_BERRY)}, {ITEM_TO_BERRY(ITEM_LUM_BERRY), ITEM_TO_BERRY(ITEM_SITRUS_BERRY), ITEM_TO_BERRY(ITEM_TAMATO_BERRY)}, {ITEM_TO_BERRY(ITEM_HONDEW_BERRY), ITEM_TO_BERRY(ITEM_YACHE_BERRY), ITEM_TO_BERRY(ITEM_LIECHI_BERRY)}, {ITEM_TO_BERRY(ITEM_QUALOT_BERRY), ITEM_TO_BERRY(ITEM_TANGA_BERRY), ITEM_TO_BERRY(ITEM_GANLON_BERRY)}, {ITEM_TO_BERRY(ITEM_GREPA_BERRY), ITEM_TO_BERRY(ITEM_ROSELI_BERRY), ITEM_TO_BERRY(ITEM_SALAC_BERRY)}, {ITEM_TO_BERRY(ITEM_POMEG_BERRY), ITEM_TO_BERRY(ITEM_KASIB_BERRY), ITEM_TO_BERRY(ITEM_PETAYA_BERRY)}, {ITEM_TO_BERRY(ITEM_KELPSY_BERRY), ITEM_TO_BERRY(ITEM_WACAN_BERRY), ITEM_TO_BERRY(ITEM_APICOT_BERRY)}, {ITEM_TO_BERRY(ITEM_GANLON_BERRY), ITEM_TO_BERRY(ITEM_LIECHI_BERRY), ITEM_TO_BERRY(ITEM_KEE_BERRY)}, {ITEM_TO_BERRY(ITEM_SALAC_BERRY), ITEM_TO_BERRY(ITEM_PETAYA_BERRY), ITEM_TO_BERRY(ITEM_MARANGA_BERRY)}, // Up to one more Mutation can be added here for a total of 15 (only 4 bits are allocated) }; static u8 GetMutationOutcome(u8 berry1, u8 berry2) { u8 i; for(i = 0; i < ARRAY_COUNT(sBerryMutations); i++) { if ((sBerryMutations[i][0] == berry1 && sBerryMutations[i][1] == berry2) ||(sBerryMutations[i][0] == berry2 && sBerryMutations[i][1] == berry1)) return (i + 1); } return 0; } static u8 TryForMutation(u8 berryTreeId, u8 berry) { u8 i, j, mulch; s16 x1, x2, y1, y2; // Get location of current tree for (i = 0; i < OBJECT_EVENTS_COUNT; i++) { if (gObjectEvents[i].trainerRange_berryTreeId == berryTreeId && gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH) break; } if (i == OBJECT_EVENTS_COUNT) return 0; x1 = gObjectEvents[i].currentCoords.x; y1 = gObjectEvents[i].currentCoords.y; mulch = GetMulchByBerryTreeId(GetObjectEventBerryTreeId(i)); // Try mutation for each adjacent tree for (j = 0; j < OBJECT_EVENTS_COUNT; j++) { if (gObjectEvents[j].active && gObjectEvents[j].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH && GetStageByBerryTreeId(GetObjectEventBerryTreeId(j)) != BERRY_STAGE_NO_BERRY && j != i) { x2 = gObjectEvents[j].currentCoords.x; y2 = gObjectEvents[j].currentCoords.y; if (Random() % 100 < (BERRY_MUTATION_CHANCE * (mulch == ITEM_TO_MULCH(ITEM_SURPRISE_MULCH) || mulch == ITEM_TO_MULCH(ITEM_AMAZE_MULCH))) && ( (x1 == x2 && y1 == y2 - 1) || (x1 == x2 && y1 == y2 + 1) || (x1 == x2 - 1 && y1 == y2) || (x1 == x2 + 1 && y1 == y2))) return GetMutationOutcome(berry, gSaveBlock1Ptr->berryTrees[GetObjectEventBerryTreeId(j)].berry); } } return 0; } #endif struct TreeMutationBitfield { u8 a: 2; u8 b: 2; u8 unused: 4; }; union TreeMutation { u8 value; struct TreeMutationBitfield asField; }; static u8 GetTreeMutationValue(u8 id) { #if OW_BERRY_MUTATIONS struct BerryTree *tree = GetBerryTreeInfo(id); union TreeMutation myMutation; if (tree->stopGrowth) // Pre-generated trees shouldn't have mutations return 0; myMutation.asField.a = tree->mutationA; myMutation.asField.b = tree->mutationB; return sBerryMutations[myMutation.value - 1][2]; #else return 0; #endif } static void SetTreeMutations(u8 id, u8 berry) { #if OW_BERRY_MUTATIONS == TRUE struct BerryTree *tree = GetBerryTreeInfo(id); union TreeMutation myMutation; myMutation.value = TryForMutation(id, berry); tree->mutationA = myMutation.asField.a; tree->mutationB = myMutation.asField.b; #endif } static u16 GetBerryPestSpecies(u8 berryId) { #if OW_BERRY_PESTS == TRUE const struct Berry *berry = GetBerryInfo(berryId); switch(berry->color) { case BERRY_COLOR_RED: return SPECIES_LEDYBA; break; case BERRY_COLOR_BLUE: return SPECIES_VOLBEAT; break; case BERRY_COLOR_PURPLE: return SPECIES_ILLUMISE; break; case BERRY_COLOR_GREEN: return SPECIES_BURMY_PLANT_CLOAK; break; case BERRY_COLOR_YELLOW: return SPECIES_COMBEE; break; case BERRY_COLOR_PINK: return SPECIES_SPEWPA; break; } #endif return SPECIES_NONE; } #define BERRY_WEEDS_CHANCE 15 #define BERRY_PESTS_CHANCE 15 static void TryForWeeds(struct BerryTree *tree) { if (!OW_BERRY_WEEDS) return; if (tree->weeds == TRUE) return; if (Random() % 100 < BERRY_WEEDS_CHANCE) tree->weeds = TRUE; } static void TryForPests(struct BerryTree *tree) { if (!OW_BERRY_WEEDS) return; if (tree->pests == TRUE) return; if (Random() % 100 < BERRY_PESTS_CHANCE && tree->stage > BERRY_STAGE_PLANTED) tree->pests = TRUE; }