mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Added Puca's Mischief and Spawnbroker
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user