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