Updated pages and stuff to be accurate. Also made magic trowel havest

all of a plant you harvest with it.
This commit is contained in:
sarah committed 2026-09-07 14:34:50 +02:00
1 parent 38146ff1db
commit d6fa5572ed
4 files changed
+304 -17

No files matched your search

+171
View File
@@ -1826,6 +1826,46 @@ function CreatePlotElement(
}
if (
SelectedGardenTool ===
"MagicTrowel"
) {
if (Progress < 1) {
MainButton.title =
Plant.Name +
" - " +
Math.floor(
Progress * 100
) +
"% grown";
MainButton.disabled = true;
return Tile;
}
Tile.classList.add(
"GardenPlotMature",
"GardenPlotMagicPlant"
);
MainButton.title =
"Harvest all mature " +
Plant.Name +
" plants in this Garden";
MainButton.addEventListener(
"click",
() => {
HarvestManyPlants(
Plot.Plant
);
}
);
return Tile;
}
if (
SelectedGardenTool !==
"Trowel"
@@ -2364,6 +2404,137 @@ async function PlantManySeeds() {
}
async function HarvestManyPlants(
PlantKey
) {
const ActionTime = Date.now();
AdvanceGameSimulation(
GameSave,
ActionTime
);
const Plant =
Plants[PlantKey];
if (Plant === undefined) {
return;
}
const MatchingPlotIndexes = [];
GameSave.Garden.Plots.forEach(
(Plot, PlotIndex) => {
if (
Plot !== null &&
Plot.Plant === PlantKey &&
IsPlantMature(
Plot,
Plant
)
) {
MatchingPlotIndexes.push(
PlotIndex
);
}
}
);
if (MatchingPlotIndexes.length === 0) {
SetGardenMessage(
"There aren't any mature " +
Plant.Name +
" plants to harvest."
);
RenderGame();
return;
}
let HarvestedCount = 0;
let RewardAmount = 0;
let DisabledCount = 0;
let RewardUnavailableCount = 0;
for (
const PlotIndex
of MatchingPlotIndexes
) {
const HarvestResult =
HarvestGardenPlot(
GameSave,
GameSave.ActiveGardenIndex,
PlotIndex,
ActionTime
);
if (!HarvestResult.Harvested) {
if (HarvestResult.Disabled) {
DisabledCount++;
} else if (
HarvestResult.RewardUnavailable
) {
RewardUnavailableCount++;
}
continue;
}
HarvestedCount++;
RewardAmount +=
HarvestResult.RewardAmount;
}
if (HarvestedCount <= 0) {
if (DisabledCount > 0) {
SetGardenMessage(
Plant.Name +
" can't be harvested right now."
);
} else if (
RewardUnavailableCount > 0
) {
SetGardenMessage(
"Couldn't calculate the harvest reward for " +
Plant.Name +
"."
);
}
RenderGame();
return;
}
SetGardenMessage(
"Magic trowel harvested " +
HarvestedCount.toLocaleString() +
" " +
Plant.Name +
(HarvestedCount === 1
? " plant"
: " plants") +
" for " +
RewardAmount.toLocaleString() +
" Dew."
);
CheckGardenMutations(
GameSave,
ActionTime
);
RenderGame();
await SaveGame(
GameSave
);
}
async function HarvestPlant(
PlotIndex
) {