Added 2 spells to Naturalist, implemented range, and started implementing mana.

This commit is contained in:
Relintai 2020-03-10 15:33:48 +01:00
parent cb6faf1120
commit c9ffc5a821
11 changed files with 131 additions and 10 deletions

View File

@ -11,15 +11,15 @@ icon = ExtResource( 2 )
time = 30.0
tick = 3.0
debuff = true
rank = 10
rank = 1
aura_type = 1
aura_group = ExtResource( 3 )
text_name = "Aspect of Scorpions"
text_description = "Deals 340 to 380 damage every 3 sec, and increases damage taken by 10% for 30 sec."
text_description = "Deals %%damage_min to %%damage_max damage every %%tick sec, and increases damage taken by 10% for 30 sec."
damage_enabled = true
damage_type = 8
damage_min = 340
damage_max = 355
damage_min = 4
damage_max = 5
attribute_count = 1
StatModAttribute_0/stat = 24
StatModAttribute_0/base_mod = 0.0

View File

@ -1,8 +1,7 @@
[gd_resource type="EntityData" load_steps=5 format=2]
[gd_resource type="EntityData" load_steps=4 format=2]
[ext_resource path="res://data/entity_classes/1_naturalist.tres" type="EntityClassData" id=1]
[ext_resource path="res://scripts/entities/EntityDataGD.gd" type="Script" id=2]
[ext_resource path="res://data/item_templates/2_test.tres" type="ItemTemplate" id=3]
[sub_resource type="LootDataBase" id=1]

View File

@ -1,4 +1,4 @@
[gd_resource type="EntityClassData" load_steps=74 format=2]
[gd_resource type="EntityClassData" load_steps=76 format=2]
[ext_resource path="res://data/spells/26_rest.tres" type="Spell" id=1]
[ext_resource path="res://data/spells/21_strength_of_nature_rank_1.tres" type="Spell" id=2]
@ -22,6 +22,8 @@
[ext_resource path="res://scripts/ai/EntityAIGD.gd" type="Script" id=20]
[ext_resource path="res://data/auras/13_aspect_of_bees_rank_1.tres" type="Aura" id=21]
[ext_resource path="res://data/auras/15_close_wounds_rank_1.tres" type="Aura" id=22]
[ext_resource path="res://data/spells/35_strike.tres" type="Spell" id=23]
[ext_resource path="res://data/spells/36_regrow.tres" type="Spell" id=24]
[ext_resource path="res://data/entity_resources/1_mana_resource.tres" type="EntityResourceData" id=27]
[sub_resource type="EntityAI" id=1]
@ -252,8 +254,8 @@ stat_data = SubResource( 50 )
player_resource_type = 2
entity_resources = [ ExtResource( 27 ) ]
specs = [ SubResource( 4 ) ]
spells = [ ExtResource( 4 ), ExtResource( 6 ), ExtResource( 16 ), ExtResource( 5 ), ExtResource( 3 ), ExtResource( 10 ), ExtResource( 8 ), ExtResource( 11 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 13 ), ExtResource( 2 ), ExtResource( 12 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 17 ), ExtResource( 1 ) ]
start_spells = [ ExtResource( 4 ) ]
spells = [ ExtResource( 4 ), ExtResource( 6 ), ExtResource( 16 ), ExtResource( 5 ), ExtResource( 3 ), ExtResource( 10 ), ExtResource( 8 ), ExtResource( 11 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 13 ), ExtResource( 2 ), ExtResource( 12 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 17 ), ExtResource( 1 ), ExtResource( 23 ), ExtResource( 24 ) ]
start_spells = [ ExtResource( 4 ), ExtResource( 23 ), ExtResource( 24 ) ]
auras = [ ExtResource( 18 ) ]
ais = [ SubResource( 1 ) ]
script = ExtResource( 19 )

View File

@ -0,0 +1,42 @@
[gd_resource type="Spell" load_steps=7 format=2]
[ext_resource path="res://scripts/spells/amplify_pain.gd" type="Script" id=1]
[ext_resource path="res://data/icons/naturalist/amplify_pain.tres" type="Texture" id=2]
[ext_resource path="res://scripts/resources/spell_effect_visual_basic.gd" type="Script" id=3]
[ext_resource path="res://data/spell_effects/nature/AmplifyPain.tscn" type="PackedScene" id=4]
[ext_resource path="res://data/spell_effects/nature/NatureCast.tscn" type="PackedScene" id=5]
[sub_resource type="SpellEffectVisual" id=1]
script = ExtResource( 3 )
spell_cast_effect_left_hand = ExtResource( 5 )
spell_cast_effect_right_hand = ExtResource( 5 )
torso_aura_effect_time = 0.0
root_aura_effect_time = 0.0
torso_spell_cast_finish_effect = ExtResource( 4 )
torso_spell_cast_finish_effect_time = 0.4
root_spell_cast_finish_effect_time = 1.0
[resource]
resource_name = "Strike"
id = 35
spell_type = 1
rank = 1
icon = ExtResource( 2 )
needs_target = true
visual_spell_effects = SubResource( 1 )
text_name = "Strike"
text_description = "Range: Melee
Strike the target with your weapon, dealing weapon damage, and an additional %%damage_min - %%damage_max ."
cooldown_cooldown = 3.0
range_enabled = true
range_range = 3.0
cast_cast_time = 1.5
damage_enabled = true
damage_type = 1
damage_min = 19
damage_max = 25
damage_scale_stat = 41
damage_scale_coeff = 1.0
aoe_targetType = -1910718371
aoe_colliderType = 1065353216
script = ExtResource( 1 )

