18 lines
584 B
GDScript
18 lines
584 B
GDScript
extends Resource
|
|
class_name ItemInstance
|
|
|
|
@export var definition: ItemDefinition
|
|
@export_range(1, 1000, 1) var item_level: int = 1
|
|
@export var additional_modifiers: Array[ItemStatModifier] = []
|
|
|
|
func get_stat_total(stat_key: String) -> float:
|
|
var total := 0.0
|
|
if definition and definition.primary_stat == stat_key:
|
|
total += definition.primary_value
|
|
if definition and stat_key == "energy_regeneration":
|
|
total += definition.energy_regeneration_bonus
|
|
for modifier in additional_modifiers:
|
|
if modifier and modifier.stat_key == stat_key:
|
|
total += modifier.value
|
|
return total
|