Merge pull request #469 from Northmoc/clbWyllsReversal

CLB: Wyll's Reversal and support/refactor
This commit is contained in:
Anthony Calosa
2022-05-24 16:42:23 +08:00
committed by GitHub
25 changed files with 51 additions and 59 deletions

View File

@@ -15,12 +15,16 @@ import forge.game.mana.ManaCostBeingPaid;
import forge.game.player.Player; import forge.game.player.Player;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityPredicates; import forge.game.spellability.SpellAbilityPredicates;
import forge.game.spellability.TargetChoices;
import forge.game.staticability.StaticAbility; import forge.game.staticability.StaticAbility;
import forge.game.trigger.Trigger; import forge.game.trigger.Trigger;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.util.Expressions; import forge.util.Expressions;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.HashSet;
import java.util.Set;
public class ForgeScript { public class ForgeScript {
public static boolean cardStateHasProperty(CardState cardState, String property, Player sourceController, public static boolean cardStateHasProperty(CardState cardState, String property, Player sourceController,
@@ -217,6 +221,15 @@ public class ForgeScript {
return false; return false;
} }
return source.equals(m.getHostCard()); return source.equals(m.getHostCard());
} else if (property.startsWith("numTargets")) {
Set<GameObject> targets = new HashSet<>();
for (TargetChoices tc : sa.getAllTargetChoices()) {
targets.addAll(tc);
}
String[] k = property.split(" ", 2);
String comparator = k[1].substring(0, 2);
int y = AbilityUtils.calculateAmount(sa.getHostCard(), k[1].substring(2), sa);
return Expressions.compare(targets.size(), comparator, y);
} else if (property.startsWith("IsTargeting")) { } else if (property.startsWith("IsTargeting")) {
String[] k = property.split(" ", 2); String[] k = property.split(" ", 2);
boolean found = false; boolean found = false;

View File

@@ -365,9 +365,6 @@ public final class AbilityFactory {
abTgt.setSAValidTargeting(mapParams.get("TargetValidTargeting")); abTgt.setSAValidTargeting(mapParams.get("TargetValidTargeting"));
} }
if (mapParams.containsKey("TargetsSingleTarget")) {
abTgt.setSingleTarget(true);
}
if (mapParams.containsKey("TargetUnique")) { if (mapParams.containsKey("TargetUnique")) {
abTgt.setUniqueTargets(true); abTgt.setUniqueTargets(true);
} }

View File

@@ -21,11 +21,9 @@ import java.util.Arrays;
import java.util.EnumMap; import java.util.EnumMap;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@@ -1971,21 +1969,6 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
} }
} }
if (tgt.isSingleTarget()) {
Set<GameObject> targets = new HashSet<>();
for (TargetChoices tc : topSA.getAllTargetChoices()) {
targets.addAll(tc);
if (targets.size() > 1) {
// As soon as we get more than one, bail out
return false;
}
}
if (targets.size() != 1) {
// Make sure that there actually is one target
return false;
}
}
return topSA.getHostCard().isValid(tgt.getValidTgts(), getActivatingPlayer(), getHostCard(), this); return topSA.getHostCard().isValid(tgt.getValidTgts(), getActivatingPlayer(), getHostCard(), this);
} }

View File

