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

View File

@@ -2,7 +2,7 @@ Name:Atomwheel Acrobats
ManaCost:3 G
Types:Creature Elf Performer
PT:3/2
T:Mode$ RolledDie | TriggerZones$ Battlefield | Execute$ TrigPutCounter | ValidResult$ 1,2 | TriggerDescription$ Whenever you roll a 1 or 2, put that many +1/+1 counters on CARDNAME.
T:Mode$ RolledDie | TriggerZones$ Battlefield | Execute$ TrigPutCounter | ValidResult$ 1,2 | ValidPlayer$ You | TriggerDescription$ Whenever you roll a 1 or 2, put that many +1/+1 counters on CARDNAME.
SVar:TrigPutCounter:DB$ PutCounter | CounterType$ P1P1 | CounterNum$ X
SVar:X:TriggerCount$Result
A:AB$ RollDice | Cost$ 2 G | AILogic$ AtOppEOT | SpellDescription$ Roll a six-sided die.

View File

@@ -0,0 +1,11 @@
Name:Mr. House, President and CEO
ManaCost:R W B
Types:Legendary Artifact Creature Human
PT:0/4
T:Mode$ RolledDie | TriggerZones$ Battlefield | Execute$ TrigBranch | ValidPlayer$ You | ValidResult$ GE4 | TriggerDescription$ Whenever you roll a 4 or higher, create a 3/3 colorless Robot artifact creature token. If you rolled 6 or higher, instead create that token and a Treasure token.
SVar:TrigBranch:DB$ Branch | BranchConditionSVar$ TriggerCount$Result | BranchConditionSVarCompare$ GE6 | TrueSubAbility$ Tokens | FalseSubAbility$ Token
SVar:Token:DB$ Token | TokenScript$ c_3_3_a_robot
SVar:Tokens:DB$ Token | TokenScript$ c_3_3_a_robot,c_a_treasure_sac
A:AB$ RollDice | Cost$ 4 T | Amount$ Count$TotalManaSpent Treasure/Plus.1 | StackDescription$ SpellDescription | SpellDescription$ Roll a six-sided die plus an additional six-sided die for each mana from Treasures spent to activate this ability.
DeckHas:Ability$Token|Sacrifice & Type$Artifact|Robot|Treasure
Oracle:Whenever you roll a 4 or higher, create a 3/3 colorless Robot artifact creature token. If you rolled 6 or higher, instead create that token and a Treasure token.\n{4}, {T}: Roll a six-sided die plus an additional six-sided die for each mana from Treasures spent to activate this ability.

View File

@@ -0,0 +1,6 @@
Name:V.A.T.S.
ManaCost:2 B B
Types:Instant
K:Split second
A:SP$ Destroy | TargetMin$ 0 | TargetMax$ Count$Valid Creature | ValidTgts$ Creature | TgtPrompt$ Choose any number of target creatures with equal toughness | TargetsWithEqualToughness$ True | SpellDescription$ Choose any number of target creatures with equal toughness. Destroy the chosen creatures.
Oracle:Split second (As long as this spell is on the stack, players can't cast spells or activate abilities that aren't mana abilities.)\nChoose any number of target creatures with equal toughness. Destroy the chosen creatures.

View File

@@ -0,0 +1,5 @@
Name:Robot Token
ManaCost:no cost
PT:3/3
Types:Artifact Creature Robot
Oracle:

View File

@@ -256,6 +256,22 @@ public final class InputSelectTargets extends InputSyncronizedBase {
}
}
// If all cards must have equal toughness
if (tgt.isEqualToughness()) {
final List<Integer> tgtTs = new ArrayList<>();
for (final GameObject o : targets) {
if (o instanceof Card) {
final Integer cmc = ((Card) o).getCurrentToughness();
tgtTs.add(cmc);
}
}
if (!tgtTs.isEmpty() && !tgtTs.contains(card.getCurrentToughness())) {
showMessage(sa.getHostCard() + " - Cannot target this card (must have equal toughness)");
return false;
}
}
// If all cards must have different mana values
if (tgt.isDifferentCMC()) {
final List<Integer> targetedCMCs = new ArrayList<>();