empowered action as a forge ability
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
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;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public class EmpoweredAction(TagsManager tagsManager)
|
||||
{
|
||||
public EffectData EmpoweredActionCostEffect = new(
|
||||
"Empowered Action Mana Cost",
|
||||
new DurationData(DurationType.Instant),
|
||||
new[] {
|
||||
new Modifier(
|
||||
"PlayerAttributeSet.Mana",
|
||||
ModifierOperation.FlatBonus,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(-20)
|
||||
)
|
||||
)
|
||||
});
|
||||
|
||||
public EffectData EmpoweredActionCooldown = new(
|
||||
"Empowered Action Cooldown",
|
||||
new DurationData(
|
||||
DurationType.HasDuration,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(1.0f))),
|
||||
effectComponents: new[] {
|
||||
new ModifierTagsEffectComponent(
|
||||
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredAction" })
|
||||
)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class EmpoweredActionBehavior : IAbilityBehavior
|
||||
{
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
// Apply costs and cooldowns
|
||||
context.AbilityHandle.CommitAbility();
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
// Do any necessary cleanups
|
||||
}
|
||||
}
|
||||
75
forge/abilities/REmpoweredAction.cs
Normal file
75
forge/abilities/REmpoweredAction.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Gamesmiths.Forge.Abilities;
|
||||
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_animation.png")]
|
||||
public partial class REmpoweredAction(float cost, float cooldown) : Resource
|
||||
{
|
||||
[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 REmpoweredAction() : this(20.0f, 1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
public EffectData CostEffect()
|
||||
{
|
||||
return new(
|
||||
"Empowered Action Mana Cost",
|
||||
new DurationData(DurationType.Instant),
|
||||
new[]
|
||||
{
|
||||
new Modifier(
|
||||
"PlayerAttributeSet.Mana",
|
||||
ModifierOperation.FlatBonus,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(-Cost)
|
||||
)
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
public EffectData CooldownEffect(TagsManager tagsManager)
|
||||
{
|
||||
return new(
|
||||
"Empowered Action Cooldown",
|
||||
new DurationData(
|
||||
DurationType.HasDuration,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(Cooldown))),
|
||||
effectComponents: new[]
|
||||
{
|
||||
new ModifierTagsEffectComponent(
|
||||
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredAction" })
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class EmpoweredActionBehavior : IAbilityBehavior
|
||||
{
|
||||
public void OnStarted(AbilityBehaviorContext context)
|
||||
{
|
||||
// Apply costs and cooldowns
|
||||
context.AbilityHandle.CommitAbility();
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
// Do any necessary cleanups
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user