Add buff management for miracles; implement checks for active buffs and update buff identifiers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user