summaryrefslogtreecommitdiff
path: root/src/field/berry.c
blob: 5888077550f654e7b45657af55605f5b8df2884f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
#include "global.h"
#include "berry.h"
#include "field_control_avatar.h"
#include "field_map_obj.h"
#include "fieldmap.h"
#include "item.h"
#include "item_menu.h"
#include "item_use.h"
#include "constants/items.h"
#include "main.h"
#include "random.h"
#include "text.h"

#define BERRY_NAME_LENGTH 6
#define BERRY_REGROW_LIMIT 10
#define MAX_BERRY_TREES 128

#define BERRY_NONE 0
#define FIRST_BERRY ITEM_CHERI_BERRY
#define LAST_BERRY  ITEM_ENIGMA_BERRY

#define GETBERRYID(berry) ((berry - FIRST_BERRY) + 1)
#define GETITEMID(berry) ((berry + FIRST_BERRY) - 1)

#ifdef ENGLISH
#define NAME_CHERI_BERRY   _("CHERI")
#define NAME_CHESTO_BERRY  _("CHESTO")
#define NAME_PECHA_BERRY   _("PECHA")
#define NAME_RAWST_BERRY   _("RAWST")
#define NAME_ASPEAR_BERRY  _("ASPEAR")
#define NAME_LEPPA_BERRY   _("LEPPA")
#define NAME_ORAN_BERRY    _("ORAN")
#define NAME_PERSIM_BERRY  _("PERSIM")
#define NAME_LUM_BERRY     _("LUM")
#define NAME_SITRUS_BERRY  _("SITRUS")
#define NAME_FIGY_BERRY    _("FIGY")
#define NAME_WIKI_BERRY    _("WIKI")
#define NAME_MAGO_BERRY    _("MAGO")
#define NAME_AGUAV_BERRY   _("AGUAV")
#define NAME_IAPAPA_BERRY  _("IAPAPA")
#define NAME_RAZZ_BERRY    _("RAZZ")
#define NAME_BLUK_BERRY    _("BLUK")
#define NAME_NANAB_BERRY   _("NANAB")
#define NAME_WEPEAR_BERRY  _("WEPEAR")
#define NAME_PINAP_BERRY   _("PINAP")
#define NAME_POMEG_BERRY   _("POMEG")
#define NAME_KELPSY_BERRY  _("KELPSY")
#define NAME_QUALOT_BERRY  _("QUALOT")
#define NAME_HONDEW_BERRY  _("HONDEW")
#define NAME_GREPA_BERRY   _("GREPA")
#define NAME_TAMATO_BERRY  _("TAMATO")
#define NAME_CORNN_BERRY   _("CORNN")
#define NAME_MAGOST_BERRY  _("MAGOST")
#define NAME_RABUTA_BERRY  _("RABUTA")
#define NAME_NOMEL_BERRY   _("NOMEL")
#define NAME_SPELON_BERRY  _("SPELON")
#define NAME_PAMTRE_BERRY  _("PAMTRE")
#define NAME_WATMEL_BERRY  _("WATMEL")
#define NAME_DURIN_BERRY   _("DURIN")
#define NAME_BELUE_BERRY   _("BELUE")
#define NAME_LIECHI_BERRY  _("LIECHI")
#define NAME_GANLON_BERRY  _("GANLON")
#define NAME_SALAC_BERRY   _("SALAC")
#define NAME_PETAYA_BERRY  _("PETAYA")
#define NAME_APICOT_BERRY  _("APICOT")
#define NAME_LANSAT_BERRY  _("LANSAT")
#define NAME_STARF_BERRY   _("STARF")
#define NAME_ENIGMA_BERRY  _("ENIGMA")

