diff --git a/MiraAPI/Modifiers/ModifierManager.cs b/MiraAPI/Modifiers/ModifierManager.cs
index 12a9519..c2688a0 100644
--- a/MiraAPI/Modifiers/ModifierManager.cs
+++ b/MiraAPI/Modifiers/ModifierManager.cs
@@ -152,7 +152,7 @@ public static class ModifierManager
}
var candidates = availablePlayers
- .Where(x => IsGameModifierValid(x, modifier, modifier.TypeId))
+ .Where(x => IsGameModifierPostCheck(x, modifier, modifier.TypeId))
.ToList();
if (candidates.Count == 0)
@@ -181,4 +181,9 @@ public static class ModifierManager
!player.HasModifier(modifierId) && modifier.IsModifierValidOn(player.Data.Role) &&
modifier.CanSpawnOnCurrentMode();
}
+ private static bool IsGameModifierPostCheck(PlayerControl player, GameModifier modifier, uint modifierId)
+ {
+ return (player.Data.Role is not ICustomRole role || role.IsModifierApplicable(modifier)) &&
+ !player.HasModifier(modifierId) && modifier.IsModifierValidOnPostCheck(player.Data.Role);
+ }
}
diff --git a/MiraAPI/Modifiers/Types/GameModifier.cs b/MiraAPI/Modifiers/Types/GameModifier.cs
index b58f8e0..f5ae883 100644
--- a/MiraAPI/Modifiers/Types/GameModifier.cs
+++ b/MiraAPI/Modifiers/Types/GameModifier.cs
@@ -33,6 +33,13 @@ public abstract class GameModifier : BaseModifier
/// if the modifier is valid on the role, otherwise .
public virtual bool IsModifierValidOn(RoleBehaviour role) => true;
+ ///
+ /// Determines whether the modifier is valid on a role, which runs after players are determined but before the modifiers are given.
+ ///
+ /// The role to be checked.
+ /// if the modifier is valid on the role, otherwise .
+ public virtual bool IsModifierValidOnPostCheck(RoleBehaviour role) => IsModifierValidOn(role);
+
///
/// Determines whether the player won the game with this modifier. The modifier with the highest priority will override other modifiers.
///