Skip to content

Commit

Permalink
Put Mulch behind config
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassoonian committed Dec 3, 2023
1 parent bd354f2 commit 0d70d99
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 30 deletions.
47 changes: 26 additions & 21 deletions data/scripts/berry_tree.inc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,15 @@ BerryTree_EventScript_WantToPlant::
end

BerryTree_EventScript_WantToMulch::
.if OW_MULCH_USAGE == TRUE
msgbox BerryTree_Text_WantToMulch, MSGBOX_YESNO
goto_if_eq VAR_RESULT, YES, BerryTree_EventScript_ChooseMulchToUse
goto_if_eq VAR_RESULT, NO, BerryTree_EventScript_CancelPlanting
.endif
end

BerryTree_EventScript_WantToPlantMulch::
.if OW_MULCH_USAGE == TRUE
message BerryTree_Text_ItsSoftLoamySoil
waitmessage
multichoice 0, 0, MULTI_BERRY_PLOT, FALSE
Expand All @@ -55,23 +58,24 @@ BerryTree_EventScript_WantToPlantMulch::
case 2, BerryTree_EventScript_CancelPlanting
case MULTI_B_PRESSED, BerryTree_EventScript_CancelPlanting

BerryTree_EventScript_ChooseBerryToPlant::
BerryTree_EventScript_ChooseMulchToUse::
fadescreen FADE_TO_BLACK
closemessage
special Bag_ChooseBerry
special Bag_ChooseMulch
waitstate
goto_if_eq VAR_ITEM_ID, 0, BerryTree_EventScript_CancelPlanting
removeitem VAR_ITEM_ID
call BerryTree_EventScript_PlantBerry
call BerryTree_EventScript_UseMulch
.endif

BerryTree_EventScript_ChooseMulchToUse::
BerryTree_EventScript_ChooseBerryToPlant::
fadescreen FADE_TO_BLACK
closemessage
special Bag_ChooseMulch
special Bag_ChooseBerry
waitstate
goto_if_eq VAR_ITEM_ID, 0, BerryTree_EventScript_CancelPlanting
removeitem VAR_ITEM_ID
call BerryTree_EventScript_UseMulch
call BerryTree_EventScript_PlantBerry

BerryTree_EventScript_CancelPlanting::
release
Expand Down Expand Up @@ -223,32 +227,17 @@ BerryTree_EventScript_PlantBerry::
waitbuttonpress
return

BerryTree_EventScript_UseMulch::
special ObjectEventInteractionApplyMulch
message BerryTree_Text_ScatteredMulch
waitmessage
waitbuttonpress
return

BerryTree_Text_ItsSoftLoamySoil:
.string "It's soft, loamy soil.$"

BerryTree_Text_WantToPlant:
.string "It's soft, loamy soil.\n"
.string "Want to plant a BERRY?$"

BerryTree_Text_WantToMulch:
.string "It's soft, loamy soil.\n"
.string "Put down some fertilizer?$"

BerryTree_Text_PlantedOneBerry:
.string "{PLAYER} planted one {STR_VAR_1} in\n"
.string "the soft, loamy soil.$"

BerryTree_Text_ScatteredMulch:
.string "{PLAYER} scattered the {STR_VAR_1}\n"
.string "on the soft, loamy soil.$"

BerryTree_Text_BerryGrowthStage1:
.string "One {STR_VAR_1} was planted here.$"

Expand Down Expand Up @@ -364,5 +353,21 @@ BerryTree_Text_PutAwayBerry_Mutation:
.string "BERRIES POCKET.\p"
.string "The soil returned to its soft and\n"
.string "loamy state.$"
.endif

.if OW_MULCH_USAGE == TRUE
BerryTree_EventScript_UseMulch::
special ObjectEventInteractionApplyMulch
message BerryTree_Text_ScatteredMulch
waitmessage
waitbuttonpress
return

BerryTree_Text_WantToMulch:
.string "It's soft, loamy soil.\n"
.string "Put down some fertilizer?$"

