Health and Speed are now EntityResources. The Stat versions are now just flat modifiers to them. Added back the Mana stat as a flat mana modifier. Also updated ESS to get the changes necessary for this system.

This commit is contained in:
Relintai 2020-04-27 18:40:20 +02:00
parent 7b76a90a8f
commit 3544cd88fc
28 changed files with 306 additions and 163 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "be5a47e75d4b671a48b0a35eb17887ee38d8516c", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "157edcc8d628d1598c35f4496dae32b1359a0e0a"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "19f3c1f8ff34331a2f1bedf260637e415b3df7d0"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}}
{"engine": {"3.2": "4dda00461f6aa45bcb0c043c911b5f0b995206a6", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "8d680240ea583b2e19ecceffca254e3d46008018"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "19f3c1f8ff34331a2f1bedf260637e415b3df7d0"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}}

View File

@ -0,0 +1,7 @@
[gd_resource type="EntityResourceData" load_steps=2 format=2]
[ext_resource path="res://scripts/resources/HealthResourceData.gd" type="Script" id=1]
[resource]
id = 1
script = ExtResource( 1 )

View File

@ -0,0 +1,7 @@
[gd_resource type="EntityResourceData" load_steps=2 format=2]
[ext_resource path="res://scripts/resources/SpeedResourceData.gd" type="Script" id=1]
[resource]
id = 1
script = ExtResource( 1 )

View File

@ -3,7 +3,6 @@
[ext_resource path="res://scripts/game_modules/GameModule.gd" type="Script" id=1]
[ext_resource path="res://modules/core/resource_db.tres" type="ESSResourceDBStatic" id=2]
[resource]
script = ExtResource( 1 )
resource_db = ExtResource( 2 )

View File

