PriorityAttackLogic ​
Inherits: AttackStateLogic < Resource
PriorityAttackLogic evaluates a list of actions in priority order and executes the first valid one. This is used for NPCs with abilities that should be used under specific conditions.
Description ​
Scenario 1 example: Caster NPC
- Priority 100: Use special ability (if off cooldown, random delay passed)
- Priority 1: Basic attack (fallback, handled by combat script)
Actions are checked from highest to lowest priority. The first action whose conditions are met gets executed.
Properties ​
Array[CombatAction] | actions | [] |
float | min_first_delay | 5.0 |
float | max_first_delay | 7.0 |
float | rest_after_action | 0.5 |
Variables ​
float | first_ability_delay | 0.0 |
bool | first_ability_used | false |
float | rest_timer | 0.0 |
Methods ​
void | setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) |
bool | execute( delta: float ) |
Dictionary | to_save_data() |
void | from_save_data( save_data: Dictionary ) |
void | cleanup() |
Property descriptions ​
Array[CombatAction] actions = [] ​
List of actions sorted by priority (highest first)
float min_first_delay = 5.0 ​
Minimum delay before first ability (seconds)
float max_first_delay = 7.0 ​
Maximum delay before first ability (seconds)
float rest_after_action = 0.5 ​
Rest period after successful action execution (seconds)
Variable descriptions ​
float first_ability_delay = 0.0 ​
Timer for the first ability delay (random 5-7s delay before first cast)
bool first_ability_used = false ​
Whether the first ability has been used yet
float rest_timer = 0.0 ​
Timer for rest period after successful action
Method descriptions ​
void setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) ​
Setup the priority logic
bool execute( delta: float ) ​
Execute the highest priority valid action
Dictionary to_save_data() ​
Save runtime state
void from_save_data( save_data: Dictionary ) ​
Restore runtime state
void cleanup() ​
Cleanup all actions