mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
PIP: vats.txt and support (#4195)
* PIP: vats.txt and support * add SpellAbility.canTarget logic for targets with equal toughness
This commit is contained in:
@@ -398,6 +398,9 @@ public final class AbilityFactory {
|
||||
if (mapParams.containsKey("TargetsWithDifferentCMC")) {
|
||||
abTgt.setDifferentCMC(true);
|
||||
}
|
||||
if (mapParams.containsKey("TargetsWithEqualToughness")) {
|
||||
abTgt.setEqualToughness(true);
|
||||
}
|
||||
if (mapParams.containsKey("TargetsAtRandom")) {
|
||||
abTgt.setRandomTarget(true);
|
||||
}
|
||||
|
||||
@@ -1399,6 +1399,14 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.isEqualToughness() && entity instanceof Card) {
|
||||
for (final Card c : targetChosen.getTargetCards()) {
|
||||
if (entity != c && c.getNetToughness() != (((Card) entity).getNetToughness())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (tr.isSameController() && entity instanceof Card) {
|
||||
Player newController;
|
||||
newController = ((Card) entity).getController();
|
||||
|
||||
@@ -58,6 +58,7 @@ public class TargetRestrictions {
|
||||
private boolean singleZone = false;
|
||||
private boolean differentControllers = false;
|
||||
private boolean differentCMC = false;
|
||||
private boolean equalToughness = false;
|
||||
private boolean sameController = false;
|
||||
private boolean withoutSameCreatureType = false;
|
||||
private boolean withSameCreatureType = false;
|
||||
@@ -100,6 +101,7 @@ public class TargetRestrictions {
|
||||
this.singleZone = target.isSingleZone();
|
||||
this.differentControllers = target.isDifferentControllers();
|
||||
this.differentCMC = target.isDifferentCMC();
|
||||
this.equalToughness = target.isEqualToughness();
|
||||
this.sameController = target.isSameController();
|
||||
this.withoutSameCreatureType = target.isWithoutSameCreatureType();
|
||||
this.withSameCreatureType = target.isWithSameCreatureType();
|
||||
@@ -616,6 +618,21 @@ public class TargetRestrictions {
|
||||
public void setDifferentCMC(boolean different) {
|
||||
this.differentCMC = different;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the equalToughness
|
||||
*/
|
||||
public boolean isEqualToughness() {
|
||||
return equalToughness;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param b the equalToughness to set
|
||||
*/
|
||||
public void setEqualToughness(boolean b) {
|
||||
this.equalToughness = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the differentControllers
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user