46 lines
1.5 KiB
C#
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
|
|
)
|
|
);
|
|
}
|
|
} |