Change Log
- References to a “run” have been replaced with the term “run”.
Proc = event payload / data type
In ProcSources.cs, a proc is a struct that implements IProc (and usually IEvent). It’s the data that describes something that happened :
OnHit,OnHeal,OnShield,OnDeath,OnTurnStart,OnTurnEnd,OnStatusEffectGained, etc.
So a proc is what is being passed around: the event type and its fields (e.g. OnHit has damage, damageSourceId, damageTargetId, notifyOtherProcs).
- Procs are published on the EventBus (e.g. from battle logic).
- GameObserverRelay subscribes to those proc types and forwards them to SharedActions (e.g. OnHit → ApplyDamage, OnHeal → ApplyHeal).
Trigger = moment/category for item effects
A trigger is an enum value: EProcTriggerType in ItemEffectConfig.cs. It answers when an item effect should run :
OnDamageDealt,OnPreDamageTaken,OnPostDamageTaken,OnTurnStart,OnHealGiven,OnPreHealTaken,OnPostHealTaken, etc.
When game code runs (e.g. inside SharedActions.ApplyDamage), it doesn’t publish another event for items. Instead it calls:
UnitInventory.TriggerProcs(EProcTriggerType.xxx, ref proc)So :- Trigger = the moment you pass to TriggerProcs(…) so the inventory can find which item effects to run.
- Proc = the payload (the struct) passed by ref into those effects.
EXAMPLE : From UnitInventory.cs :
public bool TriggerProcs<T>(EProcTriggerType triggerType, ref T proc) where T : struct, IProc {
ItemEffect[] itemsToTrigger = itemStacks.Values.SelectMany(item => item.itemEffects).Where(effect => effect.config.triggerType == triggerType).ToArray(); }`
Item effects declare a triggerType; when that matches the triggerType passed to TriggerProcs, they run with the given proc.
How they work together
One proc, multiple triggers
The same proc instance can be used with different trigger types at different steps. For example, in ApplyDamage with an OnHit:
- Source’s inventory: TriggerProcs(EProcTriggerType.OnDamageDealt, ref onHit)
- Target’s inventory (before damage): TriggerProcs(EProcTriggerType.OnPreDamageTaken, ref onHit)
- Target’s inventory (after damage): TriggerProcs(EProcTriggerType.OnPostDamageTaken, ref onHit)
So proc = one shared payload; trigger = which “moment” (and thus which item effects) you’re running.
- Proc = event/data type (the what).
- Trigger = moment/category for item effects (the when); used when calling TriggerProcs(…) and stored on ItemEffectConfig.triggerType.