Compare commits

..

2 Commits

Author SHA1 Message Date
7bf19868e7 Setup the base for abilities and events
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 24s
Create tag and build when new code gets to main / Export (push) Successful in 5m6s
2026-03-22 16:28:57 +01:00
d1f83525b1 updating mana through cues 2026-03-18 16:59:52 +01:00
18 changed files with 413 additions and 33 deletions

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/SuppressNullableWarningFix/Enabled/@EntryValue">False</s:Boolean></wpf:ResourceDictionary>

View File

@@ -9,14 +9,43 @@ public partial class ForgeManager : Node
public CuesManager CuesManager { get; private set; } = new CuesManager();
public TagsManager TagsManager { get; private set; } = new TagsManager(
[
// entities
"character.player",
"class.warrior",
"weapon",
// Statuses
"status.stunned",
"status.burning",
"status.immune.fire",
"cues.damage.fire",
// Abilities
"abilities.weapon.land",
// Events
"events.combat.damage",
"events.combat.hit",
"events.weapon.land",
// Cooldowns
"cooldown.empoweredAction",
"cooldown.empoweredSwordThrow",
// Cues
"cues.resources.mana",
]);
}
public static ForgeManager GetForgeManager(Node node)
{
return node.GetTree().Root.GetNode<ForgeManager>("ForgeManager");
}
public static TagsManager GetTagsManager(Node node)
{
return GetForgeManager(node).TagsManager;
}
public static CuesManager GetCuesManager(Node node)
{
return GetForgeManager(node).CuesManager;
}
}

View File

@@ -0,0 +1,41 @@
using System;
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components;
using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Modifiers;
using Gamesmiths.Forge.Tags;
using Godot;
using Movementtests.interfaces;
namespace Movementtests.forge.abilities;
[GlobalClass]
public partial class RAbilityBase(float cost, float cooldown) : Resource, IAbilityBase
{
[Export(PropertyHint.Range, "0,100,1,or_greater")]
public float Cost { get; set; } = cost;
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
public float Cooldown { get; set; } = cooldown;
public RAbilityBase() : this(20.0f, 0.0f)
{
}
public virtual AbilityData Ability(TagsManager tagsManager, Node3D owner)
{
throw new NotImplementedException();
}
public virtual EffectData CostEffect(TagsManager tagsManager)
{
throw new NotImplementedException();
}
public virtual EffectData CooldownEffect(TagsManager tagsManager)
{
throw new NotImplementedException();
}
}

View File

@@ -0,0 +1 @@
uid://4eosgwb3h528

View File

@@ -1,4 +1,5 @@
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components;
using Gamesmiths.Forge.Effects.Duration;
@@ -25,7 +26,17 @@ public partial class REmpoweredAction(float cost, float cooldown, float manaRege
{
}
public EffectData CostEffect()
public AbilityData Ability(TagsManager tagsManager)
{
return new AbilityData(
name: "Empowered Action",
costEffect: CostEffect(tagsManager),
cooldownEffects: [CooldownEffect(tagsManager)],
instancingPolicy: AbilityInstancingPolicy.PerEntity,
behaviorFactory: () => new EmpoweredActionBehavior());
}
public EffectData CostEffect(TagsManager tagsManager)
{
return new(
"Empowered Action Mana Cost",
@@ -40,6 +51,16 @@ public partial class REmpoweredAction(float cost, float cooldown, float manaRege
new ScalableFloat(-Cost)
)
)
},
cues: new []
{
new CueData(
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
MinValue: 0,
MaxValue: 100,
MagnitudeType: CueMagnitudeType.AttributeValueChange,
MagnitudeAttribute: "PlayerAttributeSet.Mana"
)
});
}

View File

