mirror of
https://git.srhtnin.garden/sarah/srhtnin.github.io.git
synced 2026-10-14 10:48:12 +02:00
Added the actual functional effects, not just the base.
This commit is contained in:
1 parent
9de8af0d2b
commit
1452a4a96d
6 files changed
+1102
-88
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user