Refactor alot of stuff
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using KernelPanic.Core;
|
||||
|
||||
namespace KernelPanic.Combat
|
||||
@@ -15,6 +16,7 @@ namespace KernelPanic.Combat
|
||||
public long PlayerUptimeLost { get; internal set; }
|
||||
public long PlayerShieldBlocked { get; internal set; }
|
||||
public List<string> Details { get; } = new();
|
||||
public List<string> DamageBreakdowns { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>A bounded journal of observed actions. Never predicts or executes combat.</summary>
|
||||
@@ -66,6 +68,13 @@ namespace KernelPanic.Combat
|
||||
bool standalone = _active.Count == 0;
|
||||
if (standalone) Begin(Stage, value.Cause ?? "Status or passive damage");
|
||||
var action = _active.Peek();
|
||||
if (!string.IsNullOrEmpty(value.Breakdown))
|
||||
{
|
||||
if (action.DamageBreakdowns.Count >= 32) action.DamageBreakdowns.RemoveAt(0);
|
||||
string target = ReferenceEquals(value.Target, _combat?.PlayerState) ? "Host"
|
||||
: _combat?.Enemies.FirstOrDefault(e => ReferenceEquals(e.State, value.Target))?.Name ?? "Target";
|
||||
action.DamageBreakdowns.Add(target + " / " + value.Breakdown);
|
||||
}
|
||||
if (_combat != null && ReferenceEquals(value.Target, _combat.PlayerState))
|
||||
{
|
||||
action.PlayerUptimeLost += Math.Max(0, value.UptimeDamage);
|
||||
|
||||
Reference in New Issue
Block a user