Class CombatEventCoalescer
Merges the combat events one character receives within a tick into a bounded set.
public sealed class CombatEventCoalescer
- Inheritance
-
CombatEventCoalescer
- Inherited Members
Remarks
One CombatEventBroadcast per hit is fine for a duel and a flood for an area effect: twenty projectiles landing on one creature in one tick would be twenty messages to every observer of that creature, and every one of them would spawn its own label on top of the last. Hits from the same source, of the same kind and damage type, are therefore summed into one entry; what a client shows for them is one number, which is also what a player can actually read.
Bounded at MaxEntries distinct entries per flush. Past the bound, further hits are folded into an anonymous entry (source 0) for their kind and type so the total is still right and the message count is not. Pure C# so the merge rules are unit tested.
Each entry counts its hits as well as summing them. Merging is the right answer for display and the wrong one for the caster's predicted numbers, which are drawn one per hit and settled one per report. See Occurrences.
Fields
MaxEntries
Distinct (source, kind, type) entries kept per flush before folding.
public const int MaxEntries = 8
Field Value
Properties
Count
Number of merged entries waiting to be flushed.
public int Count { get; }
Property Value
Methods
Add(int, CombatEventKind, int, int)
Records one event, merging it into an existing entry where the key matches.
public void Add(int sourceObjectID, CombatEventKind kind, int damageTemplateID, int amount)
Parameters
sourceObjectIDintNetworkObject id of the source, or 0.
kindCombatEventKindWhat happened.
damageTemplateIDintDamage template id, or 0 for a heal.
amountintThe amount. Non-positive amounts are ignored: they produce no label.
Clear()
Drops everything without reporting it.
public void Clear()
Flush(List<Entry>)
Moves every merged entry into output and clears this coalescer.
public void Flush(List<CombatEventCoalescer.Entry> output)
Parameters
outputList<CombatEventCoalescer.Entry>Receives the entries; not cleared first.