made explosion forge compliant
This commit is contained in:
@@ -22,9 +22,9 @@ public partial class ForgeEntityNode : Node3D, IForgeEntity
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency]
|
||||
public TagsManager TagsManager => this.DependOn<TagsManager>();
|
||||
public TagsManager TagsManager => this.DependOn(() => ForgeManagers.Instance.TagsManager);
|
||||
[Dependency]
|
||||
public CuesManager CuesManager => this.DependOn<CuesManager>();
|
||||
public CuesManager CuesManager => this.DependOn(() => ForgeManagers.Instance.CuesManager);
|
||||
|
||||
[Export]
|
||||
public ForgeTagContainer? BaseTags { get; set; }
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ExplodingSwordBehavior(PackedScene explosion, float radius) : IAbil
|
||||
}
|
||||
explo.Radius = radius;
|
||||
|
||||
owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explo);
|
||||
owner.GetTree().GetCurrentScene().CallDeferred(Node.MethodName.AddChild, explo);
|
||||
explo.CallDeferred(Node3D.MethodName.SetGlobalPosition, owner.GlobalPosition);
|
||||
|
||||
context.AbilityHandle.CommitAbility();
|
||||
|
||||
@@ -6,7 +6,7 @@ using Godot;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public record SimpleHitEffectData(Vector3 SourceLocation, Vector3 TargetLocation);
|
||||
public record SimpleHitEffectData(Vector3 SourceLocation, Vector3 TargetLocation, float Magnitude = 1);
|
||||
|
||||
public class SimpleHitBehavior(ForgeEffectData? damage) : IAbilityBehavior
|
||||
{
|
||||
@@ -16,9 +16,10 @@ public class SimpleHitBehavior(ForgeEffectData? damage) : IAbilityBehavior
|
||||
|
||||
var sourceLocation = (context.Source as Node3D)?.GlobalPosition ?? Vector3.Zero;
|
||||
var targetLocation = (context.Target as Node3D)?.GlobalPosition ?? Vector3.Zero;
|
||||
|
||||
|
||||
var magnitude = context.Magnitude == 0 ? 1 : context.Magnitude;
|
||||
var effect = new Effect(damage.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
|
||||
context.Target.EffectsManager.ApplyEffect(effect, new SimpleHitEffectData(sourceLocation, targetLocation));
|
||||
context.Target.EffectsManager.ApplyEffect(effect, new SimpleHitEffectData(sourceLocation, targetLocation, magnitude));
|
||||
|
||||
// context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
@@ -4,9 +4,11 @@ namespace Movementtests.scenes.enemies;
|
||||
public class MetaAttributeSet : AttributeSet
|
||||
{
|
||||
public EntityAttribute IncomingDamage { get; private set; }
|
||||
public EntityAttribute Level { get; private set; }
|
||||
|
||||
public MetaAttributeSet()
|
||||
{
|
||||
IncomingDamage = InitializeAttribute(nameof(IncomingDamage), 0, 0, 1000, channels: 4);
|
||||
Level = InitializeAttribute(nameof(Level), 1, 1, 1000);
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,8 @@ namespace Movementtests.tools.calculators;
|
||||
|
||||
public enum DamageType
|
||||
{
|
||||
/// <summary>
|
||||
/// Physical damage.
|
||||
/// </summary>
|
||||
Physical = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Magical damage.
|
||||
/// </summary>
|
||||
Magical = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Elemental damage.
|
||||
/// </summary>
|
||||
Elemental = 2,
|
||||
Explosive = 3,
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using Gamesmiths.Forge.Godot.Resources;
|
||||
using Gamesmiths.Forge.Godot.Resources.Calculators;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.forge.abilities;
|
||||
|
||||
namespace Movementtests.tools.calculators;
|
||||
|
||||
@@ -64,9 +65,9 @@ public class DamageExecution : CustomExecution
|
||||
return [.. results];
|
||||
}
|
||||
|
||||
if (effectEvaluatedData?.TryGetContextData(out float multiplier) == true)
|
||||
if (effectEvaluatedData?.TryGetContextData(out SimpleHitEffectData? hitEffectData) == true)
|
||||
{
|
||||
targetIncomingDamage *= multiplier;
|
||||
targetIncomingDamage *= hitEffectData.Magnitude;
|
||||
}
|
||||
|
||||
// Apply health reduction to target if attribute exists
|
||||
|
||||
113
forge/resources/ability_datas/explosion_hit.tres
Normal file
113
forge/resources/ability_datas/explosion_hit.tres
Normal file
@@ -0,0 +1,113 @@
|
||||
[gd_resource type="Resource" script_class="ForgeAbilityData" format=3 uid="uid://nns16d5uhtl8"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://bpovqvlqv5bs5" path="res://forge/resources/effect_components/damageable.tres" id="1_w36j6"]
|
||||
[ext_resource type="Resource" uid="uid://sn6kndc6ukic" path="res://forge/resources/tag_containers/on_damage_dealt.tres" id="2_3ma4g"]
|
||||
[ext_resource type="Resource" uid="uid://5tr54q0rdpho" path="res://forge/resources/tag_containers/on_damage_taken.tres" id="3_kyfqu"]
|
||||
[ext_resource type="Script" uid="uid://cfx62w40nd84v" path="res://forge/calculators/ForgeDamageExecution.cs" id="4_xfamx"]
|
||||
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://scenes/components/knockback/RKnockback.cs" id="5_tw4gc"]
|
||||
[ext_resource type="Resource" uid="uid://bhn27s8ne0uyg" path="res://forge/resources/tag_containers/on_knockback_dealt.tres" id="6_nq3a0"]
|
||||
[ext_resource type="Resource" uid="uid://bkr6uu57wm3o3" path="res://forge/resources/tag_containers/on_knockback_received.tres" id="7_3utx7"]
|
||||
[ext_resource type="Resource" uid="uid://45l7vnfs72b" path="res://forge/resources/tag_containers/knockbackable_tag.tres" id="8_7hfxb"]
|
||||
[ext_resource type="Script" uid="uid://diondfg5xp78h" path="res://forge/calculators/ForgeKnockbackExecution.cs" id="9_lysxe"]
|
||||
[ext_resource type="Script" uid="uid://1hgogislo1l6" path="res://addons/forge/resources/magnitudes/ForgeScalableInt.cs" id="10_sd7ih"]
|
||||
[ext_resource type="Script" uid="uid://cn3b4ya15fg7e" path="res://addons/forge/resources/magnitudes/ForgeScalableFloat.cs" id="11_bs6rs"]
|
||||
[ext_resource type="Script" uid="uid://bdfcavbjyhxxa" path="res://addons/forge/resources/ForgeModifier.cs" id="12_a6jts"]
|
||||
[ext_resource type="Script" uid="uid://b83hf13nj37k3" path="res://addons/forge/resources/ForgeEffectData.cs" id="13_c85am"]
|
||||
[ext_resource type="Texture2D" uid="uid://c2akxlg7tdb67" path="res://assets/ui/IconGodotNode/node/icon_projectile.png" id="14_ow2i8"]
|
||||
[ext_resource type="Script" uid="uid://n6efm5o4uxvr" path="res://forge/abilities/ForgeSimpleHitBehavior.cs" id="15_ki7ct"]
|
||||
[ext_resource type="Script" uid="uid://dhxfbxh54pyxp" path="res://addons/forge/resources/abilities/ForgeAbilityData.cs" id="16_hhyju"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vy8wr"]
|
||||
script = ExtResource("4_xfamx")
|
||||
DamageType = 3
|
||||
DamageDealerEventTags = ExtResource("2_3ma4g")
|
||||
DamageReceiverEventTags = ExtResource("3_kyfqu")
|
||||
metadata/_custom_type_script = "uid://cfx62w40nd84v"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ndb8p"]
|
||||
script = ExtResource("5_tw4gc")
|
||||
Modifier = 100.0
|
||||
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_dy671"]
|
||||
script = ExtResource("9_lysxe")
|
||||
KnockbackableTag = ExtResource("8_7hfxb")
|
||||
Knockback = SubResource("Resource_ndb8p")
|
||||
KnockbackDealerEventTags = ExtResource("6_nq3a0")
|
||||
KnockbackReceiverEventTags = ExtResource("7_3utx7")
|
||||
metadata/_custom_type_script = "uid://diondfg5xp78h"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_i0sj3"]
|
||||
script = ExtResource("10_sd7ih")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_1mvp7"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_jxdlf"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_rslib"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_3l3du"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
BaseValue = 1.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_qqpg8"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
BaseValue = 10.0
|
||||
|
||||
[sub_resource type="Resource" id="Resource_igmn0"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
|
||||
[sub_resource type="Resource" id="Resource_acqnn"]
|
||||
script = ExtResource("11_bs6rs")
|
||||
BaseValue = 50.0
|
||||
metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_xwtie"]
|
||||
script = ExtResource("12_a6jts")
|
||||
Attribute = "MetaAttributeSet.IncomingDamage"
|
||||
CalculationType = 1
|
||||
ScalableFloat = SubResource("Resource_acqnn")
|
||||
CapturedAttribute = "MetaAttributeSet.Level"
|
||||
Coefficient = SubResource("Resource_3l3du")
|
||||
PreMultiplyAdditiveValue = SubResource("Resource_igmn0")
|
||||
PostMultiplyAdditiveValue = SubResource("Resource_qqpg8")
|
||||
CalculatorCoefficient = SubResource("Resource_1mvp7")
|
||||
CalculatorPreMultiplyAdditiveValue = SubResource("Resource_rslib")
|
||||
CalculatorPostMultiplyAdditiveValue = SubResource("Resource_jxdlf")
|
||||
metadata/_custom_type_script = "uid://bdfcavbjyhxxa"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ikb7l"]
|
||||
script = ExtResource("10_sd7ih")
|
||||
BaseValue = 1
|
||||
|
||||
[sub_resource type="Resource" id="Resource_jdvg8"]
|
||||
script = ExtResource("13_c85am")
|
||||
Name = "Explosion hit"
|
||||
Modifiers = Array[Object]([SubResource("Resource_xwtie")])
|
||||
Components = Array[Object]([ExtResource("1_w36j6")])
|
||||
Executions = Array[Object]([SubResource("Resource_vy8wr"), SubResource("Resource_dy671")])
|
||||
StackLimit = SubResource("Resource_ikb7l")
|
||||
InitialStack = SubResource("Resource_i0sj3")
|
||||
Cues = []
|
||||
metadata/_custom_type_script = "uid://b83hf13nj37k3"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ba5lh"]
|
||||
script = ExtResource("15_ki7ct")
|
||||
DamageEffect = SubResource("Resource_jdvg8")
|
||||
Name = "Explostion hit"
|
||||
Description = "Called by explosion scene"
|
||||
Icon = ExtResource("14_ow2i8")
|
||||
metadata/_custom_type_script = "uid://n6efm5o4uxvr"
|
||||
|
||||
[resource]
|
||||
script = ExtResource("16_hhyju")
|
||||
Name = "Explosion "
|
||||
InstancingPolicy = 1
|
||||
CooldownEffects = []
|
||||
AbilityBehavior = SubResource("Resource_ba5lh")
|
||||
metadata/_custom_type_script = "uid://dhxfbxh54pyxp"
|
||||
Reference in New Issue
Block a user