@@ -0,0 +1,104 @@
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components;
using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Modifiers;
using Gamesmiths.Forge.Tags;
using Godot;
namespace Movementtests.forge.abilities;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_projectile.png")]
public partial class RExplodingSwordThrow(PackedScene? explosion, float cost, float cooldown) : RAbilityBase(cost, cooldown)
{
[Export] public PackedScene? Explosion { get; set; } = explosion;
public RExplodingSwordThrow() : this(null, 20.0f, 0.0f)
{
}
public override AbilityData Ability(TagsManager tagsManager, Node3D owner)
{
return new AbilityData(
name: "Exploding Sword Throw",
costEffect: CostEffect(tagsManager),
cooldownEffects: [CooldownEffect(tagsManager)],
abilityTags: Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer(),
instancingPolicy: AbilityInstancingPolicy.PerEntity,
behaviorFactory: () => new ExplodingSwordThrowBehavior(owner, Explosion));
}
public override EffectData CostEffect(TagsManager tagsManager)
{
return new(
"Exploding Sword Throw Mana Cost",
new DurationData(DurationType.Instant),
new[]
{
new Modifier(
"PlayerAttributeSet.Mana",
ModifierOperation.FlatBonus,
new ModifierMagnitude(
MagnitudeCalculationType.ScalableFloat,
new ScalableFloat(-Cost)
)
)
},
cues: new []
{
new CueData(
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
MinValue: 0,
MaxValue: 100,
MagnitudeType: CueMagnitudeType.AttributeValueChange,
MagnitudeAttribute: "PlayerAttributeSet.Mana"
)
});
}
public override EffectData CooldownEffect(TagsManager tagsManager)
{
return new(
"Exploding Sword Throw Cooldown",
new DurationData(
DurationType.HasDuration,
new ModifierMagnitude(
MagnitudeCalculationType.ScalableFloat,
new ScalableFloat(Cooldown))),
effectComponents: new[]
{
new ModifierTagsEffectComponent(
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredSwordThrow" })
)
});
}
}
public class ExplodingSwordThrowBehavior(Node3D owner, PackedScene? explosion) : IAbilityBehavior
{
private Node3D _owner = owner;
private PackedScene? _explosion = explosion;
public void OnStarted(AbilityBehaviorContext context)
{
if (_explosion?.Instantiate() is not Explosion explosion)
{
context.InstanceHandle.End();
return;
}
explosion.Radius = 10f;
_owner.GetTree().GetRoot().AddChild(explosion);
explosion.GlobalPosition = _owner.GlobalPosition;
context.AbilityHandle.CommitAbility();
context.InstanceHandle.End();
}
public void OnEnded(AbilityBehaviorContext context)
{
}
}

View File

@@ -0,0 +1 @@
uid://rux15j7q78e8

View File