View File

@ -0,0 +1,24 @@
[gd_resource type="Spell" load_steps=3 format=2]
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
[ext_resource path="res://data/icons/naturalist/root.tres" type="Texture" id=2]
[resource]
resource_name = "Regrow"
id = 36
spell_type = 8
target_relation_type = 5
rank = 1
icon = ExtResource( 2 )
text_name = "Regrow"
text_description = "Heals you for %%heal_min to %%heal_max ."
range_enabled = true
range_range = 30.0
cast_enabled = true
cast_cast_time = 2.0
heal_enabled = true
heal_min = 12
heal_max = 18
heal_scale_stat = 14
heal_scale_coeff = 0.1
script = ExtResource( 1 )

View File

@ -212,7 +212,7 @@ _global_script_classes=[ {
"base": "EntityResource",
"class": "ManaResource",
"language": "GDScript",
"path": "res://scripts/resources/ManResource.gd"
"path": "res://scripts/resources/ManaResource.gd"
}, {
"base": "Control",
"class": "Menu",

View File

@ -22,3 +22,4 @@ extends EntityResourceData
func _get_entity_resource_instance() -> EntityResource:
return ManaResource.new()

View File

@ -42,6 +42,10 @@ func _sstart_casting(info : SpellCastInfo) -> void:
if target_relation_type & TARGET_FRIENDLY or target_relation_type & TARGET_SELF:
if entity_relation_type == EntityEnums.ENTITY_RELATION_TYPE_FRIENDLY or entity_relation_type == EntityEnums.ENTITY_RELATION_TYPE_NEUTRAL:
ok = true
else:
if entity_relation_type == EntityEnums.ENTITY_RELATION_TYPE_HOSTILE:
info.target = info.caster
ok = true
if target_relation_type & TARGET_ENEMY:
if entity_relation_type == EntityEnums.ENTITY_RELATION_TYPE_HOSTILE:
@ -49,6 +53,14 @@ func _sstart_casting(info : SpellCastInfo) -> void:
if !ok:
return
if range_enabled:
if info.caster != info.target:
var c : Vector3 = info.caster.get_body().transform.origin
var t : Vector3 = info.target.get_body().transform.origin
if (c - t).length() > range_range:
return
if cast_enabled:
info.caster.sstart_casting(info)
@ -133,6 +145,15 @@ func handle_effect(info : SpellCastInfo) -> void:
handle_spell_damage(sdi)
if heal_enabled and info.target:
var shi : SpellHealInfo = SpellHealInfo.new()
shi.heal_source = self
shi.dealer = info.caster
shi.receiver = info.target
handle_spell_heal(shi)
for aura in caster_aura_applys:
var ainfo : AuraApplyInfo = AuraApplyInfo.new()

View File

@ -24,21 +24,29 @@ export (NodePath) var name_text_path : NodePath
export (NodePath) var level_text_path : NodePath
export (NodePath) var health_range_path : NodePath
export (NodePath) var health_text_path : NodePath
export (NodePath) var resource_range_path : NodePath
export (NodePath) var resource_text_path : NodePath
export (NodePath) var xp_range_path : NodePath
var _name_text : Label
var _level_text : Label
var _health_range : Range
var _health_text : Label
var _resource_range : Range
var _resource_text : Label
var _xp_range : Range
var _player : Entity
var _mana : ManaResource
func _ready() -> void:
_name_text = get_node(name_text_path)
_level_text = get_node(level_text_path)
_health_range = get_node(health_range_path)
_health_text = get_node(health_text_path)
_resource_range = get_node(resource_range_path)
_resource_text = get_node(resource_text_path)
_xp_range = get_node(xp_range_path)
func set_player(p_player: Entity) -> void:
@ -63,6 +71,12 @@ func set_player(p_player: Entity) -> void:
_player.connect("con_xp_gained", self, "con_xp_gained")
_player.connect("centity_data_changed", self, "centity_data_changed")
if _player.getc_resource_count() > 0:
var mana : ManaResource = _player.getc_resource_index(0) as ManaResource
if mana != null:
mana.connect("changed", self, "_on_mana_changed")
var health = _player.get_health()
_on_player_health_changed(health)
health.connect("c_changed", self, "_on_player_health_changed")
@ -89,6 +103,22 @@ func _on_player_health_changed(health: Stat) -> void:
_health_text.text = str(health.ccurrent) + "/" + str(health.cmax)
func _on_mana_changed(resource: EntityResource) -> void:
if resource.max == 0:
_resource_range.min_value = 0
_resource_range.max_value = 1
_resource_range.value = 0
_resource_range.text = ""
return
_resource_range.min_value = 0
_resource_range.max_value = resource.cmax
_resource_range.value = resource.ccurrent
_resource_range.text = str(resource.ccurrent) + "/" + str(resource.cmax)
func cname_changed(entity: Entity) -> void:
_name_text.text = _player.centity_name

View File

@ -15,6 +15,8 @@ name_text_path = NodePath("VBoxContainer/HBoxContainer/Label")
level_text_path = NodePath("VBoxContainer/HBoxContainer/Label2")
health_range_path = NodePath("VBoxContainer/MarginContainer/ProgressBar")
health_text_path = NodePath("VBoxContainer/MarginContainer/Label")
resource_range_path = NodePath("VBoxContainer/MarginContainer2/ResourceBar")
resource_text_path = NodePath("VBoxContainer/MarginContainer2/Label")
xp_range_path = NodePath("VBoxContainer/XPBar")
[node name="VBoxContainer" type="VBoxContainer" parent="."]