@ -1,4 +1,4 @@
[gd_resource type="ESSResourceDBStatic" load_steps=9 format=2]
[gd_resource type="ESSResourceDBStatic" load_steps=11 format=2]
[ext_resource path="res://modules/core/item_templates/2_test.tres" type="ItemTemplate" id=1]
[ext_resource path="res://modules/core/item_templates/3_chest_of_the_infinite_wisdom.tres" type="ItemTemplate" id=2]
@ -8,11 +8,12 @@
[ext_resource path="res://modules/core/crafting/1_test_craft.tres" type="CraftRecipe" id=6]
[ext_resource path="res://modules/core/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=7]
[ext_resource path="res://modules/core/xp/xp_data.tres" type="XPData" id=8]
[ext_resource path="res://modules/core/entity_resources/3_speed_resource.tres" type="EntityResourceData" id=9]
[ext_resource path="res://modules/core/entity_resources/2_health_resource.tres" type="EntityResourceData" id=10]
[resource]
xp_data = ExtResource( 8 )
entity_resources = [ ExtResource( 7 ) ]
entity_resources = [ ExtResource( 7 ), ExtResource( 10 ), ExtResource( 9 ) ]
entity_skills = [ ExtResource( 4 ) ]
craft_recipes = [ ExtResource( 6 ), ExtResource( 3 ) ]
item_templates = [ ExtResource( 5 ), ExtResource( 1 ), ExtResource( 2 ) ]

View File

@ -1,4 +1,4 @@
[gd_resource type="EntityClassData" load_steps=51 format=2]
[gd_resource type="EntityClassData" load_steps=50 format=2]
[ext_resource path="res://scripts/entities/EntityClassDataGD.gd" type="Script" id=1]
[ext_resource path="res://modules/entity_classes/elementalist/character_specs/2_elementalist_fire.tres" type="CharacterSpec" id=2]
@ -8,9 +8,6 @@
[ext_resource path="res://modules/entity_classes/elementalist/spells/32_heat.tres" type="Spell" id=6]
[ext_resource path="res://modules/entity_classes/elementalist/spells/33_normal.tres" type="Spell" id=7]
[sub_resource type="SimpleLevelStatData" id=1]
agility = 4
strength = 5
@ -78,125 +75,120 @@ base = 5.0
stat_id = 33
[sub_resource type="StatDataEntry" id=21]
stat_id = 7
[sub_resource type="StatDataEntry" id=22]
stat_id = 15
[sub_resource type="StatDataEntry" id=23]
[sub_resource type="StatDataEntry" id=22]
stat_id = 16
[sub_resource type="StatDataEntry" id=24]
[sub_resource type="StatDataEntry" id=23]
stat_id = 26
[sub_resource type="StatDataEntry" id=25]
[sub_resource type="StatDataEntry" id=24]
stat_id = 22
[sub_resource type="StatDataEntry" id=26]
[sub_resource type="StatDataEntry" id=25]
stat_id = 30
[sub_resource type="StatDataEntry" id=27]
[sub_resource type="StatDataEntry" id=26]
stat_id = 20
[sub_resource type="StatDataEntry" id=28]
[sub_resource type="StatDataEntry" id=27]
stat_id = 39
[sub_resource type="StatDataEntry" id=29]
[sub_resource type="StatDataEntry" id=28]
stat_id = 11
[sub_resource type="StatDataEntry" id=30]
[sub_resource type="StatDataEntry" id=29]
stat_id = 29
[sub_resource type="StatDataEntry" id=31]
[sub_resource type="StatDataEntry" id=30]
stat_id = 35
[sub_resource type="StatDataEntry" id=32]
[sub_resource type="StatDataEntry" id=31]
stat_id = 6
base = 4.2
[sub_resource type="StatDataEntry" id=33]
[sub_resource type="StatDataEntry" id=32]
stat_id = 17
[sub_resource type="StatDataEntry" id=34]
[sub_resource type="StatDataEntry" id=33]
stat_id = 18
[sub_resource type="StatDataEntry" id=35]
[sub_resource type="StatDataEntry" id=34]
stat_id = 27
[sub_resource type="StatDataEntry" id=36]
[sub_resource type="StatDataEntry" id=35]
stat_id = 23
[sub_resource type="StatDataEntry" id=37]
[sub_resource type="StatDataEntry" id=36]
stat_id = 14
[sub_resource type="StatDataEntry" id=38]
[sub_resource type="StatDataEntry" id=37]
stat_id = 4
base = 4.0
[sub_resource type="StatDataEntry" id=39]
[sub_resource type="StatDataEntry" id=38]
stat_id = 2
base = 6.0
[sub_resource type="StatDataEntry" id=40]
[sub_resource type="StatDataEntry" id=39]
stat_id = 1
base = 5.0
[sub_resource type="StatDataEntry" id=41]
[sub_resource type="StatDataEntry" id=40]
stat_id = 37
[sub_resource type="StatDataEntry" id=42]
[sub_resource type="StatDataEntry" id=41]
stat_id = 40
[sub_resource type="StatData" id=43]
[sub_resource type="StatData" id=42]
level_stat_data = SubResource( 1 )
stat/agility = SubResource( 2 )
stat/strength = SubResource( 40 )
stat/stamina = SubResource( 39 )
stat/strength = SubResource( 39 )
stat/stamina = SubResource( 38 )
stat/intellect = SubResource( 19 )
stat/spirit = SubResource( 38 )
stat/spirit = SubResource( 37 )
stat/health = SubResource( 17 )
stat/speed = SubResource( 32 )
stat/mana = SubResource( 21 )
stat/speed = SubResource( 31 )
stat/global_cooldown = SubResource( 13 )
stat/haste = SubResource( 14 )
stat/haste_rating = SubResource( 15 )
stat/resilience = SubResource( 29 )
stat/resilience = SubResource( 28 )
stat/armor = SubResource( 3 )
stat/attack_power = SubResource( 4 )
stat/spell_power = SubResource( 37 )
stat/melee_crit = SubResource( 22 )
stat/melee_crit_bonus = SubResource( 23 )
stat/spell_crit = SubResource( 33 )
stat/spell_crit_bonus = SubResource( 34 )
stat/spell_power = SubResource( 36 )
stat/melee_crit = SubResource( 21 )
stat/melee_crit_bonus = SubResource( 22 )
stat/spell_crit = SubResource( 32 )
stat/spell_crit_bonus = SubResource( 33 )
stat/block = SubResource( 5 )
stat/parry = SubResource( 27 )
stat/parry = SubResource( 26 )
stat/damage_reduction = SubResource( 7 )
stat/melee_damage_reduction = SubResource( 25 )
stat/spell_damage_reduction = SubResource( 36 )
stat/melee_damage_reduction = SubResource( 24 )
stat/spell_damage_reduction = SubResource( 35 )
stat/damage_taken = SubResource( 8 )
stat/heal_taken = SubResource( 16 )
stat/melee_damage = SubResource( 24 )
stat/spell_damage = SubResource( 35 )
stat/melee_damage = SubResource( 23 )
stat/spell_damage = SubResource( 34 )
stat/holy_resist = SubResource( 18 )
stat/shadow_resist = SubResource( 30 )
stat/nature_resist = SubResource( 26 )
stat/shadow_resist = SubResource( 29 )
stat/nature_resist = SubResource( 25 )
stat/fire_resist = SubResource( 11 )
stat/frost_resist = SubResource( 12 )
stat/lightning_resist = SubResource( 20 )
stat/chaos_resist = SubResource( 6 )
stat/silence_resist = SubResource( 31 )
stat/silence_resist = SubResource( 30 )
stat/fear_resist = SubResource( 10 )
stat/stun_resist = SubResource( 41 )
stat/stun_resist = SubResource( 40 )
stat/energy = SubResource( 9 )
stat/rage = SubResource( 28 )
stat/xp_rate = SubResource( 42 )
stat/rage = SubResource( 27 )
stat/xp_rate = SubResource( 41 )
[resource]
resource_name = "Elementalist"
id = 2
text_name = "Elementalist"
stat_data = SubResource( 43 )
player_resource_type = 2
stat_data = SubResource( 42 )
playstyle_type = 2
specs = [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ) ]
spells = [ ExtResource( 6 ), ExtResource( 7 ), ExtResource( 5 ) ]

