diff --git a/.gitattributes b/.gitattributes index 16003e58249..9ab51f67db4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12038,6 +12038,7 @@ res/cardsfolder/w/wei_infantry.txt svneol=native#text/plain res/cardsfolder/w/wei_night_raiders.txt svneol=native#text/plain res/cardsfolder/w/wei_scout.txt svneol=native#text/plain res/cardsfolder/w/wei_strike_force.txt svneol=native#text/plain +res/cardsfolder/w/weight_of_conscience.txt -text res/cardsfolder/w/weight_of_spires.txt -text res/cardsfolder/w/weird_harvest.txt -text res/cardsfolder/w/weirding_shaman.txt svneol=native#text/plain diff --git a/res/cardsfolder/w/weight_of_conscience.txt b/res/cardsfolder/w/weight_of_conscience.txt new file mode 100644 index 00000000000..0d929197ba5 --- /dev/null +++ b/res/cardsfolder/w/weight_of_conscience.txt @@ -0,0 +1,10 @@ +Name:Weight of Conscience +ManaCost:1 W +Types:Enchantment Aura +K:Enchant creature +A:SP$ Attach | Cost$ 1 W | ValidTgts$ Creature | AILogic$ Curse +S:Mode$ Continuous | Affected$ Creature.EnchantedBy | AddHiddenKeyword$ CARDNAME can't attack. | Description$ Enchanted creature can't attack. +A:AB$ ChangeZone | Cost$ tapXType<2/Creature.sharesCreatureTypeWith/creatures that share a creature type> | Defined$ Enchanted | Origin$ Battlefield | Destination$ Exile | SpellDescription$ Exile enchanted creature. +SVar:Picture:http://www.wizards.com/global/images/magic/general/weight_of_conscience.jpg +Oracle:Enchant creature\nEnchanted creature can't attack.\nTap two untapped creatures you control that share a creature type: Exile enchanted creature. +SetInfo:MOR Common \ No newline at end of file diff --git a/src/main/java/forge/card/cost/CostTapType.java b/src/main/java/forge/card/cost/CostTapType.java index 32e7e8f8253..7c1eb7e37df 100644 --- a/src/main/java/forge/card/cost/CostTapType.java +++ b/src/main/java/forge/card/cost/CostTapType.java @@ -19,8 +19,12 @@ package forge.card.cost; import java.util.ArrayList; import java.util.List; + +import com.google.common.base.Predicate; + import forge.Card; import forge.CardLists; +import forge.CardPredicates; import forge.CardPredicates.Presets; import forge.FThreads; import forge.card.ability.AbilityUtils; @@ -80,11 +84,14 @@ public class CostTapType extends CostPartWithList { final Integer i = this.convertAmount(); final String desc = this.getDescription(); - - sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "untapped " + desc)); - - sb.append(" you control"); - + final String type = this.getType(); + + if (type.contains("sharesCreatureTypeWith")) { + sb.append("two untapped creatures you control that share a creature type"); + } else { + sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), "untapped " + desc)); + sb.append(" you control"); + } return sb.toString(); } @@ -115,13 +122,34 @@ public class CostTapType extends CostPartWithList { final Card source = ability.getSourceCard(); List typeList = new ArrayList(activator.getCardsIn(ZoneType.Battlefield)); - - typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source); + String type = this.getType(); + boolean sameType = false; + + if (type.contains("sharesCreatureTypeWith")) { + sameType = true; + type = type.replace("sharesCreatureTypeWith", ""); + } + + typeList = CardLists.getValidCards(typeList, type.split(";"), activator, source); if (!canTapSource) { typeList.remove(source); } typeList = CardLists.filter(typeList, Presets.UNTAPPED); + + if (sameType) { + for (final Card card : typeList) { + if (CardLists.filter(typeList, new Predicate() { + @Override + public boolean apply(final Card c) { + return c.sharesCreatureTypeWith(card); + } + }).size() > 1) { + return true; + } + } + return false; + } final Integer amount = this.convertAmount(); if ((typeList.size() == 0) || ((amount != null) && (typeList.size() < amount))) { @@ -141,8 +169,29 @@ public class CostTapType extends CostPartWithList { @Override public final boolean payHuman(final SpellAbility ability, final GameState game) { List typeList = new ArrayList(ability.getActivatingPlayer().getCardsIn(ZoneType.Battlefield)); - typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); + String type = this.getType(); + boolean sameType = false; + if (type.contains("sharesCreatureTypeWith")) { + sameType = true; + type = type.replace("sharesCreatureTypeWith", ""); + } + typeList = CardLists.getValidCards(typeList, type.split(";"), ability.getActivatingPlayer(), ability.getSourceCard()); typeList = CardLists.filter(typeList, Presets.UNTAPPED); + if (sameType) { + final List List2 = typeList; + typeList = CardLists.filter(typeList, new Predicate() { + @Override + public boolean apply(final Card c) { + for (Card card : List2) { + if (!card.equals(c) && card.sharesCreatureTypeWith(c)) { + return true; + } + } + return false; + } + }); + } + final String amount = this.getAmount(); final Card source = ability.getSourceCard(); Integer c = this.convertAmount(); @@ -185,6 +234,9 @@ public class CostTapType extends CostPartWithList { c = AbilityUtils.calculateAmount(source, amount, ability); } } + if (this.getType().contains("sharesCreatureTypeWith")) { + return null; + } List totap = ComputerUtil.chooseTapType(ai, this.getType(), source, !canTapSource, c);