From 996b7428e2a928764eff97fabcc23e594a208ae9 Mon Sep 17 00:00:00 2001 From: Jekfer Bichon Date: Mon, 11 Jun 2018 13:52:14 +0200 Subject: [PATCH] fix for issue #31 --- LuckParser/Controllers/Controller1.cs | 4 ++-- LuckParser/Models/ParseModels/CombatData.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/LuckParser/Controllers/Controller1.cs b/LuckParser/Controllers/Controller1.cs index af46f1e47..8466dd584 100644 --- a/LuckParser/Controllers/Controller1.cs +++ b/LuckParser/Controllers/Controller1.cs @@ -3471,10 +3471,10 @@ private void CreateDeathRecap(StreamWriter sw, Player p) List damageLogs = p.getDamageTakenLogs(b_data, c_data.getCombatList(), getAgentData(), getMechData()); SkillData s_data = getSkillData(); List s_list = s_data.getSkillList(); - List down = getCombatData().getStates(p.getInstid(), "CHANGE_DOWN"); + List down = getCombatData().getStates(p.getInstid(), "CHANGE_DOWN", b_data.getFirstAware(), b_data.getLastAware()); if (down.Count > 0) { - List ups = getCombatData().getStates(p.getInstid(), "CHANGE_UP"); + List ups = getCombatData().getStates(p.getInstid(), "CHANGE_UP", b_data.getFirstAware(), b_data.getLastAware()); down = down.GetRange(ups.Count(), down.Count()-ups.Count()); } List dead = getCombatData().getStates(p.getInstid(), "CHANGE_DEAD"); diff --git a/LuckParser/Models/ParseModels/CombatData.cs b/LuckParser/Models/ParseModels/CombatData.cs index b2241f3d0..2392dea27 100644 --- a/LuckParser/Models/ParseModels/CombatData.cs +++ b/LuckParser/Models/ParseModels/CombatData.cs @@ -23,10 +23,11 @@ public void addItem(CombatItem item) combat_list.Add(item); } - public List getStates(int src_instid, String change) + public List getStates(int src_instid, String change, long start = 0, long end = 0) { List states = new List(); - foreach (CombatItem c in combat_list) + List li = (end - start) > 0 ? combat_list.Where(x => x.getTime() >= 0 && x.getTime() < end).ToList() : combat_list; + foreach (CombatItem c in li) { if (c.getSrcInstid() == src_instid && c.isStateChange().getEnum() == change) {