View File

@ -1,4 +1,4 @@
[gd_resource type="EntityClassData" load_steps=71 format=2]
[gd_resource type="EntityClassData" load_steps=74 format=2]
[ext_resource path="res://modules/entity_classes/naturalist/spells/16_close_wounds_rank_1.tres" type="Spell" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/spells/19_uproot_rank_1.tres" type="Spell" id=2]
@ -24,6 +24,8 @@
[ext_resource path="res://modules/entity_classes/naturalist/spells/25_inner_will.tres" type="Spell" id=22]
[ext_resource path="res://modules/entity_classes/naturalist/spells/15_rejuvenation_rank_1.tres" type="Spell" id=23]
[ext_resource path="res://modules/entity_classes/naturalist/spells/18_natures_swiftness_rank_1.tres" type="Spell" id=24]
[ext_resource path="res://modules/core/entity_resources/3_speed_resource.tres" type="EntityResourceData" id=25]
[ext_resource path="res://modules/core/entity_resources/2_health_resource.tres" type="EntityResourceData" id=26]
[sub_resource type="EntityAI" id=1]
script = ExtResource( 9 )
@ -106,122 +108,123 @@ base = 20.0
stat_id = 33
[sub_resource type="StatDataEntry" id=25]
stat_id = 15
stat_id = 6
[sub_resource type="StatDataEntry" id=26]
stat_id = 16
stat_id = 15
[sub_resource type="StatDataEntry" id=27]
stat_id = 26
stat_id = 16
[sub_resource type="StatDataEntry" id=28]
stat_id = 22
stat_id = 26
[sub_resource type="StatDataEntry" id=29]
stat_id = 30
stat_id = 22
[sub_resource type="StatDataEntry" id=30]
stat_id = 20
stat_id = 30
[sub_resource type="StatDataEntry" id=31]
stat_id = 39
stat_id = 20
[sub_resource type="StatDataEntry" id=32]
stat_id = 11
stat_id = 39
[sub_resource type="StatDataEntry" id=33]
stat_id = 29
stat_id = 11
[sub_resource type="StatDataEntry" id=34]
stat_id = 35
stat_id = 29
[sub_resource type="StatDataEntry" id=35]
stat_id = 6
base = 4.2
stat_id = 35
[sub_resource type="StatDataEntry" id=36]
stat_id = 17
[sub_resource type="StatDataEntry" id=37]
stat_id = 18
stat_id = 17
[sub_resource type="StatDataEntry" id=38]
stat_id = 27
stat_id = 18
[sub_resource type="StatDataEntry" id=39]
stat_id = 23
stat_id = 27
[sub_resource type="StatDataEntry" id=40]
stat_id = 14
stat_id = 23
[sub_resource type="StatDataEntry" id=41]
stat_id = 14
[sub_resource type="StatDataEntry" id=42]
stat_id = 4
base = 9.0
[sub_resource type="StatDataEntry" id=42]
[sub_resource type="StatDataEntry" id=43]
stat_id = 2
base = 17.0
[sub_resource type="StatDataEntry" id=43]
[sub_resource type="StatDataEntry" id=44]
stat_id = 1
base = 8.0
[sub_resource type="StatDataEntry" id=44]
[sub_resource type="StatDataEntry" id=45]
stat_id = 37
[sub_resource type="StatDataEntry" id=45]
[sub_resource type="StatDataEntry" id=46]
stat_id = 40
[sub_resource type="StatData" id=46]
[sub_resource type="StatData" id=47]
level_stat_data = SubResource( 5 )
stat/agility = SubResource( 6 )
stat/strength = SubResource( 43 )
stat/stamina = SubResource( 42 )
stat/strength = SubResource( 44 )
stat/stamina = SubResource( 43 )
stat/intellect = SubResource( 23 )
stat/spirit = SubResource( 41 )
stat/spirit = SubResource( 42 )
stat/health = SubResource( 21 )
stat/speed = SubResource( 35 )
stat/mana = SubResource( 25 )
stat/speed = SubResource( 36 )
stat/global_cooldown = SubResource( 17 )
stat/haste = SubResource( 18 )
stat/haste_rating = SubResource( 19 )
stat/resilience = SubResource( 32 )
stat/resilience = SubResource( 33 )
stat/armor = SubResource( 7 )
stat/attack_power = SubResource( 8 )
stat/spell_power = SubResource( 40 )
stat/melee_crit = SubResource( 25 )
stat/melee_crit_bonus = SubResource( 26 )
stat/spell_crit = SubResource( 36 )
stat/spell_crit_bonus = SubResource( 37 )
stat/spell_power = SubResource( 41 )
stat/melee_crit = SubResource( 26 )
stat/melee_crit_bonus = SubResource( 27 )
stat/spell_crit = SubResource( 37 )
stat/spell_crit_bonus = SubResource( 38 )
stat/block = SubResource( 9 )
stat/parry = SubResource( 30 )
stat/parry = SubResource( 31 )
stat/damage_reduction = SubResource( 11 )
stat/melee_damage_reduction = SubResource( 28 )
stat/spell_damage_reduction = SubResource( 39 )
stat/melee_damage_reduction = SubResource( 29 )
stat/spell_damage_reduction = SubResource( 40 )
stat/damage_taken = SubResource( 12 )
stat/heal_taken = SubResource( 20 )
stat/melee_damage = SubResource( 27 )
stat/spell_damage = SubResource( 38 )
stat/melee_damage = SubResource( 28 )
stat/spell_damage = SubResource( 39 )
stat/holy_resist = SubResource( 22 )
stat/shadow_resist = SubResource( 33 )
stat/nature_resist = SubResource( 29 )
stat/shadow_resist = SubResource( 34 )
stat/nature_resist = SubResource( 30 )
stat/fire_resist = SubResource( 15 )
stat/frost_resist = SubResource( 16 )
stat/lightning_resist = SubResource( 24 )
stat/chaos_resist = SubResource( 10 )
stat/silence_resist = SubResource( 34 )
stat/silence_resist = SubResource( 35 )
stat/fear_resist = SubResource( 14 )
stat/stun_resist = SubResource( 44 )
stat/stun_resist = SubResource( 45 )
stat/energy = SubResource( 13 )
stat/rage = SubResource( 31 )
stat/xp_rate = SubResource( 45 )
stat/rage = SubResource( 32 )
stat/xp_rate = SubResource( 46 )
[resource]
resource_name = "Naturalist"
id = 1
text_name = "Naturalist"
stat_data = SubResource( 46 )
player_resource_type = 2
entity_resources = [ ExtResource( 8 ) ]
stat_data = SubResource( 47 )
entity_resources = [ ExtResource( 26 ), ExtResource( 25 ), ExtResource( 8 ) ]
specs = [ SubResource( 4 ) ]
spells = [ ExtResource( 7 ), ExtResource( 3 ), ExtResource( 15 ), ExtResource( 5 ), ExtResource( 12 ), ExtResource( 23 ), ExtResource( 1 ), ExtResource( 10 ), ExtResource( 24 ), ExtResource( 2 ), ExtResource( 19 ), ExtResource( 18 ), ExtResource( 17 ), ExtResource( 20 ), ExtResource( 11 ), ExtResource( 22 ), ExtResource( 16 ), ExtResource( 21 ), ExtResource( 14 ) ]
start_spells = [ ExtResource( 7 ), ExtResource( 21 ), ExtResource( 14 ) ]

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_scorpions.tres" type="Texture" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/aura_groups/1_aspect_of_scorpions.tres" type="AuraGroup" id=3]
[resource]
resource_name = "Aspect of Scorpions"
id = 9

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_wasps.tres" type="Texture" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/aura_groups/2_aspect_of_wasps.tres" type="AuraGroup" id=3]
[resource]
resource_name = "Aspect of Wasps"
id = 10

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_wolves.tres" type="Texture" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/aura_groups/3_aspect_of_wolves.tres" type="AuraGroup" id=3]
[resource]
resource_name = "Aspect of Wolves"
id = 11

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_bees.tres" type="Texture" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/aura_groups/4_aspect_of_bees.tres" type="AuraGroup" id=3]
[resource]
resource_name = "Aspect of Bees"
id = 12