static const u8 gBerryDescriptionPart1_Cheri[] = _("Blooms with delicate pretty flowers.");
static const u8 gBerryDescriptionPart2_Cheri[] = _("The bright red BERRY is very spicy.");
static const u8 gBerryDescriptionPart1_Chesto[] = _("The BERRY’s thick skin and fruit are");
static const u8 gBerryDescriptionPart2_Chesto[] = _("very tough. It is dry-tasting all over.");
static const u8 gBerryDescriptionPart1_Pecha[] = _("Very sweet and delicious.");
static const u8 gBerryDescriptionPart2_Pecha[] = _("Also very tender - handle with care.");
static const u8 gBerryDescriptionPart1_Rawst[] = _("If the leaves grow long and curly,");
static const u8 gBerryDescriptionPart2_Rawst[] = _("the BERRY seems to grow very bitter.");
static const u8 gBerryDescriptionPart1_Aspear[] = _("The hard BERRY is dense with a rich");
static const u8 gBerryDescriptionPart2_Aspear[] = _("juice. It is quite sour.");
static const u8 gBerryDescriptionPart1_Leppa[] = _("Grows slower than CHERI and others.");
static const u8 gBerryDescriptionPart2_Leppa[] = _("The smaller the BERRY, the tastier.");
static const u8 gBerryDescriptionPart1_Oran[] = _("A peculiar BERRY with a mix of flavors.");
static const u8 gBerryDescriptionPart2_Oran[] = _("BERRIES grow in half a day.");
static const u8 gBerryDescriptionPart1_Persim[] = _("Loves sunlight. The BERRY’s color");
static const u8 gBerryDescriptionPart2_Persim[] = _("grows vivid when exposed to the sun.");
static const u8 gBerryDescriptionPart1_Lum[] = _("Slow to grow. If raised with loving");
static const u8 gBerryDescriptionPart2_Lum[] = _("care, it may grow two BERRIES.");
static const u8 gBerryDescriptionPart1_Sitrus[] = _("Closely related to ORAN. The large");
static const u8 gBerryDescriptionPart2_Sitrus[] = _("BERRY has a well-rounded flavor.");
static const u8 gBerryDescriptionPart1_Figy[] = _("The BERRY, which looks chewed up,");
static const u8 gBerryDescriptionPart2_Figy[] = _("brims with spicy substances.");
static const u8 gBerryDescriptionPart1_Wiki[] = _("The BERRY is said to have grown lumpy");
static const u8 gBerryDescriptionPart2_Wiki[] = _("to help POKéMON grip it.");
static const u8 gBerryDescriptionPart1_Mago[] = _("The BERRY turns curvy as it grows.");
static const u8 gBerryDescriptionPart2_Mago[] = _("The curvier, the sweeter and tastier.");
static const u8 gBerryDescriptionPart1_Aguav[] = _("The flower is dainty. It is rare in its");
static const u8 gBerryDescriptionPart2_Aguav[] = _("ability to grow without light.");
static const u8 gBerryDescriptionPart1_Iapapa[] = _("The BERRY is very big and sour.");
static const u8 gBerryDescriptionPart2_Iapapa[] = _("It takes at least a day to grow.");
static const u8 gBerryDescriptionPart1_Razz[] = _("The red BERRY tastes slightly spicy.");
static const u8 gBerryDescriptionPart2_Razz[] = _("It grows quickly in just four hours.");
static const u8 gBerryDescriptionPart1_Bluk[] = _("The BERRY is blue on the outside, but");
static const u8 gBerryDescriptionPart2_Bluk[] = _("it blackens the mouth when eaten.");
static const u8 gBerryDescriptionPart1_Nanab[] = _("This BERRY was the seventh");
static const u8 gBerryDescriptionPart2_Nanab[] = _("discovered in the world. It is sweet.");
static const u8 gBerryDescriptionPart1_Wepear[] = _("The flower is small and white. It has a");
static const u8 gBerryDescriptionPart2_Wepear[] = _("delicate balance of bitter and sour.");
static const u8 gBerryDescriptionPart1_Pinap[] = _("Weak against wind and cold.");
static const u8 gBerryDescriptionPart2_Pinap[] = _("The fruit is spicy and the skin, sour.");
static const u8 gBerryDescriptionPart1_Pomeg[] = _("However much it is watered,");
static const u8 gBerryDescriptionPart2_Pomeg[] = _("it only grows up to six BERRIES.");
static const u8 gBerryDescriptionPart1_Kelpsy[] = _("A rare variety shaped like a root.");
static const u8 gBerryDescriptionPart2_Kelpsy[] = _("Grows a very large flower.");
static const u8 gBerryDescriptionPart1_Qualot[] = _("Loves water. Grows strong even in");
static const u8 gBerryDescriptionPart2_Qualot[] = _("locations with constant rainfall.");
static const u8 gBerryDescriptionPart1_Hondew[] = _("A BERRY that is very valuable and");
static const u8 gBerryDescriptionPart2_Hondew[] = _("rarely seen. It is very delicious.");
static const u8 gBerryDescriptionPart1_Grepa[] = _("Despite its tenderness and round");
static const u8 gBerryDescriptionPart2_Grepa[] = _("shape, the BERRY is unimaginably sour.");
static const u8 gBerryDescriptionPart1_Tamato[] = _("The BERRY is lip-bendingly spicy.");
static const u8 gBerryDescriptionPart2_Tamato[] = _("It takes time to grow.");
static const u8 gBerryDescriptionPart1_Cornn[] = _("A BERRY from an ancient era. May not");
static const u8 gBerryDescriptionPart2_Cornn[] = _("grow unless planted in quantity.");
static const u8 gBerryDescriptionPart1_Magost[] = _("A BERRY that is widely said to have");
static const u8 gBerryDescriptionPart2_Magost[] = _("a finely balanced flavor.");
static const u8 gBerryDescriptionPart1_Rabuta[] = _("A rare variety that is overgrown with");
static const u8 gBerryDescriptionPart2_Rabuta[] = _("hair. It is quite bitter.");
static const u8 gBerryDescriptionPart1_Nomel[] = _("Quite sour. Just one bite makes it");
static const u8 gBerryDescriptionPart2_Nomel[] = _("impossible to taste for three days.");
static const u8 gBerryDescriptionPart1_Spelon[] = _("The vividly red BERRY is very spicy.");
static const u8 gBerryDescriptionPart2_Spelon[] = _("Its warts secrete a spicy substance.");
static const u8 gBerryDescriptionPart1_Pamtre[] = _("Drifts on the sea from somewhere.");
static const u8 gBerryDescriptionPart2_Pamtre[] = _("It is thought to grow elsewhere.");
static const u8 gBerryDescriptionPart1_Watmel[] = _("A huge BERRY, with some over 20");
static const u8 gBerryDescriptionPart2_Watmel[] = _("inches discovered. Exceedingly sweet.");
static const u8 gBerryDescriptionPart1_Durin[] = _("Bitter to even look at. It is so");
static const u8 gBerryDescriptionPart2_Durin[] = _("bitter, no one has ever eaten it as is.");
static const u8 gBerryDescriptionPart1_Belue[] = _("It is glossy and looks delicious, but");
static const u8 gBerryDescriptionPart2_Belue[] = _("it is awfully sour. Takes time to grow.");
static const u8 gBerryDescriptionPart1_Liechi[] = _("A mysterious BERRY. It is rumored to");
static const u8 gBerryDescriptionPart2_Liechi[] = _("contain the power of the sea.");
static const u8 gBerryDescriptionPart1_Ganlon[] = _("A mysterious BERRY. It is rumored to");
static const u8 gBerryDescriptionPart2_Ganlon[] = _("contain the power of the land.");
static const u8 gBerryDescriptionPart1_Salac[] = _("A mysterious BERRY. It is rumored to");
static const u8 gBerryDescriptionPart2_Salac[] = _("contain the power of the sky.");
static const u8 gBerryDescriptionPart1_Petaya[] = _("A mysterious BERRY. It is rumored to");
static const u8 gBerryDescriptionPart2_Petaya[] = _("contain the power of all living things.");
static const u8 gBerryDescriptionPart1_Apicot[] = _("A very mystifying BERRY. No telling");
static const u8 gBerryDescriptionPart2_Apicot[] = _("what may happen or how it can be used.");
static const u8 gBerryDescriptionPart1_Lansat[] = _("Said to be a legendary BERRY.");
static const u8 gBerryDescriptionPart2_Lansat[] = _("Holding it supposedly brings joy.");
static const u8 gBerryDescriptionPart1_Starf[] = _("So strong, it was abandoned at the");
static const u8 gBerryDescriptionPart2_Starf[] = _("world’s edge. Considered a mirage.");
static const u8 gBerryDescriptionPart1_Enigma[] = _("A completely enigmatic BERRY.");
static const u8 gBerryDescriptionPart2_Enigma[] = _("Appears to have the power of stars.");
#elif defined(GERMAN)
#define NAME_CHERI_BERRY   _("AMRENA")
#define NAME_CHESTO_BERRY  _("MARON")
#define NAME_PECHA_BERRY   _("PIRSIF")
#define NAME_RAWST_BERRY   _("FRAGIA")
#define NAME_ASPEAR_BERRY  _("WILBIR")
#define NAME_LEPPA_BERRY   _("JONAGO")
#define NAME_ORAN_BERRY    _("SINEL")
#define NAME_PERSIM_BERRY  _("PERSIM")
#define NAME_LUM_BERRY     _("PRUNUS")
#define NAME_SITRUS_BERRY  _("TSITRU")
#define NAME_FIGY_BERRY    _("GIEFE")
#define NAME_WIKI_BERRY    _("WIKI")
#define NAME_MAGO_BERRY    _("MAGO")
#define NAME_AGUAV_BERRY   _("GAUVE")
#define NAME_IAPAPA_BERRY  _("YAPA")
#define NAME_RAZZ_BERRY    _("HIMMIH")
#define NAME_BLUK_BERRY    _("MORB")
#define NAME_NANAB_BERRY   _("NANAB")
#define NAME_WEPEAR_BERRY  _("NIRBE")
#define NAME_PINAP_BERRY   _("SANANA")
#define NAME_POMEG_BERRY   _("GRANA")
#define NAME_KELPSY_BERRY  _("SETANG")
#define NAME_QUALOT_BERRY  _("QUALOT")
#define NAME_HONDEW_BERRY  _("HONMEL")
#define NAME_GREPA_BERRY   _("LABRUS")
#define NAME_TAMATO_BERRY  _("TAMOT")
#define NAME_CORNN_BERRY   _("SAIM")
#define NAME_MAGOST_BERRY  _("MAGOST")
#define NAME_RABUTA_BERRY  _("RABUTA")
#define NAME_NOMEL_BERRY   _("TRONZI")
#define NAME_SPELON_BERRY  _("KIWAN")
#define NAME_PAMTRE_BERRY  _("PALLM")
#define NAME_WATMEL_BERRY  _("WASMEL")
#define NAME_DURIN_BERRY   _("DURIN")
#define NAME_BELUE_BERRY   _("MYRTIL")
#define NAME_LIECHI_BERRY  _("LYDZI")
#define NAME_GANLON_BERRY  _("LINGAN")
#define NAME_SALAC_BERRY   _("SALKA")
#define NAME_PETAYA_BERRY  _("TAHAY")
#define NAME_APICOT_BERRY  _("APIKO")
#define NAME_LANSAT_BERRY  _("LANSAT")
#define NAME_STARF_BERRY   _("KRAMBO")
#define NAME_ENIGMA_BERRY  _("ENIGMA")

