Add first pass of Snow Mana impementation see #367
parent
657e230fe0
commit
b6f5909cc2
|
@ -9,6 +9,7 @@ public enum MagicCostManaType {
|
|||
// Ordered from least restrictive to most restrictive.
|
||||
// Same order as in mana cost
|
||||
Colorless("colorless","{1}",MagicManaType.ALL_TYPES),
|
||||
Snow("snow","{S}",Arrays.asList(MagicManaType.Snow)),
|
||||
WhiteBlue("white/blue","{W/U}",Arrays.asList(MagicManaType.White,MagicManaType.Blue)),
|
||||
WhiteBlack("white/black","{W/B}",Arrays.asList(MagicManaType.White,MagicManaType.Black)),
|
||||
BlueBlack("blue/black","{U/B}",Arrays.asList(MagicManaType.Blue,MagicManaType.Black)),
|
||||
|
|
|
@ -7,18 +7,19 @@ import java.util.List;
|
|||
public enum MagicManaType {
|
||||
|
||||
Colorless("colorless","{1}"),
|
||||
Snow("snow","{S}"),
|
||||
Black("black","{B}"),
|
||||
Blue("blue","{U}"),
|
||||
Green("green","{G}"),
|
||||
Red("red","{R}"),
|
||||
White("white","{W}"),
|
||||
NONE("none","{N}"),
|
||||
NONE("none","{N}")
|
||||
;
|
||||
|
||||
public static final List<MagicManaType> ALL_COLORS = Collections.unmodifiableList(Arrays.asList(
|
||||
Black,Blue,Green,Red,White));
|
||||
public static final List<MagicManaType> ALL_TYPES = Collections.unmodifiableList(Arrays.asList(
|
||||
Colorless,Black,Blue,Green,Red,White)); // Colorless must be in front.
|
||||
Colorless,Snow,Black,Blue,Green,Red,White)); // Colorless must be in front.
|
||||
|
||||
public static final int NR_OF_TYPES = ALL_TYPES.size();
|
||||
|
||||
|
@ -55,6 +56,9 @@ public enum MagicManaType {
|
|||
if ("{1}".equals(name)) {
|
||||
return Arrays.asList(Colorless);
|
||||
}
|
||||
if ("{S}".equals(name)) {
|
||||
return Arrays.asList(Snow);
|
||||
}
|
||||
if ("one mana of any color".equals(name)) {
|
||||
return ALL_TYPES;
|
||||
}
|
||||
|
|
|
@ -22,4 +22,5 @@ public class MagicTapManaActivation extends MagicManaActivation {
|
|||
public static final MagicManaActivation Black = new MagicTapManaActivation(MagicManaType.getList("{B}"));
|
||||
public static final MagicManaActivation Red = new MagicTapManaActivation(MagicManaType.getList("{R}"));
|
||||
public static final MagicManaActivation Green = new MagicTapManaActivation(MagicManaType.getList("{G}"));
|
||||
public static final MagicManaActivation Snow = new MagicTapManaActivation(MagicManaType.getList("{S}"));
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import magic.model.MagicCopyMap;
|
|||
import magic.model.MagicCounterType;
|
||||
import magic.model.MagicPermanent;
|
||||
import magic.model.MagicPowerToughness;
|
||||
import magic.model.MagicType;
|
||||
import magic.model.target.MagicTargetFilterFactory;
|
||||
import magic.model.MagicSubType;
|
||||
import magic.model.MagicAbility;
|
||||
|
@ -13,8 +14,8 @@ import java.util.Set;
|
|||
|
||||
public class MagicPermanentStatic implements Comparable<MagicPermanentStatic> {
|
||||
public static final MagicPermanentStatic CountersEffect = new MagicPermanentStatic(
|
||||
0,
|
||||
MagicPermanent.NONE,
|
||||
0,
|
||||
MagicPermanent.NONE,
|
||||
new MagicStatic(MagicLayer.CountersPT, MagicTargetFilterFactory.CREATURE) {
|
||||
@Override
|
||||
public void modPowerToughness(final MagicPermanent source, final MagicPermanent permanent, final MagicPowerToughness pt) {
|
||||
|
@ -43,8 +44,8 @@ public class MagicPermanentStatic implements Comparable<MagicPermanentStatic> {
|
|||
);
|
||||
|
||||
public static final MagicPermanentStatic BasicLandEffect = new MagicPermanentStatic(
|
||||
0,
|
||||
MagicPermanent.NONE,
|
||||
0,
|
||||
MagicPermanent.NONE,
|
||||
new MagicStatic(MagicLayer.Ability, MagicTargetFilterFactory.LAND) {
|
||||
@Override
|
||||
public void modAbilityFlags(final MagicPermanent source, final MagicPermanent permanent, final Set<MagicAbility> flags) {
|
||||
|
@ -67,6 +68,19 @@ public class MagicPermanentStatic implements Comparable<MagicPermanentStatic> {
|
|||
}
|
||||
);
|
||||
|
||||
public static final MagicPermanentStatic SnowManaEffect = new MagicPermanentStatic(
|
||||
0,
|
||||
MagicPermanent.NONE,
|
||||
new MagicStatic(MagicLayer.Ability, MagicTargetFilterFactory.PERMANENT) {
|
||||
@Override
|
||||
public void modAbilityFlags(final MagicPermanent source, final MagicPermanent permanent, final Set<MagicAbility> flags) {
|
||||
if (permanent.hasType(MagicType.Snow) && permanent.producesMana()) {
|
||||
permanent.addAbility(MagicTapManaActivation.Snow);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
private final long id;
|
||||
private final MagicPermanent permanent;
|
||||
private final MagicStatic mstatic;
|
||||
|
|
|
@ -22,9 +22,13 @@ public class MagicPermanentStaticMap {
|
|||
}
|
||||
//changes to power and toughness due to +1/+1 and -1/-1 counters
|
||||
add(MagicPermanentStatic.CountersEffect);
|
||||
|
||||
|
||||
//Handles basic lands abilities.
|
||||
add(MagicPermanentStatic.BasicLandEffect);
|
||||
|
||||
//Handles Snow mana.
|
||||
add(MagicPermanentStatic.SnowManaEffect);
|
||||
|
||||
}
|
||||
|
||||
public MagicPermanentStaticMap(final MagicCopyMap copyMap, final MagicPermanentStaticMap sourceMap) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import magic.ui.theme.PlayerAvatar;
|
|||
import magic.utility.MagicResources;
|
||||
|
||||
public final class IconImages {
|
||||
|
||||
|
||||
private static final Map<Integer, ImageIcon> manaIcons = new HashMap<>();
|
||||
private static final Map<MagicIcon, ImageIcon> icons = new HashMap<>();
|
||||
private static final Map<String, PlayerAvatar> avatarsMap = new HashMap<>();
|
||||
|
@ -115,7 +115,7 @@ public final class IconImages {
|
|||
return getIcon(perm.getCardDefinition());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static ImageIcon getIcon(final MagicCardDefinition cdef) {
|
||||
if (cdef.isLand()) {
|
||||
return getIcon(MagicIcon.LAND);
|
||||
|
@ -138,6 +138,8 @@ public final class IconImages {
|
|||
switch (mtype) {
|
||||
case Colorless:
|
||||
return getSmallManaIcon(MagicIcon.MANA_1);
|
||||
case Snow:
|
||||
return getSmallManaIcon(MagicIcon.MANA_SNOW);
|
||||
case Black:
|
||||
return getSmallManaIcon(MagicIcon.MANA_BLACK);
|
||||
case Blue:
|
||||
|
@ -154,7 +156,7 @@ public final class IconImages {
|
|||
|
||||
public static ImageIcon getIconSize1(final DuelPlayerConfig playerDef) {
|
||||
return getSizedAvatarImageIcon(playerDef, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static ImageIcon getIconSize2(final DuelPlayerConfig playerDef) {
|
||||
return getSizedAvatarImageIcon(playerDef, 2);
|
||||
|
@ -191,7 +193,7 @@ public final class IconImages {
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void getClearAvatarsCache() {
|
||||
avatarsMap.clear();
|
||||
|
|
Loading…
Reference in New Issue