ported from perforce
This commit is contained in:
43
RobotAndDonkey.Game/Modifiers/Modifier.cs
Normal file
43
RobotAndDonkey.Game/Modifiers/Modifier.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
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; }
|
||||
}
|
||||
Reference in New Issue
Block a user