TacticalAttackLogic ​
Inherits: AttackStateLogic < Resource
TacticalAttackLogic implements dynamic decision-making for action RPG style combat. Unlike Basic/Priority logic (stationary MMO combat) or Timeline logic (scripted bosses), this creates enemies that actively reposition and make tactical decisions based on distance, state, and probability.
Description ​
Use cases:
- Dark Souls/Monster Hunter style bosses that circle, lunge, retreat
- Melee enemies that close distance then attack
- Ranged enemies that maintain optimal distance
- Pack hunters that surround and coordinate
Example configurations:
Aggressive Melee Boss: preferred_range = 5.0, circle_probability = 0.3 melee_actions: [ComboAction([Slash, Delay, Sweep, Retreat]), HeavyStrike] repositioning: [CircleTarget, Retreat, KeepDistance]
Cautious Ranged Enemy: preferred_range = 12.0, circle_probability = 0.5 ranged_actions: [ArrowShot, PowerShot] repositioning: [KeepDistance(12m), StrafeAction]
Pack Hunter: preferred_range = 4.0, circle_probability = 0.7 melee_actions: [Bite, LungeCombo] repositioning: [CircleTarget, Retreat]
Properties ​
float | preferred_range | 6.0 |
float | min_range | 3.0 |
float | max_range | 10.0 |
float | circle_probability | 0.3 |
float | reposition_cooldown | 3.0 |
bool | retreat_after_combo | true |
float | retreat_distance | 8.0 |
Array[CombatAction] | melee_actions | [] |
Array[CombatAction] | ranged_actions | [] |
Array[CombatAction] | repositioning_actions | [] |
Variables ​
ComboAction | active_combo | null |
int | combo_action_index | 0 |
float | last_reposition_time | 0.0 |
Methods ​
void | setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) |
bool | execute( delta: float ) |
void | cleanup() |
Property descriptions ​
Range Management
float preferred_range = 6.0 ​
The ideal distance to maintain from target
float min_range = 3.0 ​
If closer than this, prioritize backing off
float max_range = 10.0 ​
If farther than this, prioritize closing distance
Tactical Behavior
float circle_probability = 0.3 ​
Chance (0.0-1.0) to perform circling movement when in good range
float reposition_cooldown = 3.0 ​
How often to consider repositioning (seconds)
bool retreat_after_combo = true ​
Whether to automatically retreat after finishing a combo
float retreat_distance = 8.0 ​
Distance to retreat after combo (if enabled)
Combat Actions
Array[CombatAction] melee_actions = [] ​
Actions to use when within melee range (distance <= preferred_range)
Array[CombatAction] ranged_actions = [] ​
Actions to use when at range (distance > preferred_range)
Array[CombatAction] repositioning_actions = [] ​
Movement actions for repositioning (CircleTarget, Retreat, Strafe, KeepDistance)
Variable descriptions ​
ComboAction active_combo = null ​
Current combo being executed
int combo_action_index = 0 ​
Current step in the combo sequence
float last_reposition_time = 0.0 ​
Time since last repositioning action
Method descriptions ​
void setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) ​
Setup the priority logic
bool execute( delta: float ) ​
Execute tactical combat logic
void cleanup() ​
Cleanup