AttackStateLogic ​
Inherits: Resource
Inherited by: CompanionAttackLogic, PriorityAttackLogic, SimpleAttackLogic, TacticalAttackLogic, TimelineAttackLogic
AttackStateLogic is the base class for defining what an entity does in the ATTACKING state. It handles the decision-making process for ability usage and actions during combat.
Description ​
Subclasses implement different combat behaviors:
- SimpleAttackLogic: Just uses basic attacks (Scenario 1 - melee)
- PriorityAttackLogic: Checks conditions and uses abilities by priority (Scenario 1 - caster)
- TimelineAttackLogic: Follows scripted sequence (Scenario 2 - boss)
- TacticalAttackLogic: Complex positioning and decisions (Scenario 3 - action RPG)
Variables ​
Entity | entity | |
ModularCombatScript | combat_script | |
GameHost.SystemHub | system_hub |
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() |
Variable descriptions ​
Entity entity ​
Reference to the entity using this logic
ModularCombatScript combat_script ​
Reference to the combat script that owns this logic
GameHost.SystemHub system_hub ​
The system hub (the actions and conditions it builds need it)
Method descriptions ​
void setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) ​
Initialize the attack logic with entity and combat script references
bool execute( delta: float ) ​
Called every frame when in ATTACKING state to decide what action to take Returns true if an action was executed, false if nothing was done If this returns false, the combat script will attempt a basic attack (if auto_basic_attack enabled)
Dictionary to_save_data() ​
Save runtime state for persistence Override in subclasses to save specific state
void from_save_data( save_data: Dictionary ) ​
Restore runtime state from saved data Override in subclasses to restore specific state
void cleanup() ​
Cleanup any resources when this logic is no longer needed