- Added Puca's Mischief and Spawnbroker

This commit is contained in:
swordshine
2013-05-24 05:54:18 +00:00
parent 44e967bfcb
commit cf448b4595
7 changed files with 73 additions and 1 deletions

View File

@@ -270,6 +270,9 @@ public final class AbilityFactory {
if (mapParams.containsKey("TargetsAtRandom")) {
abTgt.setRandomTarget(true);
}
if (mapParams.containsKey("TargetsWithRelatedProperty")) {
abTgt.setRelatedProperty(mapParams.get("TargetsWithRelatedProperty"));
}
return abTgt;
}

View File

@@ -65,6 +65,7 @@ public class Target {
private boolean singleTarget = false;
private boolean randomTarget = false;
private String definedController = null;
private String relatedProperty = null;
// How many can be targeted?
private String minTargets;
@@ -107,7 +108,9 @@ public class Target {
this.sameController = target.isSameController();
this.withoutSameCreatureType = target.isWithoutSameCreatureType();
this.definedController = target.getDefinedController();
this.relatedProperty = target.getRelatedProperty();
this.singleTarget = target.isSingleTarget();
this.randomTarget = target.isRandomTarget();
this.choice = target.getTargetChoices();
}
@@ -888,6 +891,20 @@ public class Target {
public void setDefinedController(String defined) {
this.definedController = defined;
}
/**
* @return the relatedProperty
*/
public String getRelatedProperty() {
return relatedProperty;
}
/**
* @param related the relatedProperty to set
*/
public void setRelatedProperty(String related) {
this.relatedProperty = related;
}
/**
* @return the singleTarget

View File

@@ -183,7 +183,35 @@ public class TargetSelection {
});
}
}
// If second target has properties related to the first
if (tgt.getRelatedProperty() != null && !targetedObjects.isEmpty()) {
final List<Card> list = new ArrayList<Card>();
final String related = tgt.getRelatedProperty();
for (final Object o : targetedObjects) {
if (o instanceof Card) {
list.add((Card) o);
}
}
if (!list.isEmpty()) {
final Card card = list.get(0);
if ("LEPower".equals(related)) {
choices = CardLists.filter(choices, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return c.getCurrentPower() <= card.getCurrentPower();
}
});
}
if ("LECMC".equals(related)) {
choices = CardLists.filter(choices, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
return c.getCMC() <= card.getCMC();
}
});
}
}
}
// If all cards must be from the same zone
if (tgt.isSingleZone() && !targeted.isEmpty()) {
choices = CardLists.filterControlledBy(choices, targeted.get(0).getController());