cleanup and changed empowered action cost

This commit is contained in:
2026-04-18 09:28:21 +02:00
parent 585c2302d6
commit bb2b2ace06
7 changed files with 10 additions and 52 deletions

View File

@@ -14,7 +14,6 @@ public class EffectApplicationBehavior(EffectData effectData) : IAbilityBehavior
private ActiveEffectHandle? _effectHandle; private ActiveEffectHandle? _effectHandle;
public void OnStarted(AbilityBehaviorContext context) public void OnStarted(AbilityBehaviorContext context)
{ {
GD.Print("This is applying the periodic effect to the flying weapon");
_effect = new Effect(effectData, new EffectOwnership(context.Owner, context.Owner)); _effect = new Effect(effectData, new EffectOwnership(context.Owner, context.Owner));
_effectHandle = context.Owner.EffectsManager.ApplyEffect(_effect); _effectHandle = context.Owner.EffectsManager.ApplyEffect(_effect);
context.AbilityHandle.CommitAbility(); context.AbilityHandle.CommitAbility();
@@ -22,7 +21,6 @@ public class EffectApplicationBehavior(EffectData effectData) : IAbilityBehavior
public void OnEnded(AbilityBehaviorContext context) public void OnEnded(AbilityBehaviorContext context)
{ {
GD.Print("This is removing the periodic effect from the flying weapon");
if (_effectHandle is not null) if (_effectHandle is not null)
context.Owner.EffectsManager.RemoveEffect(_effectHandle); context.Owner.EffectsManager.RemoveEffect(_effectHandle);
context.InstanceHandle.End(); context.InstanceHandle.End();

View File

@@ -6,7 +6,7 @@ using Godot;
namespace Movementtests.forge.abilities; namespace Movementtests.forge.abilities;
public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior public class ExplodingSwordBehavior(PackedScene explosion, float radius) : IAbilityBehavior
{ {
public void OnStarted(AbilityBehaviorContext context) public void OnStarted(AbilityBehaviorContext context)
{ {
@@ -28,10 +28,7 @@ public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior
context.InstanceHandle.End(); context.InstanceHandle.End();
return; return;
} }
explo.Radius = radius;
GD.Print("EXPLOSION");
explo.Radius = 6f;
owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explo); owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explo);
explo.CallDeferred(Node3D.MethodName.SetGlobalPosition, owner.GlobalPosition); explo.CallDeferred(Node3D.MethodName.SetGlobalPosition, owner.GlobalPosition);
@@ -50,8 +47,9 @@ public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior
public partial class ForgeExplodingSwordBehavior : ForgeAbilityBehavior public partial class ForgeExplodingSwordBehavior : ForgeAbilityBehavior
{ {
[Export] public PackedScene Explosion { get; set; } [Export] public PackedScene Explosion { get; set; }
[Export] public float Radius { get; set; } = 5f;
public override IAbilityBehavior GetBehavior() public override IAbilityBehavior GetBehavior()
{ {
return new ExplodingSwordBehavior(Explosion); return new ExplodingSwordBehavior(Explosion, Radius);
} }
} }

View File

@@ -22,10 +22,6 @@ public class RaiseEventTagExecution(TagContainer eventTags) : CustomExecution
{ {
var owner = effect.Ownership.Owner; var owner = effect.Ownership.Owner;
if (owner == null) return []; if (owner == null) return [];
foreach (var tag in eventTags.Tags)
{
GD.Print(tag);
}
owner.Events.Raise(new EventData owner.Events.Raise(new EventData
{ {

View File

@@ -268,11 +268,6 @@ public partial class WeaponSystem : RigidBody3D, IDamageDealer, IForgeEntity
// TODO: Waiting on bug resolve // TODO: Waiting on bug resolve
_weaponFlyingAbility.Cancel(); _weaponFlyingAbility.Cancel();
}); });
Events.Subscribe(Tag.RequestTag(tagsManager, "events.weapon.flyingtick"), data =>
{
GD.Print("Weapon tick triggered!");
});
} }
public void WeaponLeft() public void WeaponLeft()

View File

@@ -104,7 +104,7 @@ script = ExtResource("4_5fdax")
[sub_resource type="Resource" id="Resource_uv4a1"] [sub_resource type="Resource" id="Resource_uv4a1"]
script = ExtResource("4_5fdax") script = ExtResource("4_5fdax")
BaseValue = -30.0 BaseValue = -50.0
metadata/_custom_type_script = "uid://cn3b4ya15fg7e" metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_dhni4"] [sub_resource type="Resource" id="Resource_dhni4"]

View File

@@ -39,7 +39,7 @@ script = ExtResource("3_fp8ou")
[sub_resource type="Resource" id="Resource_mbpss"] [sub_resource type="Resource" id="Resource_mbpss"]
script = ExtResource("3_fp8ou") script = ExtResource("3_fp8ou")
BaseValue = 1.0 BaseValue = 2.0
metadata/_custom_type_script = "uid://cn3b4ya15fg7e" metadata/_custom_type_script = "uid://cn3b4ya15fg7e"
[sub_resource type="Resource" id="Resource_exi3e"] [sub_resource type="Resource" id="Resource_exi3e"]

View File

@@ -2034,30 +2034,16 @@ public partial class PlayerController : CharacterBody3D,
public bool CanPerformEmpoweredAction() public bool CanPerformEmpoweredAction()
{ {
if(_empoweredActionHandle == null) return false; if(_empoweredActionHandle == null) return false;
var cooldowns = _empoweredActionHandle.GetCooldownData(); // var cooldowns = _empoweredActionHandle.GetCooldownData();
foreach (var cd in cooldowns) // var costs = _empoweredActionHandle.GetCostData();
{
//GD.Print($"Cooldown remaining: {cd.RemainingTime}");
}
var costs = _empoweredActionHandle.GetCostData();
foreach (var cost in costs)
{
// Assuming you want to check Mana costs
if (cost.Attribute == "PlayerAttributeSet.Mana")
{
//GD.Print($"Mana Cost: {cost.Cost}");
}
}
var canActivate = _empoweredActionHandle.CanActivate(out var failures); var canActivate = _empoweredActionHandle.CanActivate(out var failures);
if (!canActivate) if (!canActivate)
{ {
GD.PrintErr($"Cannot activate empowered action: {failures}");
if (failures.HasFlag(AbilityActivationFailures.Cooldown)) GD.PrintErr("In Cooldown"); if (failures.HasFlag(AbilityActivationFailures.Cooldown)) GD.PrintErr("In Cooldown");
if (failures.HasFlag(AbilityActivationFailures.InsufficientResources)) GD.PrintErr("Not Enough Mana"); if (failures.HasFlag(AbilityActivationFailures.InsufficientResources)) GD.PrintErr("Not Enough Mana");
} }
return canActivate; return canActivate;
return EmpoweredActionsLeft > 0 && TutorialDone;
} }
public void PerformEmpoweredAction() public void PerformEmpoweredAction()
{ {
@@ -2066,19 +2052,10 @@ public partial class PlayerController : CharacterBody3D,
var canActivate = _empoweredActionHandle.Activate(out var failures); var canActivate = _empoweredActionHandle.Activate(out var failures);
if (!canActivate) if (!canActivate)
{ {
GD.PrintErr($"Cannot activate empowered action: {failures}");
if (failures.HasFlag(AbilityActivationFailures.Cooldown)) GD.PrintErr("In Cooldown"); if (failures.HasFlag(AbilityActivationFailures.Cooldown)) GD.PrintErr("In Cooldown");
if (failures.HasFlag(AbilityActivationFailures.InsufficientResources)) GD.PrintErr("Not Enough Mana"); if (failures.HasFlag(AbilityActivationFailures.InsufficientResources)) GD.PrintErr("Not Enough Mana");
return;
} }
else
{
GD.Print($"Remaining mana: {Attributes["PlayerAttributeSet.Mana"].CurrentValue}");
}
// Inhibit Mana Regeneration for a while after using an empowered action
// TODO: Use Forge events instead of relying on direct referencing
// _manaRegenEffectHandle!.SetInhibit(true);
// GetTree().CreateTimer(EmpoweredAction.ManaRegenPause).Timeout += () => {_manaRegenEffectHandle!.SetInhibit(false);};
_isWallJumpAvailable = true; _isWallJumpAvailable = true;
_canDashAirborne = true; _canDashAirborne = true;
@@ -2411,13 +2388,7 @@ public partial class PlayerController : CharacterBody3D,
{ {
// Manage head and camera movement // Manage head and camera movement
LookAround(delta); LookAround(delta);
EffectsManager.UpdateEffects(delta); 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;
} }
/////////////////////////// ///////////////////////////