Skip to content

SimpleAttackLogic ​

Inherits: AttackStateLogic < Resource

SimpleAttackLogic automatically creates priority-based actions from the entity's active abilities. This provides a zero-configuration combat AI that cycles through abilities in order.

Description ​

The system automatically:

  • Creates UseAbilityAction for each active ability
  • Assigns priority based on array order (first = highest priority)
  • Includes basic cooldown and casting checks
  • Falls back to basic attack if no abilities are available

Properties ​

floatmin_first_delay2.0
floatmax_first_delay5.0
floatrest_after_action3

Variables ​

floatfirst_ability_delay0.0
boolfirst_ability_usedfalse
floatrest_timer0.0
Array[CombatAction]generated_actions[]

Methods ​

voidsetup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript )
boolexecute( delta: float )
voidrefresh_actions()
Array[CombatAction]get_generated_actions()
intget_action_count()
boolhas_actions()
Dictionaryto_save_data()
voidfrom_save_data( save_data: Dictionary )
voidcleanup()

Property descriptions ​

float min_first_delay = 2.0 ​

Minimum delay before first ability (seconds)

float max_first_delay = 5.0 ​

Maximum delay before first ability (seconds)

float rest_after_action = 3 ​

Rest period after successful action execution (seconds)

Variable descriptions ​

float first_ability_delay = 0.0 ​

Timer for the first ability delay

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

Array[CombatAction] generated_actions = [] ​

Auto-generated priority actions

Method descriptions ​

void setup( system_hub: GameHost.SystemHub, entity_ref: Entity, script: ModularCombatScript ) ​

Setup the simple logic

bool execute( delta: float ) ​

Execute the highest priority valid action

void refresh_actions() ​

Refresh actions when abilities change (call this if entity gains/loses abilities)

Array[CombatAction] get_generated_actions() ​

Get current generated actions (for debugging/inspection)

int get_action_count() ​

Get action count

bool has_actions() ​

Check if any actions are available

Dictionary to_save_data() ​

Save runtime state

void from_save_data( save_data: Dictionary ) ​

Restore runtime state

void cleanup() ​

Cleanup all generated actions