Add buff management for miracles; implement checks for active buffs and update buff identifiers

This commit is contained in:
2025-08-23 18:28:05 +02:00
parent 73a89b736e
commit 8ae0e7e80c
11 changed files with 42 additions and 4 deletions

View File

@@ -6,12 +6,19 @@ namespace ParasiticGod.Scripts.Core.Effects;
[GlobalClass]
public partial class ApplyBuffEffect : Effect
{
[Export] public string BuffId { get; set; }
[Export] public Stat TargetStat { get; set; }
[Export] public float Multiplier { get; set; } = 2.0f;
[Export] public double Duration { get; set; } = 30.0;
public override void Execute(GameState gameState)
{
if (gameState.IsBuffActive(BuffId))
{
GD.Print($"Buff '{BuffId}' is already active. Cannot apply again.");
return;
}
var newBuff = new Buff
{
Name = $"{TargetStat} x{Multiplier}",
@@ -20,6 +27,7 @@ public partial class ApplyBuffEffect : Effect
};
gameState.ActiveBuffs.Add(newBuff);
gameState.AddActiveBuff(BuffId);
GameBus.Instance.NotifyBuffAdded(newBuff);
}

View File

@@ -4,7 +4,8 @@ namespace ParasiticGod.Scripts.Core.Effects;
public class Buff
{
public Guid Id { get; } = Guid.NewGuid(); // Unique identifier
public Guid InstanceId { get; } = Guid.NewGuid(); // Unique identifier
public string BuffId { get; set; } // Identifier for the type of buff
public string Name { get; set; } // For display purposes
public float Multiplier { get; set; } = 1.0f;
public double Duration { get; set; }