Implement too many changes to list
This commit is contained in:
@@ -8,7 +8,7 @@ namespace KernelPanic.Combat
|
||||
/// </summary>
|
||||
public sealed class CombatantState
|
||||
{
|
||||
private readonly Dictionary<StatusType, int> activeStatuses = new();
|
||||
private readonly List<StatusInstance> _statuses = new();
|
||||
|
||||
public CombatantState(int maxUptime, int ram, int cycles)
|
||||
{
|
||||
@@ -16,6 +16,7 @@ namespace KernelPanic.Combat
|
||||
CurrentUptime = maxUptime;
|
||||
Ram = ram;
|
||||
Cycles = cycles;
|
||||
MaxCycles = cycles;
|
||||
}
|
||||
|
||||
public int CurrentUptime { get; set; }
|
||||
@@ -23,6 +24,34 @@ namespace KernelPanic.Combat
|
||||
public int Shield { get; set; }
|
||||
public int Ram { get; set; }
|
||||
public int Cycles { get; set; }
|
||||
public IReadOnlyDictionary<StatusType, int> ActiveStatuses => activeStatuses;
|
||||
public int MaxCycles { get; set; }
|
||||
public bool IsDefeated { get; set; }
|
||||
public bool forceMaxRolls { get; set; }
|
||||
public IReadOnlyList<StatusInstance> Statuses => _statuses;
|
||||
public IReadOnlyDictionary<StatusType, int> ActiveStatuses => BuildStatusSnapshot();
|
||||
|
||||
internal List<StatusInstance> MutableStatuses => _statuses;
|
||||
|
||||
public bool HasStatus(StatusType type)
|
||||
{
|
||||
return _statuses.Exists(status => status.Type == type);
|
||||
}
|
||||
|
||||
public int StacksOf(StatusType type)
|
||||
{
|
||||
StatusInstance status = _statuses.Find(instance => instance.Type == type);
|
||||
return status == null ? 0 : status.Stacks;
|
||||
}
|
||||
|
||||
private IReadOnlyDictionary<StatusType, int> BuildStatusSnapshot()
|
||||
{
|
||||
Dictionary<StatusType, int> snapshot = new();
|
||||
for (int i = 0; i < _statuses.Count; i++)
|
||||
{
|
||||
snapshot[_statuses[i].Type] = _statuses[i].Stacks;
|
||||
}
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user