58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
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;
|
|
|
|
[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.01,or_greater")]
|
|
public float Frequency { get; set; } = frequency;
|
|
|
|
public RManaRegen() : this(1.0f, 0.1f)
|
|
{
|
|
}
|
|
|
|
public EffectData ManaRegen(TagsManager tagsManager)
|
|
{
|
|
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))
|
|
)
|
|
],
|
|
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,
|
|
PeriodInhibitionRemovedPolicy: PeriodInhibitionRemovedPolicy.ResetPeriod
|
|
)
|
|
);
|
|
}
|
|
} |