Added the actual functional effects, not just the base.

This commit is contained in:
sarah committed 2026-09-05 17:05:54 +02:00
1 parent 9de8af0d2b
commit 1452a4a96d
6 files changed
+1102 -88

No files matched your search

+79 -1
View File
@@ -131,7 +131,7 @@ function CheckGardenMutations(
);
const Chance = Math.max(
const BaseChance = Math.max(
0,
Math.min(
Number(
@@ -142,6 +142,31 @@ function CheckGardenMutations(
)
);
const Catalyst =
typeof GetStrongestFunctionalEffectAffectingAnyPlot ===
"function"
? GetStrongestFunctionalEffectAffectingAnyPlot(
SaveData,
SaveData.ActiveGardenIndex ?? 0,
Candidate.Cells,
"MutationChanceBonus",
AtTime
)
: null;
const CatalystBonus =
typeof GetFunctionalPercentageAmount ===
"function"
? GetFunctionalPercentageAmount(
Catalyst?.Effect
)
: 0;
const Chance = Math.min(
1,
BaseChance + CatalystBonus
);
const Succeeded =
GetSimulationRandom(
@@ -386,6 +411,42 @@ function CreateMutationCandidate(
}
const GardenIndex =
Math.max(
0,
Number(
SaveData.ActiveGardenIndex ?? 0
) || 0
);
if (
typeof IsGardenPlotMutationDisabled ===
"function" &&
Cells.some(
PlotIndex =>
IsGardenPlotMutationDisabled(
SaveData,
GardenIndex,
PlotIndex,
AtTime
)
) &&
!(
typeof DoesMutationPatternInvolveDisableMutation ===
"function" &&
DoesMutationPatternInvolveDisableMutation(
SaveData,
GardenIndex,
OriginX,
OriginY,
Orientation.Pattern
)
)
) {
return null;
}
return {
Mutation: Mutation,
@@ -789,6 +850,23 @@ function ApplyMutationResult(
: "East";
}
if (
NewPlot !== null &&
typeof NewPlot === "object" &&
ExistingPlot !== null &&
typeof ExistingPlot === "object" &&
typeof ExistingPlot.AssignedSeed ===
"string" &&
typeof CanFunctionalPlantUseAssignedSeed ===
"function" &&
CanFunctionalPlantUseAssignedSeed(
Plants?.[NewPlot.Plant]
)
) {
NewPlot.AssignedSeed =
ExistingPlot.AssignedSeed;
}
SaveData.Garden.Plots[
PlotIndex