- Added BattleState class to manage battle flow, including turn management and event handling. - Introduced BuffInstance class to represent buffs applied to combatants. - Created CardInstance class to handle card definitions and cost calculations. - Developed CombatantState class to manage combatant attributes and actions. - Implemented EffectRegistry to apply effects based on event specifications. - Added various handlers (BlockHandler, DamageHandler, DrawHandler, etc.) to process specific events. - Created IntentPlanner and IntentState classes to manage enemy actions and intents. - Established a queue system for handling battle events with BattleEventQueue and BattleEventTask. - Introduced triggers for applying effects based on game events (e.g., OnCardDrawnGainBlockTrigger). - Added necessary UID files for new scripts to ensure proper resource management.
62 lines
2.0 KiB
GDScript
62 lines
2.0 KiB
GDScript
class_name BaseCardView
|
|
extends Control
|
|
|
|
signal pressed(card_view: BaseCardView)
|
|
|
|
@export var card_style: CardStyle
|
|
|
|
var card_instance
|
|
|
|
@onready var background: TextureRect = $Visuals/BackGround
|
|
@onready var art: TextureRect = $Visuals/Art
|
|
@onready var type_layer: TextureRect = $Visuals/TypeLayer
|
|
@onready var frame: TextureRect = $Visuals/Frame
|
|
@onready var cost_indicator: TextureRect = $Visuals/CostIndicator
|
|
@onready var name_label: Label = $UILayer/NameLabel
|
|
@onready var description_label: RichTextLabel = $UILayer/DescriptionLabel
|
|
@onready var cost_label: Label = $UILayer/CostLabel
|
|
@onready var hit_button: Button = $UILayer/HitButton
|
|
@onready var selection_frame: ColorRect = $SelectionFrame
|
|
|
|
func _ready() -> void:
|
|
hit_button.pressed.connect(_on_hit_pressed)
|
|
selection_frame.visible = false
|
|
_apply_style()
|
|
_refresh()
|
|
|
|
func set_card_instance(value) -> void:
|
|
card_instance = value
|
|
_refresh()
|
|
|
|
func set_selected(is_selected: bool) -> void:
|
|
selection_frame.visible = is_selected
|
|
scale = Vector2(1.05, 1.05) if is_selected else Vector2.ONE
|
|
|
|
func _apply_style() -> void:
|
|
if card_style == null:
|
|
return
|
|
background.texture = card_style.background_texture
|
|
art.texture = card_style.art_texture
|
|
type_layer.texture = card_style.banner_texture
|
|
frame.texture = card_style.frame_texture
|
|
cost_indicator.texture = card_style.cost_orb_texture
|
|
name_label.add_theme_color_override("font_color", card_style.name_font_color)
|
|
description_label.add_theme_color_override("default_color", card_style.desc_font_color)
|
|
cost_label.add_theme_color_override("font_color", card_style.cost_font_color)
|
|
|
|
func _refresh() -> void:
|
|
if not is_inside_tree():
|
|
return
|
|
if card_instance == null or card_instance.card_def == null:
|
|
name_label.text = ""
|
|
description_label.text = ""
|
|
cost_label.text = "0"
|
|
return
|
|
|
|
name_label.text = card_instance.card_def.name_text
|
|
description_label.text = card_instance.card_def.description
|
|
cost_label.text = str(card_instance.get_cost())
|
|
|
|
func _on_hit_pressed() -> void:
|
|
emit_signal("pressed", self)
|