Some infrastructure to script Lorwyn dual lands

This commit is contained in:
Maxmtg
2013-04-05 19:57:20 +00:00
parent f18da79101
commit 9f6c077fd0
2 changed files with 20 additions and 18 deletions

View File

@@ -22,6 +22,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.TreeMap;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@@ -3145,13 +3146,14 @@ public class CardFactoryUtil {
return evokedSpell; return evokedSpell;
} }
private static final Map<String,String> emptyMap = new TreeMap<String,String>();
public static void setupETBReplacementAbility(SpellAbility sa) { public static void setupETBReplacementAbility(SpellAbility sa) {
SpellAbility tailend = sa; SpellAbility tailend = sa;
while (tailend.getSubAbility() != null) { while (tailend.getSubAbility() != null) {
tailend = tailend.getSubAbility(); tailend = tailend.getSubAbility();
} }
tailend.setSubAbility(new AbilitySub(ApiType.InternalEtbReplacement, sa.getSourceCard(), null, null)); tailend.setSubAbility(new AbilitySub(ApiType.InternalEtbReplacement, sa.getSourceCard(), null, emptyMap));
// ETBReplacementMove(sa.getSourceCard(), null)); // ETBReplacementMove(sa.getSourceCard(), null));
} }

View File

@@ -50,6 +50,7 @@ import forge.card.cost.CostPayLife;
import forge.card.cost.CostPutCounter; import forge.card.cost.CostPutCounter;
import forge.card.cost.CostRemoveCounter; import forge.card.cost.CostRemoveCounter;
import forge.card.cost.CostReturn; import forge.card.cost.CostReturn;
import forge.card.cost.CostReveal;
import forge.card.cost.CostSacrifice; import forge.card.cost.CostSacrifice;
import forge.card.cost.CostTapType; import forge.card.cost.CostTapType;
import forge.card.cost.CostUtil; import forge.card.cost.CostUtil;
@@ -515,30 +516,29 @@ public final class GameActionUtil {
else if (part instanceof CostSacrifice) { else if (part instanceof CostSacrifice) {
int amount = Integer.parseInt(((CostSacrifice)part).getAmount()); int amount = Integer.parseInt(((CostSacrifice)part).getAmount());
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType().split(";"), p, source); List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "sacrifice"); boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "sacrifice." + orString);
if(!hasPaid) return false; if(!hasPaid) return false;
} } else if (part instanceof CostReturn) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
else if (part instanceof CostReturn) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType().split(";"), p, source);
int amount = getAmountFromPartX(part, source, sourceAbility); int amount = getAmountFromPartX(part, source, sourceAbility);
boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "return to hand"); boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "return to hand." + orString);
if(!hasPaid) return false; if(!hasPaid) return false;
} } else if (part instanceof CostDiscard) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), part.getType(), p, source);
else if (part instanceof CostDiscard) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), part.getType().split(";"), p, source);
int amount = getAmountFromPartX(part, source, sourceAbility); int amount = getAmountFromPartX(part, source, sourceAbility);
boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "discard"); boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "discard." + orString);
if(!hasPaid) return false; if(!hasPaid) return false;
} } else if (part instanceof CostReveal) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Hand), part.getType(), p, source);
else if (part instanceof CostTapType) { int amount = getAmountFromPartX(part, source, sourceAbility);
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType().split(";"), p, source); boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "reveal." + orString);
if(!hasPaid) return false;
} else if (part instanceof CostTapType) {
List<Card> list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType(), p, source);
list = CardLists.filter(list, Presets.UNTAPPED); list = CardLists.filter(list, Presets.UNTAPPED);
int amount = getAmountFromPartX(part, source, sourceAbility); int amount = getAmountFromPartX(part, source, sourceAbility);
boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "tap"); boolean hasPaid = payCostPart(sourceAbility, (CostPartWithList)part, amount, list, "tap." + orString);
if(!hasPaid) return false; if(!hasPaid) return false;
} }