View File

@ -3,8 +3,6 @@
[ext_resource path="res://scripts/resources/spell_effect_visual_basic.gd" type="Script" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/spell_effects/nature/NautreSwiftness.tscn" type="PackedScene" id=2]
[resource]
script = ExtResource( 1 )
torso_aura_effect_time = 0.0

View File

@ -3,7 +3,6 @@
[ext_resource path="res://scripts/game_modules/GameModule.gd" type="Script" id=1]
[ext_resource path="res://modules/entity_classes/naturalist/resource_db.tres" type="ESSResourceDBStatic" id=2]
[resource]
script = ExtResource( 1 )
resource_db = ExtResource( 2 )

View File

@ -5,7 +5,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/auras/21_aspect_of_scorpions.tres" type="Aura" id=3]
[ext_resource path="res://modules/entity_classes/naturalist/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=4]
[resource]
resource_name = "Aspect of Scorpions"
id = 17

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/auras/22_aspect_of_wasps.tres" type="Aura" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_wasps.tres" type="Texture" id=3]
[resource]
resource_name = "Aspect of Wasps"
id = 18

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/auras/23_aspect_of_wolves.tres" type="Aura" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_wolves.tres" type="Texture" id=3]
[resource]
resource_name = "Aspect of Wolves"
id = 19

