This commit is contained in:
2025-07-27 16:45:42 +08:00
parent 5d1181ef97
commit 502edf03a0
12 changed files with 291 additions and 51 deletions

View File

@@ -0,0 +1,66 @@
using Verse;
using RimWorld;
namespace WulaFallenEmpire
{
public abstract class Condition
{
public abstract bool IsMet(out string reason);
}
public class Condition_VariableEquals : Condition
{
public string name;
public string value;
public override bool IsMet(out string reason)
{
object variable = EventContext.GetVariable<object>(name);
if (variable == null)
{
reason = $"Variable '{name}' not set.";
return false;
}
// Simple string comparison for now. Can be expanded.
bool met = variable.ToString() == value;
if (!met)
{
reason = $"Requires {name} = {value} (Current: {variable})";
}
else
{
reason = "";
}
return met;
}
}
public class Condition_VariableGreaterThan : Condition
{
public string name;
public float value;
public override bool IsMet(out string reason)
{
float variable = EventContext.GetVariable<float>(name, float.MinValue);
if (variable == float.MinValue)
{
reason = $"Variable '{name}' not set.";
return false;
}
bool met = variable > value;
if (!met)
{
reason = $"Requires {name} > {value} (Current: {variable})";
}
else
{
reason = "";
}
return met;
}
}
}