[MOC] Implement Mirror-Style Master

This commit is contained in:
theelk801 2023-04-12 08:49:45 -04:00
parent 771c291d78
commit 203defa56d
2 changed files with 105 additions and 0 deletions

View file

@ -0,0 +1,104 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.ExileTargetEffect;
import mage.abilities.keyword.BackupAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.ModifiedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTargets;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MirrorStyleMaster extends CardImpl {
public MirrorStyleMaster(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Backup 1
BackupAbility backupAbility = new BackupAbility(this, 1);
this.addAbility(backupAbility);
// Whenever this creature attacks, for each attacking modified creature you control, create a tapped and attacking token that's a copy of that creature. Exile those tokens at end of combat.
backupAbility.addAbility(new AttacksTriggeredAbility(new MirrorStyleMasterEffect())
.setTriggerPhrase("Whenever this creature attacks, "));
}
private MirrorStyleMaster(final MirrorStyleMaster card) {
super(card);
}
@Override
public MirrorStyleMaster copy() {
return new MirrorStyleMaster(this);
}
}
class MirrorStyleMasterEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(AttackingPredicate.instance);
filter.add(ModifiedPredicate.instance);
}
MirrorStyleMasterEffect() {
super(Outcome.Benefit);
staticText = "for each attacking modified creature you control, create a tapped and attacking token " +
"that's a copy of that creature. Exile those tokens at end of combat";
}
private MirrorStyleMasterEffect(final MirrorStyleMasterEffect effect) {
super(effect);
}
@Override
public MirrorStyleMasterEffect copy() {
return new MirrorStyleMasterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = new ArrayList<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(
filter, source.getControllerId(), source, game
)) {
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(
null, null, false, 1, true, true
);
effect.setSavedPermanent(permanent);
effect.apply(game, source);
permanents.addAll(effect.getAddedPermanents());
}
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(
new ExileTargetEffect()
.setTargetPointer(new FixedTargets(permanents, game))
.setText("exile those tokens")
), source);
return true;
}
}

View file

@ -197,6 +197,7 @@ public final class MarchOfTheMachineCommander extends ExpansionSet {
cards.add(new SetCardInfo("Mikaeus, the Lunarch", 197, Rarity.RARE, mage.cards.m.MikaeusTheLunarch.class));
cards.add(new SetCardInfo("Mind Stone", 364, Rarity.UNCOMMON, mage.cards.m.MindStone.class));
cards.add(new SetCardInfo("Mindless Automaton", 365, Rarity.UNCOMMON, mage.cards.m.MindlessAutomaton.class));
cards.add(new SetCardInfo("Mirror-Style Master", 32, Rarity.RARE, mage.cards.m.MirrorStyleMaster.class));
cards.add(new SetCardInfo("Mortify", 337, Rarity.UNCOMMON, mage.cards.m.Mortify.class));
cards.add(new SetCardInfo("Mossfire Valley", 414, Rarity.RARE, mage.cards.m.MossfireValley.class));
cards.add(new SetCardInfo("Mosswort Bridge", 415, Rarity.RARE, mage.cards.m.MosswortBridge.class));