Skip to content

Commit

Permalink
fixed Hexproof from color abilities not working on players (fixes Vei…
Browse files Browse the repository at this point in the history
…l of Summer issues)
  • Loading branch information
theelk801 committed Jul 1, 2019
1 parent e3f5071 commit 14c4981
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Mage/src/main/java/mage/players/PlayerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 14c4981

Please sign in to comment.