Files
MovementTests/forge/effects/RManaRegen.cs
Minimata 95616f61fc
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 40s
Create tag and build when new code gets to main / Export (push) Successful in 5m18s
Implemented mana regeneration
2026-03-11 16:29:09 +01:00

46 lines
1.5 KiB
C#

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 Godot;
namespace Movementtests.tools.effects;
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_liquid.png")]
public partial class RManaRegen(float manaRegenRate, float frequency) : Resource
{
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
public float ManaRegenRate { get; set; } = manaRegenRate;
[Export(PropertyHint.Range, "0.01,1,0.1,or_greater")]
public float Frequency { get; set; } = frequency;
public RManaRegen() : this(1.0f, 0.1f)
{
}
public EffectData ManaRegen()
{
return new EffectData(
"Mana Regen",
durationData: new DurationData(
DurationType.Infinite
),
modifiers: [
new Modifier(
"PlayerAttributeSet.Mana",
ModifierOperation.FlatBonus,
new ModifierMagnitude(
MagnitudeCalculationType.ScalableFloat,
new ScalableFloat(ManaRegenRate * Frequency))
)
],
periodicData: new PeriodicData(
Period: new ScalableFloat(Frequency),
ExecuteOnApplication: true,
PeriodInhibitionRemovedPolicy: PeriodInhibitionRemovedPolicy.ResetPeriod
)
);
}
}