adjust artifact probability equation (#13229)

This commit is contained in:
Nemanja
2022-12-30 12:21:39 -05:00
committed by GitHub
parent 0a1485a99d
commit e1b1541c56

View File

@@ -18,6 +18,7 @@ public sealed partial class ArtifactSystem
/// <summary> /// <summary>
/// Generate an Artifact tree with fully developed nodes. /// Generate an Artifact tree with fully developed nodes.
/// </summary> /// </summary>
/// <param name="artifact"></param>
/// <param name="tree">The tree being generated.</param> /// <param name="tree">The tree being generated.</param>
/// <param name="nodeAmount">The amount of nodes it has.</param> /// <param name="nodeAmount">The amount of nodes it has.</param>
private void GenerateArtifactNodeTree(EntityUid artifact, ref ArtifactTree tree, int nodeAmount) private void GenerateArtifactNodeTree(EntityUid artifact, ref ArtifactTree tree, int nodeAmount)
@@ -114,12 +115,12 @@ public sealed partial class ArtifactSystem
/// </remarks> /// </remarks>
private Dictionary<int, float> GetDepthWeights(IEnumerable<int> depths, int targetDepth) private Dictionary<int, float> GetDepthWeights(IEnumerable<int> depths, int targetDepth)
{ {
// this function is just a normal distribution with a
// mean of target depth and standard deviation of 0.75
var weights = new Dictionary<int, float>(); var weights = new Dictionary<int, float>();
foreach (var d in depths) foreach (var d in depths)
{ {
//TODO: is this equation sus? idk. -emo var w = 10f / (0.75f * MathF.Sqrt(2 * MathF.PI)) * MathF.Pow(MathF.E, -MathF.Pow((d - targetDepth) / 0.75f, 2));
// 0.3 / (|current_iterated_depth - our_actual_depth| + 1)^2
var w = 0.3f / MathF.Pow(Math.Abs(d - targetDepth) + 1, 2);
weights.Add(d, w); weights.Add(d, w);
} }
return weights; return weights;