hitting is now an ability
This commit is contained in:
@@ -11,8 +11,8 @@ public class SimpleHitBehavior(ForgeEffectData? damage) : IAbilityBehavior
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
if (context.Target == null || damage == null) return;
|
||||
|
||||
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Target));
|
||||
|
||||
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
|
||||
context.Target.EffectsManager.ApplyEffect(effect);
|
||||
|
||||
context.AbilityHandle.CommitAbility();
|
||||
|
||||
@@ -9,7 +9,7 @@ public class EnemyAttributeSet : AttributeSet
|
||||
|
||||
public EnemyAttributeSet()
|
||||
{
|
||||
Health = InitializeAttribute(nameof(Health), 100, 0, 150);
|
||||
Health = InitializeAttribute(nameof(Health), 100, 0, 100);
|
||||
Strength = InitializeAttribute(nameof(Strength), 10, 0, 99);
|
||||
Speed = InitializeAttribute(nameof(Speed), 5, 0, 10);
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_l686n")
|
||||
RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "status.invincible", "events.combat.death"])
|
||||
RegisteredTags = Array[String](["character.player", "character.enemy", "weapon", "status.stunned", "status.burning", "status.frozen", "abilities.weapon.land", "abilities.weapon.flying", "abilities.weapon.left", "events.combat.damage", "events.combat.hit", "events.weapon.flyingTick", "events.weapon.startedFlying", "events.weapon.stoppedFlying", "events.weapon.handToFlying", "events.weapon.flyingToHand", "events.weapon.plantedToHand", "events.weapon.plantedToFlying", "events.weapon.planted", "cooldown.empoweredAction", "cooldown.empoweredSwordThrow", "cues.resources.mana", "events.player.empowered_action_used", "cues.resources.mana.inhibited", "cues.resources.health", "cooldown.enemy.hit", "status.invincible", "events.combat.death", "cooldown.hit", "events.player.hit", "cues.enemy.health"])
|
||||
|
||||
178
forge/resources/ability_datas/grounded_enemy_hit.tres
Normal file
178
forge/resources/ability_datas/grounded_enemy_hit.tres
Normal file
@@ -0,0 +1,178 @@
|
||||
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://qpdw62ubaclc"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://cw2ytd34jsxj" path="res://forge/resources/tag_containers/status_invincible.tres" id="1_f6jpb"]
|
||||
[ext_resource type="Script" uid="uid://b0eq12mjqfage" path="res://addons/forge/resources/components/TargetTagRequirements.cs" id="2_mnqxs"]
|
||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="4_0mce3"]
|
||||
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="5_1yqf2"]
|
||||
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="6_41lep"]
|
||||
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="7_jf6ii"]
|
||||
[ext_resource type="Script" uid="uid://bdfcavbjyhxxa" path="res://addons/forge/resources/ForgeModifier.cs" id="8_51ikp"]
|
||||
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="9_bcnlx"]
|
||||
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="10_m4f1m"]
|
||||
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="11_8c5sq"]
|
||||
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="12_2x5q6"]
|
||||
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="13_4nn3y"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nt1hl"]
|
||||
script = ExtResource("2_mnqxs")
|
||||
ApplicationIgnoredTags = ExtResource("1_f6jpb")
|
||||
metadata/_custom_type_script = "uid://b0eq12mjqfage"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f35o6"]
|
||||
script = ExtResource("4_0mce3")
|
||||
ContainerTags = Array[String](["events.combat.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_46obe"]
|
||||
script = ExtResource("4_0mce3")
|
||||
ContainerTags = Array[String](["events.combat.damage"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_33a4r"]
|
||||
script = ExtResource("5_1yqf2")
|
||||
EventTags = SubResource("Resource_f35o6")
|
||||
TargetEventTags = SubResource("Resource_46obe")
|
||||
metadata/_custom_type_script = "uid://br7ut4lbau66w"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_rjo6h"]
|
||||
script = ExtResource("6_41lep")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8qlid"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lbthk"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_hguc3"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ugrvo"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6406e"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_x0rol"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1s1j3"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = -10.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_khx4r"]
|
||||
script = ExtResource("8_51ikp")
|
||||
Attribute = "PlayerAttributeSet.Health"
|
||||
ScalableFloat = SubResource("Resource_1s1j3")
|
||||
Coefficient = SubResource("Resource_ugrvo")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_x0rol")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_6406e")
|
||||
CalculatorCoefficient = SubResource("Resource_8qlid")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_hguc3")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_lbthk")
|
||||
metadata/_custom_type_script = "uid://bdfcavbjyhxxa"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xmw7i"]
|
||||
script = ExtResource("6_41lep")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lj45k"]
|
||||
script = ExtResource("9_bcnlx")
|
||||
Name = "SimpleHitEffect"
|
||||
Modifiers = Array[Object]([SubResource("Resource_khx4r")])
|
||||
Components = [SubResource("Resource_nt1hl")]
|
||||
Executions = [SubResource("Resource_33a4r")]
|
||||
StackLimit = SubResource("Resource_xmw7i")
|
||||
InitialStack = SubResource("Resource_rjo6h")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_m0osh"]
|
||||
script = ExtResource("10_m4f1m")
|
||||
DamageEffect = SubResource("Resource_lj45k")
|
||||
Name = "Simple hit"
|
||||
Description = "This is a simple hit from an enemy"
|
||||
metadata/_custom_type_script = "uid://n6efm5o4uxvr"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_msmv1"]
|
||||
script = ExtResource("4_0mce3")
|
||||
ContainerTags = Array[String](["status.stunned"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xdbds"]
|
||||
script = ExtResource("4_0mce3")
|
||||
ContainerTags = Array[String](["cooldown.enemy.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gna8g"]
|
||||
script = ExtResource("11_8c5sq")
|
||||
TagsToAdd = SubResource("Resource_xdbds")
|
||||
metadata/_custom_type_script = "uid://dngf30hxy5go4"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_oo2a1"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_q86ag"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5eesh"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5lf6m"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bv3hg"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_tb7hu"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bw6ul"]
|
||||
script = ExtResource("7_jf6ii")
|
||||
BaseValue = 1.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_g5uhf"]
|
||||
script = ExtResource("12_2x5q6")
|
||||
ScalableFloat = SubResource("Resource_bw6ul")
|
||||
Coefficient = SubResource("Resource_5lf6m")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_tb7hu")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_bv3hg")
|
||||
CalculatorCoefficient = SubResource("Resource_oo2a1")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_5eesh")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_q86ag")
|
||||
metadata/_custom_type_script = "uid://2gm1hdhi8u08"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vl5ta"]
|
||||
script = ExtResource("6_41lep")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_82a7m"]
|
||||
script = ExtResource("6_41lep")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0gdnn"]
|
||||
script = ExtResource("9_bcnlx")
|
||||
Name = "HitCooldown"
|
||||
Modifiers = []
|
||||
Components = [SubResource("Resource_gna8g")]
|
||||
Executions = []
|
||||
DurationType = 2
|
||||
Duration = SubResource("Resource_g5uhf")
|
||||
StackLimit = SubResource("Resource_82a7m")
|
||||
InitialStack = SubResource("Resource_vl5ta")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("13_4nn3y")
|
||||
Name = "Hit"
|
||||
CooldownEffects = [SubResource("Resource_0gdnn")]
|
||||
AbilityBehavior = SubResource("Resource_m0osh")
|
||||
ActivationBlockedTags = SubResource("Resource_msmv1")
|
||||
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
|
||||
182
forge/resources/ability_datas/player_hit.tres
Normal file
182
forge/resources/ability_datas/player_hit.tres
Normal file
@@ -0,0 +1,182 @@
|
||||
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://dgjsi1my7nlnk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="1_l0l1a"]
|
||||
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="1_n2s8d"]
|
||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="1_w1wo0"]
|
||||
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="2_0cyim"]
|
||||
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="2_5vjbv"]
|
||||
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="2_jwyed"]
|
||||
[ext_resource type="Script" uid="uid://b0eq12mjqfage" path="res://addons/forge/resources/components/TargetTagRequirements.cs" id="2_l5emy"]
|
||||
[ext_resource type="Script" uid="uid://bdfcavbjyhxxa" path="res://addons/forge/resources/ForgeModifier.cs" id="3_c4wry"]
|
||||
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="3_w1wo0"]
|
||||
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="4_c4wry"]
|
||||
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="5_0cyim"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_sgtcb"]
|
||||
script = ExtResource("1_w1wo0")
|
||||
ContainerTags = Array[String](["status.invincible"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3p0ly"]
|
||||
script = ExtResource("2_l5emy")
|
||||
ApplicationIgnoredTags = SubResource("Resource_sgtcb")
|
||||
metadata/_custom_type_script = "uid://b0eq12mjqfage"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6x2ov"]
|
||||
script = ExtResource("1_w1wo0")
|
||||
ContainerTags = Array[String](["events.combat.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ml8x2"]
|
||||
script = ExtResource("1_w1wo0")
|
||||
ContainerTags = Array[String](["events.combat.damage"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1uqo4"]
|
||||
script = ExtResource("2_0cyim")
|
||||
EventTags = SubResource("Resource_6x2ov")
|
||||
TargetEventTags = SubResource("Resource_ml8x2")
|
||||
metadata/_custom_type_script = "uid://br7ut4lbau66w"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0cyim"]
|
||||
script = ExtResource("1_l0l1a")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_h8gc3"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ewmvj"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8wvcn"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_no8t2"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vioyh"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_m6xnn"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uinv8"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = -50.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_04hqa"]
|
||||
script = ExtResource("3_c4wry")
|
||||
Attribute = "EnemyAttributeSet.Health"
|
||||
ScalableFloat = SubResource("Resource_uinv8")
|
||||
Coefficient = SubResource("Resource_no8t2")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_m6xnn")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_vioyh")
|
||||
CalculatorCoefficient = SubResource("Resource_h8gc3")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_8wvcn")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_ewmvj")
|
||||
metadata/_custom_type_script = "uid://bdfcavbjyhxxa"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8fbeq"]
|
||||
script = ExtResource("1_l0l1a")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ees2v"]
|
||||
script = ExtResource("2_5vjbv")
|
||||
Name = "Player Hit Effect"
|
||||
Modifiers = Array[Object]([SubResource("Resource_04hqa")])
|
||||
Components = Array[Object]([SubResource("Resource_3p0ly")])
|
||||
Executions = Array[Object]([SubResource("Resource_1uqo4")])
|
||||
StackLimit = SubResource("Resource_8fbeq")
|
||||
InitialStack = SubResource("Resource_0cyim")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_r7waw"]
|
||||
script = ExtResource("1_n2s8d")
|
||||
DamageEffect = SubResource("Resource_ees2v")
|
||||
Name = "PlayerHitEffect"
|
||||
Description = "Effect applied to target on player hit"
|
||||
metadata/_custom_type_script = "uid://n6efm5o4uxvr"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qk2av"]
|
||||
script = ExtResource("1_w1wo0")
|
||||
ContainerTags = Array[String](["status.stunned"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_w857g"]
|
||||
script = ExtResource("1_w1wo0")
|
||||
ContainerTags = Array[String](["cooldown.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_n2s8d"]
|
||||
script = ExtResource("2_jwyed")
|
||||
TagsToAdd = SubResource("Resource_w857g")
|
||||
metadata/_custom_type_script = "uid://dngf30hxy5go4"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_l5emy"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_agfn8"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_tkxxk"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_e4qbe"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_coxn5"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_wak7n"]
|
||||
script = ExtResource("4_c4wry")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bvwi7"]
|
||||
script = ExtResource("4_c4wry")
|
||||
BaseValue = 0.5
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3wf5l"]
|
||||
script = ExtResource("5_0cyim")
|
||||
ScalableFloat = SubResource("Resource_bvwi7")
|
||||
Coefficient = SubResource("Resource_e4qbe")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_wak7n")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_coxn5")
|
||||
CalculatorCoefficient = SubResource("Resource_l5emy")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_tkxxk")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_agfn8")
|
||||
metadata/_custom_type_script = "uid://2gm1hdhi8u08"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xs7wf"]
|
||||
script = ExtResource("1_l0l1a")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cm4e8"]
|
||||
script = ExtResource("1_l0l1a")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cmmfb"]
|
||||
script = ExtResource("2_5vjbv")
|
||||
Name = "PlayerHitCooldown"
|
||||
Modifiers = []
|
||||
Components = Array[Object]([SubResource("Resource_n2s8d")])
|
||||
Executions = []
|
||||
DurationType = 2
|
||||
Duration = SubResource("Resource_3wf5l")
|
||||
StackLimit = SubResource("Resource_cm4e8")
|
||||
InitialStack = SubResource("Resource_xs7wf")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("3_w1wo0")
|
||||
Name = "PlayerHitAbility"
|
||||
CooldownEffects = [SubResource("Resource_cmmfb")]
|
||||
AbilityBehavior = SubResource("Resource_r7waw")
|
||||
ActivationBlockedTags = SubResource("Resource_qk2av")
|
||||
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f35o6"]
|
||||
script = ExtResource("1_tvgrb")
|
||||
ContainerTags = Array[String](["cues.resources.health"])
|
||||
ContainerTags = Array[String](["cues.resources.health", "character.player"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[resource]
|
||||
|
||||
@@ -26,9 +26,12 @@ public partial class InventoryManager : Node
|
||||
|
||||
#endregion
|
||||
|
||||
public Dictionary<WeaponSystem.WeaponEvent, HashSet<ForgeAbilityBehavior>> WeaponEventsInventory { get;
|
||||
private set;
|
||||
} = [];
|
||||
public Dictionary<WeaponSystem.WeaponEvent, HashSet<ForgeAbilityBehavior>> WeaponEventsInventory { get; private set; }
|
||||
= new() {
|
||||
{ WeaponSystem.WeaponEvent.FlyingTick, [] },
|
||||
{ WeaponSystem.WeaponEvent.StartedFlying, [] },
|
||||
{ WeaponSystem.WeaponEvent.StoppedFlying, [] }
|
||||
};
|
||||
|
||||
public void InitializeFromResource(WeaponInventory inventory)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ MovementInputs = ExtResource("6_l44fp")
|
||||
HealthInputs = ExtResource("7_ucbss")
|
||||
DamageInputs = ExtResource("8_2brdd")
|
||||
Target = NodePath("../Player")
|
||||
SpawnInterval = 5.0
|
||||
SpawnInterval = 1.808
|
||||
|
||||
[node name="GroundedSpawner2" parent="." index="9" unique_id=1026317919 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 46.5, 11.5, -34.5)
|
||||
@@ -55,6 +55,7 @@ HealthInputs = ExtResource("7_ucbss")
|
||||
DamageInputs = ExtResource("8_2brdd")
|
||||
Target = NodePath("../Player")
|
||||
SpawnInterval = 5.0
|
||||
IsActiveOnStart = false
|
||||
|
||||
[node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3)
|
||||
@@ -73,6 +74,7 @@ HealthInputs = ExtResource("11_5jlg7")
|
||||
DamageInputs = ExtResource("12_pjgox")
|
||||
Target = NodePath("../Player")
|
||||
SpawnInterval = 5.0
|
||||
IsActiveOnStart = false
|
||||
|
||||
[node name="FlyingSpawner2" parent="." index="12" unique_id=365997644 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.5, 25.5, -42.5)
|
||||
@@ -82,6 +84,7 @@ HealthInputs = ExtResource("11_5jlg7")
|
||||
DamageInputs = ExtResource("12_pjgox")
|
||||
Target = NodePath("../Player")
|
||||
SpawnInterval = 5.0
|
||||
IsActiveOnStart = false
|
||||
|
||||
[node name="Targets" type="Node3D" parent="." index="13" unique_id=1620747784]
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
using Gamesmiths.Forge.Attributes;
|
||||
using Gamesmiths.Forge.Core;
|
||||
using Gamesmiths.Forge.Cues;
|
||||
using Gamesmiths.Forge.Effects;
|
||||
using Gamesmiths.Forge.Events;
|
||||
using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Godot.Nodes;
|
||||
using Gamesmiths.Forge.Godot.Resources.Abilities;
|
||||
using Gamesmiths.Forge.Statescript;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.scenes.enemies;
|
||||
using Movementtests.scenes.player_controller.scripts;
|
||||
using Movementtests.systems;
|
||||
using Movementtests.tools;
|
||||
using Node = Godot.Node;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_beetle.png"), Meta(typeof(IAutoNode))]
|
||||
@@ -42,14 +40,21 @@ public partial class Enemy : CharacterBody3D,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Signals
|
||||
|
||||
// Signals and events
|
||||
public event Action<IDamageable, DamageRecord> DamageTaken = null!;
|
||||
public event Action<IHealthable, HealthChangedRecord> HealthChanged = null!;
|
||||
public event Action<IHealthable> HealthDepleted = null!;
|
||||
public event Action<IHealthable, HealthChangedRecord> HealthChanged = null!;
|
||||
public event Action<IHealthable> HealthDepleted = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inspector
|
||||
|
||||
// Public export components
|
||||
[Export]
|
||||
public Node3D? Target { get; set; }
|
||||
[Export] public required ForgeAbilityData HitAbility { get; set; }
|
||||
|
||||
[Export]
|
||||
public float EnemyHeight { get; set; } = 1f;
|
||||
@@ -72,8 +77,10 @@ public partial class Enemy : CharacterBody3D,
|
||||
|
||||
[ExportGroup("Movement")]
|
||||
[Export]
|
||||
public RMovement? RMovement { get; set; }
|
||||
public IMoveable CMovement { get; set; } = null!;
|
||||
public required RMovement RMovement { get; set; }
|
||||
public required IMoveable CMovement { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
// Public stuff
|
||||
public float CurrentHealth
|
||||
@@ -81,45 +88,48 @@ public partial class Enemy : CharacterBody3D,
|
||||
get => CHealth.CurrentHealth;
|
||||
set => CHealth.CurrentHealth = value;
|
||||
}
|
||||
|
||||
|
||||
#region IForgeEntity
|
||||
|
||||
// Perfectly forward the IForgeEntity interface to the ForgeEntity component
|
||||
public EntityAttributes Attributes
|
||||
{
|
||||
get => _forgeEntity.Attributes;
|
||||
set => _forgeEntity.Attributes = value;
|
||||
get => ForgeEntity.Attributes;
|
||||
set => ForgeEntity.Attributes = value;
|
||||
}
|
||||
public EntityTags Tags
|
||||
{
|
||||
get => _forgeEntity.Tags;
|
||||
set => _forgeEntity.Tags = value;
|
||||
get => ForgeEntity.Tags;
|
||||
set => ForgeEntity.Tags = value;
|
||||
}
|
||||
public EffectsManager EffectsManager
|
||||
{
|
||||
get => _forgeEntity.EffectsManager;
|
||||
set => _forgeEntity.EffectsManager = value;
|
||||
get => ForgeEntity.EffectsManager;
|
||||
set => ForgeEntity.EffectsManager = value;
|
||||
}
|
||||
public EntityAbilities Abilities
|
||||
{
|
||||
get => _forgeEntity.Abilities;
|
||||
set => _forgeEntity.Abilities = value;
|
||||
get => ForgeEntity.Abilities;
|
||||
set => ForgeEntity.Abilities = value;
|
||||
}
|
||||
public EventManager Events
|
||||
{
|
||||
get => _forgeEntity.Events;
|
||||
set => _forgeEntity.Events = value;
|
||||
get => ForgeEntity.Events;
|
||||
set => ForgeEntity.Events = value;
|
||||
}
|
||||
|
||||
[Export] public ForgeAbilityData? HitAbility;
|
||||
|
||||
#endregion
|
||||
|
||||
public Variables SharedVariables { get; }
|
||||
|
||||
// Private stuff
|
||||
private Area3D _damageBox = null!;
|
||||
internal Node3D _target = null!;
|
||||
private ResourceBar _resourceBar = null!;
|
||||
private ForgeEntity _forgeEntity;
|
||||
[Node("DamageBox")] public required Area3D DamageBox { get; set;}
|
||||
[Node("CTarget")] public required Node3D TargetComponent { get; set;}
|
||||
[Node("CHealthBar")] public required CHealthbar HealthBarWrapper { get; set;}
|
||||
[Node("ForgeEntity")] public required ForgeEntity ForgeEntity { get; set;}
|
||||
|
||||
private AbilityHandle? _hitAbilityHandle;
|
||||
private EntityAttribute _healthAttribute;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
@@ -129,39 +139,38 @@ public partial class Enemy : CharacterBody3D,
|
||||
|
||||
public void Init()
|
||||
{
|
||||
_damageBox = GetNode<Area3D>("DamageBox");
|
||||
_target = GetNode<Node3D>("CTarget");
|
||||
_forgeEntity = GetNode<ForgeEntity>("ForgeEntity");
|
||||
CMovement = GetNode<Node>("CMovement") as IMoveable ?? throw new Exception("Movement component not found");
|
||||
CMovement.RMovement = RMovement;
|
||||
_healthAttribute = Attributes["EnemyAttributeSet.Health"];
|
||||
|
||||
CDamageable = (GetNode<Node>("CDamageable") as IDamageable)!;
|
||||
CMovement = (GetNode<Node>("CMovement") as IMoveable)!;
|
||||
CHealth = (GetNode<Node>("CHealth") as IHealthable)!;
|
||||
CKnockback = (GetNode<Node>("CKnockback") as IKnockbackable)!;
|
||||
|
||||
_resourceBar = GetNode<CHealthbar>("CHealthBar").ResourceBar;
|
||||
|
||||
CMovement.RMovement = RMovement;
|
||||
CHealth.RHealth = RHealth;
|
||||
CHealth.CurrentHealth = RHealth.StartingHealth;
|
||||
CKnockback.RKnockback = RKnockback;
|
||||
|
||||
if (HitAbility != null)
|
||||
_hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
_hitAbilityHandle = Abilities.GrantAbilityPermanently(HitAbility.GetAbilityData(), 1, LevelComparison.None, this);
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
HealthBarWrapper.ResourceBar.Init(_healthAttribute);
|
||||
// CuesManager.RegisterCue(Tag.RequestTag(TagsManager, "cues.enemy.health"), HealthBarWrapper.ResourceBar);
|
||||
|
||||
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.hit"),
|
||||
data => {GD.Print("Hit!");});
|
||||
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.damage"), OnDamageReceived);
|
||||
Events.Subscribe(Tag.RequestTag(TagsManager, "events.combat.death"), OnDeath);
|
||||
}
|
||||
|
||||
public void SetupSignals()
|
||||
{
|
||||
// Anonymous function call to erase return values of ReduceHealth
|
||||
CDamageable.DamageTaken += (source, record) => ReduceHealth(source, record);
|
||||
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||
CHealth.HealthDepleted += Kill;
|
||||
HealthChanged += (_, record) => _resourceBar.SetValue(record.CurrentHealth);
|
||||
// CDamageable.DamageTaken += (source, record) => ReduceHealth(source, record);
|
||||
// CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
|
||||
// CHealth.HealthDepleted += Kill;
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
@@ -188,7 +197,7 @@ public partial class Enemy : CharacterBody3D,
|
||||
{
|
||||
if (IsStunned || _hitAbilityHandle == null) return;
|
||||
|
||||
var bodies = _damageBox.GetOverlappingBodies();
|
||||
var bodies = DamageBox.GetOverlappingBodies();
|
||||
foreach (var body in bodies)
|
||||
{
|
||||
if (body is not IForgeEntity forgeEntity) continue;
|
||||
@@ -196,16 +205,40 @@ public partial class Enemy : CharacterBody3D,
|
||||
if (!canActivate) return;
|
||||
|
||||
_hitAbilityHandle.Activate(out var _, forgeEntity);
|
||||
|
||||
// if(body is IDamageable spawnable)
|
||||
// spawnable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 ComputeVelocity(MovementInputs inputs)
|
||||
{
|
||||
if (CMovement is null) return Vector3.Zero;
|
||||
return CMovement.ComputeVelocity(inputs);
|
||||
return CMovement is null ? Vector3.Zero : CMovement.ComputeVelocity(inputs);
|
||||
}
|
||||
|
||||
public void OnDamageReceived(EventData data)
|
||||
{
|
||||
var newHealth = _healthAttribute.CurrentValue + data.EventMagnitude;
|
||||
if (newHealth > _healthAttribute.Min) return;
|
||||
|
||||
Events.Raise(new EventData
|
||||
{
|
||||
EventTags = Tag.RequestTag(TagsManager, "events.combat.death").GetSingleTagContainer()!,
|
||||
Source = data.Source,
|
||||
Target = data.Target
|
||||
});
|
||||
}
|
||||
|
||||
public void OnDeath(EventData data)
|
||||
{
|
||||
// Remove weapon that might be planted there
|
||||
foreach (var child in GetChildren())
|
||||
{
|
||||
if (child is not WeaponSystem system) continue;
|
||||
CallDeferred(Node.MethodName.RemoveChild, system);
|
||||
GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, system);
|
||||
system.CallDeferred(Node3D.MethodName.SetGlobalPosition, GlobalPosition + Vector3.Up*EnemyHeight);
|
||||
system.CallDeferred(WeaponSystem.MethodName.RethrowWeapon);
|
||||
}
|
||||
|
||||
CallDeferred(Node.MethodName.QueueFree);
|
||||
}
|
||||
|
||||
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||
@@ -267,7 +300,7 @@ public partial class Enemy : CharacterBody3D,
|
||||
|
||||
public Vector3 GetTargetGlobalPosition()
|
||||
{
|
||||
return _target == null ? GlobalPosition : _target.GlobalPosition;
|
||||
return TargetComponent == null ? GlobalPosition : TargetComponent.GlobalPosition;
|
||||
}
|
||||
|
||||
// Stun management
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/Enemy.cs" id="1_q8l7o"]
|
||||
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://scenes/components/damage/RDamageModifier.cs" id="2_1bsgx"]
|
||||
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="2_46wn3"]
|
||||
[ext_resource type="Resource" uid="uid://dg1xbjhyhgnnk" path="res://scenes/enemies/flying_enemy/flying_enemy_health.tres" id="2_ma2bq"]
|
||||
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
||||
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="4_dejyg"]
|
||||
@@ -22,11 +23,6 @@ script = ExtResource("7_46wn3")
|
||||
ContainerTags = Array[String](["character.enemy"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_oj1ws"]
|
||||
script = ExtResource("8_46wn3")
|
||||
Default = 50
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_wxisp"]
|
||||
script = ExtResource("8_46wn3")
|
||||
Default = 2
|
||||
@@ -39,7 +35,7 @@ Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_hf6k8"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_46wn3"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_jnv07"]
|
||||
@@ -81,6 +77,7 @@ collision_layer = 16
|
||||
collision_mask = 273
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_q8l7o")
|
||||
HitAbility = ExtResource("2_46wn3")
|
||||
EnemyHeight = 0.5
|
||||
RHealth = ExtResource("2_ma2bq")
|
||||
DeathEffects = Array[Object]([])
|
||||
@@ -97,7 +94,8 @@ metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
||||
script = ExtResource("7_2digf")
|
||||
AttributeSetClass = "EnemyAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("8_46wn3")]({
|
||||
"Health": SubResource("Resource_oj1ws"),
|
||||
"Health": Object(RefCounted,"script":ExtResource("8_46wn3"),"Default":50,"Min":0,"Max":50)
|
||||
,
|
||||
"Speed": SubResource("Resource_wxisp"),
|
||||
"Strength": SubResource("Resource_yk4hc")
|
||||
})
|
||||
@@ -110,7 +108,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||
|
||||
[node name="CHealthBar" parent="." unique_id=1635725931 instance=ExtResource("7_ykkxn")]
|
||||
transform = Transform3D(0.3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.70000005, 0)
|
||||
texture = SubResource("ViewportTexture_hf6k8")
|
||||
texture = SubResource("ViewportTexture_46wn3")
|
||||
|
||||
[node name="CDamageable" type="Node" parent="." unique_id=1785297232]
|
||||
script = ExtResource("8_uotso")
|
||||
|
||||
@@ -6,203 +6,23 @@
|
||||
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://scenes/components/damage/RDamageModifier.cs" id="2_r3cnf"]
|
||||
[ext_resource type="Resource" uid="uid://bohbojc68j7y1" path="res://scenes/enemies/grounded_enemy/grounded_enemy_health.tres" id="2_w4lm8"]
|
||||
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="4_na24f"]
|
||||
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="6_4jf2q"]
|
||||
[ext_resource type="Resource" uid="uid://cw2ytd34jsxj" path="res://forge/resources/tag_containers/status_invincible.tres" id="6_5lf6m"]
|
||||
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="6_jryek"]
|
||||
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="6_msmv1"]
|
||||
[ext_resource type="Resource" uid="uid://bsqvfefpb7jix" path="res://forge/resources/cues/player_health_changed_cue.tres" id="6_oo2a1"]
|
||||
[ext_resource type="Resource" uid="uid://qpdw62ubaclc" path="res://forge/resources/ability_datas/grounded_enemy_hit.tres" id="6_4jf2q"]
|
||||
[ext_resource type="Script" uid="uid://8uj04dfe8oql" path="res://addons/forge/nodes/ForgeEntity.cs" id="6_x50ya"]
|
||||
[ext_resource type="Script" uid="uid://cxihb42t2mfqi" path="res://addons/forge/nodes/ForgeAttributeSet.cs" id="6_yk4hc"]
|
||||
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/components/damage/CDamageable.cs" id="7_1tw73"]
|
||||
[ext_resource type="Script" uid="uid://b0eq12mjqfage" path="res://addons/forge/resources/components/TargetTagRequirements.cs" id="7_5eesh"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwx2um43k0ou4" path="res://scenes/components/health/CHealthbar.tscn" id="7_18xwy"]
|
||||
[ext_resource type="Script" uid="uid://cw525n4mjqgw0" path="res://addons/forge/resources/ForgeTagContainer.cs" id="7_f22p3"]
|
||||
[ext_resource type="Script" uid="uid://2gm1hdhi8u08" path="res://addons/forge/resources/magnitudes/ForgeModifierMagnitude.cs" id="7_msmv1"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/components/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
||||
[ext_resource type="Script" uid="uid://ccovd5i0wr3kk" path="res://addons/forge/editor/attributes/AttributeValues.cs" id="7_x50ya"]
|
||||
[ext_resource type="Script" uid="uid://bdfcavbjyhxxa" path="res://addons/forge/resources/ForgeModifier.cs" id="8_3gkmr"]
|
||||
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://scenes/components/movement/RMovement.cs" id="8_6d4gl"]
|
||||
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="8_m0osh"]
|
||||
[ext_resource type="Script" uid="uid://br7ut4lbau66w" path="res://forge/calculators/ForgeRaiseEventTagExecution.cs" id="8_q86ag"]
|
||||
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="9_3gkmr"]
|
||||
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="10_jqqi6"]
|
||||
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
|
||||
[ext_resource type="Script" uid="uid://dngf30hxy5go4" path="res://addons/forge/resources/components/ModifierTags.cs" id="12_3gkmr"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nt1hl"]
|
||||
script = ExtResource("7_5eesh")
|
||||
ApplicationIgnoredTags = ExtResource("6_5lf6m")
|
||||
metadata/_custom_type_script = "uid://b0eq12mjqfage"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f35o6"]
|
||||
script = ExtResource("7_f22p3")
|
||||
ContainerTags = Array[String](["events.combat.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_46obe"]
|
||||
script = ExtResource("7_f22p3")
|
||||
ContainerTags = Array[String](["events.combat.damage"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_33a4r"]
|
||||
script = ExtResource("8_q86ag")
|
||||
EventTags = SubResource("Resource_f35o6")
|
||||
TargetEventTags = SubResource("Resource_46obe")
|
||||
metadata/_custom_type_script = "uid://br7ut4lbau66w"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_rjo6h"]
|
||||
script = ExtResource("8_m0osh")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_8qlid"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lbthk"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_hguc3"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ugrvo"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_6406e"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_x0rol"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1s1j3"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = -10.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_khx4r"]
|
||||
script = ExtResource("8_3gkmr")
|
||||
Attribute = "PlayerAttributeSet.Health"
|
||||
ScalableFloat = SubResource("Resource_1s1j3")
|
||||
Coefficient = SubResource("Resource_ugrvo")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_x0rol")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_6406e")
|
||||
CalculatorCoefficient = SubResource("Resource_8qlid")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_hguc3")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_lbthk")
|
||||
metadata/_custom_type_script = "uid://bdfcavbjyhxxa"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xmw7i"]
|
||||
script = ExtResource("8_m0osh")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_lj45k"]
|
||||
script = ExtResource("9_3gkmr")
|
||||
Name = "SimpleHitEffect"
|
||||
Modifiers = Array[Object]([SubResource("Resource_khx4r")])
|
||||
Components = [SubResource("Resource_nt1hl")]
|
||||
Executions = [SubResource("Resource_33a4r")]
|
||||
StackLimit = SubResource("Resource_xmw7i")
|
||||
InitialStack = SubResource("Resource_rjo6h")
|
||||
Cues = [ExtResource("6_oo2a1")]
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_m0osh"]
|
||||
script = ExtResource("6_msmv1")
|
||||
DamageEffect = SubResource("Resource_lj45k")
|
||||
Name = "Simple hit"
|
||||
Description = "This is a simple hit from an enemy"
|
||||
metadata/_custom_type_script = "uid://n6efm5o4uxvr"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_msmv1"]
|
||||
script = ExtResource("7_f22p3")
|
||||
ContainerTags = Array[String](["status.stunned"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xdbds"]
|
||||
script = ExtResource("7_f22p3")
|
||||
ContainerTags = Array[String](["cooldown.enemy.hit"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gna8g"]
|
||||
script = ExtResource("12_3gkmr")
|
||||
TagsToAdd = SubResource("Resource_xdbds")
|
||||
metadata/_custom_type_script = "uid://dngf30hxy5go4"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_oo2a1"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_q86ag"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5eesh"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5lf6m"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bv3hg"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_tb7hu"]
|
||||
script = ExtResource("6_jryek")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bw6ul"]
|
||||
script = ExtResource("6_jryek")
|
||||
BaseValue = 1.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_g5uhf"]
|
||||
script = ExtResource("7_msmv1")
|
||||
ScalableFloat = SubResource("Resource_bw6ul")
|
||||
Coefficient = SubResource("Resource_5lf6m")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_tb7hu")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_bv3hg")
|
||||
CalculatorCoefficient = SubResource("Resource_oo2a1")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_5eesh")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_q86ag")
|
||||
metadata/_custom_type_script = "uid://2gm1hdhi8u08"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vl5ta"]
|
||||
script = ExtResource("8_m0osh")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_82a7m"]
|
||||
script = ExtResource("8_m0osh")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_0gdnn"]
|
||||
script = ExtResource("9_3gkmr")
|
||||
Name = "HitCooldown"
|
||||
Modifiers = []
|
||||
Components = [SubResource("Resource_gna8g")]
|
||||
Executions = []
|
||||
DurationType = 2
|
||||
Duration = SubResource("Resource_g5uhf")
|
||||
StackLimit = SubResource("Resource_82a7m")
|
||||
InitialStack = SubResource("Resource_vl5ta")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ub34u"]
|
||||
script = ExtResource("6_4jf2q")
|
||||
Name = "Hit"
|
||||
CooldownEffects = [SubResource("Resource_0gdnn")]
|
||||
AbilityBehavior = SubResource("Resource_m0osh")
|
||||
ActivationBlockedTags = SubResource("Resource_msmv1")
|
||||
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4jf2q"]
|
||||
script = ExtResource("7_f22p3")
|
||||
ContainerTags = Array[String](["character.enemy"])
|
||||
metadata/_custom_type_script = "uid://cw525n4mjqgw0"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f22p3"]
|
||||
script = ExtResource("7_x50ya")
|
||||
Default = 100
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="Resource" id="Resource_x50ya"]
|
||||
script = ExtResource("7_x50ya")
|
||||
Default = 1
|
||||
@@ -215,7 +35,7 @@ Default = 1
|
||||
Min = 1
|
||||
Max = 100
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_5lf6m"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_4jf2q"]
|
||||
viewport_path = NodePath("SubViewport")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qj0ob"]
|
||||
@@ -257,13 +77,13 @@ radius = 2.0
|
||||
collision_layer = 16
|
||||
collision_mask = 273
|
||||
script = ExtResource("1_r6506")
|
||||
HitAbility = ExtResource("6_4jf2q")
|
||||
EnemyHeight = 2.0
|
||||
RHealth = ExtResource("2_w4lm8")
|
||||
DeathEffects = Array[Object]([])
|
||||
RDamage = ExtResource("2_bn56u")
|
||||
RKnockback = ExtResource("11_8k3xb")
|
||||
RMovement = ExtResource("4_na24f")
|
||||
HitAbility = SubResource("Resource_ub34u")
|
||||
|
||||
[node name="ForgeEntity" type="Node" parent="." unique_id=432521027]
|
||||
script = ExtResource("6_x50ya")
|
||||
@@ -274,7 +94,8 @@ metadata/_custom_type_script = "uid://8uj04dfe8oql"
|
||||
script = ExtResource("6_yk4hc")
|
||||
AttributeSetClass = "EnemyAttributeSet"
|
||||
InitialAttributeValues = Dictionary[String, ExtResource("7_x50ya")]({
|
||||
"Health": SubResource("Resource_f22p3"),
|
||||
"Health": Object(RefCounted,"script":ExtResource("7_x50ya"),"Default":100,"Min":0,"Max":100)
|
||||
,
|
||||
"Speed": SubResource("Resource_x50ya"),
|
||||
"Strength": SubResource("Resource_yk4hc")
|
||||
})
|
||||
@@ -287,7 +108,7 @@ metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||
|
||||
[node name="CHealthBar" parent="." unique_id=1278247727 instance=ExtResource("7_18xwy")]
|
||||
transform = Transform3D(0.4, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2, 0)
|
||||
texture = SubResource("ViewportTexture_5lf6m")
|
||||
texture = SubResource("ViewportTexture_4jf2q")
|
||||
|
||||
[node name="CDamageable" type="Node" parent="." unique_id=1601518000]
|
||||
script = ExtResource("7_1tw73")
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
|
||||
[ext_resource type="Resource" uid="uid://bjyd801wvverk" path="res://scenes/player_controller/resources/player_health.tres" id="4_m8gvy"]
|
||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://dgjsi1my7nlnk" path="res://forge/resources/ability_datas/player_hit.tres" id="4_u8yay"]
|
||||
[ext_resource type="Resource" uid="uid://dh437cuxgjv6b" path="res://forge/resources/effect_datas/mana_regeneration.tres" id="5_2rkt1"]
|
||||
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
||||
[ext_resource type="PackedScene" uid="uid://hpsg4fqwrx1u" path="res://scenes/components/damage/CDamageable.tscn" id="5_jb43f"]
|
||||
@@ -131,6 +132,9 @@ height = 1.0
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_abfq8"]
|
||||
radius = 2.0
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ue7xq"]
|
||||
radius = 1.5
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_cmijs"]
|
||||
radius = 1.0
|
||||
|
||||
@@ -141,9 +145,6 @@ height = 3.5
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_nob5r"]
|
||||
radius = 0.4
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_ue7xq"]
|
||||
radius = 1.5
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||
blend_mode = 1
|
||||
|
||||
@@ -156,6 +157,7 @@ script = ExtResource("1_poq2x")
|
||||
BaseTags = SubResource("Resource_mpigw")
|
||||
EmpoweredActionUsed = SubResource("Resource_5gbhg")
|
||||
InvincibleTag = SubResource("Resource_2rkt1")
|
||||
HitAbility = ExtResource("4_u8yay")
|
||||
EmpoweredActionAbility = ExtResource("10_2rkt1")
|
||||
DefaultGrantedAbilities = [ExtResource("5_u8yay")]
|
||||
DefaultPermanentEffects = [ExtResource("5_2rkt1")]
|
||||
@@ -236,12 +238,6 @@ stream = ExtResource("9_jb43f")
|
||||
autoplay = true
|
||||
bus = &"SFX"
|
||||
|
||||
[node name="WallRunSnapper" type="RayCast3D" parent="." unique_id=1342764801]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||
target_position = Vector3(0, 0, -5)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="InputController" type="Node3D" parent="." unique_id=846069741]
|
||||
script = ExtResource("16_v31n3")
|
||||
base_mode = ExtResource("3_cresl")
|
||||
@@ -412,6 +408,16 @@ target_position = Vector3(0, 0, 0)
|
||||
max_results = 512
|
||||
collision_mask = 16
|
||||
|
||||
[node name="SlidingEnemyDetector" type="Area3D" parent="." unique_id=42873532]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="SlidingEnemyDetector" unique_id=1287455053]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("SphereShape3D_ue7xq")
|
||||
|
||||
[node name="CloseEnemyDetector" type="ShapeCast3D" parent="." unique_id=2109861596]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
|
||||
@@ -425,6 +431,10 @@ target_position = Vector3(0, 0, -6)
|
||||
collision_mask = 112
|
||||
collide_with_areas = true
|
||||
|
||||
[node name="DirectGroundDetector" type="RayCast3D" parent="." unique_id=1037335553]
|
||||
target_position = Vector3(0, -2, 0)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="GroundDetector" type="ShapeCast3D" parent="." unique_id=1681055424]
|
||||
shape = SubResource("CapsuleShape3D_6lejt")
|
||||
collision_mask = 256
|
||||
@@ -436,20 +446,6 @@ shape = SubResource("SphereShape3D_nob5r")
|
||||
target_position = Vector3(0, 0.4, 0)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="DirectGroundDetector" type="RayCast3D" parent="." unique_id=1037335553]
|
||||
target_position = Vector3(0, -2, 0)
|
||||
collision_mask = 256
|
||||
|
||||
[node name="SlidingEnemyDetector" type="Area3D" parent="." unique_id=42873532]
|
||||
collision_layer = 0
|
||||
collision_mask = 16
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="SlidingEnemyDetector" unique_id=1287455053]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("SphereShape3D_ue7xq")
|
||||
|
||||
[node name="InvincibilityTime" type="Timer" parent="." unique_id=1244463585]
|
||||
one_shot = true
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ public partial class PlayerUi : Control
|
||||
|
||||
[Dependency]
|
||||
public TagsManager TagsManager => this.DependOn<TagsManager>();
|
||||
[Dependency]
|
||||
public CuesManager CuesManager => this.DependOn<CuesManager>();
|
||||
|
||||
#region Utils
|
||||
|
||||
@@ -58,8 +60,8 @@ public partial class PlayerUi : Control
|
||||
public void OnResolved()
|
||||
{
|
||||
if (_health == null || _mana == null) throw new Exception("Health and mana attributes are not set");
|
||||
Healthbar.Init(_health, Tag.RequestTag(TagsManager, "cues.resources.health"));
|
||||
Manabar.Init(_mana, Tag.RequestTag(TagsManager, "cues.resources.mana"));
|
||||
Healthbar.Init(_health);
|
||||
Manabar.Init(_mana);
|
||||
}
|
||||
|
||||
public void SetEnemyTargetProperties(TargetProperties targetProperties)
|
||||
|
||||
@@ -372,7 +372,7 @@ tracks/3/keys = {
|
||||
}
|
||||
tracks/4/type = "method"
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/path = NodePath("../..")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
|
||||
@@ -116,12 +116,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
#region Privates
|
||||
|
||||
private StateChart _weaponState = null!;
|
||||
private Transition _handToFlying = null!;
|
||||
private Transition _flyingToHand = null!;
|
||||
private Transition _plantedToHand = null!;
|
||||
private Transition _plantedToFlying = null!;
|
||||
private Transition _toPlanted = null!;
|
||||
private StateChart _weaponState = null!;
|
||||
private Transition _handToFlying = null!;
|
||||
private Transition _flyingToHand = null!;
|
||||
private Transition _plantedToHand = null!;
|
||||
private Transition _plantedToFlying = null!;
|
||||
private Transition _toPlanted = null!;
|
||||
|
||||
private ShapeCast3D _dashCast3D = null!;
|
||||
|
||||
@@ -177,17 +177,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
WeaponFlyingAbilityTag = Tag.RequestTag(tagsManager,"abilities.weapon.flying");
|
||||
|
||||
List<AttributeSet> attributeSetList = [];
|
||||
foreach (Node node in GetChildren())
|
||||
foreach (var node in GetChildren())
|
||||
{
|
||||
if (node is ForgeAttributeSet attributeSetNode)
|
||||
{
|
||||
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
|
||||
|
||||
if (attributeSet is not null)
|
||||
{
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
}
|
||||
if (node is not ForgeAttributeSet attributeSetNode) continue;
|
||||
var attributeSet = attributeSetNode.GetAttributeSet();
|
||||
if (attributeSet is not null)
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
||||
|
||||
@@ -458,6 +453,7 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Abilities.UpdateAbilities(delta);
|
||||
EffectsManager.UpdateEffects(delta);
|
||||
|
||||
if (!FlyingState.Active) return;
|
||||
|
||||
@@ -61,6 +61,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
#region Forge
|
||||
|
||||
private AbilityHandle? _empoweredActionHandle;
|
||||
private AbilityHandle? _hitAbilityHandle;
|
||||
public required EntityAttribute HealthAttribute { get; set; }
|
||||
public required EntityAttribute ManaAttribute { get; set; }
|
||||
|
||||
@@ -103,12 +104,12 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
#region Publics
|
||||
|
||||
public EntityAttributes Attributes { get; set; } = null!;
|
||||
public EntityTags Tags { get; set; } = null!;
|
||||
public EffectsManager EffectsManager { get; set; } = null!;
|
||||
public EntityAbilities Abilities { get; set; } = null!;
|
||||
public EventManager Events { get; set; } = null!;
|
||||
public Variables SharedVariables { get; }
|
||||
public required EntityAttributes Attributes { get; set; }
|
||||
public required EntityTags Tags { get; set; }
|
||||
public required EffectsManager EffectsManager { get; set; }
|
||||
public required EntityAbilities Abilities { get; set; }
|
||||
public required EventManager Events { get; set; }
|
||||
public required Variables SharedVariables { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -125,7 +126,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
[ExportGroup("Abilities")]
|
||||
[ExportSubgroup("Common and defaults")]
|
||||
[Export] public ForgeAbilityData? EmpoweredActionAbility;
|
||||
[Export] public required ForgeAbilityData HitAbility { get; set; }
|
||||
[Export] public required ForgeAbilityData EmpoweredActionAbility { get; set; }
|
||||
[Export] public ForgeAbilityData[] DefaultGrantedAbilities = [];
|
||||
|
||||
[ExportGroup("Effects")]
|
||||
@@ -443,7 +445,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
}
|
||||
|
||||
// Damage dealing
|
||||
private readonly List<IDamageable> _hitEnemies = new List<IDamageable>();
|
||||
private readonly List<IForgeEntity> _hitEnemies = [];
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -454,17 +456,12 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
// General use stuff
|
||||
List<AttributeSet> attributeSetList = [];
|
||||
foreach (Node node in GetChildren())
|
||||
foreach (var node in GetChildren())
|
||||
{
|
||||
if (node is ForgeAttributeSet attributeSetNode)
|
||||
{
|
||||
AttributeSet? attributeSet = attributeSetNode.GetAttributeSet();
|
||||
|
||||
if (attributeSet is not null)
|
||||
{
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
}
|
||||
if (node is not ForgeAttributeSet attributeSetNode) continue;
|
||||
var attributeSet = attributeSetNode.GetAttributeSet();
|
||||
if (attributeSet is not null)
|
||||
attributeSetList.Add(attributeSet);
|
||||
}
|
||||
Attributes = new EntityAttributes([.. attributeSetList]);
|
||||
HealthAttribute = Attributes["PlayerAttributeSet.Health"];
|
||||
@@ -682,21 +679,31 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
}
|
||||
|
||||
#region LifecycleManagement
|
||||
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
base._ExitTree();
|
||||
|
||||
ForgeManagers.Instance.CuesManager.UnregisterCue(Tag.RequestTag(TagsManager, "cues.resources.health"), this);
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
#region Forge
|
||||
EffectsManager = new EffectsManager(this, CuesManager);
|
||||
CuesManager.RegisterCue(Tag.RequestTag(TagsManager, "cues.resources.health"), this);
|
||||
|
||||
if (EmpoweredActionAbility != null)
|
||||
{
|
||||
_empoweredActionHandle = Abilities.GrantAbilityPermanently(
|
||||
EmpoweredActionAbility.GetAbilityData(),
|
||||
abilityLevel: 1,
|
||||
levelOverridePolicy: LevelComparison.None,
|
||||
sourceEntity: this);
|
||||
}
|
||||
|
||||
_hitAbilityHandle = Abilities.GrantAbilityPermanently(
|
||||
HitAbility.GetAbilityData(),
|
||||
abilityLevel: 1,
|
||||
levelOverridePolicy: LevelComparison.None,
|
||||
sourceEntity: this);
|
||||
|
||||
_empoweredActionHandle = Abilities.GrantAbilityPermanently(
|
||||
EmpoweredActionAbility.GetAbilityData(),
|
||||
abilityLevel: 1,
|
||||
levelOverridePolicy: LevelComparison.None,
|
||||
sourceEntity: this);
|
||||
|
||||
foreach (var defaultGrantedAbility in DefaultGrantedAbilities)
|
||||
{
|
||||
@@ -713,6 +720,10 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
EffectsManager.ApplyEffect(new Effect(effect.GetEffectData(), new EffectOwnership(this, this)));
|
||||
}
|
||||
|
||||
// Apply children node effects
|
||||
// var effectApplier = new EffectApplier(this);
|
||||
// effectApplier.ApplyEffects(this, this, this);
|
||||
|
||||
// Subscribe default empowered actions effects to the Empowered Action Used event
|
||||
foreach (var effect in EmpoweredActionEffects)
|
||||
{
|
||||
@@ -1924,9 +1935,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
public void EnemyHitWhileSliding(Node enemy)
|
||||
{
|
||||
if(enemy is not IDamageable damageable)
|
||||
if(enemy is not IForgeEntity entity)
|
||||
return;
|
||||
_hitEnemies.Add(damageable);
|
||||
_hitEnemies.Add(entity);
|
||||
TriggerDamage();
|
||||
}
|
||||
|
||||
@@ -2145,8 +2156,8 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
for (var i = 0; i < DashDamageDetector.GetCollisionCount(); i++)
|
||||
{
|
||||
var collidedObject = DashDamageDetector.GetCollider(i);
|
||||
if (collidedObject is not IDamageable damageable) continue;
|
||||
_hitEnemies.Add(damageable);
|
||||
if (collidedObject is not IForgeEntity entity) continue;
|
||||
_hitEnemies.Add(entity);
|
||||
}
|
||||
TriggerDamage();
|
||||
|
||||
@@ -2296,9 +2307,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
public void ManageAttackedEnemyPostDash(Node? enemy)
|
||||
{
|
||||
if (enemy is IDamageable damageable)
|
||||
if (enemy is IForgeEntity entity)
|
||||
{
|
||||
_hitEnemies.Add(damageable);
|
||||
_hitEnemies.Add(entity);
|
||||
TriggerDamage();
|
||||
}
|
||||
if (enemy is IStunnable stunnable)
|
||||
@@ -2332,9 +2343,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
LookAround(delta);
|
||||
}
|
||||
|
||||
// private float _oldMana = 100;
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Abilities.UpdateAbilities(delta);
|
||||
EffectsManager.UpdateEffects(delta);
|
||||
}
|
||||
|
||||
@@ -2478,9 +2489,9 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
public void StopDashAction()
|
||||
{
|
||||
if (_targetObject is IDamageable damageable)
|
||||
if (_targetObject is IForgeEntity entity)
|
||||
{
|
||||
_hitEnemies.Add(damageable);
|
||||
_hitEnemies.Add(entity);
|
||||
TriggerDamage();
|
||||
}
|
||||
if (_targetObject is IStunnable stunnable)
|
||||
@@ -2536,9 +2547,12 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
return;
|
||||
}
|
||||
if (!WeaponSystem.InHandState.Active) return;
|
||||
|
||||
if (_hitAbilityHandle is null) return;
|
||||
if (!_hitAbilityHandle.CanActivate(out _)) return;
|
||||
|
||||
var attackToDo = _isEnemyInDashAttackRange ? "dash_attack" : "standard_attack";
|
||||
_playerState.SendEvent(attackToDo);
|
||||
_playerState.SendEvent("standard_attack");
|
||||
}
|
||||
|
||||
public void ResetAttackCooldown()
|
||||
@@ -2559,16 +2573,27 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
|
||||
public void RegisterHitEnnemy(Node3D body)
|
||||
{
|
||||
if (body is not IDamageable damageable) return;
|
||||
_hitEnemies.Add(damageable);
|
||||
if (body is not IForgeEntity entity) return;
|
||||
_hitEnemies.Add(entity);
|
||||
// return;
|
||||
// if (body is not IDamageable damageable) return;
|
||||
// _hitEnemies.Add(damageable);
|
||||
}
|
||||
|
||||
public void TriggerDamage()
|
||||
{
|
||||
if (_hitEnemies.Count == 0) return;
|
||||
|
||||
foreach (var damageable in _hitEnemies)
|
||||
damageable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
|
||||
if (_hitAbilityHandle is null) return;
|
||||
|
||||
if (!_hitAbilityHandle.CanActivate(out _)) return;
|
||||
|
||||
foreach (var entity in _hitEnemies)
|
||||
{
|
||||
// TODO: WTF why doesn't health move
|
||||
// GD.Print(entity.Attributes["EnemyAttributeSet.Health"].CurrentValue);
|
||||
_hitAbilityHandle.Activate(out _, entity);
|
||||
}
|
||||
_hitEnemies.Clear();
|
||||
|
||||
HeadSystem.OnHitTarget();
|
||||
@@ -2587,12 +2612,6 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
{
|
||||
ResetTimeScale();
|
||||
}
|
||||
public HealthChangedRecord ReduceHealth(IDamageable source, DamageRecord damageRecord)
|
||||
{
|
||||
// var record = CHealth!.ReduceHealth(source, damageRecord);
|
||||
// HealthChanged?.Invoke(this, record);
|
||||
return new HealthChangedRecord(100, 0, 100);
|
||||
}
|
||||
public void RegisterKnockback(KnockbackRecord knockbackRecord)
|
||||
{
|
||||
// CKnockback!.RegisterKnockback(knockbackRecord);
|
||||
@@ -2609,7 +2628,6 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
{
|
||||
Kill();
|
||||
}
|
||||
|
||||
public void Kill()
|
||||
{
|
||||
HeadSystem.OnStartDeathAnimation();
|
||||
@@ -2635,6 +2653,19 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
|
||||
public void OnDamageReceived(EventData data)
|
||||
{
|
||||
var newHealth = HealthAttribute.CurrentValue + data.EventMagnitude;
|
||||
CuesManager.ExecuteCue(
|
||||
Tag.RequestTag(TagsManager, "cues.resources.health"),
|
||||
this,
|
||||
new CueParameters(
|
||||
(int) data.EventMagnitude,
|
||||
data.EventMagnitude / HealthAttribute.Max,
|
||||
data.Source,
|
||||
new Dictionary<StringKey, object>
|
||||
{
|
||||
{"test", "hello"}
|
||||
})
|
||||
);
|
||||
|
||||
if (newHealth > HealthAttribute.Min) return;
|
||||
|
||||
var tagsManager = TagsManager;
|
||||
|
||||
@@ -9,7 +9,7 @@ using Gamesmiths.Forge.Godot.Core;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_heart.png"), Meta(typeof(IAutoNode))]
|
||||
public partial class ResourceBar : ProgressBar, ICueHandler
|
||||
public partial class ResourceBar : ProgressBar
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -34,16 +34,17 @@ public partial class ResourceBar : ProgressBar, ICueHandler
|
||||
AddThemeStyleboxOverride("fill", BarStyle);
|
||||
}
|
||||
|
||||
public void Init(EntityAttribute attribute, Tag cueTag)
|
||||
public void Init(EntityAttribute attribute)
|
||||
{
|
||||
_currentValue = attribute.BaseValue;
|
||||
MaxValue = attribute.Max;
|
||||
// Should be Max but it's bugged
|
||||
// Therefore we just assume that the base value is the max value, i.e. entities spawn at full health
|
||||
MaxValue = attribute.BaseValue; // MaxValue = attribute.Max;
|
||||
Value = attribute.BaseValue;
|
||||
DamageBar.MaxValue = attribute.Max;
|
||||
DamageBar.Value = attribute.BaseValue;
|
||||
|
||||
var cuesManager = ForgeManagers.Instance.CuesManager;
|
||||
cuesManager.RegisterCue(cueTag, this);
|
||||
|
||||
attribute.OnValueChanged += (entityAttribute, i) => CurrentValue = entityAttribute.CurrentValue;
|
||||
}
|
||||
|
||||
public void SetValue(float newValue)
|
||||
@@ -69,24 +70,4 @@ public partial class ResourceBar : ProgressBar, ICueHandler
|
||||
{
|
||||
DamageBar.Value = _currentValue;
|
||||
}
|
||||
|
||||
public void OnExecute(IForgeEntity? target, CueParameters? parameters)
|
||||
{
|
||||
if (target == null || !parameters.HasValue) return;
|
||||
|
||||
float magnitude = parameters.Value.Magnitude;
|
||||
CurrentValue += magnitude;
|
||||
}
|
||||
|
||||
public void OnApply(IForgeEntity? target, CueParameters? parameters)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnRemove(IForgeEntity? target, bool interrupted)
|
||||
{
|
||||
}
|
||||
|
||||
public void OnUpdate(IForgeEntity? target, CueParameters? parameters)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
using Godot;
|
||||
using GdUnit4;
|
||||
using static GdUnit4.Assertions;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.systems.damage;
|
||||
|
||||
namespace Movementtests.tests;
|
||||
|
||||
[TestSuite, RequireGodotRuntime]
|
||||
public class EnemyUnitTest
|
||||
{
|
||||
[TestCase]
|
||||
public void ComputeDamageNoComponent()
|
||||
{
|
||||
var enemy = new Enemy();
|
||||
var input = new DamageRecord(Vector3.Zero, new RDamage(10.0f, EDamageTypes.Normal));
|
||||
|
||||
var result = enemy.ComputeDamage(input);
|
||||
AssertFloat(result.Damage.DamageDealt).IsEqual(0.0f);
|
||||
}
|
||||
|
||||
[TestCase]
|
||||
public void Unstun()
|
||||
{
|
||||
var enemy = new Enemy();
|
||||
enemy.IsStunned = true;
|
||||
enemy.Unstun();
|
||||
AssertBool(enemy.IsStunned).IsFalse();
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://cojxgcs6xqqoq
|
||||
Reference in New Issue
Block a user