@@ -65,7 +65,6 @@ public class TargetRestrictions {
private boolean withoutSameCreatureType = false; private boolean withoutSameCreatureType = false;
private boolean withSameCreatureType = false; private boolean withSameCreatureType = false;
private boolean withSameCardType = false; private boolean withSameCardType = false;
private boolean singleTarget = false;
private boolean randomTarget = false; private boolean randomTarget = false;
private boolean randomNumTargets = false; private boolean randomNumTargets = false;
@@ -108,7 +107,6 @@ public class TargetRestrictions {
this.withoutSameCreatureType = target.isWithoutSameCreatureType(); this.withoutSameCreatureType = target.isWithoutSameCreatureType();
this.withSameCreatureType = target.isWithSameCreatureType(); this.withSameCreatureType = target.isWithSameCreatureType();
this.withSameCardType = target.isWithSameCardType(); this.withSameCardType = target.isWithSameCardType();
this.singleTarget = target.isSingleTarget();
this.randomTarget = target.isRandomTarget(); this.randomTarget = target.isRandomTarget();
this.randomNumTargets = target.isRandomNumTargets(); this.randomNumTargets = target.isRandomNumTargets();
} }
@@ -767,20 +765,6 @@ public class TargetRestrictions {
this.sameController = same; this.sameController = same;
} }
/**
* @return the singleTarget
*/
public boolean isSingleTarget() {
return singleTarget;
}
/**
* @param singleTarget the singleTarget to set
*/
public void setSingleTarget(boolean singleTarget) {
this.singleTarget = singleTarget;
}
public final void applyTargetTextChanges(final SpellAbility sa) { public final void applyTargetTextChanges(final SpellAbility sa) {
for (int i = 0; i < validTgts.length; i++) { for (int i = 0; i < validTgts.length; i++) {
validTgts[i] = AbilityUtils.applyAbilityTextChangeEffects(originalValidTgts[i], sa); validTgts[i] = AbilityUtils.applyAbilityTextChangeEffects(originalValidTgts[i], sa);

View File

@@ -2,6 +2,6 @@ Name:Bolt Bend
ManaCost:3 R ManaCost:3 R
Types:Instant Types:Instant
S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ 3 | EffectZone$ All | IsPresent$ Creature.YouCtrl+powerGE4 | Description$ This Spell costs {3} less to cast if you control a creature with power 4 or greater. S:Mode$ ReduceCost | ValidCard$ Card.Self | Type$ Spell | Amount$ 3 | EffectZone$ All | IsPresent$ Creature.YouCtrl+powerGE4 | Description$ This Spell costs {3} less to cast if you control a creature with power 4 or greater.
A:SP$ ChangeTargets | Cost$ 3 R | TargetType$ Spell,Activated,Triggered | ValidTgts$ Card | TargetsSingleTarget$ True | SpellDescription$ Change the target of target spell or ability with a single target. A:SP$ ChangeTargets | TargetType$ SpellAbility.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell or ability with a single target | SpellDescription$ Change the target of target spell or ability with a single target.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:This spell costs {3} less to cast if you control a creature with power 4 or greater.\nChange the target of target spell or ability with a single target. Oracle:This spell costs {3} less to cast if you control a creature with power 4 or greater.\nChange the target of target spell or ability with a single target.

View File

@@ -1,7 +1,7 @@
Name:Chef's Kiss Name:Chef's Kiss
ManaCost:1 R R ManaCost:1 R R
Types:Instant Types:Instant
A:SP$ ControlSpell | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only a single permanent or player | TargetType$ Spell | Mode$ Gain | TargetsSingleTarget$ True | TargetValidTargeting$ Permanent.inZoneBattlefield,Player | SubAbility$ DBCopy | StackDescription$ SpellDescription | SpellDescription$ Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control. A:SP$ ControlSpell | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only a single permanent or player | TargetType$ Spell.numTargets EQ1+IsTargeting Player,Spell.numTargets EQ1+IsTargeting Valid Permanent | Mode$ Gain | SubAbility$ DBCopy | StackDescription$ SpellDescription | SpellDescription$ Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control.
SVar:DBCopy:DB$ CopySpellAbility | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl | SubAbility$ DBChangeTargets | StackDescription$ None SVar:DBCopy:DB$ CopySpellAbility | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl | SubAbility$ DBChangeTargets | StackDescription$ None
SVar:DBChangeTargets:DB$ ChangeTargets | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl SVar:DBChangeTargets:DB$ ChangeTargets | Defined$ Targeted | RandomTarget$ True | RandomTargetRestriction$ Player.Other,Permanent.YouDontCtrl
Oracle:Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control. Oracle:Gain control of target spell that targets only a single permanent or player. Copy it, then reselect the targets at random for the spell and the copy. The new targets can't be you or a permanent you control.

View File

@@ -1,6 +1,6 @@
Name:Deflection Name:Deflection
ManaCost:3 U ManaCost:3 U
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ 3 U | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | SpellDescription$ Change the target of target spell with a single target. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | SpellDescription$ Change the target of target spell with a single target.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target spell with a single target. Oracle:Change the target of target spell with a single target.

View File

@@ -1,6 +1,6 @@
Name:Divert Name:Divert
ManaCost:U ManaCost:U
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ U | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | RememberTargets$ True | ForgetOtherRemembered$ True | UnlessCost$ 2 | SpellDescription$ Change the target of target spell with a single target unless that spell's controller pays {2}. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | UnlessCost$ 2 | SpellDescription$ Change the target of target spell with a single target unless that spell's controller pays {2}.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target spell with a single target unless that spell's controller pays {2}. Oracle:Change the target of target spell with a single target unless that spell's controller pays {2}.

View File

@@ -1,8 +1,8 @@
Name:Imp's Mischief Name:Imp's Mischief
ManaCost:1 B ManaCost:1 B
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ 1 B | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | RememberTargetedCard$ True | SubAbility$ DBLoseLife | SpellDescription$ Change the target of target spell with a single target. You lose life equal to that spell's mana value. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | RememberTargetedCard$ True | SubAbility$ DBLoseLife | SpellDescription$ Change the target of target spell with a single target. You lose life equal to that spell's mana value.
SVar:DBLoseLife:DB$ LoseLife | Defined$ You | LifeAmount$ X | SubAbility$ DBCleanup SVar:DBLoseLife:DB$ LoseLife | LifeAmount$ X | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
SVar:X:Remembered$CardManaCost SVar:X:Remembered$CardManaCost
AI:RemoveDeck:All AI:RemoveDeck:All

View File

@@ -2,6 +2,6 @@ Name:Misdirection
ManaCost:3 U U ManaCost:3 U U
Types:Instant Types:Instant
SVar:AltCost:Cost$ ExileFromHand<1/Card.Blue+Other> | Description$ You may exile a blue card from your hand rather than pay this spell's mana cost. SVar:AltCost:Cost$ ExileFromHand<1/Card.Blue+Other> | Description$ You may exile a blue card from your hand rather than pay this spell's mana cost.
A:SP$ ChangeTargets | Cost$ 3 U U | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | SpellDescription$ Change the target of target spell with a single target. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | SpellDescription$ Change the target of target spell with a single target.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:You may exile a blue card from your hand rather than pay this spell's mana cost.\nChange the target of target spell with a single target. Oracle:You may exile a blue card from your hand rather than pay this spell's mana cost.\nChange the target of target spell with a single target.

View File

@@ -4,6 +4,6 @@ Types:Creature Beast
PT:3/3 PT:3/3
K:Flash K:Flash
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, change the target of target spell that targets only a single creature to Muck Drubb. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | TriggerDescription$ When CARDNAME enters the battlefield, change the target of target spell that targets only a single creature to Muck Drubb.
SVar:TrigChange:DB$ ChangeTargets | TargetType$ Spell | ValidTgts$ Card | DefinedMagnet$ Self | TargetsSingleTarget$ True | TargetValidTargeting$ Creature SVar:TrigChange:DB$ ChangeTargets | TargetType$ Spell.numTargets EQ1+IsTargeting Valid Creature | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only a single creature | DefinedMagnet$ Self
K:Madness:2 B K:Madness:2 B
Oracle:Flash\nWhen Muck Drubb enters the battlefield, change the target of target spell that targets only a single creature to Muck Drubb.\nMadness {2}{B} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.) Oracle:Flash\nWhen Muck Drubb enters the battlefield, change the target of target spell that targets only a single creature to Muck Drubb.\nMadness {2}{B} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.)

View File

@@ -4,5 +4,5 @@ Types:Creature Human Wizard
PT:2/2 PT:2/2
K:Flash K:Flash
T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromYourHandByYou+Self | Destination$ Battlefield | Execute$ TrigRadiate | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, choose target spell or ability that targets only a single permanent or player. Copy that spell or ability for each other permanent or player the spell or ability could target. Each copy targets a different one of those permanents and players. T:Mode$ ChangesZone | ValidCard$ Card.wasCastFromYourHandByYou+Self | Destination$ Battlefield | Execute$ TrigRadiate | TriggerDescription$ When CARDNAME enters the battlefield, if you cast it from your hand, choose target spell or ability that targets only a single permanent or player. Copy that spell or ability for each other permanent or player the spell or ability could target. Each copy targets a different one of those permanents and players.
SVar:TrigRadiate:DB$ CopySpellAbility | ValidTgts$ Card | TgtPrompt$ Select target spell or ability that targets a single permanent or player | TargetType$ Spell,Activated,Triggered | TargetsSingleTarget$ True | TargetValidTargeting$ Permanent.inZoneBattlefield,Player | Controller$ You | CopyForEachCanTarget$ True | CanTargetPlayer$ True | SpellDescription$ Choose target spell or ability that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players. SVar:TrigRadiate:DB$ CopySpellAbility | ValidTgts$ Card | TgtPrompt$ Select target spell or ability that targets a single permanent or player | TargetType$ SpellAbility.numTargets EQ1+IsTargeting Player,SpellAbility.numTargets EQ1+IsTargeting Valid Permanent | Controller$ You | CopyForEachCanTarget$ True | CanTargetPlayer$ True | SpellDescription$ Choose target spell or ability that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players.
Oracle:Flash\nWhen Radiant Performer enters the battlefield, if you cast it from your hand, choose target spell or ability that targets only a single permanent or player. Copy that spell or ability for each other permanent or player the spell or ability could target. Each copy targets a different one of those permanents and players. Oracle:Flash\nWhen Radiant Performer enters the battlefield, if you cast it from your hand, choose target spell or ability that targets only a single permanent or player. Copy that spell or ability for each other permanent or player the spell or ability could target. Each copy targets a different one of those permanents and players.

View File

@@ -1,6 +1,6 @@
Name:Radiate Name:Radiate
ManaCost:3 R R ManaCost:3 R R
Types:Instant Types:Instant
A:SP$ CopySpellAbility | Cost$ 3 R R | ValidTgts$ Instant,Sorcery | TargetType$ Spell | TargetsSingleTarget$ True | TargetValidTargeting$ Permanent.inZoneBattlefield,Player | Controller$ You | CopyForEachCanTarget$ True | CanTargetPlayer$ True | SpellDescription$ Choose target instant or sorcery spell that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players. A:SP$ CopySpellAbility | ValidTgts$ Instant,Sorcery | TgtPrompt$ Choose target instant or sorcery spell that targets only a single permanent or player | TargetType$ Spell.numTargets EQ1+IsTargeting Player,Spell.numTargets EQ1+IsTargeting Valid Permanent | Controller$ You | CopyForEachCanTarget$ True | CanTargetPlayer$ True | SpellDescription$ Choose target instant or sorcery spell that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players.
AI:RemoveDeck:Random AI:RemoveDeck:Random
Oracle:Choose target instant or sorcery spell that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players. Oracle:Choose target instant or sorcery spell that targets only a single permanent or player. Copy that spell for each other permanent or player the spell could target. Each copy targets a different one of those permanents and players.

View File

@@ -1,6 +1,6 @@
Name:Rebound Name:Rebound
ManaCost:1 U ManaCost:1 U
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ 1 U | TargetType$ Spell | ValidTgts$ Card | TargetValidTargeting$ Player | TargetsSingleTarget$ True | TargetRestriction$ Player | SpellDescription$ Change the target of target spell that targets only a player. The new target must be a player. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1+IsTargeting Player | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only a player | TargetRestriction$ Player | SpellDescription$ Change the target of target spell that targets only a player. The new target must be a player.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target spell that targets only a player. The new target must be a player. Oracle:Change the target of target spell that targets only a player. The new target must be a player.

View File

@@ -1,7 +1,7 @@
Name:Reflecting Mirror Name:Reflecting Mirror
ManaCost:4 ManaCost:4
Types:Artifact Types:Artifact
A:AB$ ChangeTargets | Cost$ X T | TargetType$ Spell | ValidTgts$ Card | TargetValidTargeting$ You | TargetsSingleTarget$ True | TargetRestriction$ Player | SpellDescription$ Change the target of target spell with a single target if that target is you. The new target must be a player. X is twice the mana value of that spell. A:AB$ ChangeTargets | Cost$ X T | TargetType$ Spell.numTargets EQ1+IsTargeting You | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target targeting you | TargetRestriction$ Player | SpellDescription$ Change the target of target spell with a single target if that target is you. The new target must be a player. X is twice the mana value of that spell.
AI:RemoveDeck:All AI:RemoveDeck:All
SVar:X:Targeted$CardManaCost/Twice SVar:X:Targeted$CardManaCost/Twice
Oracle:{X}, {T}: Change the target of target spell with a single target if that target is you. The new target must be a player. X is twice the mana value of that spell. Oracle:{X}, {T}: Change the target of target spell with a single target if that target is you. The new target must be a player. X is twice the mana value of that spell.

View File

@@ -1,7 +1,7 @@
Name:Reroute Name:Reroute
ManaCost:1 R ManaCost:1 R
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ 1 R | TargetType$ Activated | ValidTgts$ Card | TgtPrompt$ Select target Activated Ability | TargetsSingleTarget$ True | SubAbility$ DBDraw | SpellDescription$ Change the target of target activated ability with a single target. (Mana abilities can't be targeted.) Draw a card. A:SP$ ChangeTargets | TargetType$ Activated.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target activated ability with a single target | SubAbility$ DBDraw | SpellDescription$ Change the target of target activated ability with a single target. (Mana abilities can't be targeted.) Draw a card.
SVar:DBDraw:DB$ Draw | NumCards$ 1 SVar:DBDraw:DB$ Draw | NumCards$ 1
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target activated ability with a single target. (Mana abilities can't be targeted.)\nDraw a card. Oracle:Change the target of target activated ability with a single target. (Mana abilities can't be targeted.)\nDraw a card.

View File

@@ -2,6 +2,6 @@ Name:Ricochet Trap
ManaCost:3 R ManaCost:3 R
Types:Instant Trap Types:Instant Trap
SVar:AltCost:Cost$ R | CheckSVar$ X | SVarCompare$ GE1 | StackDescription$ Description | Description$ If an opponent cast a blue spell this turn, you may pay {R} rather than pay this spell's mana cost. SVar:AltCost:Cost$ R | CheckSVar$ X | SVarCompare$ GE1 | StackDescription$ Description | Description$ If an opponent cast a blue spell this turn, you may pay {R} rather than pay this spell's mana cost.
A:SP$ ChangeTargets | Cost$ 3 R | TargetType$ Spell | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | TargetsSingleTarget$ True | StackDescription$ SpellDescription | SpellDescription$ Change the target of target spell with a single target. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | StackDescription$ SpellDescription | SpellDescription$ Change the target of target spell with a single target.
SVar:X:Count$ThisTurnCast_Card.Blue+OppCtrl SVar:X:Count$ThisTurnCast_Card.Blue+OppCtrl
Oracle:If an opponent cast a blue spell this turn, you may pay {R} rather than pay this spell's mana cost.\nChange the target of target spell with a single target. Oracle:If an opponent cast a blue spell this turn, you may pay {R} rather than pay this spell's mana cost.\nChange the target of target spell with a single target.

View File

@@ -1,6 +1,6 @@
Name:Shunt Name:Shunt
ManaCost:1 R R ManaCost:1 R R
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ 1 R R | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | SpellDescription$ Change the target of target spell with a single target. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | SpellDescription$ Change the target of target spell with a single target.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target spell with a single target. Oracle:Change the target of target spell with a single target.

View File

@@ -3,6 +3,6 @@ ManaCost:3 U U
Types:Creature Drake Types:Creature Drake
PT:4/3 PT:4/3
K:Flying K:Flying
A:AB$ ChangeTargets | Cost$ U | TargetType$ Spell,Activated,Triggered | ValidTgts$ Card | TargetValidTargeting$ Card.Self | TargetsSingleTarget$ True | TargetRestriction$ Creature | SpellDescription$ Change the target of target spell or ability that targets only CARDNAME. The new target must be a creature. A:AB$ ChangeTargets | Cost$ U | TargetType$ SpellAbility.numTargets EQ1+IsTargeting Self | ValidTgts$ Card | TgtPrompt$ Select target spell or ability that targets only CARDNAME | TargetRestriction$ Creature | SpellDescription$ Change the target of target spell or ability that targets only CARDNAME. The new target must be a creature.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Flying\n{U}: Change the target of target spell or ability that targets only Silver Wyvern. The new target must be a creature. Oracle:Flying\n{U}: Change the target of target spell or ability that targets only Silver Wyvern. The new target must be a creature.

View File

@@ -1,6 +1,6 @@
Name:Swerve Name:Swerve
ManaCost:U R ManaCost:U R
Types:Instant Types:Instant
A:SP$ ChangeTargets | Cost$ U R | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | SpellDescription$ Change the target of target spell with a single target. A:SP$ ChangeTargets | TargetType$ Spell.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell with a single target | SpellDescription$ Change the target of target spell with a single target.
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Change the target of target spell with a single target. Oracle:Change the target of target spell with a single target.

View File

@@ -4,7 +4,7 @@ Types:Creature Shapeshifter
PT:3/3 PT:3/3
A:AB$ Untap | Cost$ R | SpellDescription$ Untap CARDNAME. A:AB$ Untap | Cost$ R | SpellDescription$ Untap CARDNAME.
A:AB$ MustBlock | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature | SpellDescription$ Target creature blocks CARDNAME this turn if able. A:AB$ MustBlock | Cost$ R | ValidTgts$ Creature | TgtPrompt$ Select target creature | SpellDescription$ Target creature blocks CARDNAME this turn if able.
A:AB$ ChangeTargets | Cost$ R | TargetType$ Spell | ValidTgts$ Card | TargetsSingleTarget$ True | TargetValidTargeting$ Card.Self | SpellDescription$ Change the target of target spell that targets only CARDNAME. A:AB$ ChangeTargets | Cost$ R | TargetType$ Spell.numTargets EQ1+IsTargeting Self | ValidTgts$ Card | TgtPrompt$ Select target spell that targets only CARDNAME | SpellDescription$ Change the target of target spell that targets only CARDNAME.
A:AB$ Pump | Cost$ 1 | NumAtt$ +1 | NumDef$ -1 | SpellDescription$ CARDNAME gets +1/-1 until end of turn. A:AB$ Pump | Cost$ 1 | NumAtt$ +1 | NumDef$ -1 | SpellDescription$ CARDNAME gets +1/-1 until end of turn.
A:AB$ Pump | Cost$ 1 | NumAtt$ -1 | NumDef$ +1 | SpellDescription$ CARDNAME gets -1/+1 until end of turn. A:AB$ Pump | Cost$ 1 | NumAtt$ -1 | NumDef$ +1 | SpellDescription$ CARDNAME gets -1/+1 until end of turn.
AI:RemoveDeck:All AI:RemoveDeck:All

View File

@@ -0,0 +1,10 @@
Name:Wyll's Reversal
ManaCost:2 R
Types:Instant
A:SP$ Pump | TargetType$ SpellAbility.numTargets GE1 | TgtZone$ Stack | ValidTgts$ Card | TgtPrompt$ Select target spell or ability with one or more targets | SubAbility$ RollD20 | StackDescription$ {p:You} chooses {s:Targeted}. | SpellDescription$ Choose target spell or ability with one or more targets.
SVar:RollD20:DB$ RollDice | Sides$ 20 | Modifier$ Y | ResultSubAbilities$ 1-14:ChooseNew,Else:ChooseAndCopy | StackDescription$ SpellDescription | SpellDescription$ Roll a d20 and add the greatest power among creatures you control.
SVar:ChooseNew:DB$ ChangeTargets | Defined$ Targeted | Optional$ True | SpellDescription$ 1—14 VERT You may choose new targets for that spell or ability.
SVar:ChooseAndCopy:DB$ ChangeTargets | Defined$ Targeted | Optional$ True | SubAbility$ DBCopy | SpellDescription$ 15+ VERT You may choose new targets for that spell or ability.
SVar:DBCopy:DB$ CopySpellAbility | Defined$ Targeted | Controller$ You | MayChooseTarget$ True
SVar:Y:Count$Valid Creature.YouCtrl$GreatestPower
Oracle:Choose target spell or ability with one or more targets. Roll a d20 and add the greatest power among creatures you control.\n1-14 | You may choose new targets for that spell or ability.\n15+ | You may choose new targets for that spell or ability. Then copy it. You may choose new targets for the copy.

View File

@@ -2,7 +2,7 @@ Name:Warriors' Lesson
ManaCost:G ManaCost:G
Types:Instant Types:Instant
A:SP$ Animate | Cost$ G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | TargetMin$ 0 | TargetMax$ 2 | Triggers$ WarriorLessonDmg | sVars$ WarriorLessonDraw | SpellDescription$ Until end of turn, up to two target creatures you control each gain "Whenever this creature deals combat damage to a player, draw a card." A:SP$ Animate | Cost$ G | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select up to two target creatures you control | TargetMin$ 0 | TargetMax$ 2 | Triggers$ WarriorLessonDmg | sVars$ WarriorLessonDraw | SpellDescription$ Until end of turn, up to two target creatures you control each gain "Whenever this creature deals combat damage to a player, draw a card."
SVar:WarriorLessonDmg:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ WarriorLessonDraw | TriggerDescription$ Whenever CARDNAME deals combat damage to a player, draw a card. SVar:WarriorLessonDmg:Mode$ DamageDone | ValidSource$ Card.Self | ValidTarget$ Player | CombatDamage$ True | Execute$ WarriorLessonDraw | TriggerDescription$ Whenever this creature deals combat damage to a player, draw a card.
SVar:WarriorLessonDraw:DB$ Draw | Defined$ You | NumCards$ 1 SVar:WarriorLessonDraw:DB$ Draw | Defined$ You | NumCards$ 1
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Until end of turn, up to two target creatures you control each gain "Whenever this creature deals combat damage to a player, draw a card." Oracle:Until end of turn, up to two target creatures you control each gain "Whenever this creature deals combat damage to a player, draw a card."

View File

@@ -4,6 +4,6 @@ Types:Creature Human Wizard
PT:1/2 PT:1/2
K:Morph:1 U K:Morph:1 U
T:Mode$ TurnFaceUp | ValidCard$ Card.Self | Execute$ TrigChange | TriggerZones$ Battlefield | TriggerDescription$ When CARDNAME is turned face up, change the target of target spell or ability with a single target. T:Mode$ TurnFaceUp | ValidCard$ Card.Self | Execute$ TrigChange | TriggerZones$ Battlefield | TriggerDescription$ When CARDNAME is turned face up, change the target of target spell or ability with a single target.
SVar:TrigChange:DB$ ChangeTargets | TargetType$ Spell,Activated,Triggered | ValidTgts$ Card | TargetsSingleTarget$ True SVar:TrigChange:DB$ ChangeTargets | TargetType$ SpellAbility.numTargets EQ1 | ValidTgts$ Card | TgtPrompt$ Select target spell or ability with a single target
AI:RemoveDeck:All AI:RemoveDeck:All
Oracle:Morph {1}{U} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)\nWhen Willbender is turned face up, change the target of target spell or ability with a single target. Oracle:Morph {1}{U} (You may cast this card face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)\nWhen Willbender is turned face up, change the target of target spell or ability with a single target.

View File

@@ -47,6 +47,7 @@ import forge.game.zone.Zone;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.gamemodes.match.input.InputSelectTargets; import forge.gamemodes.match.input.InputSelectTargets;
import forge.util.Aggregates; import forge.util.Aggregates;
import forge.util.TextUtil;
/** /**
* <p> * <p>
@@ -265,10 +266,13 @@ public class TargetSelection {
} }
Object chosen = null; Object chosen = null;
String message = TextUtil.fastReplace(getTgt().getVTSelection(),
"CARDNAME", ability.getHostCard().toString());
if (!choices.isEmpty() && mandatory) { if (!choices.isEmpty() && mandatory) {
chosen = controller.getGui().one(getTgt().getVTSelection(), choicesFiltered); chosen = controller.getGui().one(message, choicesFiltered);
} else { } else {
chosen = controller.getGui().oneOrNone(getTgt().getVTSelection(), choicesFiltered); chosen = controller.getGui().oneOrNone(message, choicesFiltered);
} }
if (chosen == null) { if (chosen == null) {
return false; return false;
@@ -303,7 +307,8 @@ public class TargetSelection {
private final boolean chooseCardFromStack(final boolean mandatory) { private final boolean chooseCardFromStack(final boolean mandatory) {
final TargetRestrictions tgt = this.getTgt(); final TargetRestrictions tgt = this.getTgt();
final String message = tgt.getVTSelection(); final String message = TextUtil.fastReplace(tgt.getVTSelection(),
"CARDNAME", ability.getHostCard().toString());
// Find what's targetable, then allow human to choose // Find what's targetable, then allow human to choose
final List<Object> selectOptions = new ArrayList<>(); final List<Object> selectOptions = new ArrayList<>();
HashMap<StackItemView, SpellAbilityStackInstance> stackItemViewCache = new HashMap<>(); HashMap<StackItemView, SpellAbilityStackInstance> stackItemViewCache = new HashMap<>();