Files
MovementTests/forge/abilities/ForgeInstantEndBehavior.cs
Minimata bed1384dc7
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 57s
Create tag and build when new code gets to main / Export (push) Successful in 5m13s
fixed inventory + using Sync bindings
2026-05-04 10:19:00 +02:00

31 lines
1002 B
C#

using Gamesmiths.Forge.Abilities;
using Gamesmiths.Forge.Effects;
using Gamesmiths.Forge.Godot.Resources;
using Gamesmiths.Forge.Godot.Resources.Abilities;
using Godot;
namespace Movementtests.forge.abilities;
public class InstantEndBehavior(ForgeEffectData? effectData) : IAbilityBehavior
{
public void OnStarted(AbilityBehaviorContext context)
{
if (effectData != null)
{
var effect = new Effect(effectData.GetEffectData(), new EffectOwnership(context.Owner, context.Owner));
context.Owner.EffectsManager.ApplyEffect(effect);
}
context.AbilityHandle.CommitAbility();
context.InstanceHandle.End();
}
public void OnEnded(AbilityBehaviorContext context) {}
}
[Tool]
[GlobalClass]
public partial class ForgeInstantEndBehavior : ForgeAbilityBehavior
{
[Export] public ForgeEffectData? OptionalEffectData { get; set; }
public override IAbilityBehavior GetBehavior() => new InstantEndBehavior(OptionalEffectData);
}