View File

@ -4,7 +4,6 @@
[ext_resource path="res://modules/entity_classes/naturalist/auras/24_aspect_of_bees.tres" type="Aura" id=2]
[ext_resource path="res://modules/entity_classes/naturalist/icons/aspect_of_bees.tres" type="Texture" id=3]
[resource]
resource_name = "Aspect of Bees"
id = 20

View File

@ -89,11 +89,7 @@ var entity : Entity
var model_rotation_node : Spatial
var character_skeleton : CharacterSkeleton3D
var speed_stat_id : int
func _ready() -> void:
speed_stat_id = ESS.stat_get_id("Speed")
camera = get_node_or_null("CameraPivot/Camera") as Camera
camera_pivot = get_node_or_null("CameraPivot") as Spatial
@ -262,7 +258,7 @@ func process_movement_player(delta : float) -> void:
hvel.y = 0
var target : Vector3 = dir
target *= entity.get_stat(speed_stat_id).ccurrent
target *= entity.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_SPEED).current_value / 100.0 * 4.2
var accel
if dir.dot(hvel) > 0:
@ -336,7 +332,7 @@ func process_movement_mob(delta : float) -> void:
hvel.y = 0
var target : Vector3 = dir
target *= entity.get_stat(speed_stat_id).ccurrent
target *= entity.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_SPEED).current_value / 100.0 * 4.2
var accel
if dir.dot(hvel) > 0:

