Fix Spell targets

This commit is contained in:
tool4EvEr
2021-03-19 23:13:11 +01:00
parent 46718ff96a
commit 0c1ca71f93
7 changed files with 17 additions and 14 deletions

View File

@@ -239,6 +239,14 @@ public abstract class SpellAbilityEffect {
: AbilityUtils.getDefinedObjects(sa.getHostCard(), sa.getParam(definedParam), sa); : AbilityUtils.getDefinedObjects(sa.getHostCard(), sa.getParam(definedParam), sa);
} }
protected final static List<Card> getCardsfromTargets(final SpellAbility sa) {
List<Card> cards = getTargetCards(sa);
List<SpellAbility> spells = getTargetSpells(sa);
for (SpellAbility s : spells) {
cards.add(s.getHostCard());
}
return cards;
}
protected static void registerDelayedTrigger(final SpellAbility sa, String location, final Iterable<Card> crds) { protected static void registerDelayedTrigger(final SpellAbility sa, String location, final Iterable<Card> crds) {
boolean intrinsic = sa.isIntrinsic(); boolean intrinsic = sa.isIntrinsic();

View File

@@ -132,7 +132,7 @@ public class AnimateEffect extends AnimateEffectBase {
sVars.addAll(Arrays.asList(sa.getParam("sVars").split(","))); sVars.addAll(Arrays.asList(sa.getParam("sVars").split(",")));
} }
List<Card> tgts = getTargetCards(sa); List<Card> tgts = getCardsfromTargets(sa);
for (final Card c : tgts) { for (final Card c : tgts) {
doAnimate(c, sa, power, toughness, types, removeTypes, finalDesc, doAnimate(c, sa, power, toughness, types, removeTypes, finalDesc,
@@ -210,7 +210,7 @@ public class AnimateEffect extends AnimateEffectBase {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
final List<Card> tgts = getTargetCards(sa); final List<Card> tgts = getCardsfromTargets(sa);
for (final Card c : tgts) { for (final Card c : tgts) {
sb.append(c).append(" "); sb.append(c).append(" ");

View File

@@ -97,7 +97,7 @@ public class ChangeTextEffect extends SpellAbilityEffect {
changedTypeWordNew = null; changedTypeWordNew = null;
} }
final List<Card> tgts = getTargetCards(sa); final List<Card> tgts = getCardsfromTargets(sa);
for (final Card c : tgts) { for (final Card c : tgts) {
if (changedColorWordOriginal != null && changedColorWordNew != null) { if (changedColorWordOriginal != null && changedColorWordNew != null) {
c.addChangedTextColorWord(changedColorWordOriginal, changedColorWordNew, timestamp); c.addChangedTextColorWord(changedColorWordOriginal, changedColorWordNew, timestamp);
@@ -156,7 +156,7 @@ public class ChangeTextEffect extends SpellAbilityEffect {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
sb.append("Change the text of "); sb.append("Change the text of ");
final List<Card> tgts = getTargetCards(sa); final List<Card> tgts = getCardsfromTargets(sa);
for (final Card c : tgts) { for (final Card c : tgts) {
sb.append(c).append(" "); sb.append(c).append(" ");
} }

View File

@@ -179,7 +179,7 @@ public class PumpEffect extends SpellAbilityEffect {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
List<GameEntity> tgts = Lists.newArrayList(); List<GameEntity> tgts = Lists.newArrayList();
tgts.addAll(getTargetCards(sa)); tgts.addAll(getCardsfromTargets(sa));
if ((sa.usesTargeting() && sa.getTargetRestrictions().canTgtPlayer()) || sa.hasParam("Defined")) { if ((sa.usesTargeting() && sa.getTargetRestrictions().canTgtPlayer()) || sa.hasParam("Defined")) {
tgts.addAll(getTargetPlayers(sa)); tgts.addAll(getTargetPlayers(sa));
} }
@@ -279,7 +279,7 @@ public class PumpEffect extends SpellAbilityEffect {
} }
List<GameEntity> tgts = Lists.newArrayList(); List<GameEntity> tgts = Lists.newArrayList();
List<Card> tgtCards = getTargetCards(sa); List<Card> tgtCards = getCardsfromTargets(sa);
List<Player> tgtPlayers = getTargetPlayers(sa); List<Player> tgtPlayers = getTargetPlayers(sa);
tgts.addAll(tgtCards); tgts.addAll(tgtCards);
tgts.addAll(tgtPlayers); tgts.addAll(tgtPlayers);

View File

@@ -2,8 +2,7 @@ Name:Ersatz Gnomes
ManaCost:3 ManaCost:3
Types:Artifact Creature Gnome Types:Artifact Creature Gnome
PT:1/1 PT:1/1
A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Card.inZoneStack | TgtZone$ Stack,Battlefield | TgtPrompt$ Select target spell to make colorless | Permanent$ True | SpellDescription$ Target spell becomes colorless. A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Card | TgtZone$ Stack | TgtPrompt$ Select target spell to make colorless | Permanent$ True | SpellDescription$ Target spell becomes colorless.
#For the above part to work, another zone MUST be included because of interaction with regular targeting on the stack that stops the ability from working correctly. Use the inZone targeting restriction to limit it to stack. TODO: Probably need to fix this properly.
A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Permanent | TgtPrompt$ Select target permanent to make colorless | SpellDescription$ Target permanent becomes colorless until end of turn. A:AB$ Animate | Cost$ T | Colors$ Colorless | OverwriteColors$ True | ValidTgts$ Permanent | TgtPrompt$ Select target permanent to make colorless | SpellDescription$ Target permanent becomes colorless until end of turn.
AI:RemoveDeck:Random AI:RemoveDeck:Random
AI:RemoveDeck:All AI:RemoveDeck:All

View File

@@ -3,8 +3,6 @@ ManaCost:RG RG
Types:Creature Goblin Shaman Types:Creature Goblin Shaman
PT:2/2 PT:2/2
K:CARDNAME can't be countered. K:CARDNAME can't be countered.
A:AB$ Pump | Cost$ RG | ValidTgts$ Card.inZoneStack | TgtZone$ Stack,Battlefield | PumpZone$ Stack | KW$ HIDDEN This spell can't be countered. | SpellDescription$ Target spell can't be countered. A:AB$ Pump | Cost$ RG | ValidTgts$ Card.inZoneStack | TgtZone$ Stack | PumpZone$ Stack | KW$ HIDDEN This spell can't be countered. | SpellDescription$ Target spell can't be countered.
#Should include another zone otherwise the target would not be defined as a card
AI:RemoveDeck:All AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/vexing_shusher.jpg
Oracle:This spell can't be countered.\n{R/G}: Target spell can't be countered. Oracle:This spell can't be countered.\n{R/G}: Target spell can't be countered.

View File

@@ -3,9 +3,7 @@ ManaCost:1 U
Types:Creature Merfolk Wizard Types:Creature Merfolk Wizard
PT:1/1 PT:1/1
A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ Animate | SpellDescription$ Target instant or sorcery spell becomes the color of your choice. A:AB$ ChooseColor | Cost$ T | Defined$ You | SubAbility$ Animate | SpellDescription$ Target instant or sorcery spell becomes the color of your choice.
SVar:Animate:DB$ Animate | ValidTgts$ Instant.inZoneStack,Sorcery.inZoneStack | TgtPrompt$ Select target instant or sorcery spell to change the color of | TgtZone$ Stack,Battlefield | Colors$ ChosenColor | OverwriteColors$ True | Permanent$ True SVar:Animate:DB$ Animate | ValidTgts$ Instant,Sorcery | TgtPrompt$ Select target instant or sorcery spell to change the color of | TgtZone$ Stack | Colors$ ChosenColor | OverwriteColors$ True | Permanent$ True
#For the above part to work, another zone MUST be included because of interaction with regular targeting on the stack that stops the ability from working correctly. Use the inZone targeting restriction to limit it to stack. TODO: Probably need to fix this properly.
AI:RemoveDeck:Random AI:RemoveDeck:Random
AI:RemoveDeck:All AI:RemoveDeck:All
SVar:Picture:http://www.wizards.com/global/images/magic/general/vodalian_mystic.jpg
Oracle:{T}: Target instant or sorcery spell becomes the color of your choice. Oracle:{T}: Target instant or sorcery spell becomes the color of your choice.