static const u8 gBerryDescriptionPart1_Cheri[] = _("Erblüht mit hübschen, zarten Blumen.");
static const u8 gBerryDescriptionPart2_Cheri[] = _("Diese knallrote BEERE ist sehr scharf.");
static const u8 gBerryDescriptionPart1_Chesto[] = _("Diese BEERE hat eine dicke Haut und");
static const u8 gBerryDescriptionPart2_Chesto[] = _("hartes Fruchtfleisch. Trocken!");
static const u8 gBerryDescriptionPart1_Pecha[] = _("Sehr süß und delikat.");
static const u8 gBerryDescriptionPart2_Pecha[] = _("Sehr zart. Vorsichtig anfassen!");
static const u8 gBerryDescriptionPart1_Rawst[] = _("Wenn die Blätter lang und wellig sind,");
static const u8 gBerryDescriptionPart2_Rawst[] = _("wird die BEERE sehr bitter.");
static const u8 gBerryDescriptionPart1_Aspear[] = _("Diese harte BEERE ist sehr");
static const u8 gBerryDescriptionPart2_Aspear[] = _("saftig und sauer im Geschmack!");
static const u8 gBerryDescriptionPart1_Leppa[] = _("Wächst langsamer als AMRENA und");
static const u8 gBerryDescriptionPart2_Leppa[] = _("andere. Je kleiner, desto delikater.");
static const u8 gBerryDescriptionPart1_Oran[] = _("Eine BEERE unterschiedlichsten Ge-");
static const u8 gBerryDescriptionPart2_Oran[] = _("schmacks. Wächst an einem halben Tag.");
static const u8 gBerryDescriptionPart1_Persim[] = _("Liebt Sonnenlicht. Die BEERE");
static const u8 gBerryDescriptionPart2_Persim[] = _("wächst im Sonnenlicht sehr schnell.");
static const u8 gBerryDescriptionPart1_Lum[] = _("Langsamer Wuchs. Wird sie liebevoll ge-");
static const u8 gBerryDescriptionPart2_Lum[] = _("pflegt, kann sie 2 BEEREN tragen.");
static const u8 gBerryDescriptionPart1_Sitrus[] = _("Eng verwandt mit SINEL. Diese große");
static const u8 gBerryDescriptionPart2_Sitrus[] = _("BEERE ist von rundem Geschmack.");
static const u8 gBerryDescriptionPart1_Figy[] = _("Die BEERE sieht angekaut aus. Sie ist");
static const u8 gBerryDescriptionPart2_Figy[] = _("voller scharfer Substanzen.");
static const u8 gBerryDescriptionPart1_Wiki[] = _("Die BEERE wächst unförmig,");
static const u8 gBerryDescriptionPart2_Wiki[] = _("damit PKMN sie besser greifen können.");
static const u8 gBerryDescriptionPart1_Mago[] = _("Die BEERE hat Ausbeulungen. Je mehr");
static const u8 gBerryDescriptionPart2_Mago[] = _("Beulen, desto schmackhafter ist sie.");
static const u8 gBerryDescriptionPart1_Aguav[] = _("Die Blume ist zart. Sie ist fähig,");
static const u8 gBerryDescriptionPart2_Aguav[] = _("ohne Licht wachsen zu können.");
static const u8 gBerryDescriptionPart1_Iapapa[] = _("Die BEERE ist groß und sauer.");
static const u8 gBerryDescriptionPart2_Iapapa[] = _("Sie braucht einen Tag zum Wachsen.");
static const u8 gBerryDescriptionPart1_Razz[] = _("Diese rote BEERE schmeckt etwas");
static const u8 gBerryDescriptionPart2_Razz[] = _("scharf. Sie wächst in nur 4 Stunden.");
static const u8 gBerryDescriptionPart1_Bluk[] = _("Die BEERE ist außen blau, verfärbt");
static const u8 gBerryDescriptionPart2_Bluk[] = _("sich im Mund aber schwarz.");
static const u8 gBerryDescriptionPart1_Nanab[] = _("Diese BEERE war die 7., die auf der");
static const u8 gBerryDescriptionPart2_Nanab[] = _("Welt entdeckt wurde. Sie ist süß.");
static const u8 gBerryDescriptionPart1_Wepear[] = _("Die Blume ist klein und weiß. Angenehm");
static const u8 gBerryDescriptionPart2_Wepear[] = _("bitter und sauer zugleich.");
static const u8 gBerryDescriptionPart1_Pinap[] = _("Wind und Kälte verträgt sie nicht.");
static const u8 gBerryDescriptionPart2_Pinap[] = _("Fruchtfleisch: Scharf. Haut: Sauer.");
static const u8 gBerryDescriptionPart1_Pomeg[] = _("Egal wie viel Wasser sie bekommt, sie");
static const u8 gBerryDescriptionPart2_Pomeg[] = _("trägt immer bis zu 6 BEEREN.");
static const u8 gBerryDescriptionPart1_Kelpsy[] = _("Eine Seltenheit. Geformt wie eine");
static const u8 gBerryDescriptionPart2_Kelpsy[] = _("Wurzel. Hat eine große Blume.");
static const u8 gBerryDescriptionPart1_Qualot[] = _("Liebt das Wasser. Wächst besonders");
static const u8 gBerryDescriptionPart2_Qualot[] = _("gut in regenreichen Gegenden.");
static const u8 gBerryDescriptionPart1_Hondew[] = _("Eine wertvolle und seltene BEERE.");
static const u8 gBerryDescriptionPart2_Hondew[] = _("Sie ist sehr schmackhaft.");
static const u8 gBerryDescriptionPart1_Grepa[] = _("Die BEERE ist zart und von runder");
static const u8 gBerryDescriptionPart2_Grepa[] = _("Form. Aber sie ist unglaublich sauer!");
static const u8 gBerryDescriptionPart1_Tamato[] = _("Die Schärfe der BEERE verbrennt die");
static const u8 gBerryDescriptionPart2_Tamato[] = _("Lippen. Sie braucht Zeit zum Wachsen.");
static const u8 gBerryDescriptionPart1_Cornn[] = _("Eine BEERE aus alten Zeiten. Wächst");
static const u8 gBerryDescriptionPart2_Cornn[] = _("nur, wenn in großen Mengen gepflanzt.");
static const u8 gBerryDescriptionPart1_Magost[] = _("Eine BEERE, die für ihren feinen, aus-");
static const u8 gBerryDescriptionPart2_Magost[] = _("gewogenen Geschmack bekannt ist.");
static const u8 gBerryDescriptionPart1_Rabuta[] = _("Eine Seltenheit, die über und über mit");
static const u8 gBerryDescriptionPart2_Rabuta[] = _("Haaren bewachsen ist. Sehr bitter!");
static const u8 gBerryDescriptionPart1_Nomel[] = _("Sehr sauer. Ein Biss betäubt die");
static const u8 gBerryDescriptionPart2_Nomel[] = _("Geschmacksnerven für 3 Tage!");
static const u8 gBerryDescriptionPart1_Spelon[] = _("Die leuchtend rote BEERE ist sehr");
static const u8 gBerryDescriptionPart2_Spelon[] = _("scharf. Gibt scharfe Substanzen ab!");
static const u8 gBerryDescriptionPart1_Pamtre[] = _("Wird vom Meer angespült. Sie wächst");
static const u8 gBerryDescriptionPart2_Pamtre[] = _("an einem anderen Ort.");
static const u8 gBerryDescriptionPart1_Watmel[] = _("Eine große BEERE, 25 cm groß.");
static const u8 gBerryDescriptionPart2_Watmel[] = _("Außergewöhnlich süß.");
static const u8 gBerryDescriptionPart1_Durin[] = _("Bitter schon ihr Anblick! Sie ist so");
static const u8 gBerryDescriptionPart2_Durin[] = _("bitter, dass niemand sie pur isst.");
static const u8 gBerryDescriptionPart1_Belue[] = _("Sie glänzt, sieht zart aus, ist extrem");
static const u8 gBerryDescriptionPart2_Belue[] = _("sauer und braucht Zeit zum Wachsen.");
static const u8 gBerryDescriptionPart1_Liechi[] = _("Eine geheimnisvolle BEERE. Man sagt,");
static const u8 gBerryDescriptionPart2_Liechi[] = _("sie enthalte die Kraft des Meeres.");
static const u8 gBerryDescriptionPart1_Ganlon[] = _("Eine geheimnisvolle BEERE. Man sagt,");
static const u8 gBerryDescriptionPart2_Ganlon[] = _("sie enthalte die Kraft des Landes.");
static const u8 gBerryDescriptionPart1_Salac[] = _("Eine geheimnisvolle BEERE. Man sagt,");
static const u8 gBerryDescriptionPart2_Salac[] = _("sie enthalte die Kraft des Himmels.");
static const u8 gBerryDescriptionPart1_Petaya[] = _("Eine geheimnisvolle BEERE. Man sagt,");
static const u8 gBerryDescriptionPart2_Petaya[] = _("sie enthalte die Kraft allen Lebens.");
static const u8 gBerryDescriptionPart1_Apicot[] = _("Eine rätselhafte BEERE. Man kann");
static const u8 gBerryDescriptionPart2_Apicot[] = _("nicht sagen, wie und was sie ist.");
static const u8 gBerryDescriptionPart1_Lansat[] = _("Eine legendäre BEERE. Sie zu");
static const u8 gBerryDescriptionPart2_Lansat[] = _("tragen bringt Freude.");
static const u8 gBerryDescriptionPart1_Starf[] = _("So stark, dass sie an den Rand der");
static const u8 gBerryDescriptionPart2_Starf[] = _("Welt verbannt wurde. Ein Märchen?");
static const u8 gBerryDescriptionPart1_Enigma[] = _("Eine enigmatische BEERE. Sie scheint");
static const u8 gBerryDescriptionPart2_Enigma[] = _("die Macht der Sterne zu besitzen.");
#endif