View File

@ -37,7 +37,7 @@ func _ready():
func c_on_damage_taken(entity, dpd):
print("c " + str(dpd.damage))
print("ch " + str(get_health().ccurrent) + "/" + str(get_health().cmax))
# print("ch " + str(get_health().ccurrent) + "/" + str(get_health().cmax))
pass
func s_on_damage_taken(entity, dpd):

View File

@ -44,21 +44,15 @@ var health_bar : TextureProgress = null
var health_bar_label : Label = null
var entity : Entity = null
var health : Stat = null
var health_stat_id : int
var health : EntityResource = null
func _ready():
health_stat_id = ESS.stat_get_id("Health")
name_label = get_node(name_label_path) as Label
health_bar = get_node(health_bar_path) as TextureProgress
health_bar_label = get_node(health_bar_label_path) as Label
entity = get_node("../..") as Entity
health = entity.get_stat(health_stat_id)
health.connect("c_changed", self, "c_health_changed")
entity.connect("centity_resource_added", self, "on_centity_resource_added")
name_label.text = entity.centity_name
@ -68,8 +62,6 @@ func _ready():
entity.connect("onc_targeted", self, "onc_targeted")
entity.connect("onc_untargeted", self, "onc_untargeted")
c_health_changed(health)
modulate = normal_color
set_scale(normal_scale)
@ -130,13 +122,13 @@ func set_max_distance(var value : float) -> void:
max_distance = value
func c_health_changed(stat : Stat) -> void:
if stat.cmax != 0:
health_bar.max_value = stat.cmax
func c_health_changed(stat : EntityResource) -> void:
if stat.current_value != 0:
health_bar.max_value = stat.max_value
else:
health_bar.max_value = 1
health_bar.value = stat.ccurrent
health_bar.value = stat.current_value
# if stat.cmax != 0:
@ -174,3 +166,10 @@ func onc_untargeted() -> void:
func interpolate_scale(target : Vector2) -> void:
target_scale = target
interpolating = true
func on_centity_resource_added(resorce) -> void:
if health != null:
return
health = entity.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH)
health.connect("changed", self, "c_health_changed")

View File

@ -24,7 +24,6 @@ class_name PlayerGD
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
func _from_dict(dict):
._from_dict(dict)

View File

