82 lines
1.7 KiB
GDScript
82 lines
1.7 KiB
GDScript
extends Resource
|
|
class_name Item
|
|
|
|
const TYPE_ICON = preload("res://common/icons/backpack.svg")
|
|
const ACTION_ICON = preload("res://common/icons/swipe-down.svg")
|
|
const ENERGY_ICON = preload("res://common/icons/bolt.svg")
|
|
const ONE_TIME_ICON = preload("res://common/icons/circle-number-1.svg")
|
|
|
|
var name: String : get = get_item_name
|
|
var description: String : get = get_description
|
|
var icon: Texture2D : get = get_icon
|
|
var usage_zone_radius: int = 5 : get = get_usage_zone_radius
|
|
var energy_usage : int = 1 : get = get_energy_used
|
|
|
|
func get_item_name() -> String:
|
|
return name
|
|
|
|
func get_description() -> String:
|
|
return description
|
|
|
|
func get_icon() -> Texture2D:
|
|
return icon
|
|
|
|
func get_energy_used() -> int:
|
|
return energy_usage
|
|
|
|
func get_usage_zone_radius() -> int:
|
|
return usage_zone_radius
|
|
|
|
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
|
return false
|
|
|
|
func is_one_time_use():
|
|
return false
|
|
|
|
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
|
return false
|
|
|
|
func use_text() -> String:
|
|
return ""
|
|
|
|
func use(_player : Player, _zone: Player.ActionZone):
|
|
return false
|
|
|
|
func card_info() -> CardInfo:
|
|
var info = CardInfo.new(
|
|
get_item_name()
|
|
)
|
|
info.texture = icon
|
|
info.type_icon = TYPE_ICON
|
|
|
|
info.stats.append(
|
|
CardStatInfo.new(
|
|
"Cost %d energy" % energy_usage,
|
|
ENERGY_ICON
|
|
)
|
|
)
|
|
|
|
if is_one_time_use():
|
|
info.stats.append(
|
|
CardStatInfo.new(
|
|
"One time use",
|
|
ONE_TIME_ICON
|
|
)
|
|
)
|
|
|
|
var effect_section = CardSectionInfo.new(
|
|
"Effect",
|
|
get_description()
|
|
)
|
|
effect_section.title_icon = ACTION_ICON
|
|
|
|
if energy_usage > 0:
|
|
effect_section.title_icon = ENERGY_ICON
|
|
|
|
info.sections.append(effect_section)
|
|
|
|
return info
|
|
|
|
func get_particles() -> Array[Particles.Parameters]:
|
|
return []
|