added more target choice for searching for land cards

master
melvin 2013-08-25 10:25:20 +08:00
parent d10d981a2a
commit 8492f03292
2 changed files with 78 additions and 12 deletions

View File

@ -589,6 +589,48 @@ public class MagicTargetChoice extends MagicChoice {
MagicTargetHint.None,
"a Island or Mountain card from your library"
);
public static final MagicTargetChoice SWAMP_OR_FOREST_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_SWAMP_OR_FOREST_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Swamp or Forest card from your library"
);
public static final MagicTargetChoice PLAINS_OR_SWAMP_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_PLAINS_OR_SWAMP_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Plains or Swamp card from your library"
);
public static final MagicTargetChoice MOUNTAIN_OR_PLAINS_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_MOUNTAIN_OR_PLAINS_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Mountain or Plains card from your library"
);
public static final MagicTargetChoice ISLAND_OR_SWAMP_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_ISLAND_OR_SWAMP_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Island or Swamp card from your library"
);
public static final MagicTargetChoice PLAINS_OR_ISLAND_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_PLAINS_OR_ISLAND_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Plains or Island card from your library"
);
public static final MagicTargetChoice PLAINS_ISLAND_SWAMP_OR_MOUNTAIN_CARD_FROM_LIBRARY = new MagicTargetChoice(
MagicTargetFilter.TARGET_PLAINS_ISLAND_SWAMP_OR_MOUNTAIN_CARD_FROM_LIBRARY,
false,
MagicTargetHint.None,
"a Plains, Island, Swamp, or Mountain card from your library"
);
public static final MagicTargetChoice LAND_CARD_FROM_HAND = new MagicTargetChoice(
MagicTargetFilter.TARGET_LAND_CARD_FROM_HAND,

View File

@ -1277,20 +1277,33 @@ public interface MagicTargetFilter<T extends MagicTarget> {
}
};
MagicCardFilterImpl TARGET_FOREST_OR_ISLAND_CARD_FROM_LIBRARY=new MagicCardFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
final MagicCardDefinition cardDefinition = target.getCardDefinition();
return cardDefinition.hasSubType(MagicSubType.Forest) || cardDefinition.hasSubType(MagicSubType.Island);
}
public boolean acceptType(final MagicTargetType targetType) {
return targetType==MagicTargetType.Library;
}
};
MagicCardFilterImpl TARGET_FOREST_OR_ISLAND_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Forest, MagicSubType.Island);
MagicCardFilterImpl TARGET_ISLAND_OR_MOUNTAIN_CARD_FROM_LIBRARY=new MagicCardFilterImpl() {
MagicCardFilterImpl TARGET_ISLAND_OR_MOUNTAIN_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Island, MagicSubType.Mountain);
MagicCardFilterImpl TARGET_SWAMP_OR_FOREST_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Swamp, MagicSubType.Forest);
MagicCardFilterImpl TARGET_PLAINS_OR_SWAMP_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Plains, MagicSubType.Swamp);
MagicCardFilterImpl TARGET_MOUNTAIN_OR_PLAINS_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Mountain, MagicSubType.Plains);
MagicCardFilterImpl TARGET_ISLAND_OR_SWAMP_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Island, MagicSubType.Swamp);
MagicCardFilterImpl TARGET_PLAINS_OR_ISLAND_CARD_FROM_LIBRARY =
Factory.land(MagicTargetType.Library, MagicSubType.Plains, MagicSubType.Island);
MagicCardFilterImpl TARGET_PLAINS_ISLAND_SWAMP_OR_MOUNTAIN_CARD_FROM_LIBRARY = new MagicCardFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
final MagicCardDefinition cardDefinition = target.getCardDefinition();
return cardDefinition.hasSubType(MagicSubType.Island) || cardDefinition.hasSubType(MagicSubType.Mountain);
return target.hasSubType(MagicSubType.Plains) ||
target.hasSubType(MagicSubType.Island) ||
target.hasSubType(MagicSubType.Swamp) ||
target.hasSubType(MagicSubType.Mountain);
}
public boolean acceptType(final MagicTargetType targetType) {
return targetType==MagicTargetType.Library;
@ -1437,6 +1450,17 @@ public interface MagicTargetFilter<T extends MagicTarget> {
}
};
}
public static final MagicCardFilterImpl land(final MagicTargetType aTargetType, final MagicSubType type1, final MagicSubType type2) {
return new MagicCardFilterImpl() {
public boolean accept(final MagicGame game,final MagicPlayer player,final MagicCard target) {
final MagicCardDefinition cardDefinition = target.getCardDefinition();
return cardDefinition.hasSubType(type1) || cardDefinition.hasSubType(type2);
}
public boolean acceptType(final MagicTargetType targetType) {
return targetType == aTargetType;
}
};
}
}
// Permanent reference can not be used because game is copied.