const struct Berry gBerries[] =
{
    {
        .name = NAME_CHERI_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 20,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Cheri,
        .description2 = gBerryDescriptionPart2_Cheri,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_CHESTO_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 80,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Chesto,
        .description2 = gBerryDescriptionPart2_Chesto,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 10,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_PECHA_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_SOFT,
        .size = 40,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Pecha,
        .description2 = gBerryDescriptionPart2_Pecha,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 0,
        .sweet = 10,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_RAWST_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 32,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Rawst,
        .description2 = gBerryDescriptionPart2_Rawst,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 10,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_ASPEAR_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 50,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Aspear,
        .description2 = gBerryDescriptionPart2_Aspear,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 10,
        .smoothness = 25,
    },
    {
        .name = NAME_LEPPA_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 28,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Leppa,
        .description2 = gBerryDescriptionPart2_Leppa,
        .stageDuration = 4,
        .spicy = 10,
        .dry = 0,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_ORAN_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 35,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Oran,
        .description2 = gBerryDescriptionPart2_Oran,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_PERSIM_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 47,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Persim,
        .description2 = gBerryDescriptionPart2_Persim,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_LUM_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 34,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Lum,
        .description2 = gBerryDescriptionPart2_Lum,
        .stageDuration = 12,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_SITRUS_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 95,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Sitrus,
        .description2 = gBerryDescriptionPart2_Sitrus,
        .stageDuration = 6,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_FIGY_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 100,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Figy,
        .description2 = gBerryDescriptionPart2_Figy,
        .stageDuration = 6,
        .spicy = 10,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_WIKI_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 115,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Wiki,
        .description2 = gBerryDescriptionPart2_Wiki,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 10,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_MAGO_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 126,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Mago,
        .description2 = gBerryDescriptionPart2_Mago,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 0,
        .sweet = 10,
        .bitter = 0,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_AGUAV_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 64,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Aguav,
        .description2 = gBerryDescriptionPart2_Aguav,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 10,
        .sour = 0,
        .smoothness = 25,
    },
    {
        .name = NAME_IAPAPA_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 223,
        .maxYield = 3,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Iapapa,
        .description2 = gBerryDescriptionPart2_Iapapa,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 10,
        .smoothness = 25,
    },
    {
        .name = NAME_RAZZ_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 120,
        .maxYield = 6,
        .minYield = 3,
        .description1 = gBerryDescriptionPart1_Razz,
        .description2 = gBerryDescriptionPart2_Razz,
        .stageDuration = 1,
        .spicy = 10,
        .dry = 10,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 20,
    },
    {
        .name = NAME_BLUK_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 108,
        .maxYield = 6,
        .minYield = 3,
        .description1 = gBerryDescriptionPart1_Bluk,
        .description2 = gBerryDescriptionPart2_Bluk,
        .stageDuration = 1,
        .spicy = 0,
        .dry = 10,
        .sweet = 10,
        .bitter = 0,
        .sour = 0,
        .smoothness = 20,
    },
    {
        .name = NAME_NANAB_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 77,
        .maxYield = 6,
        .minYield = 3,
        .description1 = gBerryDescriptionPart1_Nanab,
        .description2 = gBerryDescriptionPart2_Nanab,
        .stageDuration = 1,
        .spicy = 0,
        .dry = 0,
        .sweet = 10,
        .bitter = 10,
        .sour = 0,
        .smoothness = 20,
    },
    {
        .name = NAME_WEPEAR_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 74,
        .maxYield = 6,
        .minYield = 3,
        .description1 = gBerryDescriptionPart1_Wepear,
        .description2 = gBerryDescriptionPart2_Wepear,
        .stageDuration = 1,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_PINAP_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 80,
        .maxYield = 6,
        .minYield = 3,
        .description1 = gBerryDescriptionPart1_Pinap,
        .description2 = gBerryDescriptionPart2_Pinap,
        .stageDuration = 1,
        .spicy = 10,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_POMEG_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 135,
        .maxYield = 6,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Pomeg,
        .description2 = gBerryDescriptionPart2_Pomeg,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 0,
        .sweet = 10,
        .bitter = 10,
        .sour = 0,
        .smoothness = 20,
    },
    {
        .name = NAME_KELPSY_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 150,
        .maxYield = 6,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Kelpsy,
        .description2 = gBerryDescriptionPart2_Kelpsy,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 10,
        .sweet = 0,
        .bitter = 10,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_QUALOT_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 110,
        .maxYield = 6,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Qualot,
        .description2 = gBerryDescriptionPart2_Qualot,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 0,
        .sweet = 10,
        .bitter = 0,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_HONDEW_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 162,
        .maxYield = 6,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Hondew,
        .description2 = gBerryDescriptionPart2_Hondew,
        .stageDuration = 3,
        .spicy = 10,
        .dry = 10,
        .sweet = 0,
        .bitter = 10,
        .sour = 0,
        .smoothness = 20,
    },
    {
        .name = NAME_GREPA_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 149,
        .maxYield = 6,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Grepa,
        .description2 = gBerryDescriptionPart2_Grepa,
        .stageDuration = 3,
        .spicy = 0,
        .dry = 10,
        .sweet = 10,
        .bitter = 0,
        .sour = 10,
        .smoothness = 20,
    },
    {
        .name = NAME_TAMATO_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 200,
        .maxYield = 4,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Tamato,
        .description2 = gBerryDescriptionPart2_Tamato,
        .stageDuration = 6,
        .spicy = 20,
        .dry = 10,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 30,
    },
    {
        .name = NAME_CORNN_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 75,
        .maxYield = 4,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Cornn,
        .description2 = gBerryDescriptionPart2_Cornn,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 20,
        .sweet = 10,
        .bitter = 0,
        .sour = 0,
        .smoothness = 30,
    },
    {
        .name = NAME_MAGOST_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 140,
        .maxYield = 4,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Magost,
        .description2 = gBerryDescriptionPart2_Magost,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 0,
        .sweet = 20,
        .bitter = 10,
        .sour = 0,
        .smoothness = 30,
    },
    {
        .name = NAME_RABUTA_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 226,
        .maxYield = 4,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Rabuta,
        .description2 = gBerryDescriptionPart2_Rabuta,
        .stageDuration = 6,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 20,
        .sour = 10,
        .smoothness = 30,
    },
    {
        .name = NAME_NOMEL_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 285,
        .maxYield = 4,
        .minYield = 2,
        .description1 = gBerryDescriptionPart1_Nomel,
        .description2 = gBerryDescriptionPart2_Nomel,
        .stageDuration = 6,
        .spicy = 10,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 20,
        .smoothness = 30,
    },
    {
        .name = NAME_SPELON_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 133,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Spelon,
        .description2 = gBerryDescriptionPart2_Spelon,
        .stageDuration = 18,
        .spicy = 40,
        .dry = 10,
        .sweet = 0,
        .bitter = 0,
        .sour = 0,
        .smoothness = 70,
    },
    {
        .name = NAME_PAMTRE_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_SOFT,
        .size = 244,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Pamtre,
        .description2 = gBerryDescriptionPart2_Pamtre,
        .stageDuration = 18,
        .spicy = 0,
        .dry = 40,
        .sweet = 10,
        .bitter = 0,
        .sour = 0,
        .smoothness = 70,
    },
    {
        .name = NAME_WATMEL_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 250,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Watmel,
        .description2 = gBerryDescriptionPart2_Watmel,
        .stageDuration = 18,
        .spicy = 0,
        .dry = 0,
        .sweet = 40,
        .bitter = 10,
        .sour = 0,
        .smoothness = 70,
    },
    {
        .name = NAME_DURIN_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 280,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Durin,
        .description2 = gBerryDescriptionPart2_Durin,
        .stageDuration = 18,
        .spicy = 0,
        .dry = 0,
        .sweet = 0,
        .bitter = 40,
        .sour = 10,
        .smoothness = 70,
    },
    {
        .name = NAME_BELUE_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_SOFT,
        .size = 300,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Belue,
        .description2 = gBerryDescriptionPart2_Belue,
        .stageDuration = 18,
        .spicy = 10,
        .dry = 0,
        .sweet = 0,
        .bitter = 0,
        .sour = 40,
        .smoothness = 70,
    },
    {
        .name = NAME_LIECHI_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 111,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Liechi,
        .description2 = gBerryDescriptionPart2_Liechi,
        .stageDuration = 24,
        .spicy = 40,
        .dry = 0,
        .sweet = 40,
        .bitter = 0,
        .sour = 10,
        .smoothness = 80,
    },
    {
        .name = NAME_GANLON_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 33,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Ganlon,
        .description2 = gBerryDescriptionPart2_Ganlon,
        .stageDuration = 24,
        .spicy = 0,
        .dry = 40,
        .sweet = 0,
        .bitter = 40,
        .sour = 0,
        .smoothness = 80,
    },
    {
        .name = NAME_SALAC_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 95,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Salac,
        .description2 = gBerryDescriptionPart2_Salac,
        .stageDuration = 24,
        .spicy = 0,
        .dry = 0,
        .sweet = 40,
        .bitter = 0,
        .sour = 40,
        .smoothness = 80,
    },
    {
        .name = NAME_PETAYA_BERRY,
        .firmness = BERRY_FIRMNESS_VERY_HARD,
        .size = 237,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Petaya,
        .description2 = gBerryDescriptionPart2_Petaya,
        .stageDuration = 24,
        .spicy = 40,
        .dry = 0,
        .sweet = 0,
        .bitter = 40,
        .sour = 0,
        .smoothness = 80,
    },
    {
        .name = NAME_APICOT_BERRY,
        .firmness = BERRY_FIRMNESS_HARD,
        .size = 75,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Apicot,
        .description2 = gBerryDescriptionPart2_Apicot,
        .stageDuration = 24,
        .spicy = 0,
        .dry = 40,
        .sweet = 0,
        .bitter = 0,
        .sour = 40,
        .smoothness = 80,
    },
    {
        .name = NAME_LANSAT_BERRY,
        .firmness = BERRY_FIRMNESS_SOFT,
        .size = 97,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Lansat,
        .description2 = gBerryDescriptionPart2_Lansat,
        .stageDuration = 24,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 30,
    },
    {
        .name = NAME_STARF_BERRY,
        .firmness = BERRY_FIRMNESS_SUPER_HARD,
        .size = 153,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Starf,
        .description2 = gBerryDescriptionPart2_Starf,
        .stageDuration = 24,
        .spicy = 10,
        .dry = 10,
        .sweet = 10,
        .bitter = 10,
        .sour = 10,
        .smoothness = 30,
    },
    {
        .name = NAME_ENIGMA_BERRY,
        .firmness = BERRY_FIRMNESS_UNKNOWN,
        .size = 0,
        .maxYield = 2,
        .minYield = 1,
        .description1 = gBerryDescriptionPart1_Enigma,
        .description2 = gBerryDescriptionPart2_Enigma,
        .stageDuration = 24,
        .spicy = 40,
        .dry = 40,
        .sweet = 40,
        .bitter = 40,
        .sour = 40,
        .smoothness = 40,
    },
};

static const struct BerryTree gBlankBerryTree = {0};

extern u8 S_BerryTree[];
extern u16 gSpecialVar_LastTalked;
extern u16 gSpecialVar_0x8004;
extern u16 gSpecialVar_0x8005;
extern u16 gSpecialVar_0x8006;

/*
    An enigma berry is a type of berry which functions
    as though it is a custom berry. Because it behaves
    like its a custom berry, it doesn't hold an identity
    represented in its icons or descriptions, leaving its
    information to be decided by the e-reader cards
    which were intended to deliver these custom
    berries.
*/

static u8 CalcBerryYield(struct BerryTree *tree);
static u16 GetStageDurationByBerryType(u8 berry);

