19 lines
495 B
GDScript
19 lines
495 B
GDScript
extends ConditionLeaf
|
|
|
|
func tick(actor: Node, blackboard: Blackboard) -> int:
|
|
var main = get_tree().get_root().get_node_or_null("Main")
|
|
if not main:
|
|
return FAILURE
|
|
|
|
# Always return SUCCESS for bots in non-turn-based mode
|
|
if actor.is_bot and not TurnManager.turn_based_mode:
|
|
return SUCCESS
|
|
|
|
# Update action points in blackboard
|
|
blackboard.set_value("action_points", actor.action_points)
|
|
|
|
# Check if we have enough AP
|
|
if actor.action_points >= 1:
|
|
return SUCCESS
|
|
return FAILURE
|