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

+52 -11
View File
@@ -98,13 +98,29 @@ function ValidateAdminFunctionalEffects(
);
}
const EffectType = String(
Effect.Type ?? ""
).trim();
ValidateAdminKey(
String(
Effect.Type ?? ""
).trim(),
EffectType,
"Functional effect type"
);
if (
typeof IsKnownFunctionalEffectType ===
"function" &&
!IsKnownFunctionalEffectType(
EffectType
)
) {
throw new Error(
"Unknown functional effect type: " +
EffectType +
"."
);
}
if (Effect.Key !== undefined) {
const EffectKey = String(
Effect.Key ?? ""
@@ -175,16 +191,41 @@ function ValidateAdminFunctionalEffects(
"Functional effect amount must be a number."
);
}
if (
[
"GrowthAdvance",
"MutationChanceBonus",
"CooldownReduction",
"HarvestYieldBonus"
].includes(EffectType) &&
(Amount < 0 || Amount > 1)
) {
throw new Error(
"Functional percentage amounts must be between 0 and 1."
);
}
}
if (
Effect.RequireMature !== undefined &&
typeof Effect.RequireMature !==
"boolean"
) {
throw new Error(
"Functional effect RequireMature must be On or Off."
);
for (const BooleanField of [
"RequireMature",
"RequireMatureSource",
"RandomSource",
"RandomTarget",
"ExcludeFunctional",
"ConsumeSeed"
]) {
if (
Effect[BooleanField] !== undefined &&
typeof Effect[BooleanField] !==
"boolean"
) {
throw new Error(
"Functional effect " +
BooleanField +
" must be On or Off."
);
}
}
if (