- Added Weight of Conscience

This commit is contained in:
swordshine
2013-04-01 02:32:23 +00:00
parent 9a13f34517
commit df171b28bd
3 changed files with 71 additions and 8 deletions

1
.gitattributes vendored
View File

@@ -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

View File

@@ -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

View File

@@ -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();
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,14 +122,35 @@ public class CostTapType extends CostPartWithList {
final Card source = ability.getSourceCard();
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
String type = this.getType();
boolean sameType = false;
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
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<Card>() {
@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))) {
return false;
@@ -141,8 +169,29 @@ public class CostTapType extends CostPartWithList {
@Override
public final boolean payHuman(final SpellAbility ability, final GameState game) {
List<Card> typeList = new ArrayList<Card>(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<Card> List2 = typeList;
typeList = CardLists.filter(typeList, new Predicate<Card>() {
@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<Card> totap = ComputerUtil.chooseTapType(ai, this.getType(), source, !canTapSource, c);