#if DEBUG
__attribute__((naked))
void debug_sub_80C2B04()
{
    asm(
        "	push	{lr}\n"
        "	mov	r0, #0x0\n"
        "	bl	sub_80B47D8\n"
        "	lsl	r0, r0, #0x18\n"
        "	lsr	r0, r0, #0x18\n"
        "	ldr	r2, ._1         @ gTasks\n"
        "	lsl	r1, r0, #0x2\n"
        "	add	r1, r1, r0\n"
        "	lsl	r1, r1, #0x3\n"
        "	add	r1, r1, r2\n"
        "	ldrh	r0, [r1, #0x10]\n"
        "	sub	r0, r0, #0x1\n"
        "	strh	r0, [r1, #0x10]\n"
        "	bl	CloseMenu\n"
        "	mov	r0, #0x1\n"
        "	pop	{r1}\n"
        "	bx	r1\n"
        "._2:\n"
        "	.align	2, 0\n"
        "._1:\n"
        "	.word	gTasks\n"
        "\n"
    );
}

__attribute__((naked))
void debug_sub_80C2B30()
{
    asm(
        "	push	{lr}\n"
        "	mov	r0, #0x1\n"
        "	bl	sub_80B47D8\n"
        "	lsl	r0, r0, #0x18\n"
        "	lsr	r0, r0, #0x18\n"
        "	ldr	r2, ._3         @ gTasks\n"
        "	lsl	r1, r0, #0x2\n"
        "	add	r1, r1, r0\n"
        "	lsl	r1, r1, #0x3\n"
        "	add	r1, r1, r2\n"
        "	ldrh	r0, [r1, #0x10]\n"
        "	sub	r0, r0, #0x1\n"
        "	strh	r0, [r1, #0x10]\n"
        "	bl	CloseMenu\n"
        "	mov	r0, #0x1\n"
        "	pop	{r1}\n"
        "	bx	r1\n"
        "._4:\n"
        "	.align	2, 0\n"
        "._3:\n"
        "	.word	gTasks\n"
        "\n"
    );
}
#endif

// unused
// this could be static, but making it so causes a compile-time warning.
void ClearEnigmaBerries(void)
{
    CpuFill16(0, &gSaveBlock1.enigmaBerry, sizeof(gSaveBlock1.enigmaBerry));
}

void SetEnigmaBerry(u8 *src)
{
    // initialize the enigma berry by copying the data from the script.
    u32 i;
    u8 *dest = (u8*)&gSaveBlock1.enigmaBerry;

    for (i = 0; i < sizeof(gSaveBlock1.enigmaBerry); i++)
        dest[i] = src[i];

    // at this point, the description pointer is not yet initialized. we need to initialize it since
    // we dont know where in memory this is going to be. set the berry desc pointers to the
    // EnigmaBerry struct's description arrays since these are where the descriptions are stored.
    gSaveBlock1.enigmaBerry.berry.description1 = gSaveBlock1.enigmaBerry.description1;
    gSaveBlock1.enigmaBerry.berry.description2 = gSaveBlock1.enigmaBerry.description2;
}

#if DEBUG
__attribute__((naked))
void debug_sub_80C2BD0()
{
    asm(
        "	push	{r4, r5, r6, r7, lr}\n"
        "	ldr	r3, ._11        @ gSaveBlock1\n"
        "	ldr	r1, ._11 + 4    @ 0x316c\n"
        "	add	r4, r3, r1\n"
        "	ldr	r6, [r4]\n"
        "	add	r1, r1, #0x4\n"
        "	add	r2, r3, r1\n"
        "	ldr	r7, [r2]\n"
        "	mov	r1, #0x0\n"
        "	str	r1, [r4]\n"
        "	str	r1, [r2]\n"
        "	add	r4, r0, #0\n"
        "	mov	r2, #0x0\n"
        "	ldr	r5, ._11 + 8    @ 0x52b\n"
        "._10:\n"
        "	add	r0, r4, r1\n"
        "	ldrb	r0, [r0]\n"
        "	add	r2, r2, r0\n"
        "	add	r1, r1, #0x1\n"
        "	cmp	r1, r5\n"
        "	bls	._10	@cond_branch\n"
        "	ldr	r1, ._11 + 4    @ 0x316c\n"
        "	add	r0, r3, r1\n"
        "	str	r6, [r0]\n"
        "	add	r1, r1, #0x4\n"
        "	add	r0, r3, r1\n"
        "	str	r7, [r0]\n"
        "	add	r0, r2, #0\n"
        "	pop	{r4, r5, r6, r7}\n"
        "	pop	{r1}\n"
        "	bx	r1\n"
        "._12:\n"
        "	.align	2, 0\n"
        "._11:\n"
        "	.word	gSaveBlock1\n"
        "	.word	0x316c\n"
        "	.word	0x52b\n"
        "\n"
    );
}
#endif

#if DEBUG
__attribute__((naked))
u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
{
    asm(
        "	push	{r4, r5, r6, r7, lr}\n"
        "	mov	r7, r9\n"
        "	mov	r6, r8\n"
        "	push	{r6, r7}\n"
        "	add	r3, r0, #0\n"
        "	lsl	r1, r1, #0x18\n"
        "	lsr	r1, r1, #0x18\n"
        "	mov	r9, r1\n"
        "	lsl	r2, r2, #0x18\n"
        "	lsr	r2, r2, #0x18\n"
        "	mov	r8, r2\n"
        "	ldr	r4, ._16        @ gSaveBlock1\n"
        "	ldr	r1, ._16 + 4    @ 0x3160\n"
        "	add	r0, r4, r1\n"
        "	add	r2, r0, #0\n"
        "	ldr	r1, ._16 + 8    @ gBerries\n"
        "	ldmia	r1!, {r5, r6, r7}\n"
        "	stmia	r2!, {r5, r6, r7}\n"
        "	ldmia	r1!, {r5, r6, r7}\n"
        "	stmia	r2!, {r5, r6, r7}\n"
        "	ldr	r1, [r1]\n"
        "	str	r1, [r2]\n"
        "	add	r1, r3, #0\n"
        "	bl	StringCopy\n"
        "	ldr	r0, ._16 + 12   @ 0x361c\n"
        "	add	r6, r4, r0\n"
        "	ldr	r1, ._16 + 16   @ gUnknown_Debug_083F7F84\n"
        "	add	r0, r6, #0\n"
        "	bl	StringCopy\n"
        "	ldr	r1, ._16 + 20   @ 0x3649\n"
        "	add	r5, r4, r1\n"
        "	ldr	r1, ._16 + 24   @ gUnknown_Debug_083F7F90\n"
        "	add	r0, r5, #0\n"
        "	bl	StringCopy\n"
        "	ldr	r2, ._16 + 28   @ 0x316c\n"
        "	add	r0, r4, r2\n"
        "	str	r6, [r0]\n"
        "	ldr	r6, ._16 + 32   @ 0x3170\n"
        "	add	r0, r4, r6\n"
        "	str	r5, [r0]\n"
        "	mov	r2, #0x0\n"
        "	ldr	r6, ._16 + 36   @ 0x47f\n"
        "	ldr	r7, ._16 + 40   @ 0x317c\n"
        "	add	r5, r4, r7\n"
        "	ldr	r3, ._16 + 44   @ gSpriteImage_UnusedCherry\n"
        "._13:\n"
        "	add	r0, r2, r5\n"
        "	add	r1, r2, r3\n"
        "	ldrb	r1, [r1]\n"
        "	strb	r1, [r0]\n"
        "	add	r2, r2, #0x1\n"
        "	cmp	r2, r6\n"
        "	ble	._13	@cond_branch\n"
        "	ldr	r0, ._16        @ gSaveBlock1\n"
        "	ldr	r3, ._16 + 48   @ gSpritePalette_UnusedCherry\n"
        "	ldr	r2, ._16 + 52   @ 0x35fc\n"
        "	add	r1, r0, r2\n"
        "	mov	r2, #0xf\n"
        "._14:\n"
        "	ldrh	r0, [r3]\n"
        "	strh	r0, [r1]\n"
        "	add	r3, r3, #0x2\n"
        "	add	r1, r1, #0x2\n"
        "	sub	r2, r2, #0x1\n"
        "	cmp	r2, #0\n"
        "	bge	._14	@cond_branch\n"
        "	mov	r2, #0x0\n"
        "	ldr	r5, ._16 + 56   @ gSaveBlock1\n"
        "	ldr	r3, ._16 + 60   @ gUnknown_Debug_839B6CE\n"
        "._15:\n"
        "	add	r0, r2, r5\n"
        "	add	r1, r2, r3\n"
        "	ldrb	r1, [r1]\n"
        "	strb	r1, [r0]\n"
        "	add	r2, r2, #0x1\n"
        "	cmp	r2, #0x11\n"
        "	ble	._15	@cond_branch\n"
        "	ldr	r5, ._16 + 64   @ 0x3688\n"
        "	add	r0, r4, r5\n"
        "	mov	r6, r9\n"
        "	strb	r6, [r0]\n"
        "	ldr	r7, ._16 + 68   @ 0x3689\n"
        "	add	r0, r4, r7\n"
        "	mov	r1, r8\n"
        "	strb	r1, [r0]\n"
        "	ldr	r2, ._16 + 4    @ 0x3160\n"
        "	add	r0, r4, r2\n"
        "	bl	debug_sub_80C2BD0\n"
        "	add	r5, r5, #0x4\n"
        "	add	r1, r4, r5\n"
        "	str	r0, [r1]\n"
        "	pop	{r3, r4}\n"
        "	mov	r8, r3\n"
        "	mov	r9, r4\n"
        "	pop	{r4, r5, r6, r7}\n"
        "	pop	{r0}\n"
        "	bx	r0\n"
        "._17:\n"
        "	.align	2, 0\n"
        "._16:\n"
        "	.word	gSaveBlock1\n"
        "	.word	0x3160\n"
        "	.word	gBerries\n"
        "	.word	0x361c\n"
        "	.word	gUnknown_Debug_083F7F84\n"
        "	.word	0x3649\n"
        "	.word	gUnknown_Debug_083F7F90\n"
        "	.word	0x316c\n"
        "	.word	0x3170\n"
        "	.word	0x47f\n"
        "	.word	0x317c\n"
        "	.word	gSpriteImage_UnusedCherry\n"
        "	.word	gSpritePalette_UnusedCherry\n"
        "	.word	0x35fc\n"
        "	.word	gSaveBlock1+0x3676\n"
        "	.word	gUnknown_Debug_839B6CE\n"
        "	.word	0x3688\n"
        "	.word	0x3689\n"
        "\n"
    );
}
#else
static u32 GetEnigmaBerryChecksum(struct EnigmaBerry *enigmaBerry)
{
    const u8 *description1;
    const u8 *description2;
    u32 i;
    u32 checksum;
    u8 *dest;

    // the description pointers could be pointing to anywhere in memory. we do not want these
    // pointers to factor into the checksum as it will produce a different result every time: so
    // back the pointers up and set them to null so the checksum is safe to calculate.
    description1 = gSaveBlock1.enigmaBerry.berry.description1;
    description2 = gSaveBlock1.enigmaBerry.berry.description2;
    gSaveBlock1.enigmaBerry.berry.description1 = NULL;
    gSaveBlock1.enigmaBerry.berry.description2 = NULL;

    dest = (u8*)enigmaBerry;
    checksum = 0;
    for (i = 0; i < ((u32)&gSaveBlock1.enigmaBerry.checksum - (u32)&gSaveBlock1.enigmaBerry); i++)
    {
        checksum += dest[i];
    }

    // the checksum is calculated: the descriptions are safe to restore now.
    gSaveBlock1.enigmaBerry.berry.description1 = description1;
    gSaveBlock1.enigmaBerry.berry.description2 = description2;

    return checksum;
}
#endif

