From 4c88d2ae5e24507f6061f8bb1e482f20f68df74b Mon Sep 17 00:00:00 2001 From: Jeff Wadsworth Date: Thu, 23 Sep 2021 12:02:29 -0500 Subject: [PATCH] - a real fix for #5630 --- Mage/src/main/java/mage/players/PlayerImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index 08e3127b259..d6c8c2a37b5 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -634,13 +634,19 @@ public abstract class PlayerImpl implements Player, Serializable { return false; } if (source != null) { + // there is only variant of shroud, so check the instance and any asthougheffects that would ignore it if (abilities.containsKey(ShroudAbility.getInstance().getId()) && game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.SHROUD, null, sourceControllerId, game) == null) { return false; } - if (abilities.containsKey(HexproofAbility.getInstance().getId()) - && game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) == null) { - return false; + // check for all variants of hexproof and any asthougheffects that would ignore it + // TODO there may be "prevented by rule-modification" effects, so add them if known + for (Ability a : abilities) { + if (a instanceof HexproofBaseAbility + && ((HexproofBaseAbility) a).checkObject(source, game) + && game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) == null) { + return false; + } } return !hasProtectionFrom(source, game); }