AF_MoveCounter now accepts Card targeting for a destination

This commit is contained in:
slapshot5
2011-10-30 16:50:19 +00:00
parent 69cd39f9c5
commit 31eb1dca22

View File

@@ -2102,10 +2102,12 @@ public class AbilityFactory_Counters {
source = srcCards.get(0);
}
ArrayList<Card> destCards = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa);
Card dest = null;
if (destCards.size() > 0) {
dest = destCards.get(0);
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
tgtCards = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa);
}
Counters cType = Counters.valueOf(params.get("CounterType"));
@@ -2116,7 +2118,7 @@ public class AbilityFactory_Counters {
sb.append("s");
}
sb.append(" from ");
sb.append(source).append(" to ").append(dest);
sb.append(source).append(" to ").append(tgtCards.get(0));
sb.append(".");
@@ -2259,19 +2261,23 @@ public class AbilityFactory_Counters {
source = srcCards.get(0);
}
ArrayList<Card> destCards = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa);
Card dest = null;
if (destCards.size() > 0) {
dest = destCards.get(0);
ArrayList<Card> tgtCards;
Target tgt = af.getAbTgt();
if (tgt != null) {
tgtCards = tgt.getTargetCards();
} else {
tgtCards = AbilityFactory.getDefinedCards(host, params.get("Defined"), sa);
}
if (null != source && null != dest) {
if (source.getCounters(cType) >= amount) {
if (!dest.hasKeyword("CARDNAME can't have counters placed on it.")
&& !(dest.hasKeyword("CARDNAME can't have -1/-1 counters placed on it.") && cType
.equals("M1M1"))) {
dest.addCounter(cType, amount);
source.subtractCounter(cType, amount);
for (Card dest : tgtCards) {
if (null != source && null != dest) {
if (source.getCounters(cType) >= amount) {
if (!dest.hasKeyword("CARDNAME can't have counters placed on it.")
&& !(dest.hasKeyword("CARDNAME can't have -1/-1 counters placed on it.") && cType
.equals("M1M1"))) {
dest.addCounter(cType, amount);
source.subtractCounter(cType, amount);
}
}
}
}