#if DEBUG
__attribute__((naked))
void debug_sub_80C2D24()
{
    asm(
        "	push	{r4, r5, r6, r7, lr}\n"
        "	mov	r7, r8\n"
        "	push	{r7}\n"
        "	ldr	r6, [sp, #0x18]\n"
        "	ldr	r4, [sp, #0x1c]\n"
        "	mov	r8, r4\n"
        "	ldr	r5, ._18        @ gSaveBlock1\n"
        "	ldr	r7, ._18 + 4    @ 0x3175\n"
        "	add	r4, r5, r7\n"
        "	strb	r0, [r4]\n"
        "	ldr	r4, ._18 + 8    @ 0x3176\n"
        "	add	r0, r5, r4\n"
        "	strb	r1, [r0]\n"
        "	add	r7, r7, #0x2\n"
        "	add	r0, r5, r7\n"
        "	strb	r2, [r0]\n"
        "	ldr	r1, ._18 + 12   @ 0x3178\n"
        "	add	r0, r5, r1\n"
        "	strb	r3, [r0]\n"
        "	add	r4, r4, #0x3\n"
        "	add	r0, r5, r4\n"
        "	strb	r6, [r0]\n"
        "	add	r7, r7, #0x3\n"
        "	add	r0, r5, r7\n"
        "	mov	r1, r8\n"
        "	strb	r1, [r0]\n"
        "	sub	r4, r4, #0x19\n"
        "	add	r0, r5, r4\n"
        "	bl	debug_sub_80C2BD0\n"
        "	ldr	r7, ._18 + 16   @ 0x368c\n"
        "	add	r5, r5, r7\n"
        "	str	r0, [r5]\n"
        "	pop	{r3}\n"
        "	mov	r8, r3\n"
        "	pop	{r4, r5, r6, r7}\n"
        "	pop	{r0}\n"
        "	bx	r0\n"
        "._19:\n"
        "	.align	2, 0\n"
        "._18:\n"
        "	.word	gSaveBlock1\n"
        "	.word	0x3175\n"
        "	.word	0x3176\n"
        "	.word	0x3178\n"
        "	.word	0x368c\n"
        "\n"
    );
}
#endif

// due to e-reader scans being particularly volatile to failure, it is a requirement to check for
// their integrity here due to scans possibly failing to produce the correct result.
#if DEBUG
__attribute__((naked))
bool32 IsEnigmaBerryValid()
{
    asm(
        "	push	{r4, lr}\n"
        "	ldr	r4, ._24        @ gSaveBlock1\n"
        "	ldr	r1, ._24 + 4    @ 0x3174\n"
        "	add	r0, r4, r1\n"
        "	ldrb	r0, [r0]\n"
        "	cmp	r0, #0\n"
        "	beq	._22	@cond_branch\n"
        "	ldr	r2, ._24 + 8    @ 0x316a\n"
        "	add	r0, r4, r2\n"
        "	ldrb	r0, [r0]\n"
        "	cmp	r0, #0\n"
        "	beq	._22	@cond_branch\n"
        "	ldr	r1, ._24 + 12   @ 0x3160\n"
        "	add	r0, r4, r1\n"
        "	bl	debug_sub_80C2BD0\n"
        "	ldr	r2, ._24 + 16   @ 0x368c\n"
        "	add	r1, r4, r2\n"
        "	ldr	r1, [r1]\n"
        "	cmp	r0, r1\n"
        "	bne	._22	@cond_branch\n"
        "	mov	r0, #0x1\n"
        "	b	._23\n"
        "._25:\n"
        "	.align	2, 0\n"
        "._24:\n"
        "	.word	gSaveBlock1\n"
        "	.word	0x3174\n"
        "	.word	0x316a\n"
        "	.word	0x3160\n"
        "	.word	0x368c\n"
        "._22:\n"
        "	mov	r0, #0x0\n"
        "._23:\n"
        "	pop	{r4}\n"
        "	pop	{r1}\n"
        "	bx	r1\n"
        "\n"
    );
}
#else
bool32 IsEnigmaBerryValid(void)
{
    if (gSaveBlock1.enigmaBerry.berry.stageDuration == 0)
        return FALSE;
    if (gSaveBlock1.enigmaBerry.berry.maxYield == 0)
        return FALSE;
    if (GetEnigmaBerryChecksum(&gSaveBlock1.enigmaBerry) != gSaveBlock1.enigmaBerry.checksum)
        return FALSE;
    return TRUE;
}
#endif

const struct Berry *GetBerryInfo(u8 berry)
{
    // when getting the pointer to the berry info, enigma berries are handled differently. if your
    // berry is an Enigma Berry and its checksum is valid, fetch the pointer to its information in
    // the save block.
    if (berry == GETBERRYID(ITEM_ENIGMA_BERRY) && IsEnigmaBerryValid())
        return &gSaveBlock1.enigmaBerry.berry;
    else
    {
        // invalid berries will be flattened into a cheri berry. Interestingly, if your berry was 
        // an enigma berry whos checksum failed, the game will use the Enigma Berry information
        // for this: meaning if you see the Enigma Berry information, its actually because the 
        // checksum failed.
        if (berry == BERRY_NONE || berry > GETBERRYID(LAST_BERRY))
            berry = GETBERRYID(FIRST_BERRY);
        return &gBerries[berry - 1];
    }
}

// the save file can handle up to a number of 128 berry trees as indicated by its definition
// in global.h. Interestingly, this function does not check that limit of 128.
static struct BerryTree *GetBerryTreeInfo(u8 id)
{
    return &gSaveBlock1.berryTrees[id];
}

// this was called because the berry script was successful: meaning the player chose to
// water the tree. We need to check for the current tree stage and set the appropriate
// water flag to true.
bool32 FieldObjectInteractionWaterBerryTree(void)
{
    // GetBerryTreeInfo does not sanitize the tree retrieved, but there are no known
    // instances where this can cause problems.
    struct BerryTree *tree = GetBerryTreeInfo(FieldObjectGetBerryTreeId(gSelectedMapObject));

    switch (tree->stage)
    {
    case BERRY_STAGE_PLANTED:
        tree->watered1 = TRUE;
        break;
    case BERRY_STAGE_SPROUTED:
        tree->watered2 = TRUE;
        break;
    case BERRY_STAGE_TALLER:
        tree->watered3 = TRUE;
        break;
    case BERRY_STAGE_FLOWERING:
        tree->watered4 = TRUE;
        break;
    default:
        return FALSE;
    }
    return TRUE;
}

bool8 IsPlayerFacingUnplantedSoil(void)
{
    if (GetFieldObjectScriptPointerPlayerFacing() == S_BerryTree
     && GetStageByBerryTreeId(FieldObjectGetBerryTreeId(gSelectedMapObject)) == BERRY_STAGE_NO_BERRY)
        return TRUE;
    else
        return FALSE;
}

