A class in Root.Township, Alta.Alchemy.
Component next to a HealthObject that receives potion and alchemy effects: poison over time, teleporting and reveal. Reach it through HealthObject.EffectHandler; players use the PlayerEffectController subclass.
Constructors
| Member | What it is |
|---|
EffectHandler() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|
protected bool isTeleportable | False during the teleport cooldown. |
9 private and internal fields
| Member | What it is |
|---|
private NetworkEntity entity | Backing field for Entity. |
private HealthObject health | Backing field for Health. |
private EffectHandler.EffectTypes immuneTo | Flags for effects this handler ignores: poison, teleport and reveal. |
private Coroutine poisonCoroutine | The running RunPoison coroutine, or null when not poisoned. |
private float poisonFrequency | Seconds between poison damage ticks. 1 by default. |
private float poisonMultiplier | Poison damage multiplier, taken from the health object's poison attack type multiplier. |
private float poisonStrength | Damage per poison tick: the highest strength among active stacks. Reset to 0 when the last stack ends. |
private StatManager statManager | Backing field for StatManager. |
private Dictionary<EffectDefinition, ValueTuple<Queue<EffectHandler.EffectOverTimeData>, AltaCoroutine>> unitsToRegen | Per effect definition, the queue of pending over-time effects and the coroutine working through it. |
Properties
| Member | What it is |
|---|
NetworkEntity Entity { get; } | The NetworkEntity this handler belongs to. |
HealthObject Health { get; } | The health object poison damages. |
int PoisonStacks { get; protected set; } | How many poison effects are active. Poison stops when it reaches 0. |
StatManager StatManager { get; } | The stat manager that stat effects change. |
Events
| Member | What it is |
|---|
event Action OnReveal | Raised by Reveal. Phantoms listen to it to become visible. |
Methods
| Member | What it is |
|---|
virtual void PoisonOverTime(float strength) | A positive strength adds a poison stack (damage each second at the strongest strength so far); zero or less removes one. |
virtual void Reveal() | Raises OnReveal, unless immune to reveal. |
virtual void Teleport(Vector3 position, float strength, EffectHandler.TeleportType teleportType = 0) | Moves the object to a position (the move happens on the server), then blocks further teleports for 2 seconds. Ignored if immune. |
protected IEnumerator TeleportCooldown() (iterator) | Coroutine that re-enables teleporting after 2 seconds. |
4 private and internal methods
| Member | What it is |
|---|
internal void EffectOverTime(EffectDefinition effectToModify, float strength, int duration, Action<EffectHandler, EffectDefinition, float> handleUpdate) | Queues an effect that applies its strength spread over duration seconds, starting the loop for that effect if needed. |
private IEnumerator EffectOverTimeLoop(Queue<EffectHandler.EffectOverTimeData> queue) (iterator) | Coroutine that works through queued over-time effects one at a time, ticking once a second. |
private IEnumerator RunPoison() (iterator) | Coroutine that deals poison damage every poisonFrequency seconds while health is above 0. |
private void Start() | Reads the health object's poison multiplier into poisonMultiplier. |
Used in
Members of other types that take, return or hold a EffectHandler:
BuildUpconcoctionEffect.buildupMap, BuildUpconcoctionEffect.CheckApply, BuildUpconcoctionEffect.RunBuildup, BuildupTeleportEffect.Apply, BurnEffect.Apply, ChanceBasedEffectDefinition.CheckApply, Effect.Apply, Effect.Handler, EffectArea.affecting, EffectArea.EnterObject, EffectArea.GetHandler, EffectArea.LeaveObject, EffectDefinition.Apply, EffectDefinition.CheckApply, EffectDefinitionApplication.Apply, EffectDefinitionApplication.CheckApply, EffectHandler.EffectOverTimeData.EffectOverTimeData, EffectHandler.EffectOverTimeData.handleUpdate, EffectHandler.EffectOverTimeData.HandleUpdate, EffectVolumeTrigger.EffectHandlerEntered, EffectVolumeTrigger.EffectHandlerLeft, EffectVolumeTrigger.Effect.Apply, EffectVolumeTrigger.Effect.Unapply, EnvironmentalEffect<T>.Apply, IEffectDefinition.CheckApply, InateEffect.Apply, PoisonEffect.Apply, PoisonEffect.CheckApply, RevealEffect.Apply, StatEffect.Apply, StatMultiplierEffect.Apply, TeleportEffect.Apply, LiquidData.Apply, IndirectStatModifierDefinition.Apply, ConsumptionManager.effectHandler, HealthObject.effectHandler, HealthObject.EffectHandler, VolumeTrigger.ActiveEffectTargets, VolumeTrigger.EffectHandlerEntered, VolumeTrigger.EffectHandlerLeft, VolumeTrigger.effectHandlers, VolumeTrigger.GetEffectHandler.