Class BossScriptState
- Namespace
- FishMMO.Server.Implementation.World.SceneServer.AI
- Assembly
- FishMMO.Server.dll
Per-NPC runtime state for a BossScript. Tracks the current phase index, timed mechanic timers, and handles phase transitions and mechanic activations.
This is a plain C# class (not a ScriptableObject) because it holds mutable state that differs per NPC instance — the same BossScript asset may be shared across multiple boss spawns.
public class BossScriptState
- Inheritance
-
BossScriptState
- Inherited Members
Constructors
BossScriptState(BossScript)
public BossScriptState(BossScript script)
Parameters
scriptBossScript
Properties
CurrentPhase
Returns the current BossPhase, or null if no phases are configured.
public BossPhase CurrentPhase { get; }
Property Value
CurrentPhaseIndex
Current phase index into Phases.
public int CurrentPhaseIndex { get; }
Property Value
Initialized
True if this state has been initialized.
public bool Initialized { get; }
Property Value
LiveAddCount
How many of this boss's adds are alive.
public int LiveAddCount { get; }
Property Value
Script
The asset defining phases and mechanics.
public BossScript Script { get; }
Property Value
Methods
EvaluatePhases(AIController)
Evaluates phase transitions based on current HP. Returns true if a phase change occurred. Call once per AI tick.
public bool EvaluatePhases(AIController controller)
Parameters
controllerAIControllerThe boss NPC's AI controller.
Returns
- bool
True if a phase transition happened this tick.
MayCallInAdd(bool, int, int)
Whether one more add may be called in, with liveAdds of the boss's
adds already alive.
public static bool MayCallInAdd(bool phaseAdd, int liveAdds, int maxLiveAdds)
Parameters
phaseAddboolTrue for a phase's SpawnOnEnter, false for a timed mechanic's.
liveAddsintThe boss's adds alive now, including any called in earlier in the same call.
maxLiveAddsintThe boss script's cap; anything below one is treated as one.
Returns
Remarks
A phase's adds always arrive: a phase is entered at most once per pull, so they are bounded by what was authored. A timed mechanic's arrive only below the cap, since it fires for as long as the fight lasts. See MaxLiveAdds.
Reset()
Resets the boss to phase 0 and resets all mechanic timers. Called on leash or despawn.
public void Reset()
Remarks
The adds are not touched here: a leash dismisses them (FishMMO.Server.Implementation.World.SceneServer.AI.BossScriptState.DismissAdds(FishNet.Managing.NetworkManager)) and a despawn releases them (FishMMO.Server.Implementation.World.SceneServer.AI.BossScriptState.ReleaseAdds()), and AIController says which.
TickMechanics(AIController, float)
Ticks all active timed mechanics for the current phase. Call once per AI tick with the delta time.
public void TickMechanics(AIController controller, float deltaTime)
Parameters
controllerAIControllerThe boss NPC's AI controller.
deltaTimefloatTime since last tick.