@@ -1,8 +1,10 @@
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Effects.Modifiers;
using Gamesmiths.Forge.Effects.Periodic;
using Gamesmiths.Forge.Tags;
using Godot;
namespace Movementtests.tools.effects;
@@ -20,7 +22,7 @@ public partial class RManaRegen(float manaRegenRate, float frequency) : Resource
{
}
public EffectData ManaRegen()
public EffectData ManaRegen(TagsManager tagsManager)
{
return new EffectData(
"Mana Regen",
@@ -36,6 +38,16 @@ public partial class RManaRegen(float manaRegenRate, float frequency) : Resource
new ScalableFloat(ManaRegenRate * Frequency))
)
],
cues: new []
{
new CueData(
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
MinValue: 0,
MaxValue: 100,
MagnitudeType: CueMagnitudeType.AttributeValueChange,
MagnitudeAttribute: "PlayerAttributeSet.Mana"
)
},
periodicData: new PeriodicData(
Period: new ScalableFloat(Frequency),
ExecuteOnApplication: true,

View File

@@ -0,0 +1,13 @@
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Tags;
using Godot;
namespace Movementtests.interfaces;
public interface IAbilityBase
{
AbilityData Ability(TagsManager tagsManager, Node3D owner);
EffectData CostEffect(TagsManager tagsManager);
EffectData CooldownEffect(TagsManager tagsManager);
}

View File

@@ -0,0 +1 @@
uid://de881c2xsbutk

View File

@@ -7,6 +7,7 @@
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://inputs/base_mode/base_mode.tres" id="3_cresl"]
[ext_resource type="Resource" uid="uid://dtmhtlix2amme" path="res://scenes/player_controller/resources/player_mana_regen.tres" id="3_n24vh"]
[ext_resource type="PackedScene" uid="uid://c4ikbhojckpnc" path="res://scenes/components/health/CHealth.tscn" id="3_q7bng"]
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="4_11013"]
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://scenes/components/health/RHealth.cs" id="4_abfq8"]
[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"]
@@ -18,7 +19,7 @@
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://inputs/base_mode/move_right.tres" id="6_q7bng"]
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://scenes/player_controller/scripts/StairsSystem.cs" id="7_bmt5a"]
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://inputs/base_mode/move_front.tres" id="7_m8gvy"]
[ext_resource type="Resource" uid="uid://7dpkk5rk3di5" path="res://scenes/player_controller/resources/forge_empowered_action.tres" id="7_qheee"]
[ext_resource type="Resource" uid="uid://7dpkk5rk3di5" path="res://scenes/player_controller/resources/forge/empowered_action.tres" id="7_qheee"]
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://scenes/components/knockback/CKnockback.tscn" id="7_x835q"]
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://inputs/base_mode/move_back.tres" id="8_jb43f"]
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://inputs/base_mode/aim_release.tres" id="8_lhb11"]
@@ -55,6 +56,12 @@
[ext_resource type="Texture2D" uid="uid://c40orhfdgsim" path="res://assets/ui/IconGodotNode/white/icon_circle.png" id="45_u8rdp"]
[ext_resource type="PackedScene" uid="uid://cyw8p0p6a78tl" path="res://scenes/ui/healthbar/healthbar.tscn" id="47_76kmc"]
[sub_resource type="Resource" id="Resource_5b7hb"]
script = ExtResource("4_11013")
Explosion = ExtResource("5_ue7xq")
Cost = 10.0
metadata/_custom_type_script = "uid://rux15j7q78e8"
[sub_resource type="Resource" id="Resource_cb2lu"]
script = ExtResource("2_x835q")
DamageDealt = 10.0
@@ -119,6 +126,7 @@ collision_mask = 272
script = ExtResource("1_poq2x")
EmpoweredAction = ExtResource("7_qheee")
ManaRegen = ExtResource("3_n24vh")
AbilityLoadout = [SubResource("Resource_5b7hb")]
AimAssistStrength = 0.3
AimAssistReductionWhenCloseToTarget = 0.1
AimAssistReductionStartDistance = 8.0

View File

@@ -1,9 +1,13 @@
using Godot;
using System;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Cues;
using Gamesmiths.Forge.Tags;
using Movementtests.interfaces;
using Movementtests.tools;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/control/icon_text_panel.png")]
public partial class PlayerUi : Control
public partial class PlayerUi : Control, ICueHandler
{
internal TextureRect[] DashIcons = new TextureRect[3];
private TextureRect _enemyTarget = null!;
@@ -33,11 +37,17 @@ public partial class PlayerUi : Control
_enemyTarget = GetNode<TextureRect>("%EnemyTarget");
_healthbar = GetNode<Healthbar>("%Healthbar");
_manabar = GetNode<Healthbar>("%Manabar");
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
var tagsManager = forgeManager.TagsManager;
var cuesManager = forgeManager.CuesManager;
cuesManager.RegisterCue(Tag.RequestTag(tagsManager, "cues.resources.mana"), this);
}
public void Initialize(float initialHealth)
public void Initialize(float initialHealth, float initialMana)
{
_healthbar.Initialize(initialHealth);
_manabar.Initialize(initialMana);
}
public void SetEnemyTargetProperties(TargetProperties targetProperties)
@@ -77,4 +87,31 @@ public partial class PlayerUi : Control
{
_manabar.CurrentHealth = newValue;
}
public void OnExecute(IForgeEntity? target, CueParameters? parameters)
{
// One-shot effect (like impact)
// Called when an instant effect with this cue is applied
// Also called when a periodic effect with this cue executes its period
if (target == null || !parameters.HasValue) return;
// Extract parameters
float magnitude = parameters.Value.Magnitude;
// Play effects scaled by magnitude
// PlayFireImpactSound(normalizedMagnitude);
// SpawnFireImpactParticles(target, magnitude);
_manabar.CurrentHealth += magnitude;
}
public void OnApply(IForgeEntity? target, CueParameters? parameters)
{
}
public void OnRemove(IForgeEntity? target, bool interrupted)
{
}
public void OnUpdate(IForgeEntity? target, CueParameters? parameters)
{
}
}

