diff --git a/Mage/src/main/java/mage/abilities/icon/abilities/HexproofAbilityIcon.java b/Mage/src/main/java/mage/abilities/icon/abilities/HexproofAbilityIcon.java index 1872ad3d79..5f6c29e013 100644 --- a/Mage/src/main/java/mage/abilities/icon/abilities/HexproofAbilityIcon.java +++ b/Mage/src/main/java/mage/abilities/icon/abilities/HexproofAbilityIcon.java @@ -1,7 +1,9 @@ package mage.abilities.icon.abilities; import mage.abilities.icon.CardIcon; +import mage.abilities.icon.CardIconImpl; import mage.abilities.icon.CardIconType; +import mage.util.CardUtil; /** * @author JayDi85 @@ -28,4 +30,8 @@ public enum HexproofAbilityIcon implements CardIcon { public CardIcon copy() { return instance; } + + public static CardIconImpl createDynamicCardIcon(String hint) { + return new CardIconImpl(CardIconType.ABILITY_HEXPROOF, CardUtil.getTextWithFirstCharUpperCase(hint)); + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofAbility.java index eb42f64c80..c5b9b0ddb6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofAbility.java @@ -45,4 +45,9 @@ public class HexproofAbility extends HexproofBaseAbility { public String getRule() { return "hexproof"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from all"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofBaseAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofBaseAbility.java index bf87e48188..94da34ba71 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofBaseAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofBaseAbility.java @@ -4,12 +4,15 @@ import mage.MageObject; import mage.ObjectColor; import mage.abilities.MageSingleton; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.icon.CardIcon; +import mage.abilities.icon.CardIconImpl; +import mage.abilities.icon.CardIconType; import mage.abilities.icon.abilities.HexproofAbilityIcon; import mage.constants.Zone; import mage.game.Game; +import mage.game.permanent.Permanent; -import java.util.HashSet; -import java.util.Set; +import java.util.*; /** * an abstract base class for hexproof abilities @@ -20,7 +23,6 @@ public abstract class HexproofBaseAbility extends SimpleStaticAbility implements HexproofBaseAbility() { super(Zone.BATTLEFIELD, null); - this.addIcon(HexproofAbilityIcon.instance); } public abstract boolean checkObject(MageObject source, Game game); @@ -60,4 +62,20 @@ public abstract class HexproofBaseAbility extends SimpleStaticAbility implements return null; } } + + public abstract String getCardIconHint(Game game); + + @Override + public List getIcons(Game game) { + if (game == null) { + return new ArrayList<>(Collections.singletonList( + HexproofAbilityIcon.instance + )); + } + + // dynamic icon (example: colored hexproof) + return new ArrayList<>(Collections.singletonList( + HexproofAbilityIcon.createDynamicCardIcon(getCardIconHint(game)) + )); + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromArtifactsCreaturesAndEnchantments.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromArtifactsCreaturesAndEnchantments.java index 2ce0b0eeb5..0c808248b6 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromArtifactsCreaturesAndEnchantments.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromArtifactsCreaturesAndEnchantments.java @@ -44,4 +44,9 @@ public class HexproofFromArtifactsCreaturesAndEnchantments extends HexproofBaseA public String getRule() { return "hexproof from artifacts, creatures, and enchantments"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from artifacts, creatures, and enchantments"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlackAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlackAbility.java index 82f2275563..c731cb15e9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlackAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlackAbility.java @@ -45,4 +45,9 @@ public class HexproofFromBlackAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from black (This creature can't be the target of black spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from black"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlueAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlueAbility.java index ac7317f025..dcf3f44974 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlueAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromBlueAbility.java @@ -45,4 +45,9 @@ public class HexproofFromBlueAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from blue (This creature can't be the target of blue spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from blue"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromGreenAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromGreenAbility.java index 3534c4b72d..12f8768cfd 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromGreenAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromGreenAbility.java @@ -45,4 +45,9 @@ public class HexproofFromGreenAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from green (This creature can't be the target of green spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from green"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromMonocoloredAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromMonocoloredAbility.java index 27a711692a..4d5a24b0d7 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromMonocoloredAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromMonocoloredAbility.java @@ -45,4 +45,9 @@ public class HexproofFromMonocoloredAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from monocolored (This creature can't be the target of monocolored spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from monocolored"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromPlaneswalkersAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromPlaneswalkersAbility.java index 0e30e798d9..e7fa893ba1 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromPlaneswalkersAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromPlaneswalkersAbility.java @@ -44,4 +44,9 @@ public class HexproofFromPlaneswalkersAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from planeswalkers"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from planeswalkers"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromRedAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromRedAbility.java index b65634b118..ef41e61798 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromRedAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromRedAbility.java @@ -45,4 +45,9 @@ public class HexproofFromRedAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from red (This creature can't be the target of red spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from red"; + } } diff --git a/Mage/src/main/java/mage/abilities/keyword/HexproofFromWhiteAbility.java b/Mage/src/main/java/mage/abilities/keyword/HexproofFromWhiteAbility.java index ec1d60a020..d3dc9924b9 100644 --- a/Mage/src/main/java/mage/abilities/keyword/HexproofFromWhiteAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/HexproofFromWhiteAbility.java @@ -45,4 +45,9 @@ public class HexproofFromWhiteAbility extends HexproofBaseAbility { public String getRule() { return "hexproof from white (This creature can't be the target of white spells or abilities your opponents control.)"; } + + @Override + public String getCardIconHint(Game game) { + return "hexproof from white"; + } }