worldbox-observer-mod/IdleSpectator/Events/Catalogs/EventCatalog.Relationship.cs

71 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
namespace IdleSpectator;
/// <summary>Authored discrete relationship lifecycle events (not a live asset library).</summary>
public static partial class EventCatalog
{
public static class Relationship
{
private static readonly Dictionary<string, DiscreteEventEntry> Entries =
new Dictionary<string, DiscreteEventEntry>(StringComparer.OrdinalIgnoreCase);
static Relationship()
{
Add("set_lover", 72f, "Relationship", "{a} became lovers with {b}");
Add("clear_lover", 55f, "Relationship", "{a} parted from a lover");
Add("add_child", 68f, "Relationship", "{a} gains a child, {b}");
Add("new_family", 70f, "Relationship", "{a} starts a new family");
Add("family_removed", 50f, "Relationship", "{a}'s family ends");
// Seeking / pack churn are still candidates; low strength lets the director bury them.
Add("find_lover", 45f, "Relationship", "{a} is seeking a lover");
Add("become_alpha", 72f, "LifeChapter", "{a} becomes the family alpha");
Add("family_group_new", 60f, "Relationship", "{a} forms a family pack");
Add("family_group_join", 36f, "Relationship", "{a} joins a family pack");
Add("family_group_leave", 36f, "Relationship", "{a} leaves a family pack");
Add("baby_created", 70f, "Relationship", "{a} is created as a baby");
}
private static void Add(
string id,
float strength,
string category,
string label,
bool createsInterest = true)
{
Entries[id] = new DiscreteEventEntry
{
Id = id,
EventStrength = strength,
Category = category,
CreatesInterest = createsInterest,
LabelTemplate = label
};
}
public static IEnumerable<string> AuthoredIds => Entries.Keys;
public static bool HasAuthored(string id) =>
!string.IsNullOrEmpty(id) && Entries.ContainsKey(id.Trim());
public static DiscreteEventEntry GetOrFallback(string id)
{
if (!string.IsNullOrEmpty(id) && Entries.TryGetValue(id.Trim(), out DiscreteEventEntry entry))
{
return entry;
}
string key = string.IsNullOrEmpty(id) ? "unknown" : id.Trim();
return new DiscreteEventEntry
{
Id = key,
EventStrength = 40f,
Category = "Relationship",
LabelTemplate = "{a} · {id}",
CreatesInterest = false,
IsFallback = true
};
}
}
}