From 14c4981c72057adbcacb7653082bdd9d7cf6e45d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Mon, 1 Jul 2019 13:00:35 -0400 Subject: [PATCH] fixed Hexproof from color abilities not working on players (fixes Veil of Summer issues) --- .../main/java/mage/players/PlayerImpl.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index c783f1ad07e4..e7d5240b3a19 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -606,12 +606,46 @@ public boolean canBeTargetedBy(MageObject source, UUID sourceControllerId, Game if (abilities.containsKey(ShroudAbility.getInstance().getId())) { return false; } + if (abilities.containsKey(HexproofAbility.getInstance().getId())) { if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game) && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game)) { return false; } } + + if (abilities.containsKey(HexproofFromWhiteAbility.getInstance().getId())) { + if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game) + && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) + && source.getColor(game).isWhite()) { + return false; + } + } + + if (abilities.containsKey(HexproofFromBlueAbility.getInstance().getId())) { + if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game) + && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) + && source.getColor(game).isBlue()) { + return false; + } + } + + if (abilities.containsKey(HexproofFromBlackAbility.getInstance().getId())) { + if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game) + && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) + && source.getColor(game).isBlack()) { + return false; + } + } + + if (abilities.containsKey(HexproofFromMonocoloredAbility.getInstance().getId())) { + if (sourceControllerId != null && this.hasOpponent(sourceControllerId, game) + && null == game.getContinuousEffects().asThough(this.getId(), AsThoughEffectType.HEXPROOF, null, sourceControllerId, game) + && !source.getColor(game).isColorless() && !source.getColor(game).isMulticolored()) { + return false; + } + } + return !hasProtectionFrom(source, game); }