View File

@@ -0,0 +1,13 @@
using Gamesmiths.Forge.Attributes;
namespace Movementtests.scenes.player_controller.components.weapon;
public class WeaponAttributeSet : AttributeSet
{
public EntityAttribute Level { get; }
public WeaponAttributeSet()
{
Level = InitializeAttribute(nameof(Level), 1, 1, 10);
}
}

View File

@@ -0,0 +1 @@
uid://mvc3bv0p021

View File

@@ -1,13 +1,21 @@
using System;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Tags;
using Godot;
using GodotStateCharts;
using Movementtests.interfaces;
using Movementtests.scenes.player_controller.components.weapon;
using Movementtests.systems.damage;
using Movementtests.tools;
namespace Movementtests.systems;
public record struct WeaponLandPayload(int Damage, bool IsCritical);
[GlobalClass, Icon("res://assets/ui/IconGodotNode/node_3D/icon_sword.png")]
public partial class WeaponSystem : RigidBody3D, IDamageDealer
public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
{
[Signal]
public delegate void WeaponThrownEventHandler();
@@ -22,6 +30,12 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
public float StraightThrowDuration { get; set; } = 0.1f;
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!;
private StateChart _weaponState = null!;
public StateChartState InHandState = null!;
public StateChartState FlyingState = null!;
@@ -40,6 +54,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; } = null!;
public MeshInstance3D WeaponMesh { get; set; } = null!;
public Tag WeaponLandTag;
public void Init()
{
_weaponState = StateChart.Of(GetNode("StateChart"));
@@ -57,6 +73,22 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
_startTransform = Transform;
Freeze = true;
Visible = false;
var tagsManager = ForgeManager.GetTagsManager(this);
var cuesManager = ForgeManager.GetCuesManager(this);
var baseTags = new TagContainer(
tagsManager,
[
Tag.RequestTag(tagsManager, "weapon")
]);
Attributes = new EntityAttributes(new WeaponAttributeSet());
Tags = new EntityTags(baseTags);
EffectsManager = new EffectsManager(this, cuesManager);
Abilities = new(this);
Events = new();
WeaponLandTag = Tag.RequestTag(tagsManager, "events.weapon.land");
BodyEntered += OnThrownWeaponReachesGround;
@@ -109,11 +141,26 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
tween.Finished += ThrowWeaponOnCurve;
}
public void RaiseWeaponLandEvent(IForgeEntity? victim = null)
{
Events.Raise(new EventData<WeaponLandPayload>
{
EventTags = WeaponLandTag.GetSingleTagContainer(),
Source = this,
Target = victim,
EventMagnitude = 25f,
Payload = new WeaponLandPayload(Damage: 25, IsCritical: true)
});
}
public void PlantInEnemy(Node3D enemy)
{
GetTree().GetRoot().CallDeferred(Node.MethodName.RemoveChild, this);
enemy.CallDeferred(Node.MethodName.AddChild, this);
if (enemy is IForgeEntity victim) RaiseWeaponLandEvent(victim);
else RaiseWeaponLandEvent();
if (enemy is IDamageable damageable)
{
damageable.TakeDamage(new DamageRecord(GlobalPosition, RDamage));
@@ -145,6 +192,8 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer
{
PlantInEnemy(node);
}
else RaiseWeaponLandEvent();
CallDeferred(Node3D.MethodName.SetGlobalPosition, PlantLocation);
CallDeferred(Node3D.MethodName.LookAt, GlobalTransform.Origin + PlantNormal, Vector3.Up, true);
}

View File

@@ -0,0 +1,8 @@
[gd_resource type="Resource" script_class="RExplodingSwordThrow" format=3 uid="uid://cdxbwirfiaipi"]
[ext_resource type="Script" uid="uid://rux15j7q78e8" path="res://forge/abilities/RExplodingSwordThrow.cs" id="1_5iq8v"]
[resource]
script = ExtResource("1_5iq8v")
Cost = 20.0
metadata/_custom_type_script = "uid://rux15j7q78e8"

View File

@@ -3,6 +3,9 @@ using System.Collections.Generic;
using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Core;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Effects.Components;
using Gamesmiths.Forge.Effects.Duration;
using Gamesmiths.Forge.Effects.Magnitudes;
using Gamesmiths.Forge.Events;
using Gamesmiths.Forge.Tags;
@@ -102,6 +105,10 @@ public partial class PlayerController : CharacterBody3D,
[ExportGroup("General")]
[Export] public REmpoweredAction EmpoweredAction = null!;
[Export] public RManaRegen ManaRegen = null!;
[ExportGroup("Abilities")]
[ExportSubgroup("WeaponThrow")]
[Export] public RAbilityBase[] AbilityLoadout = [];
// Combat stuff
[ExportCategory("Combat")]
@@ -429,27 +436,21 @@ public partial class PlayerController : CharacterBody3D,
_aimAssisRayCast.TargetPosition = _aimAssisRayCast.TargetPosition.Normalized() * (TargetingDistance*1.5f);
// Forge stuff
var forgeManager = GetTree().Root.GetNode<ForgeManager>("ForgeManager")!;
var tagsManager = ForgeManager.GetTagsManager(this);
var cuesManager = ForgeManager.GetCuesManager(this);
var baseTags = new TagContainer(
forgeManager.TagsManager,
tagsManager,
[
Tag.RequestTag(forgeManager.TagsManager, "character.player"),
Tag.RequestTag(forgeManager.TagsManager, "class.warrior")
Tag.RequestTag(tagsManager, "character.player")
]);
Attributes = new EntityAttributes(new PlayerAttributeSet());
Tags = new EntityTags(baseTags);
EffectsManager = new EffectsManager(this, forgeManager.CuesManager);
EffectsManager = new EffectsManager(this, cuesManager);
Abilities = new(this);
Events = new();
var empoweredActionData = new AbilityData(
name: "Empowered Action",
costEffect: EmpoweredAction.CostEffect(),
cooldownEffects: [EmpoweredAction.CooldownEffect(forgeManager.TagsManager)],
instancingPolicy: AbilityInstancingPolicy.PerEntity,
behaviorFactory: () => new EmpoweredActionBehavior());
var empoweredActionData = EmpoweredAction.Ability(tagsManager);
// Grant permanently
_empoweredActionHandle = Abilities.GrantAbilityPermanently(
empoweredActionData,
@@ -457,7 +458,7 @@ public partial class PlayerController : CharacterBody3D,
levelOverridePolicy: LevelComparison.None,
sourceEntity: this);
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(), new EffectOwnership(this, this));
var manaRegenEffect = new Effect(ManaRegen.ManaRegen(tagsManager), new EffectOwnership(this, this));
_manaRegenEffectHandle = EffectsManager.ApplyEffect(manaRegenEffect);
var health = Attributes["PlayerAttributeSet.Health"].CurrentValue; // 100
@@ -529,7 +530,7 @@ public partial class PlayerController : CharacterBody3D,
}
if (RKnockback != null) CKnockback!.RKnockback = RKnockback;
PlayerUi.Initialize(CHealth.CurrentHealth);
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
CDamageable.DamageTaken += (damageable, record) => ReduceHealth(damageable, record);
CDamageable.DamageTaken += (_, record) => RegisterKnockback(new KnockbackRecord(record));
CHealth.HealthChanged += PlayerUi.OnHealthChanged;
@@ -703,9 +704,47 @@ public partial class PlayerController : CharacterBody3D,
_attackDash.StateEntered += OnDashAttackStarted;
_parryStandard.StateEntered += OnStandardParryStarted;
_parryDash.StateEntered += OnDashParryStarted;
foreach (var weaponLandAbility in AbilityLoadout)
{
var grantAbilityConfig = new GrantAbilityConfig(
weaponLandAbility.Ability(tagsManager, WeaponSystem),
ScalableLevel: new ScalableInt(1),
RemovalPolicy: AbilityDeactivationPolicy.CancelImmediately,
InhibitionPolicy: AbilityDeactivationPolicy.CancelImmediately,
TryActivateOnGrant: false,
TryActivateOnEnable: false,
LevelOverridePolicy: LevelComparison.Higher);
var grantComponent = new GrantAbilityEffectComponent([grantAbilityConfig]);
var grantEffect = new EffectData(
"Grant Weapon Land Ability",
new DurationData(DurationType.Infinite),
effectComponents: [grantComponent]);
EffectsManager.ApplyEffect(new Effect(grantEffect, new EffectOwnership(this, this)));
}
// Testing out kill
// GetTree().CreateTimer(2).Timeout += () => Kill(this);
// Forge events
EventSubscriptionToken token = WeaponSystem.Events.Subscribe<WeaponLandPayload>(WeaponSystem.WeaponLandTag, OnWeaponLanded);
}
public void OnWeaponLanded(EventData<WeaponLandPayload> data)
{
var source = data.Source;
var target = data.Target;
var magnitude = data.EventMagnitude;
var weaponLandPayload = data.Payload;
var tagsManager = ForgeManager.GetTagsManager(this);
var weaponLandTag = Tag.RequestTag(tagsManager, "abilities.weapon.land").GetSingleTagContainer();
if (weaponLandTag == null) return;
var anyActivated = Abilities.TryActivateAbilitiesByTag(
weaponLandTag,
target,
out var failures);
if (anyActivated)
{
}
}
///////////////////////////
@@ -765,7 +804,7 @@ public partial class PlayerController : CharacterBody3D,
{
RHealth.StartingHealth = newHealthValue;
CHealth!.CurrentHealth = newHealthValue;
PlayerUi.Initialize(CHealth.CurrentHealth);
PlayerUi.Initialize(CHealth.CurrentHealth, Attributes["PlayerAttributeSet.Mana"].BaseValue);
}
public void SetPlayerDamageOverride(float newDamageValue)
{
@@ -2309,7 +2348,7 @@ public partial class PlayerController : CharacterBody3D,
HandleEnemyTargeting();
}
private float _oldMana = 100;
// private float _oldMana = 100;
public override void _Process(double delta)
{
// Manage head and camera movement
@@ -2317,10 +2356,10 @@ public partial class PlayerController : CharacterBody3D,
EffectsManager.UpdateEffects(delta);
// TODO: change for actual Cue
var currentMana = Attributes["PlayerAttributeSet.Mana"].CurrentValue;
if (Mathf.Abs(currentMana - _oldMana) > Mathf.Epsilon)
PlayerUi.OnManaChanged(currentMana);
_oldMana = currentMana;
// var currentMana = Attributes["PlayerAttributeSet.Mana"].CurrentValue;
// if (Mathf.Abs(currentMana - _oldMana) > Mathf.Epsilon)
// PlayerUi.OnManaChanged(currentMana);
// _oldMana = currentMana;
}
///////////////////////////