43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using RobotAndDonkey.Game.Execution.Results;
|
|
using RobotAndDonkey.Game.GameState;
|
|
using RobotAndDonkey.Game.Intents;
|
|
|
|
namespace RobotAndDonkey.Game.Modifiers;
|
|
|
|
public abstract record Modifier(EModifierKind Kind, EModifierId Id, EModifierDuration Duration)
|
|
{
|
|
public Modifier DeepClone()
|
|
{
|
|
var result = CreateInstance();
|
|
foreach (var debuffSource in DebuffSources)
|
|
result.DebuffSources.Add(debuffSource);
|
|
return result;
|
|
}
|
|
|
|
protected abstract Modifier CreateInstance();
|
|
|
|
public virtual void OnAdded(Entity owner, List<Intent> newIntents)
|
|
{
|
|
}
|
|
|
|
public virtual void Before(Guid requestId, ReadOnlySpan<Intent> intents, CoreLoop coreLoop, Entity owner, List<Intent> newIntents, List<Result> results)
|
|
{
|
|
}
|
|
|
|
public virtual void After(Guid requestId, ReadOnlySpan<Intent> intents, CoreLoop coreLoop, Entity owner, List<Intent> newIntents, List<Result> results)
|
|
{
|
|
}
|
|
|
|
public virtual void OnRemoved(Entity owner, List<Intent> newIntents)
|
|
{
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return "<" + $"{Id}, {Duration}" + (DebuffSources.Count > 0 ? ", debuffed" : "") + ">";
|
|
}
|
|
|
|
public HashSet<Entity> DebuffSources { get; } = [];
|
|
|
|
public abstract string ToolTip { get; }
|
|
} |