Files
hsgj25-growth/growth/BaseCard/BaseCard.gd

31 lines
844 B
GDScript

extends Control
class_name BaseCard
@export var behaviors = []
@export var art: Texture2D
@export var title = ""
@export var description = ""
func _ready() -> void:
for behavior in behaviors:
$Behaviors.add_child(behavior.instantiate())
$MarginContainer/VSplitContainer/Art.texture = art
$MarginContainer/VSplitContainer/VSplitContainer2/Title.text = title
$MarginContainer/VSplitContainer/VSplitContainer2/Description.text = description
func activate(world, activator):
for behavior in $Behaviors.get_children():
behavior.activate(world, activator)
func discard(world, activator, do_ability):
for behavior in $Behaviors.get_children():
behavior.discard(world, activator, do_ability)
func get_ammo():
for behavior in $Behaviors.get_children():
if behavior.has_method("get_ammo"):
return behavior.get_ammo()
return -1