mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Move TargetsWithRelatedProperty to canTarget
This commit is contained in:
@@ -255,9 +255,6 @@ public final class AbilityFactory {
|
||||
if (mapParams.containsKey("TargetsAtRandom")) {
|
||||
abTgt.setRandomTarget(true);
|
||||
}
|
||||
if (mapParams.containsKey("TargetsWithRelatedProperty")) {
|
||||
abTgt.setRelatedProperty(mapParams.get("TargetsWithRelatedProperty"));
|
||||
}
|
||||
if (mapParams.containsKey("TargetingPlayer")) {
|
||||
abTgt.setMandatory(true);
|
||||
}
|
||||
|
||||
@@ -1046,6 +1046,27 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasParam("TargetsWithRelatedProperty") && entity instanceof Card) {
|
||||
final String related = getParam("TargetsWithRelatedProperty");
|
||||
final Card c = (Card) entity;
|
||||
Card parentTarget = null;
|
||||
for (GameObject o : this.getUniqueTargets()) {
|
||||
if (o instanceof Card) {
|
||||
parentTarget = (Card) o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parentTarget == null) {
|
||||
return false;
|
||||
}
|
||||
switch (related) {
|
||||
case "LEPower" :
|
||||
return c.getNetAttack() <= parentTarget.getNetAttack();
|
||||
case "LECMC" :
|
||||
return c.getCMC() <= parentTarget.getCMC();
|
||||
}
|
||||
}
|
||||
|
||||
if (hasParam("TargetingPlayerControls") && entity instanceof Card) {
|
||||
final Card c = (Card) entity;
|
||||
if (!c.getController().equals(targetingPlayer)) {
|
||||
|
||||
@@ -63,7 +63,6 @@ public class TargetRestrictions {
|
||||
private boolean withoutSameCreatureType = false;
|
||||
private boolean singleTarget = false;
|
||||
private boolean randomTarget = false;
|
||||
private String relatedProperty = null;
|
||||
|
||||
// How many can be targeted?
|
||||
private String minTargets;
|
||||
@@ -100,7 +99,6 @@ public class TargetRestrictions {
|
||||
this.differentZone = target.isDifferentZone();
|
||||
this.sameController = target.isSameController();
|
||||
this.withoutSameCreatureType = target.isWithoutSameCreatureType();
|
||||
this.relatedProperty = target.getRelatedProperty();
|
||||
this.singleTarget = target.isSingleTarget();
|
||||
this.randomTarget = target.isRandomTarget();
|
||||
}
|
||||
@@ -630,20 +628,6 @@ public class TargetRestrictions {
|
||||
public final void setSameController(final boolean same) {
|
||||
this.sameController = same;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
|
||||
Reference in New Issue
Block a user