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:
Northmoc
2023-11-25 06:28:24 -05:00
committed by GitHub
parent c5419d8c24
commit a635d35dfa
8 changed files with 67 additions and 1 deletions

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -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
*/