Table of Contents

Class ApplyThreatAction

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Action that generates threat on nearby hostile NPCs without dealing damage.

[Serializable]
public class ApplyThreatAction : BaseAction, IAction
Inheritance
ApplyThreatAction
Implements
Inherited Members

Remarks

The designer-facing hook for "this cast drew attention". Two uses:

  • Flat — a high-threat ability adds a fixed number of points.
  • Resource-weighted — the cost of the cast is fed through each NPC's ResourceWeight, so a caster burning mana near a pack draws proportionally more attention than one chipping away.

The resource-weighted path is what finally gives ResourceWeight and RecordResourceSpent a caller. Both existed, were serialized, and were documented as "points per resource point spent casting near the NPC" — but nothing in the project ever invoked them, so tuning that weight had no effect at all.

Only NPCs already in combat are affected: RecordResourceSpent(long, int) ignores an NPC with an empty threat table, so casting near an unaware mob does not pull it. Server-only in effect — threat tables are not replicated.

Fields

NPCLayers

Physics layers to search for NPCs.

[Tooltip("Physics layers to search for NPCs.")]
public LayerMask NPCLayers

Field Value

LayerMask

Radius

Radius around the initiator within which hostile NPCs notice the cast.

[Tooltip("Radius around the caster within which hostile NPCs gain threat.")]
public float Radius

Field Value

float

ResourceSpent

Amount of resource this cast is treated as having spent. Each NPC scales it by its own ResourceWeight.

[Tooltip("Resource spent by this cast, weighted per-NPC by its ResourceWeight.")]
public int ResourceSpent

Field Value

int

ThreatPoints

Flat threat points added to every affected NPC. Applied in addition to ResourceSpent.

[Tooltip("Flat threat added to each affected NPC.")]
public float ThreatPoints

Field Value

float

Methods

Execute(ICharacter, EventData)

Applies threat to hostile NPCs around the initiator.

public override void Execute(ICharacter initiator, EventData eventData)

Parameters

initiator ICharacter

The casting character.

eventData EventData

Unused; threat is applied by proximity, not to a named target.