bool8 TryToWaterBerryTree(void)
{
    if (GetFieldObjectScriptPointerPlayerFacing() != S_BerryTree)
        return FALSE;
    else
        return FieldObjectInteractionWaterBerryTree();
}

void ClearBerryTrees(void)
{
    int i;
    struct SaveBlock1 *saveBlock1 = &gSaveBlock1;
    struct BerryTree berryTree = gBlankBerryTree;

    for (i = 0; i < MAX_BERRY_TREES; i++)
        saveBlock1->berryTrees[i] = berryTree;
}

// when the player does not interact with the tree for a period of time, this is called
// to advance the grow state.
static bool32 BerryTreeGrow(struct BerryTree *tree)
{
    if (tree->growthSparkle)
        return FALSE;
    switch (tree->stage)
    {
    case BERRY_STAGE_NO_BERRY:
        return FALSE;
    case BERRY_STAGE_FLOWERING:
        tree->berryYield = CalcBerryYield(tree);
    case BERRY_STAGE_PLANTED:
    case BERRY_STAGE_SPROUTED:
    case BERRY_STAGE_TALLER:
        tree->stage++;
        break;
    case BERRY_STAGE_BERRIES:
        tree->watered1 = 0;
        tree->watered2 = 0;
        tree->watered3 = 0;
        tree->watered4 = 0;
        tree->berryYield = 0;
        tree->stage = BERRY_STAGE_SPROUTED;
        if (++tree->regrowthCount == BERRY_REGROW_LIMIT)
            *tree = gBlankBerryTree;
        break;
    }
    return TRUE;
}

void BerryTreeTimeUpdate(s32 minutesPassed)
{
    int i;
    struct BerryTree *tree;

    for (i = 0; i < MAX_BERRY_TREES; i++)
    {
        tree = &gSaveBlock1.berryTrees[i];

        if (tree->berry != BERRY_NONE && tree->stage != BERRY_STAGE_NO_BERRY && tree->growthSparkle == FALSE)
        {
            // the player has waited too long to water the berry. Reset the tree. This is because
            // if the berry state is not in the unwatered state, the tree will grow anyway despite this 
            // check, which means BerryTreeGrow will handle the regrow process for this, removing the 
            // need for this check. This only handles the unwatered soil state.
            if (minutesPassed >= GetStageDurationByBerryType(tree->berry) * 71)
            {
                *tree = gBlankBerryTree;
            }
            else
            {
                // because time is altered below, perhaps they thought it was unsafe to change it, even
                // though that is not how passed arguments behave.
                s32 time = minutesPassed;

                while (time != 0)
                {
                    if (tree->minutesUntilNextStage > time)
                    {
                        // its been X minutes since the last berry update, so update
                        // minutesUntilNextStage appropriately to match the time offset
                        // that has passed since the update.
                        tree->minutesUntilNextStage -= time; 
                        break;
                    }
                    // perform the subtraction the other way around to get the number of minutes since
                    // the inferred stage update that occured, since minutesUntilNextStage is <= time.
                    // we may need this variable to simulate multiple berry cycles in the while loop.
                    time -= tree->minutesUntilNextStage;
                    tree->minutesUntilNextStage = GetStageDurationByBerryType(tree->berry); // since the tree was inferred to update, set the new minutesUntilNextStage.
                    if (BerryTreeGrow(tree) == FALSE)
                        break;
                    if (tree->stage == BERRY_STAGE_BERRIES)
                        tree->minutesUntilNextStage *= 4;
                }
            }
        }
    }
}

void PlantBerryTree(u8 id, u8 berry, u8 stage, bool8 noSparkle)
{
    struct BerryTree *tree = GetBerryTreeInfo(id);

    *tree = gBlankBerryTree;
    tree->berry = berry;
    tree->minutesUntilNextStage = GetStageDurationByBerryType(berry);
    tree->stage = stage;
    if (stage == BERRY_STAGE_BERRIES)
    {
        tree->berryYield = CalcBerryYield(tree);
        tree->minutesUntilNextStage *= 4;
    }
    if (noSparkle == FALSE)
    {
        tree->growthSparkle = TRUE;
    }
}

void RemoveBerryTree(u8 id)
{
    gSaveBlock1.berryTrees[id] = gBlankBerryTree;
}

u8 GetBerryTypeByBerryTreeId(u8 id)
{
    return gSaveBlock1.berryTrees[id].berry;
}

u8 GetStageByBerryTreeId(u8 id)
{
    return gSaveBlock1.berryTrees[id].stage;
}

u8 ItemIdToBerryType(u16 item)
{
    u16 berry = item - FIRST_BERRY;

    if (berry > LAST_BERRY - FIRST_BERRY)
        return GETBERRYID(FIRST_BERRY);
    else
        return GETBERRYID(item);
}

static u16 BerryTypeToItemId(u16 berry)
{
    u16 item = berry - 1;

    if (item > LAST_BERRY - FIRST_BERRY)
        return FIRST_BERRY;
    else
        return GETITEMID(berry);
}

void GetBerryNameByBerryType(u8 berry, u8 *string)
{
    memcpy(string, GetBerryInfo(berry)->name, BERRY_NAME_LENGTH);
    string[BERRY_NAME_LENGTH] = EOS;
}

void ResetBerryTreeSparkleFlag(u8 id)
{
    GetBerryTreeInfo(id)->growthSparkle = FALSE;
}

static u8 BerryTreeGetNumStagesWatered(struct BerryTree *tree)
{
    u8 count = 0;

    if (tree->watered1)
        count++;
    if (tree->watered2)
        count++;
    if (tree->watered3)
        count++;
    if (tree->watered4)
        count++;
    return count;
}

static u8 GetNumStagesWateredByBerryTreeId(u8 id)
{
    return BerryTreeGetNumStagesWatered(GetBerryTreeInfo(id));
}

static u8 CalcBerryYieldInternal(u16 max, u16 min, u8 water)
{
    u32 randMin;
    u32 randMax;
    u32 rand;
    u32 extraYield;

    // depending on if the player gave the tree plenty of water, berry yield will be affected proportionally.

    if (water == 0)
        return min;
    else
    {
        randMin = (max - min) * (water - 1);
        randMax = (max - min) * (water);
        rand = randMin + Random() % (randMax - randMin + 1);

        if ((rand % 4) > 1)
            extraYield = rand / 4 + 1;
        else
            extraYield = rand / 4;
        return extraYield + min;
    }
}

static u8 CalcBerryYield(struct BerryTree *tree)
{
    const struct Berry *berry = GetBerryInfo(tree->berry);
    u8 min = berry->minYield;
    u8 max = berry->maxYield;

    return CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree));
}

static u8 GetBerryCountByBerryTreeId(u8 id)
{
    return gSaveBlock1.berryTrees[id].berryYield;
}

static u16 GetStageDurationByBerryType(u8 berry)
{
    return GetBerryInfo(berry)->stageDuration * 60;
}

void FieldObjectInteractionGetBerryTreeData(void)
{
    u8 id;
    u8 berry;
    u8 localId;
    u8 group;
    u8 num;

    id = FieldObjectGetBerryTreeId(gSelectedMapObject);
    berry = GetBerryTypeByBerryTreeId(id);
    ResetBerryTreeSparkleFlag(id);
    localId = gSpecialVar_LastTalked;
    num = gSaveBlock1.location.mapNum;
    group = gSaveBlock1.location.mapGroup;
    if (IsBerryTreeSparkling(localId, num, group))
    {
        // we cannot allow the player to grow/interact with the tree while the tree
        // is undergoing the sparkling effect, so set the special var to the sparkling
        // state and let the event script process the flag.
        gSpecialVar_0x8004 = BERRY_STAGE_SPARKLING; 
    }
    else
        gSpecialVar_0x8004 = GetStageByBerryTreeId(id);
    gSpecialVar_0x8005 = GetNumStagesWateredByBerryTreeId(id);
    gSpecialVar_0x8006 = GetBerryCountByBerryTreeId(id);
    GetBerryNameByBerryType(berry, gStringVar1);
}

void Berry_FadeAndGoToBerryBagMenu(void)
{
    SetMainCallback2(sub_80A68CC);
}

void FieldObjectInteractionPlantBerryTree(void)
{
    u8 berry = ItemIdToBerryType(gSpecialVar_ItemId);

    PlantBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject), berry, 1, TRUE);
    FieldObjectInteractionGetBerryTreeData();
}

void FieldObjectInteractionPickBerryTree(void)
{
    u8 id = FieldObjectGetBerryTreeId(gSelectedMapObject);
    u8 berry = GetBerryTypeByBerryTreeId(id);

    gSpecialVar_0x8004 = AddBagItem(BerryTypeToItemId(berry), GetBerryCountByBerryTreeId(id));
}

void FieldObjectInteractionRemoveBerryTree(void)
{
    RemoveBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject));
    sub_8060288(gSpecialVar_LastTalked, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup);
}

bool8 PlayerHasBerries(void)
{
    return IsBagPocketNonEmpty(BAG_BERRIES);
}

