yow it's working or wat
This commit is contained in:
@@ -17,6 +17,10 @@ public partial class ForgeManager : Node
|
||||
// Statuses
|
||||
"status.stunned",
|
||||
|
||||
"status.weapon.inHand",
|
||||
"status.weapon.flying",
|
||||
"status.weapon.planted",
|
||||
|
||||
// Abilities
|
||||
"abilities.weapon.land",
|
||||
"abilities.weapon.flying",
|
||||
@@ -25,9 +29,15 @@ public partial class ForgeManager : Node
|
||||
// Events
|
||||
"events.combat.damage",
|
||||
"events.combat.hit",
|
||||
"events.weapon.left",
|
||||
|
||||
"events.weapon.flyingTick",
|
||||
"events.weapon.land",
|
||||
"events.weapon.startedFlying",
|
||||
"events.weapon.stoppedFlying",
|
||||
"events.weapon.handToFlying",
|
||||
"events.weapon.flyingToHand",
|
||||
"events.weapon.plantedToHand",
|
||||
"events.weapon.plantedToFlying",
|
||||
"events.weapon.planted",
|
||||
|
||||
// Cooldowns
|
||||
"cooldown.empoweredAction",
|
||||
|
||||
@@ -13,28 +13,13 @@ using Movementtests.interfaces;
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class RAbilityBase(float cost, float cooldown) : Resource, IAbilityBase
|
||||
public partial class RAbilityBase : 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 RAbilityBase() : this(20.0f, 0.0f)
|
||||
public RAbilityBase()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual AbilityData Ability(TagsManager tagsManager, TagContainer? tags, Node3D owner)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual EffectData CostEffect(TagsManager tagsManager)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual EffectData CooldownEffect(TagsManager tagsManager)
|
||||
public virtual AbilityData Ability(TagContainer? tags, Node3D owner)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -8,74 +8,32 @@ using Gamesmiths.Forge.Effects.Magnitudes;
|
||||
using Gamesmiths.Forge.Effects.Modifiers;
|
||||
using Gamesmiths.Forge.Tags;
|
||||
using Godot;
|
||||
using Movementtests.interfaces;
|
||||
using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.forge.abilities;
|
||||
|
||||
public record struct ExplodingSwordCreation(Node3D Owner);
|
||||
|
||||
[GlobalClass, Icon("res://assets/ui/IconGodotNode/white/icon_projectile.png")]
|
||||
public partial class RExplodingSword(PackedScene? explosion, float cost, float cooldown) : RAbilityBase(cost, cooldown)
|
||||
public partial class RExplodingSword(PackedScene? explosion) : Resource, IAbilityBase<ExplodingSwordCreation, WeaponEventPayload>
|
||||
{
|
||||
[Export] public PackedScene? Explosion { get; set; } = explosion;
|
||||
|
||||
public RExplodingSword() : this(null, 20.0f, 0.0f)
|
||||
{
|
||||
}
|
||||
public RExplodingSword() : this(null) {}
|
||||
|
||||
public override AbilityData Ability(TagsManager tagsManager, TagContainer? tags, Node3D owner)
|
||||
public AbilityData Ability(ExplodingSwordCreation creationData, TagContainer? tags)
|
||||
{
|
||||
return new AbilityData(
|
||||
name: "Exploding Sword Throw",
|
||||
costEffect: CostEffect(tagsManager),
|
||||
cooldownEffects: [CooldownEffect(tagsManager)],
|
||||
abilityTags: tags,
|
||||
instancingPolicy: AbilityInstancingPolicy.PerEntity,
|
||||
behaviorFactory: () => new ExplodingSwordThrowBehavior<WeaponLeftPayload>(owner, Explosion));
|
||||
behaviorFactory: () => new ExplodingSwordThrowBehavior<WeaponEventPayload>(creationData.Owner, Explosion));
|
||||
}
|
||||
|
||||
public override EffectData CostEffect(TagsManager tagsManager)
|
||||
{
|
||||
return new(
|
||||
"Exploding Sword Throw Mana Cost",
|
||||
new DurationData(DurationType.Instant),
|
||||
new[]
|
||||
{
|
||||
new Modifier(
|
||||
"PlayerAttributeSet.Mana",
|
||||
ModifierOperation.FlatBonus,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(-Cost)
|
||||
)
|
||||
)
|
||||
},
|
||||
cues: new []
|
||||
{
|
||||
new CueData(
|
||||
CueTags: Tag.RequestTag(tagsManager, "cues.resources.mana").GetSingleTagContainer(),
|
||||
MinValue: 0,
|
||||
MaxValue: 100,
|
||||
MagnitudeType: CueMagnitudeType.AttributeValueChange,
|
||||
MagnitudeAttribute: "PlayerAttributeSet.Mana"
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public override EffectData CooldownEffect(TagsManager tagsManager)
|
||||
public IAbilityBehavior<WeaponEventPayload> Behavior(ExplodingSwordCreation creationData)
|
||||
{
|
||||
return new(
|
||||
"Exploding Sword Throw Cooldown",
|
||||
new DurationData(
|
||||
DurationType.HasDuration,
|
||||
new ModifierMagnitude(
|
||||
MagnitudeCalculationType.ScalableFloat,
|
||||
new ScalableFloat(Cooldown))),
|
||||
effectComponents: new[]
|
||||
{
|
||||
new ModifierTagsEffectComponent(
|
||||
tagsManager.RequestTagContainer(new[] { "cooldown.empoweredSwordThrow" })
|
||||
)
|
||||
});
|
||||
return new ExplodingSwordThrowBehavior<WeaponEventPayload>(creationData.Owner, Explosion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,18 +43,21 @@ public class ExplodingSwordThrowBehavior<TPayload>(Node3D owner, PackedScene? ex
|
||||
private PackedScene? _explosion = explosion;
|
||||
public void OnStarted(AbilityBehaviorContext context, TPayload payload)
|
||||
{
|
||||
GD.Print(payload);
|
||||
if (_explosion?.Instantiate() is not Explosion explosion)
|
||||
{
|
||||
GD.Print("Cannot instantiate");
|
||||
context.InstanceHandle.End();
|
||||
return;
|
||||
}
|
||||
if (!_owner.IsInsideTree())
|
||||
{
|
||||
GD.Print("Not inside tree");
|
||||
context.InstanceHandle.End();
|
||||
return;
|
||||
}
|
||||
|
||||
GD.Print("EXPLOSION");
|
||||
|
||||
explosion.Radius = 6f;
|
||||
|
||||
_owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explosion);
|
||||
@@ -109,16 +70,4 @@ public class ExplodingSwordThrowBehavior<TPayload>(Node3D owner, PackedScene? ex
|
||||
public void OnEnded(AbilityBehaviorContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class TestBehavior<TPayload>(
|
||||
Action<AbilityBehaviorContext, TPayload> callback) : IAbilityBehavior<TPayload>
|
||||
{
|
||||
public void OnStarted(AbilityBehaviorContext context, TPayload data)
|
||||
{
|
||||
callback(context, data);
|
||||
context.InstanceHandle.End();
|
||||
}
|
||||
|
||||
public void OnEnded(AbilityBehaviorContext context){}
|
||||
}
|
||||
@@ -11,17 +11,18 @@ using Movementtests.systems;
|
||||
|
||||
namespace Movementtests.tools.calculators;
|
||||
|
||||
|
||||
public class FlyingWeaponExecution(WeaponSystem weaponSystem) : CustomExecution
|
||||
{
|
||||
public override ModifierEvaluatedData[] EvaluateExecution(Effect effect, IForgeEntity target, EffectEvaluatedData? effectEvaluatedData)
|
||||
{
|
||||
GD.Print("Custom execution executed");
|
||||
weaponSystem.Events.Raise(new EventData<WeaponFlyingPayload>
|
||||
weaponSystem.Events.Raise(new EventData<WeaponEventPayload>
|
||||
{
|
||||
EventTags = weaponSystem.WeaponFlyingTickTag.GetSingleTagContainer()!,
|
||||
EventTags = weaponSystem.WeaponFlyingTickEventTag.GetSingleTagContainer()!,
|
||||
Source = weaponSystem,
|
||||
EventMagnitude = 12f,
|
||||
Payload = new WeaponFlyingPayload(Message: "flying")
|
||||
Payload = new WeaponEventPayload(Message: "flying")
|
||||
});
|
||||
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user