fix some missing target tags

This commit is contained in:
xenohedron 2025-05-31 23:03:02 -04:00
parent 8b29853e4c
commit 8b2a81cb42
12 changed files with 24 additions and 47 deletions

View file

@ -44,11 +44,11 @@ public final class ClosingStatement extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Destroy target creature or planeswalker you don't control. Put a +1/+1 counter on up to one target creature you control. // Destroy target creature or planeswalker you don't control. Put a +1/+1 counter on up to one target creature you control.
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker(1, 1, filter, false)); this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker(1, 1, filter, false)
.setTargetTag(1));
this.getSpellAbility().addEffect(new DestroyTargetEffect()); this.getSpellAbility().addEffect(new DestroyTargetEffect());
Target target = new TargetControlledCreaturePermanent(0, 1); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent(0, 1)
target.setTargetTag(2); .setTargetTag(2));
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new ClosingStatementEffect()); this.getSpellAbility().addEffect(new ClosingStatementEffect());
} }
@ -94,4 +94,4 @@ class ClosingStatementEffect extends OneShotEffect {
} }
return true; return true;
} }
} }

View file

@ -53,7 +53,7 @@ public final class CombineGuildmage extends CardImpl {
// {1}{U}, {T}: Move a +1/+1 counter from target creature you control onto another target creature you control. // {1}{U}, {T}: Move a +1/+1 counter from target creature you control onto another target creature you control.
ability = new SimpleActivatedAbility(new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{U}")); ability = new SimpleActivatedAbility(new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{U}"));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetControlledCreaturePermanent().withChooseHint("to remove a counter from")); ability.addTarget(new TargetControlledCreaturePermanent().withChooseHint("to remove a counter from").setTargetTag(1));
ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2)); ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -53,7 +53,7 @@ public final class DaghatarTheAdamant extends CardImpl {
Ability ability = new SimpleActivatedAbility( Ability ability = new SimpleActivatedAbility(
new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{B/G}{B/G}") new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{B/G}{B/G}")
); );
ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from")); ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from").setTargetTag(1));
ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2)); ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -19,7 +19,6 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent; import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.common.TargetControlledCreaturePermanent;
@ -44,9 +43,7 @@ public final class DevouringTendrils extends CardImpl {
Effect effect = new DamageWithPowerFromOneToAnotherTargetEffect(); Effect effect = new DamageWithPowerFromOneToAnotherTargetEffect();
this.getSpellAbility().addEffect(effect); this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
TargetPermanent target = new TargetPermanent(filter); this.getSpellAbility().addTarget(new TargetPermanent(filter));
target.setTargetTag(2);
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new DevouringTendrilsEffect()); this.getSpellAbility().addEffect(new DevouringTendrilsEffect());
} }
@ -79,11 +76,7 @@ class DevouringTendrilsEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Target target = source.getTargets().stream() Permanent permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
.filter(t -> t.getTargetTag() == 2)
.findFirst()
.orElseThrow(() -> new IllegalStateException("Expected to find target with tag 2 but found none"));
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) { if (permanent != null) {
DelayedTriggeredAbility delayedAbility = new DevouringTendrilsDelayedTriggeredAbility(new MageObjectReference(permanent, game)); DelayedTriggeredAbility delayedAbility = new DevouringTendrilsDelayedTriggeredAbility(new MageObjectReference(permanent, game));
game.addDelayedTriggeredAbility(delayedAbility, source); game.addDelayedTriggeredAbility(delayedAbility, source);

View file

@ -52,7 +52,7 @@ public final class FallOfGilGalad extends CardImpl {
.setTriggerPhrase("When this creature dies, ") .setTriggerPhrase("When this creature dies, ")
).setText("until end of turn, target creature you control gains \"When this creature dies, draw two cards.\"")); ).setText("until end of turn, target creature you control gains \"When this creature dies, draw two cards.\""));
ability.addEffect(new FightTargetsEffect().setText("Then that creature fights up to one other target creature")); ability.addEffect(new FightTargetsEffect().setText("Then that creature fights up to one other target creature"));
ability.addTarget(new TargetControlledCreaturePermanent()); ability.addTarget(new TargetControlledCreaturePermanent().setTargetTag(1));
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2)); ability.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2));
}); });

View file

@ -12,19 +12,11 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.cards.CardsImpl; import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.*;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.StaticFilters; import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game; import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID; import java.util.UUID;
@ -49,14 +41,8 @@ public final class GarrukSavageHerald extends CardImpl {
effect.setText("Target creature you control deals damage equal to its power to another target creature"); effect.setText("Target creature you control deals damage equal to its power to another target creature");
Ability minusAbility = new LoyaltyAbility(effect, -2); Ability minusAbility = new LoyaltyAbility(effect, -2);
TargetControlledCreaturePermanent controlledCreature = new TargetControlledCreaturePermanent(); minusAbility.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_CREATURE).setTargetTag(1));
controlledCreature.setTargetTag(1); minusAbility.addTarget(new TargetPermanent(StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2));
minusAbility.addTarget(controlledCreature);
FilterCreaturePermanent filter = new FilterCreaturePermanent();
filter.add(new AnotherTargetPredicate(2));
TargetCreaturePermanent anotherTargetCreature = new TargetCreaturePermanent(filter);
minusAbility.addTarget(anotherTargetCreature.withChooseHint("another creature to deal damage to"));
this.addAbility(minusAbility); this.addAbility(minusAbility);

View file

