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