pokeemerald/src/berry.c

1354 lines
42 KiB
C
Raw Normal View History

2017-09-12 18:47:27 +02:00
#include "global.h"
#include "berry.h"
2017-09-13 11:16:26 +02:00
#include "event_data.h"
2019-04-14 13:22:37 +02:00
#include "event_object_movement.h"
#include "event_scripts.h"
2018-11-21 21:58:35 +01:00
#include "field_control_avatar.h"
2017-09-13 11:16:26 +02:00
#include "fieldmap.h"
2018-10-17 14:52:26 +02:00
#include "item.h"
2018-11-21 21:58:35 +01:00
#include "item_menu.h"
2018-10-17 14:52:26 +02:00
#include "main.h"
#include "random.h"
2018-11-21 21:58:35 +01:00
#include "string_util.h"
2018-10-17 14:52:26 +02:00
#include "text.h"
2019-11-21 20:03:35 +01:00
#include "constants/event_object_movement.h"
2018-10-17 14:52:26 +02:00
#include "constants/items.h"
2017-09-12 18:47:27 +02:00
2018-10-17 14:52:26 +02:00
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry);
static bool32 BerryTreeGrow(struct BerryTree *tree);
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);
//.rodata
2017-09-13 11:16:26 +02:00
static const u8 sBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers.");
static const u8 sBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy.");
2018-12-07 16:41:08 +01:00
static const u8 sBerryDescriptionPart1_Chesto[] = _("The BERRY's thick skin and fruit are");
2017-09-13 11:16:26 +02:00
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.");
2018-12-07 16:41:08 +01:00
static const u8 sBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY's color");
2017-09-13 11:16:26 +02:00
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_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");
2018-12-07 16:41:08 +01:00
static const u8 sBerryDescriptionPart2_Starf[] = _("world's edge. Considered a mirage.");
2017-09-13 11:16:26 +02:00
static const u8 sBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY.");
static const u8 sBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars.");
2017-09-12 18:47:27 +02:00
const struct Berry gBerries[] =
{
2019-04-14 13:22:37 +02:00
[ITEM_CHERI_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("CHERI"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 20,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Cheri,
.description2 = sBerryDescriptionPart2_Cheri,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_CHESTO_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("CHESTO"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 80,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Chesto,
.description2 = sBerryDescriptionPart2_Chesto,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 10,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_PECHA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("PECHA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_SOFT,
.size = 40,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Pecha,
.description2 = sBerryDescriptionPart2_Pecha,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 0,
.sweet = 10,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_RAWST_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("RAWST"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 32,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Rawst,
.description2 = sBerryDescriptionPart2_Rawst,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 10,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_ASPEAR_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("ASPEAR"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 50,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Aspear,
.description2 = sBerryDescriptionPart2_Aspear,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 10,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_LEPPA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("LEPPA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 28,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Leppa,
.description2 = sBerryDescriptionPart2_Leppa,
2017-09-12 18:47:27 +02:00
.stageDuration = 4,
.spicy = 10,
.dry = 0,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_ORAN_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("ORAN"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 35,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Oran,
.description2 = sBerryDescriptionPart2_Oran,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_PERSIM_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("PERSIM"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 47,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Persim,
.description2 = sBerryDescriptionPart2_Persim,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_LUM_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("LUM"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 34,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Lum,
.description2 = sBerryDescriptionPart2_Lum,
2017-09-12 18:47:27 +02:00
.stageDuration = 12,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_SITRUS_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("SITRUS"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 95,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Sitrus,
.description2 = sBerryDescriptionPart2_Sitrus,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_FIGY_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("FIGY"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 100,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Figy,
.description2 = sBerryDescriptionPart2_Figy,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 10,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_WIKI_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("WIKI"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 115,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Wiki,
.description2 = sBerryDescriptionPart2_Wiki,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 10,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_MAGO_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("MAGO"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 126,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Mago,
.description2 = sBerryDescriptionPart2_Mago,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 0,
.sweet = 10,
.bitter = 0,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_AGUAV_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("AGUAV"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 64,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Aguav,
.description2 = sBerryDescriptionPart2_Aguav,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 10,
.sour = 0,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_IAPAPA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("IAPAPA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 223,
.maxYield = 3,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Iapapa,
.description2 = sBerryDescriptionPart2_Iapapa,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 10,
.smoothness = 25,
},
2019-04-14 13:22:37 +02:00
[ITEM_RAZZ_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("RAZZ"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 120,
.maxYield = 6,
.minYield = 3,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Razz,
.description2 = sBerryDescriptionPart2_Razz,
2017-09-12 18:47:27 +02:00
.stageDuration = 1,
.spicy = 10,
.dry = 10,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_BLUK_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("BLUK"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 108,
.maxYield = 6,
.minYield = 3,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Bluk,
.description2 = sBerryDescriptionPart2_Bluk,
2017-09-12 18:47:27 +02:00
.stageDuration = 1,
.spicy = 0,
.dry = 10,
.sweet = 10,
.bitter = 0,
.sour = 0,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_NANAB_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("NANAB"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 77,
.maxYield = 6,
.minYield = 3,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Nanab,
.description2 = sBerryDescriptionPart2_Nanab,
2017-09-12 18:47:27 +02:00
.stageDuration = 1,
.spicy = 0,
.dry = 0,
.sweet = 10,
.bitter = 10,
.sour = 0,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_WEPEAR_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("WEPEAR"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 74,
.maxYield = 6,
.minYield = 3,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Wepear,
.description2 = sBerryDescriptionPart2_Wepear,
2017-09-12 18:47:27 +02:00
.stageDuration = 1,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_PINAP_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("PINAP"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 80,
.maxYield = 6,
.minYield = 3,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Pinap,
.description2 = sBerryDescriptionPart2_Pinap,
2017-09-12 18:47:27 +02:00
.stageDuration = 1,
.spicy = 10,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_POMEG_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("POMEG"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 135,
.maxYield = 6,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Pomeg,
.description2 = sBerryDescriptionPart2_Pomeg,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 0,
.sweet = 10,
.bitter = 10,
.sour = 0,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_KELPSY_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("KELPSY"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 150,
.maxYield = 6,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Kelpsy,
.description2 = sBerryDescriptionPart2_Kelpsy,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 10,
.sweet = 0,
.bitter = 10,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_QUALOT_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("QUALOT"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 110,
.maxYield = 6,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Qualot,
.description2 = sBerryDescriptionPart2_Qualot,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 0,
.sweet = 10,
.bitter = 0,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_HONDEW_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("HONDEW"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 162,
.maxYield = 6,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Hondew,
.description2 = sBerryDescriptionPart2_Hondew,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 10,
.dry = 10,
.sweet = 0,
.bitter = 10,
.sour = 0,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_GREPA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("GREPA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 149,
.maxYield = 6,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Grepa,
.description2 = sBerryDescriptionPart2_Grepa,
2017-09-12 18:47:27 +02:00
.stageDuration = 3,
.spicy = 0,
.dry = 10,
.sweet = 10,
.bitter = 0,
.sour = 10,
.smoothness = 20,
},
2019-04-14 13:22:37 +02:00
[ITEM_TAMATO_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("TAMATO"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 200,
.maxYield = 4,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Tamato,
.description2 = sBerryDescriptionPart2_Tamato,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 20,
.dry = 10,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_CORNN_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("CORNN"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 75,
.maxYield = 4,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Cornn,
.description2 = sBerryDescriptionPart2_Cornn,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 20,
.sweet = 10,
.bitter = 0,
.sour = 0,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_MAGOST_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("MAGOST"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 140,
.maxYield = 4,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Magost,
.description2 = sBerryDescriptionPart2_Magost,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 0,
.sweet = 20,
.bitter = 10,
.sour = 0,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_RABUTA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("RABUTA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 226,
.maxYield = 4,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Rabuta,
.description2 = sBerryDescriptionPart2_Rabuta,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 20,
.sour = 10,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_NOMEL_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("NOMEL"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 285,
.maxYield = 4,
.minYield = 2,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Nomel,
.description2 = sBerryDescriptionPart2_Nomel,
2017-09-12 18:47:27 +02:00
.stageDuration = 6,
.spicy = 10,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 20,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_SPELON_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("SPELON"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 133,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Spelon,
.description2 = sBerryDescriptionPart2_Spelon,
2017-09-12 18:47:27 +02:00
.stageDuration = 18,
.spicy = 40,
.dry = 10,
.sweet = 0,
.bitter = 0,
.sour = 0,
.smoothness = 70,
},
2019-04-14 13:22:37 +02:00
[ITEM_PAMTRE_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("PAMTRE"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_SOFT,
.size = 244,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Pamtre,
.description2 = sBerryDescriptionPart2_Pamtre,
2017-09-12 18:47:27 +02:00
.stageDuration = 18,
.spicy = 0,
.dry = 40,
.sweet = 10,
.bitter = 0,
.sour = 0,
.smoothness = 70,
},
2019-04-14 13:22:37 +02:00
[ITEM_WATMEL_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("WATMEL"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 250,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Watmel,
.description2 = sBerryDescriptionPart2_Watmel,
2017-09-12 18:47:27 +02:00
.stageDuration = 18,
.spicy = 0,
.dry = 0,
.sweet = 40,
.bitter = 10,
.sour = 0,
.smoothness = 70,
},
2019-04-14 13:22:37 +02:00
[ITEM_DURIN_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("DURIN"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 280,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Durin,
.description2 = sBerryDescriptionPart2_Durin,
2017-09-12 18:47:27 +02:00
.stageDuration = 18,
.spicy = 0,
.dry = 0,
.sweet = 0,
.bitter = 40,
.sour = 10,
.smoothness = 70,
},
2019-04-14 13:22:37 +02:00
[ITEM_BELUE_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("BELUE"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_SOFT,
.size = 300,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Belue,
.description2 = sBerryDescriptionPart2_Belue,
2017-09-12 18:47:27 +02:00
.stageDuration = 18,
.spicy = 10,
.dry = 0,
.sweet = 0,
.bitter = 0,
.sour = 40,
.smoothness = 70,
},
2019-04-14 13:22:37 +02:00
[ITEM_LIECHI_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("LIECHI"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 111,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Liechi,
.description2 = sBerryDescriptionPart2_Liechi,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 40,
.dry = 0,
.sweet = 40,
.bitter = 0,
.sour = 10,
.smoothness = 80,
},
2019-04-14 13:22:37 +02:00
[ITEM_GANLON_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("GANLON"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 33,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Ganlon,
.description2 = sBerryDescriptionPart2_Ganlon,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 0,
.dry = 40,
.sweet = 0,
.bitter = 40,
.sour = 0,
.smoothness = 80,
},
2019-04-14 13:22:37 +02:00
[ITEM_SALAC_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("SALAC"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 95,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Salac,
.description2 = sBerryDescriptionPart2_Salac,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 0,
.dry = 0,
.sweet = 40,
.bitter = 0,
.sour = 40,
.smoothness = 80,
},
2019-04-14 13:22:37 +02:00
[ITEM_PETAYA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("PETAYA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_VERY_HARD,
.size = 237,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Petaya,
.description2 = sBerryDescriptionPart2_Petaya,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 40,
.dry = 0,
.sweet = 0,
.bitter = 40,
.sour = 0,
.smoothness = 80,
},
2019-04-14 13:22:37 +02:00
[ITEM_APICOT_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("APICOT"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_HARD,
.size = 75,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Apicot,
.description2 = sBerryDescriptionPart2_Apicot,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 0,
.dry = 40,
.sweet = 0,
.bitter = 0,
.sour = 40,
.smoothness = 80,
},
2019-04-14 13:22:37 +02:00
[ITEM_LANSAT_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("LANSAT"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SOFT,
.size = 97,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Lansat,
.description2 = sBerryDescriptionPart2_Lansat,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_STARF_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("STARF"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_SUPER_HARD,
.size = 153,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Starf,
.description2 = sBerryDescriptionPart2_Starf,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 10,
.dry = 10,
.sweet = 10,
.bitter = 10,
.sour = 10,
.smoothness = 30,
},
2019-04-14 13:22:37 +02:00
[ITEM_ENIGMA_BERRY - FIRST_BERRY_INDEX] =
2017-09-12 18:47:27 +02:00
{
2017-09-13 19:30:05 +02:00
.name = _("ENIGMA"),
2017-09-12 18:47:27 +02:00
.firmness = BERRY_FIRMNESS_UNKNOWN,
.size = 0,
.maxYield = 2,
.minYield = 1,
2017-09-13 11:16:26 +02:00
.description1 = sBerryDescriptionPart1_Enigma,
.description2 = sBerryDescriptionPart2_Enigma,
2017-09-12 18:47:27 +02:00
.stageDuration = 24,
.spicy = 40,
.dry = 40,
.sweet = 40,
.bitter = 40,
.sour = 40,
.smoothness = 40,
},
};
2021-03-16 10:40:42 +01:00
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 - FIRST_BERRY_INDEX] = {.difficulty = 150, .powder = 200}
2017-09-25 20:47:44 +02:00
};
const struct BerryTree gBlankBerryTree = {};
2017-09-13 11:16:26 +02:00
// unused
void ClearEnigmaBerries(void)
{
2018-12-31 18:16:45 +01:00
CpuFill16(0, &gSaveBlock1Ptr->enigmaBerry, sizeof(gSaveBlock1Ptr->enigmaBerry));
2017-09-13 11:16:26 +02:00
}
void SetEnigmaBerry(u8 *src)
{
u32 i;
u8 *dest = (u8 *)&gSaveBlock1Ptr->enigmaBerry;
2017-09-13 11:16:26 +02:00
2018-12-31 18:16:45 +01:00
for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry); i++)
2017-09-13 11:16:26 +02:00
dest[i] = src[i];
}
2018-10-17 14:52:26 +02:00
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
2017-09-13 11:16:26 +02:00
{
u32 i;
u32 checksum;
u8 *dest;
dest = (u8 *)enigmaBerry;
2017-09-13 11:16:26 +02:00
checksum = 0;
2018-12-31 18:16:45 +01:00
for (i = 0; i < sizeof(gSaveBlock1Ptr->enigmaBerry) - sizeof(gSaveBlock1Ptr->enigmaBerry.checksum); i++)
2017-09-13 11:16:26 +02:00
checksum += dest[i];
return checksum;
}
bool32 IsEnigmaBerryValid(void)
{
if (!gSaveBlock1Ptr->enigmaBerry.berry.stageDuration)
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)
{
2018-11-07 00:15:57 +01:00
if (berry == ITEM_TO_BERRY(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid())
2022-07-29 17:15:33 +02:00
return (struct Berry *)(&gSaveBlock1Ptr->enigmaBerry.berry);
2017-09-13 11:16:26 +02:00
else
{
2018-11-07 00:15:57 +01:00
if (berry == BERRY_NONE || berry > ITEM_TO_BERRY(LAST_BERRY_INDEX))
berry = ITEM_TO_BERRY(FIRST_BERRY_INDEX);
2017-09-13 11:16:26 +02:00
return &gBerries[berry - 1];
}
}
struct BerryTree *GetBerryTreeInfo(u8 id)
{
return &gSaveBlock1Ptr->berryTrees[id];
}
bool32 ObjectEventInteractionWaterBerryTree(void)
2017-09-13 11:16:26 +02:00
{
2020-06-01 16:23:12 +02:00
struct BerryTree *tree = GetBerryTreeInfo(GetObjectEventBerryTreeId(gSelectedObjectEvent));
2017-09-13 11:16:26 +02:00
switch (tree->stage)
{
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_PLANTED:
2017-09-13 11:16:26 +02:00
tree->watered1 = TRUE;
break;
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_SPROUTED:
2017-09-13 11:16:26 +02:00
tree->watered2 = TRUE;
break;
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_TALLER:
2017-09-13 11:16:26 +02:00
tree->watered3 = TRUE;
break;
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_FLOWERING:
2017-09-13 11:16:26 +02:00
tree->watered4 = TRUE;
break;
default:
return FALSE;
}
return TRUE;
}
2018-12-31 18:16:45 +01:00
bool8 IsPlayerFacingEmptyBerryTreePatch(void)
2017-09-13 11:16:26 +02:00
{
if (GetObjectEventScriptPointerPlayerFacing() == BerryTreeScript
2020-06-01 16:23:12 +02:00
&& GetStageByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent)) == BERRY_STAGE_NO_BERRY)
2017-09-13 11:16:26 +02:00
return TRUE;
else
return FALSE;
}
bool8 TryToWaterBerryTree(void)
{
if (GetObjectEventScriptPointerPlayerFacing() != BerryTreeScript)
2017-09-13 11:16:26 +02:00
return FALSE;
else
return ObjectEventInteractionWaterBerryTree();
2017-09-13 11:16:26 +02:00
}
void ClearBerryTrees(void)
{
int i;
2017-09-13 19:30:05 +02:00
for (i = 0; i < BERRY_TREES_COUNT; i++)
2017-09-13 11:16:26 +02:00
gSaveBlock1Ptr->berryTrees[i] = gBlankBerryTree;
}
2018-10-17 14:52:26 +02:00
static bool32 BerryTreeGrow(struct BerryTree *tree)
2017-09-13 11:16:26 +02:00
{
2021-01-26 11:16:01 +01:00
if (tree->stopGrowth)
2017-09-13 11:16:26 +02:00
return FALSE;
2021-01-26 11:16:01 +01:00
2017-09-13 11:16:26 +02:00
switch (tree->stage)
{
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_NO_BERRY:
2017-09-13 11:16:26 +02:00
return FALSE;
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_FLOWERING:
2017-09-13 11:16:26 +02:00
tree->berryYield = CalcBerryYield(tree);
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_PLANTED:
case BERRY_STAGE_SPROUTED:
case BERRY_STAGE_TALLER:
2017-09-13 11:16:26 +02:00
tree->stage++;
break;
2018-10-17 14:52:26 +02:00
case BERRY_STAGE_BERRIES:
2017-09-13 11:16:26 +02:00
tree->watered1 = 0;
tree->watered2 = 0;
tree->watered3 = 0;
tree->watered4 = 0;
tree->berryYield = 0;
2018-10-17 14:52:26 +02:00
tree->stage = BERRY_STAGE_SPROUTED;
2017-09-13 11:16:26 +02:00
if (++tree->regrowthCount == 10)
*tree = gBlankBerryTree;
break;
}
return TRUE;
}
void BerryTreeTimeUpdate(s32 minutes)
{
int i;
struct BerryTree *tree;
2017-09-13 19:30:05 +02:00
for (i = 0; i < BERRY_TREES_COUNT; i++)
2017-09-13 11:16:26 +02:00
{
tree = &gSaveBlock1Ptr->berryTrees[i];
2021-01-26 11:16:01 +01:00
if (tree->berry && tree->stage && !tree->stopGrowth)
2017-09-13 11:16:26 +02:00
{
if (minutes >= GetStageDurationByBerryType(tree->berry) * 71)
{
*tree = gBlankBerryTree;
}
else
{
s32 time = minutes;
while (time != 0)
{
if (tree->minutesUntilNextStage > time)
{
tree->minutesUntilNextStage -= time;
break;
}
time -= tree->minutesUntilNextStage;
tree->minutesUntilNextStage = GetStageDurationByBerryType(tree->berry);
if (!BerryTreeGrow(tree))
break;
2018-10-17 14:52:26 +02:00
if (tree->stage == BERRY_STAGE_BERRIES)
2017-09-13 11:16:26 +02:00
tree->minutesUntilNextStage *= 4;
}
}
}
}
}
2021-01-26 11:16:01 +01:00
void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 allowGrowth)
2017-09-13 11:16:26 +02:00
{
struct BerryTree *tree = GetBerryTreeInfo(id);
*tree = gBlankBerryTree;
tree->berry = berry;
tree->minutesUntilNextStage = GetStageDurationByBerryType(berry);
tree->stage = stage;
2018-10-17 14:52:26 +02:00
if (stage == BERRY_STAGE_BERRIES)
2017-09-13 11:16:26 +02:00
{
tree->berryYield = CalcBerryYield(tree);
tree->minutesUntilNextStage *= 4;
}
2018-12-31 18:16:45 +01:00
2021-01-26 11:16:01 +01:00
// 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;
2017-09-13 11:16:26 +02:00
}
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 ItemIdToBerryType(u16 item)
{
2017-11-18 16:11:34 +01:00
u16 berry = item - FIRST_BERRY_INDEX;
2017-09-13 11:16:26 +02:00
2017-11-18 16:11:34 +01:00
if (berry > LAST_BERRY_INDEX - FIRST_BERRY_INDEX)
2018-12-31 18:16:45 +01:00
return ITEM_TO_BERRY(FIRST_BERRY_INDEX);
2017-09-13 11:16:26 +02:00
else
2017-11-18 16:11:34 +01:00
return ITEM_TO_BERRY(item);
2017-09-13 11:16:26 +02:00
}
2018-10-17 14:52:26 +02:00
static u16 BerryTypeToItemId(u16 berry)
2017-09-13 11:16:26 +02:00
{
u16 item = berry - 1;
2017-11-18 16:11:34 +01:00
if (item > LAST_BERRY_INDEX - FIRST_BERRY_INDEX)
return FIRST_BERRY_INDEX;
2017-09-13 11:16:26 +02:00
else
2017-11-18 16:11:34 +01:00
return berry + FIRST_BERRY_INDEX - 1;
2017-09-13 11:16:26 +02:00
}
void GetBerryNameByBerryType(u8 berry, u8 *string)
{
2018-09-01 22:03:21 +02:00
memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH);
string[BERRY_NAME_LENGTH] = EOS;
2017-09-13 11:16:26 +02:00
}
void GetBerryCountStringByBerryType(u8 berry, u8 *dest, u32 berryCount)
2017-09-13 11:16:26 +02:00
{
GetBerryCountString(dest, GetBerryInfo(berry)->name, berryCount);
}
2021-01-26 11:16:01 +01:00
void AllowBerryTreeGrowth(u8 id)
2017-09-13 11:16:26 +02:00
{
2021-01-26 11:16:01 +01:00
GetBerryTreeInfo(id)->stopGrowth = FALSE;
2017-09-13 11:16:26 +02:00
}
2018-10-17 14:52:26 +02:00
static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree)
2017-09-13 11:16:26 +02:00
{
u8 count = 0;
if (tree->watered1)
count++;
if (tree->watered2)
count++;
if (tree->watered3)
count++;
if (tree->watered4)
count++;
return count;
}
2018-10-17 14:52:26 +02:00
static u8 GetNumStagesWateredByBerryTreeId(u8 id)
2017-09-13 11:16:26 +02:00
{
return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id));
}
2020-05-02 17:46:12 +02:00
// 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.
//
2020-05-02 19:59:28 +02:00
// See resulting yields: https://gist.github.com/hondew/2a099dbe54aa91414decdbfaa524327d,
// and bug fix: https://gist.github.com/hondew/0f0164e5b9dadfd72d24f30f2c049a0b.
2018-10-17 14:52:26 +02:00
static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
2017-09-13 11:16:26 +02:00
{
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);
2020-05-02 17:46:12 +02:00
// Round upwards
2020-05-02 19:38:25 +02:00
if ((rand % NUM_WATER_STAGES) >= NUM_WATER_STAGES / 2)
extraYield = rand / NUM_WATER_STAGES + 1;
2017-09-13 11:16:26 +02:00
else
2020-05-02 19:38:25 +02:00
extraYield = rand / NUM_WATER_STAGES;
2017-09-13 11:16:26 +02:00
return extraYield + min;
}
}
2018-10-17 14:52:26 +02:00
static u8 CalcBerryYield(struct BerryTree *tree)
2017-09-13 11:16:26 +02:00
{
const struct Berry *berry = GetBerryInfo(tree->berry);
u8 min = berry->minYield;
u8 max = berry->maxYield;
return CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree));
}
2018-10-17 14:52:26 +02:00
static u8 GetBerryCountByBerryTreeId(u8 id)
2017-09-13 11:16:26 +02:00
{
return gSaveBlock1Ptr->berryTrees[id].berryYield;
}
2018-10-17 14:52:26 +02:00
static u16 GetStageDurationByBerryType(u8 berry)
2017-09-13 11:16:26 +02:00
{
return GetBerryInfo(berry)->stageDuration * 60;
}
void ObjectEventInteractionGetBerryTreeData(void)
2017-09-13 11:16:26 +02:00
{
u8 id;
u8 berry;
2018-10-17 14:52:26 +02:00
u8 localId;
2017-09-13 11:16:26 +02:00
u8 group;
u8 num;
2020-06-01 16:23:12 +02:00
id = GetObjectEventBerryTreeId(gSelectedObjectEvent);
2017-09-13 11:16:26 +02:00
berry = GetBerryTypeByBerryTreeId(id);
2021-01-26 11:16:01 +01:00
AllowBerryTreeGrowth(id);
2018-10-17 14:52:26 +02:00
localId = gSpecialVar_LastTalked;
2017-09-13 11:16:26 +02:00
num = gSaveBlock1Ptr->location.mapNum;
group = gSaveBlock1Ptr->location.mapGroup;
2018-10-17 14:52:26 +02:00
if (IsBerryTreeSparkling(localId, num, group))
gSpecialVar_0x8004 = BERRY_STAGE_SPARKLING;
2017-09-13 11:16:26 +02:00
else
gSpecialVar_0x8004 = GetStageByBerryTreeId(id);
gSpecialVar_0x8005 = GetNumStagesWateredByBerryTreeId(id);
gSpecialVar_0x8006 = GetBerryCountByBerryTreeId(id);
GetBerryCountStringByBerryType(berry, gStringVar1, gSpecialVar_0x8006);
}
void ObjectEventInteractionGetBerryName(void)
2017-09-13 11:16:26 +02:00
{
2020-06-01 16:23:12 +02:00
u8 berryType = GetBerryTypeByBerryTreeId(GetObjectEventBerryTreeId(gSelectedObjectEvent));
2017-09-13 11:16:26 +02:00
GetBerryNameByBerryType(berryType, gStringVar1);
}
void ObjectEventInteractionGetBerryCountString(void)
2017-09-13 11:16:26 +02:00
{
2020-06-01 16:23:12 +02:00
u8 treeId = GetObjectEventBerryTreeId(gSelectedObjectEvent);
2017-09-13 11:16:26 +02:00
u8 berry = GetBerryTypeByBerryTreeId(treeId);
u8 count = GetBerryCountByBerryTreeId(treeId);
GetBerryCountStringByBerryType(berry, gStringVar1, count);
}
void Bag_ChooseBerry(void)
{
SetMainCallback2(CB2_ChooseBerry);
}
void ObjectEventInteractionPlantBerryTree(void)
2017-09-13 11:16:26 +02:00
{
2017-11-11 01:12:18 +01:00
u8 berry = ItemIdToBerryType(gSpecialVar_ItemId);
2017-09-13 11:16:26 +02:00
2022-07-25 20:59:14 +02:00
PlantBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent), berry, BERRY_STAGE_PLANTED, TRUE);
ObjectEventInteractionGetBerryTreeData();
2017-09-13 11:16:26 +02:00
}
void ObjectEventInteractionPickBerryTree(void)
2017-09-13 11:16:26 +02:00
{
2020-06-01 16:23:12 +02:00
u8 id = GetObjectEventBerryTreeId(gSelectedObjectEvent);
2017-09-13 11:16:26 +02:00
u8 berry = GetBerryTypeByBerryTreeId(id);
gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id));
}
void ObjectEventInteractionRemoveBerryTree(void)
2017-09-13 11:16:26 +02:00
{
2020-06-01 16:23:12 +02:00
RemoveBerryTree(GetObjectEventBerryTreeId(gSelectedObjectEvent));
2021-01-26 11:16:01 +01:00
SetBerryTreeJustPicked(gSpecialVar_LastTalked, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
2017-09-13 11:16:26 +02:00
}
2018-10-17 14:52:26 +02:00
bool8 PlayerHasBerries(void)
2017-09-13 11:16:26 +02:00
{
2018-04-29 15:34:14 +02:00
return IsBagPocketNonEmpty(POCKET_BERRIES);
2017-09-13 11:16:26 +02:00
}
2021-01-26 11:16:01 +01:00
// 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)
2017-09-13 11:16:26 +02:00
{
s16 cam_left;
s16 cam_top;
s16 left;
s16 top;
s16 right;
s16 bottom;
int i;
GetCameraCoords(&cam_left, &cam_top);
2017-09-13 11:16:26 +02:00
left = cam_left;
top = cam_top + 3;
right = cam_left + 14;
bottom = top + 8;
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
2017-09-13 11:16:26 +02:00
{
if (gObjectEvents[i].active && gObjectEvents[i].movementType == MOVEMENT_TYPE_BERRY_TREE_GROWTH)
2017-09-13 11:16:26 +02:00
{
cam_left = gObjectEvents[i].currentCoords.x;
cam_top = gObjectEvents[i].currentCoords.y;
2017-09-13 11:16:26 +02:00
if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom)
2021-01-26 11:16:01 +01:00
AllowBerryTreeGrowth(gObjectEvents[i].trainerRange_berryTreeId);
2017-09-13 11:16:26 +02:00
}
}
}