protected internal BuffSimulationItemBase(BuffStackItem buffStackItem) : base(buffStackItem.Start, buffStackItem.Duration) { _src = buffStackItem.Src; _seedSrc = buffStackItem.SeedSrc; _isExtension = buffStackItem.IsExtension; _originalDuration = buffStackItem.Duration; }
protected void Add(long duration, AgentItem src, AgentItem seedSrc, long time, bool atFirst, bool isExtension) { var toAdd = new BuffStackItem(time, duration, src, seedSrc, isExtension); // Find empty slot if (!IsFull) { if (atFirst) { BuffStack.Insert(0, toAdd); } else { _logic.Add(Log, BuffStack, toAdd); } } // Replace lowest value else { if (!_logic.FindLowestValue(Log, toAdd, BuffStack, WasteSimulationResult)) { OverstackSimulationResult.Add(new BuffSimulationItemOverstack(src, duration, time)); } } }
public override void Extend(long extension, long oldValue, AgentItem src, long time, uint stackID) { BuffStackItem toExtend = BuffStack.FirstOrDefault(x => x.StackID == stackID); if (toExtend == null) { throw new EIBuffSimulatorIDException("Extend has failed"); } toExtend.Extend(extension, src); }
public override void Add(long duration, AgentItem src, long start, uint stackID, bool addedActive, uint overstackDuration) { var toAdd = new BuffStackItem(start, duration, src); // Find empty slot if (!IsFull) { _logic.Add(Log, BuffStack, toAdd); } // Replace lowest value else { if (!_logic.FindLowestValue(Log, toAdd, BuffStack, WasteSimulationResult)) { OverstackSimulationResult.Add(new BuffSimulationItemOverstack(src, duration, start)); } } }
public override void Add(ParsedEvtcLog log, List <BuffStackItem> stacks, BuffStackItem stackItem) { if (!stacks.Any()) { stacks.Add(stackItem); return; } int insertIndex = BinarySearchRecursive(stacks, stackItem.TotalDuration, 0, stacks.Count - 1); if (insertIndex > stacks.Count - 1) { stacks.Add(stackItem); } else { stacks.Insert(insertIndex, stackItem); } }
public override bool FindLowestValue(ParsedEvtcLog log, BuffStackItem stackItem, List <BuffStackItem> stacks, List <BuffSimulationItemWasted> wastes) { if (!stacks.Any()) { return(false); } BuffStackItem stack = stacks[0]; wastes.Add(new BuffSimulationItemWasted(stack.Src, stack.Duration, stack.Start)); if (stack.Extensions.Count > 0) { foreach ((AgentItem src, long value) in stack.Extensions) { wastes.Add(new BuffSimulationItemWasted(src, value, stack.Start)); } } stacks[0] = stackItem; return(true); }
public override void Remove(AgentItem by, long removedDuration, int removedStacks, long time, ArcDPSEnums.BuffRemove removeType, uint stackID) { switch (removeType) { case BuffRemove.All: foreach (BuffStackItem stackItem in BuffStack) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } BuffStack.Clear(); break; case BuffRemove.Single: for (int i = 0; i < BuffStack.Count; i++) { BuffStackItem stackItem = BuffStack[i]; if (Math.Abs(removedDuration - stackItem.TotalDuration) < ParserHelper.BuffSimulatorDelayConstant) { WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } BuffStack.RemoveAt(i); return; } } break; default: break; } }
public override bool FindLowestValue(ParsedEvtcLog log, BuffStackItem stackItem, List <BuffStackItem> stacks, List <BuffSimulationItemWasted> wastes) { if (stacks.Count <= 1) { throw new InvalidDataException("Queue logic based must have a >1 capacity"); } BuffStackItem first = stacks[0]; BuffStackItem minItem = stacks.Where(x => x != first).MinBy(x => x.TotalDuration); wastes.Add(new BuffSimulationItemWasted(minItem.Src, minItem.Duration, minItem.Start)); if (minItem.Extensions.Any()) { foreach ((AgentItem src, long value) in minItem.Extensions) { wastes.Add(new BuffSimulationItemWasted(src, value, minItem.Start)); } } stacks[stacks.IndexOf(minItem)] = stackItem; Sort(log, stacks); return(true); }
public override bool FindLowestValue(ParsedEvtcLog log, BuffStackItem stackItem, List <BuffStackItem> stacks, List <BuffSimulationItemWasted> wastes) { // no lowest value to find return(false); }
private static uint GetHealing(BuffStackItem stack) { return(stack.SeedSrc.Healing); }
public static int Compare(BuffStackItem x, BuffStackItem y) { return(-GetHealing(x).CompareTo(GetHealing(y))); }
public abstract bool FindLowestValue(ParsedEvtcLog log, BuffStackItem stackItem, List <BuffStackItem> stacks, List <BuffSimulationItemWasted> wastes);
public virtual void Add(ParsedEvtcLog log, List <BuffStackItem> stacks, BuffStackItem stackItem) { stacks.Add(stackItem); Sort(log, stacks); }
public override void Remove(AgentItem by, long removedDuration, int removedStacks, long time, ArcDPSEnums.BuffRemove removeType, uint stackID) { BuffStackItemID toRemove; switch (removeType) { case ArcDPSEnums.BuffRemove.All: // remove all due to despawn event if (removedStacks == BuffRemoveAllEvent.FullRemoval) { BuffStack.Clear(); return; } if (BuffStack.Count != 1) { if (BuffStack.Count < removedStacks) { throw new EIBuffSimulatorIDException("Remove all failed"); } // buff cleanse all for (int i = 0; i < BuffStack.Count; i++) { BuffStackItem stackItem = BuffStack[i]; WasteSimulationResult.Add(new BuffSimulationItemWasted(stackItem.Src, stackItem.Duration, time)); if (stackItem.Extensions.Any()) { foreach ((AgentItem src, long value) in stackItem.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } BuffStack.Clear(); return; } toRemove = BuffStack[0]; break; case ArcDPSEnums.BuffRemove.Single: toRemove = BuffStack.FirstOrDefault(x => x.StackID == stackID); break; default: throw new InvalidDataException("Unknown remove type"); } if (toRemove == null) { throw new EIBuffSimulatorIDException("Remove has failed"); } BuffStack.Remove(toRemove); if (removedDuration > ParserHelper.BuffSimulatorDelayConstant) { // safe checking, this can happen when an inactive stack is being removed but it was actually active if (Math.Abs(removedDuration - toRemove.TotalDuration) > ParserHelper.BuffSimulatorDelayConstant && !toRemove.Active) { toRemove.Activate(); toRemove.Shift(0, Math.Abs(removedDuration - toRemove.TotalDuration)); } // Removed due to override if (by == ParserHelper._unknownAgent) { WasteSimulationResult.Add(new BuffSimulationItemWasted(toRemove.Src, toRemove.Duration, time)); if (toRemove.Extensions.Any()) { foreach ((AgentItem src, long value) in toRemove.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } // Removed due to a cleanse else { WasteSimulationResult.Add(new BuffSimulationItemWasted(toRemove.Src, toRemove.Duration, time)); if (toRemove.Extensions.Any()) { foreach ((AgentItem src, long value) in toRemove.Extensions) { WasteSimulationResult.Add(new BuffSimulationItemWasted(src, value, time)); } } } } }