@ -189,6 +189,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/game_modules/GameModule.gd"
}, {
"base": "EntityResource",
"class": "HealthResource",
"language": "GDScript",
"path": "res://scripts/resources/HealthResource.gd"
}, {
"base": "ItemTemplate",
"class": "ItemTemplateGD",
"language": "GDScript",
@ -239,6 +244,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://scripts/networking/PlayerMaster.gd"
}, {
"base": "EntityResource",
"class": "SpeedResource",
"language": "GDScript",
"path": "res://scripts/resources/SpeedResource.gd"
}, {
"base": "SpellEffectVisual",
"class": "SpellEffectVisualBasic",
"language": "GDScript",
@ -301,6 +311,7 @@ _global_script_class_icons={
"GSAITargetAcceleration": "",
"GSAIUtils": "",
"GameModule": "",
"HealthResource": "",
"ItemTemplateGD": "",
"LayeredTextureMaker": "",
"Main": "",
@ -311,6 +322,7 @@ _global_script_class_icons={
"NetworkedPlayerGD": "",
"PlayerGD": "",
"PlayerMaster": "",
"SpeedResource": "",
"SpellEffectVisualBasic": "",
"SpellGD": "",
"TVVoxelChunk": "",
@ -364,7 +376,7 @@ spells/allow_class_recipe_learning=true
level/use_class_xp=true
data/ess_resource_db_path="res://data/resource_db.tres"
data/ess_entity_spawner_path="res://player/bs_entity_spawner.tres"
enums/stats="Agility,Strength,Stamina,Intellect,Spirit,Health,Speed,Global Cooldown,Haste,Haste Rating,Resilience,Armor,Attack Power,Spell Power,Melee Crit,Melee Crit bonus,Spell Crit,Spell Crit Bonus,Block,Parry,Damage Reduction,Melee Damage Reduction,Spell Damage Reduction,Damage Taken,Heal Taken,Melee Damage,Spell Damage,Holy Resist,Shadow Resist,Nature Resist,Fire Resist,Frost Resist,Lightning Resist,Chaos Resist,Silence Resist,Fear Resist,Stun Resist,Energy,Rage,XP Rate"
enums/stats="Agility,Strength,Stamina,Intellect,Spirit,Health,Mana,Speed,Global Cooldown,Haste,Haste Rating,Resilience,Armor,Attack Power,Spell Power,Melee Crit,Melee Crit bonus,Spell Crit,Spell Crit Bonus,Block,Parry,Damage Reduction,Melee Damage Reduction,Spell Damage Reduction,Damage Taken,Heal Taken,Melee Damage,Spell Damage,Holy Resist,Shadow Resist,Nature Resist,Fire Resist,Frost Resist,Lightning Resist,Chaos Resist,Silence Resist,Fear Resist,Stun Resist,Energy,Rage,XP Rate"
profiles/automatic_save=true
[importer_defaults]

View File

@ -0,0 +1,47 @@
extends EntityResource
class_name HealthResource
# Copyright (c) 2019-2020 Péter Magyar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
var stamina_stat_id : int = 0
var health_stat_id = 0
func _init():
current_value = 100
stamina_stat_id = ESS.stat_get_id("Stamina")
health_stat_id = ESS.stat_get_id("Health")
func _ons_added(entity):
refresh()
func _ons_stat_changed(stat : Stat):
if stat.id == stamina_stat_id || stat.id == health_stat_id:
refresh()
func refresh():
var stamina : Stat = owner.get_stat(stamina_stat_id)
var health : Stat = owner.get_stat(health_stat_id)
max_value = int(stamina.scurrent) * 10 + int(health.scurrent)
#todo fix this if this solution works well
current_value = max_value

View File

@ -0,0 +1,28 @@
extends EntityResourceData
# Copyright (c) 2019-2020 Péter Magyar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
func _get_entity_resource_instance() -> EntityResource:
var mr = HealthResource.new()
mr.data_path = resource_path
return mr

View File

@ -0,0 +1,44 @@
extends EntityResource
class_name SpeedResource
# Copyright (c) 2019-2020 Péter Magyar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
var speed_stat_id : int = 0
var base_value = 100
func _init():
current_value = base_value
speed_stat_id = ESS.stat_get_id("Speed")
func _ons_added(entity):
refresh()
func _ons_stat_changed(stat : Stat):
if stat.id == speed_stat_id:
refresh()
func refresh():
var speed_stat : Stat = owner.get_stat(speed_stat_id)
current_value = base_value + speed_stat.scurrent * 0.01

View File

@ -0,0 +1,28 @@
extends EntityResourceData
# Copyright (c) 2019-2020 Péter Magyar
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
func _get_entity_resource_instance() -> EntityResource:
var mr = SpeedResource.new()
mr.data_path = resource_path
return mr

View File

@ -39,12 +39,8 @@ var _aura_grid : GridContainer
var _player : Entity
var _mana : ManaResource
var health_stat_id : int
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
health_stat_id = ESS.stat_get_id("Health")
_name_text = get_node(name_text_path) as Label
_health_range = get_node(health_range_path) as Range
_health_text = get_node(health_text_path) as Label
@ -54,7 +50,7 @@ func _ready() -> void:
func set_player(p_player : Entity) -> void:
if not _player == null and is_instance_valid(_player):
_player.get_stat(health_stat_id).disconnect("c_changed", self, "_on_player_health_changed")
_player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH).disconnect("changed", self, "_on_player_health_changed")
_player.disconnect("caura_added", self, "on_caura_added")
_player.disconnect("caura_removed", self, "on_caura_removed")
_player.disconnect("cdied", self, "cdied")
@ -91,9 +87,9 @@ func set_player(p_player : Entity) -> void:
for i in range(_player.getc_resource_count()):
centity_resource_added(_player.getc_resource_index(i))
var health = _player.get_stat(health_stat_id)
var health = _player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH)
_on_player_health_changed(health)
health.connect("c_changed", self, "_on_player_health_changed")
health.connect("changed", self, "_on_player_health_changed")
_name_text.text = _player.centity_name
@ -138,8 +134,8 @@ func on_caura_removed(aura_data : AuraData) -> void:
bn.queue_free()
return
func _on_player_health_changed(health : Stat) -> void:
if health.cmax == 0:
func _on_player_health_changed(health : EntityResource) -> void:
if health.max_value == 0:
_health_range.min_value = 0
_health_range.max_value = 1
_health_range.value = 0
@ -149,10 +145,10 @@ func _on_player_health_changed(health : Stat) -> void:
return
_health_range.min_value = 0
_health_range.max_value = health.cmax
_health_range.value = health.ccurrent
_health_range.max_value = health.max_value
_health_range.value = health.current_value
_health_text.text = str(health.ccurrent) + "/" + str(health.cmax)
_health_text.text = str(health.current_value) + "/" + str(health.max_value)
func cdied(entity : Entity) -> void:
set_player(null)

View File

@ -40,11 +40,7 @@ var _player : Entity
var _mana : ManaResource
var health_stat_id : int
func _ready() -> void:
health_stat_id = ESS.stat_get_id("Health")
_name_text = get_node(name_text_path)
_level_text = get_node(level_text_path)
_health_range = get_node(health_range_path)
@ -55,7 +51,7 @@ func _ready() -> void:
func set_player(p_player: Entity) -> void:
if not _player == null:
_player.get_health().disconnect("c_changed", self, "_on_player_health_changed")
_player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH).disconnect("changed", self, "_on_player_health_changed")
_player.disconnect("cname_changed", self, "cname_changed")
_player.disconnect("con_level_up", self, "clevel_changed")
_player.disconnect("con_level_changed", self, "clevel_changed")
@ -84,9 +80,9 @@ func set_player(p_player: Entity) -> void:
for i in range(_player.getc_resource_count()):
centity_resource_added(_player.getc_resource_index(i))
var health = _player.get_stat(health_stat_id)
var health = _player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH)
_on_player_health_changed(health)
health.connect("c_changed", self, "_on_player_health_changed")
health.connect("changed", self, "_on_player_health_changed")
_name_text.text = _player.centity_name
_level_text.text = str(_player.ccharacter_level)
@ -101,8 +97,8 @@ func centity_resource_added(res : EntityResource):
_mana.connect("changed", self, "_on_mana_changed")
_on_mana_changed(_mana)
func _on_player_health_changed(health: Stat) -> void:
if health.cmax == 0:
func _on_player_health_changed(health: EntityResource) -> void:
if health.max_value == 0:
_health_range.min_value = 0
_health_range.max_value = 1
_health_range.value = 0
@ -112,10 +108,10 @@ func _on_player_health_changed(health: Stat) -> void:
return
_health_range.min_value = 0
_health_range.max_value = health.cmax
_health_range.value = health.ccurrent
_health_range.max_value = health.max_value
_health_range.value = health.current_value
_health_text.text = str(health.ccurrent) + "/" + str(health.cmax)
_health_text.text = str(health.current_value) + "/" + str(health.max_value)
func _on_mana_changed(resource: EntityResource) -> void:
if resource.max_value == 0:
@ -146,5 +142,5 @@ func con_xp_gained(entity: Entity, val: int) -> void:
_xp_range.value = _player.ccharacter_xp
func centity_data_changed(data: EntityData) -> void:
var health = _player.get_stat(health_stat_id)
var health = _player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH)
_on_player_health_changed(health)