private CombatLog(IReadOnlyList<LogEntry> entries) { Entries = entries; var combats = new List<Combat>(); Combat combat = null; foreach (var entry in Entries) { if (entry.Type == EntryType.Event && entry.Action == LogEntry.EnterCombatAction) { combat = new Combat(entry.Who); combats.Add(combat); } combat?.AddLogEntry(entry); if (entry.Type == EntryType.Event && entry.Action == LogEntry.ExitCombatAction) combat = null; } Combats = combats.AsReadOnly(); }
public CombatViewModel(Combat combat) { Combat = combat; }