Ещё больше

This commit is contained in:
BIGZi0348
2025-01-01 19:34:11 +03:00
parent 84d4c85b2f
commit 12eb0b5308
7 changed files with 65 additions and 9 deletions

View File

@@ -264,7 +264,7 @@ public sealed partial class ArtifactSystem
uninitializedNodes.Remove(node);
node.Trigger = GetRandomTrigger(artifact, ref node);
node.Effect = GetSafeRandomEffect(artifact, ref node);
node.Effect = GetRandomEffect(artifact, ref node);
var maxChildren = _random.Next(1, MaxEdgesPerNode - 1);
@@ -285,18 +285,24 @@ public sealed partial class ArtifactSystem
allNodes.Add(node);
}
foreach (var item in allNodes)
{
if (item.Depth <= 3)
item.Effect = GetSafeRandomEffect(artifact, item.Depth);
}
}
/// <summary>
/// WD.
/// </summary>
private string GetSafeRandomEffect(EntityUid artifact, ref ArtifactNode node)
private string GetSafeRandomEffect(EntityUid artifact, int nodeDepth)
{
var allEffects = _prototype.EnumeratePrototypes<ArtifactEffectPrototype>()
.Where(x => (x.Whitelist?.IsValid(artifact, EntityManager) ?? true) && (!x.Blacklist?.IsValid(artifact, EntityManager) ?? true) && x.Safe).ToList();
var validDepth = allEffects.Select(x => x.TargetDepth).Distinct().ToList();
var weights = GetDepthWeights(validDepth, node.Depth);
var weights = GetDepthWeights(validDepth, nodeDepth);
var selectedRandomTargetDepth = GetRandomTargetDepth(weights);
var targetEffects = allEffects
.Where(x => x.TargetDepth == selectedRandomTargetDepth).ToList();