feat: define cards as resources
This commit is contained in:
parent
498604499a
commit
e304dd671b
8 changed files with 60 additions and 0 deletions
6
card/card.gd
Normal file
6
card/card.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Resource
|
||||
class_name Card
|
||||
|
||||
var id: String:
|
||||
get:
|
||||
return resource_path.rsplit(".", true, 1)[0]
|
||||
8
card/monster_card.gd
Normal file
8
card/monster_card.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Card
|
||||
class_name MonsterCard
|
||||
|
||||
@export var rock: int = 0
|
||||
@export var paper: int = 0
|
||||
@export var scissors: int = 0
|
||||
@export var energy_cost: int = 1
|
||||
@export var base_health: int = 100
|
||||
5
card/support_card.gd
Normal file
5
card/support_card.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
extends Card
|
||||
class_name SupportCard
|
||||
|
||||
@export_enum("red", "green") var type = "green"
|
||||
@export var effect: Array[SupportCardEffectInstance] = [null]
|
||||
7
card/support_card_effect.gd
Normal file
7
card/support_card_effect.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@tool
|
||||
extends Resource
|
||||
class_name SupportCardEffect
|
||||
|
||||
var id: String:
|
||||
get:
|
||||
return resource_path.rsplit(".", true, 1)[0]
|
||||
5
card/support_card_effect_instance.gd
Normal file
5
card/support_card_effect_instance.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
extends Resource
|
||||
class_name SupportCardEffectInstance
|
||||
|
||||
@export var magnitude: int
|
||||
@export var effect: SupportCardEffect
|
||||
16
data/cards/potion.tres
Normal file
16
data/cards/potion.tres
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_resource type="Resource" script_class="SupportCard" load_steps=5 format=3 uid="uid://bhk1nc02g0gtb"]
|
||||
|
||||
[ext_resource type="Script" path="res://card/support_card_effect_instance.gd" id="1_fq8c7"]
|
||||
[ext_resource type="Resource" uid="uid://h1ki1kya43v7" path="res://data/support_effects/heal.tres" id="2_3x5mu"]
|
||||
[ext_resource type="Script" path="res://card/support_card.gd" id="2_44syi"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_l7fsx"]
|
||||
script = ExtResource("1_fq8c7")
|
||||
magnitude = 3
|
||||
effect = ExtResource("2_3x5mu")
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_44syi")
|
||||
type = null
|
||||
effect = Array[ExtResource("1_fq8c7")]([SubResource("Resource_l7fsx")])
|
||||
id = ""
|
||||
6
data/support_effects/heal.tres
Normal file
6
data/support_effects/heal.tres
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_resource type="Resource" script_class="SupportCardEffect" load_steps=2 format=3 uid="uid://h1ki1kya43v7"]
|
||||
|
||||
[ext_resource type="Script" path="res://card/support_card_effect.gd" id="1_exmke"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_exmke")
|
||||
7
data/support_effects/swap_monst.er.tres
Normal file
7
data/support_effects/swap_monst.er.tres
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="Resource" script_class="SupportCardEffect" load_steps=2 format=3 uid="uid://xinrslggye4"]
|
||||
|
||||
[ext_resource type="Script" path="res://card/support_card_effect.gd" id="1_7awm5"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_7awm5")
|
||||
id = "swap_monster"
|
||||
Loading…
Add table
Add a link
Reference in a new issue