[STX] fixed Magma Opus not tapping permanents (fixes #7787)

This commit is contained in:
Evan Kranzler 2021-04-30 07:01:18 -04:00
parent 9604a9c3ea
commit b27f2f04c1

View file

@ -4,22 +4,20 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DamageMultiEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.TapTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.PrismariToken;
import mage.game.permanent.token.TreasureToken;
import mage.target.TargetPermanent;
import mage.target.common.TargetAnyTargetAmount;
import mage.target.targetpointer.SecondTargetPointer;
import java.util.UUID;
@ -34,7 +32,7 @@ public final class MagmaOpus extends CardImpl {
// Magma Opus deals 4 damage divided as you choose among any number of targets. Tap two target permanents. Create a 4/4 blue and red Elemental creature token. Draw two cards.
this.getSpellAbility().addEffect(new DamageMultiEffect(4));
this.getSpellAbility().addTarget(new TargetAnyTargetAmount(4).withChooseHint("damage"));
this.getSpellAbility().addEffect(new MagmaOpusTapEffect());
this.getSpellAbility().addEffect(new TapTargetEffect().setTargetPointer(new SecondTargetPointer()).setText("two target permanents"));
this.getSpellAbility().addTarget(new TargetPermanent(2, StaticFilters.FILTER_PERMANENTS).withChooseHint("tap"));
this.getSpellAbility().addEffect(new CreateTokenEffect(new PrismariToken()));
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2).setText("Draw two cards"));
@ -56,34 +54,3 @@ public final class MagmaOpus extends CardImpl {
return new MagmaOpus(this);
}
}
class MagmaOpusTapEffect extends OneShotEffect {
MagmaOpusTapEffect() {
super(Outcome.Benefit);
staticText = "Tap two target permanents.";
}
private MagmaOpusTapEffect(final MagmaOpusTapEffect effect) {
super(effect);
}
@Override
public MagmaOpusTapEffect copy() {
return new MagmaOpusTapEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
if (!source.getTargets().get(1).getTargets().contains(targetId)) {
continue;
}
Permanent permanent = game.getPermanent(targetId);
if (permanent != null) {
permanent.tap(source, game);
}
}
return true;
}
}