// Public Methods public override void update(long time_passed) { if (boon_stack.Count > 0) { var toAdd = new BoonSimulationItemIntensity(boon_stack); if (simulation.Count > 0) { BoonSimulationItem last = simulation.Last(); if (last.getEnd() > toAdd.getStart()) { last.setEnd(toAdd.getStart()); } } simulation.Add(toAdd); // Subtract from each for (int i = boon_stack.Count - 1; i >= 0; i--) { var item = new BoonStackItem(boon_stack[i], time_passed, -time_passed); if (item.boon_duration <= 0) { boon_stack.RemoveAt(i); } else { boon_stack[i] = item; } } } }
// Abstract Methods /// <summary> /// Make sure the last element does not overflow the fight /// </summary> /// <param name="fight_duration">Duration of the fight</param> public void trim(long fight_duration) { for (int i = simulation.Count - 1; i >= 0; i--) { BoonSimulationItem data = simulation[i]; if (data.getEnd() > fight_duration) { data.setEnd(fight_duration); } else { break; } } simulation.RemoveAll(x => x.getDuration(0) <= 0); }