@ -46,7 +46,7 @@ public final class LeechBonder extends CardImpl {
// {U}, {untap}: Move a counter from target creature onto another target creature. // {U}, {untap}: Move a counter from target creature onto another target creature.
Ability ability = new SimpleActivatedAbility(new MoveCounterTargetsEffect(), new ManaCostsImpl<>("{U}")); Ability ability = new SimpleActivatedAbility(new MoveCounterTargetsEffect(), new ManaCostsImpl<>("{U}"));
ability.addCost(new UntapSourceCost()); ability.addCost(new UntapSourceCost());
ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from")); ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from").setTargetTag(1));
ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2)); ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -29,13 +29,11 @@ public class MastersRebuke extends CardImpl {
// Target creature you control deals damage equal to its power to target creature or planeswalker you dont control. // Target creature you control deals damage equal to its power to target creature or planeswalker you dont control.
this.getSpellAbility().addEffect(new DamageWithPowerFromOneToAnotherTargetEffect()); this.getSpellAbility().addEffect(new DamageWithPowerFromOneToAnotherTargetEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
TargetPermanent targetForDamage = new TargetPermanent(filter); this.getSpellAbility().addTarget(new TargetPermanent(filter));
targetForDamage.setTargetTag(2);
this.getSpellAbility().addTarget(targetForDamage);
} }
private MastersRebuke(final MastersRebuke card) { super(card); } private MastersRebuke(final MastersRebuke card) { super(card); }
@Override @Override
public MastersRebuke copy() { return new MastersRebuke(this); } public MastersRebuke copy() { return new MastersRebuke(this); }
} }

View file

@ -36,7 +36,7 @@ public final class NestingGrounds extends CardImpl {
// {1}, {T}: Move a counter from target permanent you control onto another target permanent. Activate this ability only any time you could cast a sorcery. // {1}, {T}: Move a counter from target permanent you control onto another target permanent. Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(new MoveCounterTargetsEffect(), new GenericManaCost(1)); Ability ability = new ActivateAsSorceryActivatedAbility(new MoveCounterTargetsEffect(), new GenericManaCost(1));
ability.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability.addTarget(new TargetControlledPermanent().withChooseHint("to remove a counter from")); ability.addTarget(new TargetControlledPermanent().withChooseHint("to remove a counter from").setTargetTag(1));
ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2)); ability.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -46,7 +46,7 @@ public final class RumorMonger extends CardImpl {
// <i>Bounty</i> &mdash; Whenever a creature an opponent controls with a bounty counter on it dies, you may move a bounty counter from one target creature to another target creatute. // <i>Bounty</i> &mdash; Whenever a creature an opponent controls with a bounty counter on it dies, you may move a bounty counter from one target creature to another target creatute.
ability = new BountyAbility(new MoveCounterTargetsEffect(CounterType.BOUNTY), true); ability = new BountyAbility(new MoveCounterTargetsEffect(CounterType.BOUNTY), true);
ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from")); ability.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from").setTargetTag(1));
ability.addTarget(new TargetPermanent(filter).setTargetTag(2).withChooseHint("to move a counter to")); ability.addTarget(new TargetPermanent(filter).setTargetTag(2).withChooseHint("to move a counter to"));
this.addAbility(ability); this.addAbility(ability);
} }

View file

@ -35,8 +35,8 @@ public final class SelfDestruct extends CardImpl {
// Target creature you control deals X damage to any other target and X damage to itself, where X is its power. // Target creature you control deals X damage to any other target and X damage to itself, where X is its power.
this.getSpellAbility().addEffect(new SelfDestructEffect()); this.getSpellAbility().addEffect(new SelfDestructEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addTarget(new TargetAnyTarget().setTargetTag(2)); this.getSpellAbility().addTarget(new TargetAnyTarget(filter).setTargetTag(2));
} }
private SelfDestruct(final SelfDestruct card) { private SelfDestruct(final SelfDestruct card) {

View file

@ -57,7 +57,7 @@ public final class SimicGuildmage extends CardImpl {
// {1}{G}: Move a +1/+1 counter from target creature onto another target creature with the same controller. // {1}{G}: Move a +1/+1 counter from target creature onto another target creature with the same controller.
Ability countersAbility = new SimpleActivatedAbility(new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{G}")); Ability countersAbility = new SimpleActivatedAbility(new MoveCounterTargetsEffect(CounterType.P1P1), new ManaCostsImpl<>("{1}{G}"));
countersAbility.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from")); countersAbility.addTarget(new TargetCreaturePermanent().withChooseHint("to remove a counter from").setTargetTag(1));
countersAbility.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2)); countersAbility.addTarget(new TargetPermanent(filter).withChooseHint("to move a counter to").setTargetTag(2));
this.addAbility(countersAbility); this.addAbility(countersAbility);
@ -136,7 +136,7 @@ class MoveAuraEffect extends OneShotEffect {
} }
FilterPermanent filter = new FilterPermanent( FilterPermanent filter = new FilterPermanent(
"permanent" + Optional "permanent" + Optional
.ofNullable(aura) .of(aura)
.map(Permanent::getAttachedTo) .map(Permanent::getAttachedTo)
.map(game::getControllerId) .map(game::getControllerId)
.map(game::getPlayer) .map(game::getPlayer)
@ -153,7 +153,7 @@ class MoveAuraEffect extends OneShotEffect {
target.withNotTarget(true); target.withNotTarget(true);
controller.choose(outcome, target, source, game); controller.choose(outcome, target, source, game);
return Optional return Optional
.ofNullable(target) .of(target)
.map(TargetImpl::getFirstTarget) .map(TargetImpl::getFirstTarget)
.map(game::getPermanent) .map(game::getPermanent)
.map(permanent -> permanent.addAttachment(aura.getId(), source, game)) .map(permanent -> permanent.addAttachment(aura.getId(), source, game))