Anomaly events & science point gen tweaks (#13590)
This commit is contained in:
@@ -17,9 +17,6 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private const int PricePerNode = 500;
|
||||
private const int PointsPerNode = 5000;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -34,7 +31,7 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
|
||||
private void OnInit(EntityUid uid, ArtifactComponent component, MapInitEvent args)
|
||||
{
|
||||
RandomizeArtifact(component);
|
||||
RandomizeArtifact(uid, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,7 +49,7 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
if (component.NodeTree == null)
|
||||
return;
|
||||
|
||||
var price = component.NodeTree.AllNodes.Sum(GetNodePrice);
|
||||
var price = component.NodeTree.AllNodes.Sum(x => GetNodePrice(x, component));
|
||||
|
||||
// 25% bonus for fully exploring every node.
|
||||
var fullyExploredBonus = component.NodeTree.AllNodes.Any(x => !x.Triggered) ? 1 : 1.25f;
|
||||
@@ -60,7 +57,7 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
args.Price =+ price * fullyExploredBonus;
|
||||
}
|
||||
|
||||
private float GetNodePrice(ArtifactNode node)
|
||||
private float GetNodePrice(ArtifactNode node, ArtifactComponent component)
|
||||
{
|
||||
if (!node.Discovered) //no money for undiscovered nodes.
|
||||
return 0;
|
||||
@@ -70,7 +67,7 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
//the danger is the average of node depth, effect danger, and trigger danger.
|
||||
var nodeDanger = (node.Depth + node.Effect.TargetDepth + node.Trigger.TargetDepth) / 3;
|
||||
|
||||
var price = MathF.Pow(2f, nodeDanger) * PricePerNode * priceMultiplier;
|
||||
var price = MathF.Pow(2f, nodeDanger) * component.PricePerNode * priceMultiplier;
|
||||
return price;
|
||||
}
|
||||
|
||||
@@ -78,43 +75,52 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
/// Calculates how many research points the artifact is worht
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Rebalance this shit at some point. Definitely OP.
|
||||
/// General balancing (for fully unlocked artifacts):
|
||||
/// Simple (1-2 Nodes): ~10K
|
||||
/// Medium (5-8 Nodes): ~30-40K
|
||||
/// Complex (7-12 Nodes): ~60-80K
|
||||
///
|
||||
/// Simple artifacts should be enough to unlock a few techs.
|
||||
/// Medium should get you partway through a tree.
|
||||
/// Complex should get you through a full tree and then some.
|
||||
/// </remarks>
|
||||
public int GetResearchPointValue(EntityUid uid, ArtifactComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component) || component.NodeTree == null)
|
||||
return 0;
|
||||
|
||||
var sumValue = component.NodeTree.AllNodes.Sum(GetNodePointValue);
|
||||
var sumValue = component.NodeTree.AllNodes.Sum(n => GetNodePointValue(n, component));
|
||||
var fullyExploredBonus = component.NodeTree.AllNodes.Any(x => !x.Triggered) ? 1 : 1.25f;
|
||||
|
||||
var pointValue = (int) (sumValue * fullyExploredBonus);
|
||||
return pointValue;
|
||||
}
|
||||
|
||||
private float GetNodePointValue(ArtifactNode node)
|
||||
/// <summary>
|
||||
/// Gets the point value for an individual node
|
||||
/// </summary>
|
||||
private float GetNodePointValue(ArtifactNode node, ArtifactComponent component)
|
||||
{
|
||||
if (!node.Discovered)
|
||||
return 0;
|
||||
|
||||
var valueDeduction = !node.Triggered ? 0.5f : 1;
|
||||
var valueDeduction = !node.Triggered ? 0.25f : 1;
|
||||
var nodeDanger = (node.Depth + node.Effect.TargetDepth + node.Trigger.TargetDepth) / 3;
|
||||
|
||||
return (nodeDanger+1) * PointsPerNode * valueDeduction;
|
||||
return component.PointsPerNode * MathF.Pow(component.PointDangerMultiplier, nodeDanger) * valueDeduction;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Randomize a given artifact.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public void RandomizeArtifact(ArtifactComponent component)
|
||||
public void RandomizeArtifact(EntityUid uid, ArtifactComponent component)
|
||||
{
|
||||
var nodeAmount = _random.Next(component.NodesMin, component.NodesMax);
|
||||
|
||||
component.NodeTree = new ArtifactTree();
|
||||
|
||||
GenerateArtifactNodeTree(component.Owner, ref component.NodeTree, nodeAmount);
|
||||
EnterNode(component.Owner, ref component.NodeTree.StartNode, component);
|
||||
GenerateArtifactNodeTree(uid, ref component.NodeTree, nodeAmount);
|
||||
EnterNode(uid, ref component.NodeTree.StartNode, component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -166,21 +172,21 @@ public sealed partial class ArtifactSystem : EntitySystem
|
||||
component.CurrentNode.Triggered = true;
|
||||
if (component.CurrentNode.Edges.Any())
|
||||
{
|
||||
var newNode = GetNewNode(component);
|
||||
var newNode = GetNewNode(uid, component);
|
||||
if (newNode == null)
|
||||
return;
|
||||
EnterNode(uid, ref newNode, component);
|
||||
}
|
||||
}
|
||||
|
||||
private ArtifactNode? GetNewNode(ArtifactComponent component)
|
||||
private ArtifactNode? GetNewNode(EntityUid uid, ArtifactComponent component)
|
||||
{
|
||||
if (component.CurrentNode == null)
|
||||
return null;
|
||||
|
||||
var allNodes = component.CurrentNode.Edges;
|
||||
|
||||
if (TryComp<BiasedArtifactComponent>(component.Owner, out var bias) &&
|
||||
if (TryComp<BiasedArtifactComponent>(uid, out var bias) &&
|
||||
TryComp<TraversalDistorterComponent>(bias.Provider, out var trav) &&
|
||||
_random.Prob(trav.BiasChance) &&
|
||||
this.IsPowered(bias.Provider, EntityManager))
|
||||
|
||||
Reference in New Issue
Block a user