BerryTree_Text_ScatteredMulch:
.string "{PLAYER} scattered the {STR_VAR_1}\n"
.string "on the soft, loamy soil.$"
.endif
1 change: 1 addition & 0 deletions include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Berry settings
#define OW_BERRY_MUTATIONS FALSE // If enabled, Berry plants can mutate based on berries planted next to them.
#define OW_MULCH_USAGE TRUE // If enabled, Mulch can be used on soil to fertilize it. Otherwise, it is considered unusable.

// Out-of-battle Ability effects
#define OW_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8, if a Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same Nature, as opposed to 50% previously. Stationary Pokémon are excluded in Gen3. In Gen6, all No Eggs Discovered gift Pokémon will have the same Nature, while in Gen7 all gift Pokémon will, regardless of Egg Group - In Gen 8, no gift Pokémon are affected. In Gen9, this ability has no out-of-battle effect.
Expand Down
4 changes: 3 additions & 1 deletion src/berry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ static u8 CalcBerryYield(struct BerryTree *tree)
u8 min = berry->minYield;
u8 max = berry->maxYield;
u8 result = CalcBerryYieldInternal(max, min, BerryTreeGetNumStagesWatered(tree));
if (tree->mulch == ITEM_TO_MULCH(ITEM_RICH_MULCH) || tree->mulch == ITEM_TO_MULCH(ITEM_AMAZE_MULCH))
if (OW_MULCH_USAGE && (tree->mulch == ITEM_TO_MULCH(ITEM_RICH_MULCH) || tree->mulch == ITEM_TO_MULCH(ITEM_AMAZE_MULCH)))
result += 2;

return result;
Expand Down Expand Up @@ -1907,6 +1907,8 @@ void SetBerryTreesSeen(void)

bool8 PlayerHasMulch(void)
{
if (!OW_MULCH_USAGE)
return FALSE;
if (CheckBagHasItem(ITEM_GROWTH_MULCH, 1))
return TRUE;
if (CheckBagHasItem(ITEM_DAMP_MULCH, 1))
Expand Down
16 changes: 8 additions & 8 deletions src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -2164,7 +2164,7 @@ const struct Item gItems[] =
{
.name = _("Growth Mulch"),
.price = 200,
.description = sGrowthMulchDesc,
.description = OW_MULCH_USAGE ? sGrowthMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2176,7 +2176,7 @@ const struct Item gItems[] =
{
.name = _("Damp Mulch"),
.price = 200,
.description = sDampMulchDesc,
.description = OW_MULCH_USAGE ? sDampMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2188,7 +2188,7 @@ const struct Item gItems[] =
{
.name = _("Stable Mulch"),
.price = 200,
.description = sStableMulchDesc,
.description = OW_MULCH_USAGE ? sStableMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2200,7 +2200,7 @@ const struct Item gItems[] =
{
.name = _("Gooey Mulch"),
.price = 200,
.description = sGooeyMulchDesc,
.description = OW_MULCH_USAGE ? sGooeyMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2212,7 +2212,7 @@ const struct Item gItems[] =
{
.name = _("Rich Mulch"),
.price = 200,
.description = sRichMulchDesc,
.description = OW_MULCH_USAGE ? sRichMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2224,7 +2224,7 @@ const struct Item gItems[] =
{
.name = _("SurprseMulch"),
.price = 200,
.description = sSurpriseMulchDesc,
.description = OW_MULCH_USAGE ? sSurpriseMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2236,7 +2236,7 @@ const struct Item gItems[] =
{
.name = _("Boost Mulch"),
.price = 200,
.description = sBoostMulchDesc,
.description = OW_MULCH_USAGE ? sBoostMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand All @@ -2248,7 +2248,7 @@ const struct Item gItems[] =
{
.name = _("Amaze Mulch"),
.price = 200,
.description = sAmazeMulchDesc,
.description = OW_MULCH_USAGE ? sAmazeMulchDesc : sGenericMulchDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
Expand Down
5 changes: 5 additions & 0 deletions src/data/text/item_descriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,11 @@ static const u8 sAmazeMulchDesc[] = _(
"Surprising and\n"
"Boosting as well.");

static const u8 sGenericMulchDesc[] = _(
"A fertilizer that\n"
"is unsuitable for\n"
"local soil.");

// Apricorns
static const u8 sRedApricornDesc[] = _(
"A red apricorn.\n"
Expand Down

0 comments on commit 0d70d99

Please sign in to comment.