* Hextproof from color - improved card icon, added details in icon's popup text;

This commit is contained in:
Oleg Agafonov 2021-09-26 00:31:17 +04:00
parent de378577a6
commit f3b8f0a44a
11 changed files with 72 additions and 3 deletions

View file

@ -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));
}
}

View file

@ -45,4 +45,9 @@ public class HexproofAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from all";
}
}

View file

@ -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<CardIcon> 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))
));
}
}

View file

@ -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";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromBlackAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from black <i>(This creature can't be the target of black spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from black";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromBlueAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from blue <i>(This creature can't be the target of blue spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from blue";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromGreenAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from green <i>(This creature can't be the target of green spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from green";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromMonocoloredAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from monocolored <i>(This creature can't be the target of monocolored spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from monocolored";
}
}

View file

@ -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";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromRedAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from red <i>(This creature can't be the target of red spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from red";
}
}

View file

@ -45,4 +45,9 @@ public class HexproofFromWhiteAbility extends HexproofBaseAbility {
public String getRule() {
return "hexproof from white <i>(This creature can't be the target of white spells or abilities your opponents control.)</i>";
}
@Override
public String getCardIconHint(Game game) {
return "hexproof from white";
}
}