mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 10:48:12 +02:00
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:
1 parent
38146ff1db
commit
d6fa5572ed
4 files changed
+304
-17
No files matched your search
@@ -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
|
||||
) {
|
||||
|
||||
@@ -796,6 +796,12 @@ function RenderProfileStatistics() {
|
||||
?.length ??
|
||||
0;
|
||||
|
||||
const GardensOwned =
|
||||
ProfileSave
|
||||
?.Gardens
|
||||
?.length ??
|
||||
1;
|
||||
|
||||
const GardenWidth =
|
||||
ProfileSave
|
||||
?.Garden
|
||||
@@ -837,6 +843,13 @@ function RenderProfileStatistics() {
|
||||
)
|
||||
);
|
||||
|
||||
SetProfileStatistic(
|
||||
"ProfileGardensOwned",
|
||||
FormatProfileNumber(
|
||||
GardensOwned
|
||||
)
|
||||
);
|
||||
|
||||
SetProfileStatistic(
|
||||
"ProfileGardenSize",
|
||||
GardenWidth +
|
||||
@@ -852,6 +865,7 @@ function RenderProfileStatisticsError() {
|
||||
"ProfileLifetimeDew",
|
||||
"ProfilePlantsDiscovered",
|
||||
"ProfileMutationsDiscovered",
|
||||
"ProfileGardensOwned",
|
||||
"ProfileGardenSize"
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user