#if DEBUG
void debug_sub_80C33FC(u8 *buffer, s32 value, u8 n)
{
    StringAppend(gStringVar4, buffer);
    ConvertIntToDecimalStringN(gStringVar1, value, STR_CONV_MODE_LEADING_ZEROS, n);
    StringAppend(gStringVar4, gStringVar1);
}

extern const u8 gUnknown_Debug_083F7F9D[];
extern const u8 gUnknown_Debug_083F7FA2[];
extern const u8 gUnknown_Debug_083F7FA9[];
extern const u8 gUnknown_Debug_083F7FB0[];
extern const u8 gUnknown_Debug_083F7FB7[];
extern const u8 gUnknown_Debug_083F7FBE[];
extern const u8 gUnknown_Debug_083F7FC5[];
extern const u8 gUnknown_Debug_083F7FCC[];
extern const u8 gUnknown_Debug_083F7FD3[];
extern const u8 gUnknown_Debug_083F7FD3[];
extern const u8 gUnknown_Debug_083F7FD3[];

#ifdef NONMATCHING
u8* DebugOpenBerryInfo(void)
{
    s32 i;
    u8 berryTreeId;
    struct BerryTree *berryTree;

    if (GetFieldObjectScriptPointerPlayerFacing() != &S_BerryTree)
        return NULL;

    berryTreeId = FieldObjectGetBerryTreeId(gSelectedMapObject);
    berryTree = GetBerryTreeInfo(berryTreeId);
    
    for (i = 0; i < 500; i++)
        gStringVar4[i] |= 0xFF;

    debug_sub_80C33FC(gUnknown_Debug_083F7F9D, berryTreeId, 3);
    debug_sub_80C33FC(gUnknown_Debug_083F7FA2, berryTree->berry, 2);
    debug_sub_80C33FC(gUnknown_Debug_083F7FA9, berryTree->stage, 2);
    debug_sub_80C33FC(gUnknown_Debug_083F7FB0, berryTree->secondsUntilNextStage, 5);
    debug_sub_80C33FC(gUnknown_Debug_083F7FB7, berryTree->berryYield, 2);
    debug_sub_80C33FC(gUnknown_Debug_083F7FBE, berryTree->regrowthCount, 3);
    debug_sub_80C33FC(gUnknown_Debug_083F7FC5, berryTree->growthSparkle, 1);
    debug_sub_80C33FC(gUnknown_Debug_083F7FCC, berryTree->watered1, 1);
    debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered2, 1);
    debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered3, 1);
    debug_sub_80C33FC(gUnknown_Debug_083F7FD3, berryTree->watered4, 1);

    return gStringVar4;
}
#else
__attribute__((naked))
void DebugOpenBerryInfo()
{
    asm(
        "	push	{r4, r5, r6, r7, lr}\n"
        "	bl	GetFieldObjectScriptPointerPlayerFacing\n"
        "	ldr	r1, ._138       @ S_BerryTree\n"
        "	cmp	r0, r1\n"
        "	beq	._136	@cond_branch\n"
        "	mov	r0, #0x0\n"
        "	b	._137\n"
        "._139:\n"
        "	.align	2, 0\n"
        "._138:\n"
        "	.word	S_BerryTree\n"
        "._136:\n"
        "	ldr	r0, ._141       @ gSelectedMapObject\n"
        "	ldrb	r0, [r0]\n"
        "	bl	FieldObjectGetBerryTreeId\n"
        "	lsl	r0, r0, #0x18\n"
        "	lsr	r6, r0, #0x18\n"
        "	add	r0, r6, #0\n"
        "	bl	GetBerryTreeInfo\n"
        "	add	r5, r0, #0\n"
        "	mov	r2, #0x0\n"
        "	ldr	r7, ._141 + 4   @ 0x1f3\n"
        "	ldr	r4, ._141 + 8   @ gStringVar4\n"
        "	mov	r3, #0xff\n"
        "._140:\n"
        "	add	r1, r2, r4\n"
        "	ldrb	r0, [r1]\n"
        "	orr	r0, r0, r3\n"
        "	strb	r0, [r1]\n"
        "	add	r2, r2, #0x1\n"
        "	cmp	r2, r7\n"
        "	ble	._140	@cond_branch\n"
        "	ldr	r0, ._141 + 12  @ gUnknown_Debug_083F7F9D\n"
        "	add	r1, r6, #0\n"
        "	mov	r2, #0x3\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 16  @ gUnknown_Debug_083F7FA2\n"
        "	ldrb	r1, [r5]\n"
        "	mov	r2, #0x2\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 20  @ gUnknown_Debug_083F7FA9\n"
        "	ldrb	r1, [r5, #0x1]\n"
        "	lsl	r1, r1, #0x19\n"
        "	lsr	r1, r1, #0x19\n"
        "	mov	r2, #0x2\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 24  @ gUnknown_Debug_083F7FB0\n"
        "	ldrh	r1, [r5, #0x2]\n"
        "	mov	r2, #0x5\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 28  @ gUnknown_Debug_083F7FB7\n"
        "	ldrb	r1, [r5, #0x4]\n"
        "	mov	r2, #0x2\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 32  @ gUnknown_Debug_083F7FBE\n"
        "	ldrb	r1, [r5, #0x5]\n"
        "	lsl	r1, r1, #0x1c\n"
        "	lsr	r1, r1, #0x1c\n"
        "	mov	r2, #0x3\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 36  @ gUnknown_Debug_083F7FC5\n"
        "	ldrb	r1, [r5, #0x1]\n"
        "	lsr	r1, r1, #0x7\n"
        "	mov	r2, #0x1\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 40  @ gUnknown_Debug_083F7FCC\n"
        "	ldrb	r1, [r5, #0x5]\n"
        "	lsl	r1, r1, #0x1b\n"
        "	lsr	r1, r1, #0x1f\n"
        "	mov	r2, #0x1\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r4, ._141 + 44  @ gUnknown_Debug_083F7FD3\n"
        "	ldrb	r1, [r5, #0x5]\n"
        "	lsl	r1, r1, #0x1a\n"
        "	lsr	r1, r1, #0x1f\n"
        "	add	r0, r4, #0\n"
        "	mov	r2, #0x1\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldrb	r1, [r5, #0x5]\n"
        "	lsl	r1, r1, #0x19\n"
        "	lsr	r1, r1, #0x1f\n"
        "	add	r0, r4, #0\n"
        "	mov	r2, #0x1\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldrb	r1, [r5, #0x5]\n"
        "	lsr	r1, r1, #0x7\n"
        "	add	r0, r4, #0\n"
        "	mov	r2, #0x1\n"
        "	bl	debug_sub_80C33FC\n"
        "	ldr	r0, ._141 + 8   @ gStringVar4\n"
        "._137:\n"
        "	pop	{r4, r5, r6, r7}\n"
        "	pop	{r1}\n"
        "	bx	r1\n"
        "._142:\n"
        "	.align	2, 0\n"
        "._141:\n"
        "	.word	gSelectedMapObject\n"
        "	.word	0x1f3\n"
        "	.word	gStringVar4\n"
        "	.word	gUnknown_Debug_083F7F9D\n"
        "	.word	gUnknown_Debug_083F7FA2\n"
        "	.word	gUnknown_Debug_083F7FA9\n"
        "	.word	gUnknown_Debug_083F7FB0\n"
        "	.word	gUnknown_Debug_083F7FB7\n"
        "	.word	gUnknown_Debug_083F7FBE\n"
        "	.word	gUnknown_Debug_083F7FC5\n"
        "	.word	gUnknown_Debug_083F7FCC\n"
        "	.word	gUnknown_Debug_083F7FD3\n"
        "\n"
    );
}
#endif

#endif

// whenever the player is not within view of the berry tree during its sparkle state, the
// sparkle state will be reset.
void ResetBerryTreeSparkleFlags(void)
{
    s16 cam_left;
    s16 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 < (u8)ARRAY_COUNT(gSaveBlock1.mapObjects); i++)
    {
        if (gMapObjects[i].active && gMapObjects[i].animPattern == 12) // is the object an active berry tree?
        {
            cam_left = gMapObjects[i].coords2.x;
            cam_top = gMapObjects[i].coords2.y;
            if (left <= cam_left && cam_left <= right && top <= cam_top && cam_top <= bottom)
                ResetBerryTreeSparkleFlag(gMapObjects[i].trainerRange_berryTreeId);
        }
    }
}

#if DEBUG
static const u8 gUnknown_Debug_083F7F84[] = _("そとから きた きのみ");
static const u8 gUnknown_Debug_083F7F90[] = _("ただいま かいはつちゅう");
static const u8 gUnknown_Debug_083F7F9D[] = _("POS:");
static const u8 gUnknown_Debug_083F7FA2[] = _("\nTYPE:");
static const u8 gUnknown_Debug_083F7FA9[] = _("\nGROW:");
static const u8 gUnknown_Debug_083F7FB0[] = _("\nTIME:");
static const u8 gUnknown_Debug_083F7FB7[] = _("\nFCNT:");
static const u8 gUnknown_Debug_083F7FBE[] = _("\nSCNT:");
static const u8 gUnknown_Debug_083F7FC5[] = _("\nHOOK:");
static const u8 gUnknown_Debug_083F7FCC[] = _("\nWBIT:");
static const u8 gUnknown_Debug_083F7FD3[] = _("");
#endif