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

@@ -85,6 +85,11 @@ public partial class MiracleButton : Button
{
missingRequirements.Add("Already unlocked subsequent powers.");
}
if (IsBuffAlreadyActive(state))
{
missingRequirements.Add("This buff is already active.");
}
if (missingRequirements.Any())
{
@@ -145,4 +150,16 @@ public partial class MiracleButton : Button
return unlockEffect.MiraclesToUnlock.All(state.IsMiracleUnlocked);
}
private bool IsBuffAlreadyActive(GameState state)
{
var buffEffect = _miracle.Effects.OfType<ApplyBuffEffect>().FirstOrDefault();
if (buffEffect == null || string.IsNullOrEmpty(buffEffect.BuffId))
{
return false;
}
return state.IsBuffActive(buffEffect.BuffId);
}
}