[MOM] Implement Tandem Takedown

This commit is contained in:
theelk801 2023-04-15 18:11:38 -04:00
parent 9631d8ddb8
commit 26945fe505
2 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,94 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.other.AnotherTargetPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* @author TheElk801
*/
public final class TandemTakedown extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("creature, planeswalker, or battle");
static {
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.PLANESWALKER.getPredicate(),
CardType.BATTLE.getPredicate()
));
filter.add(new AnotherTargetPredicate(2));
}
public TandemTakedown(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{G}{G}");
// Up to two target creatures you control each get +1/+0 until end of turn. They each deal damage equal to their power to another target creature, planeswalker, or battle.
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0)
.setText("up to two target creatures you control each get +1/+0 until end of turn"));
this.getSpellAbility().addEffect(new TandemTakedownEffect());
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1));
this.getSpellAbility().addTarget(new TargetPermanent(filter).setTargetTag(2));
}
private TandemTakedown(final TandemTakedown card) {
super(card);
}
@Override
public TandemTakedown copy() {
return new TandemTakedown(this);
}
}
class TandemTakedownEffect extends OneShotEffect {
TandemTakedownEffect() {
super(Outcome.Benefit);
staticText = "They each deal damage equal to their power to another target creature, planeswalker, or battle";
}
private TandemTakedownEffect(final TandemTakedownEffect effect) {
super(effect);
}
@Override
public TandemTakedownEffect copy() {
return new TandemTakedownEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = this
.getTargetPointer()
.getTargets(game, source)
.stream()
.map(game::getPermanent)
.filter(Objects::nonNull)
.collect(Collectors.toList());
Permanent targetPermanent = game.getPermanent(source.getTargets().get(0).getFirstTarget());
if (permanents.isEmpty() || targetPermanent == null) {
return false;
}
for (Permanent permanent : permanents) {
targetPermanent.damage(permanent.getPower().getValue(), permanent.getId(), source, game);
}
return true;
}
}

View file

@ -300,6 +300,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Swiftwater Cliffs", 273, Rarity.COMMON, mage.cards.s.SwiftwaterCliffs.class));
cards.add(new SetCardInfo("Sword of Once and Future", 265, Rarity.MYTHIC, mage.cards.s.SwordOfOnceAndFuture.class));
cards.add(new SetCardInfo("Swordsworn Cavalier", 42, Rarity.COMMON, mage.cards.s.SwordswornCavalier.class));
cards.add(new SetCardInfo("Tandem Takedown", 208, Rarity.UNCOMMON, mage.cards.t.TandemTakedown.class));
cards.add(new SetCardInfo("Tangled Skyline", 209, Rarity.UNCOMMON, mage.cards.t.TangledSkyline.class));
cards.add(new SetCardInfo("Tarkir Duneshaper", 43, Rarity.COMMON, mage.cards.t.TarkirDuneshaper.class));
cards.add(new SetCardInfo("Temporal Cleansing", 80, Rarity.COMMON, mage.cards.t.TemporalCleansing.class));