Implemented Masterful Replication

This commit is contained in:
Evan Kranzler 2019-06-22 18:25:48 -04:00
parent 1e43c38b49
commit 59ae424fb3
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.GolemToken;
import mage.target.TargetPermanent;
import mage.util.functions.EmptyApplyToPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MasterfulReplication extends CardImpl {
public MasterfulReplication(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{U}");
// Choose one
// Create two 3/3 colorless Golem artifact creature tokens.
this.getSpellAbility().addEffect(new CreateTokenEffect(new GolemToken(), 2));
// Choose target artifact you control. Each other artifact you control becomes a copy of that artifact until end of turn.
Mode mode = new Mode(new MasterfulReplicationEffect());
mode.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT));
this.getSpellAbility().addMode(mode);
}
private MasterfulReplication(final MasterfulReplication card) {
super(card);
}
@Override
public MasterfulReplication copy() {
return new MasterfulReplication(this);
}
}
class MasterfulReplicationEffect extends OneShotEffect {
MasterfulReplicationEffect() {
super(Outcome.Copy);
this.staticText = "Choose target artifact you control. Each other artifact you control " +
"becomes a copy of that artifact until end of turn.";
}
private MasterfulReplicationEffect(final MasterfulReplicationEffect effect) {
super(effect);
}
@Override
public MasterfulReplicationEffect copy() {
return new MasterfulReplicationEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent copyFromArtifact = game.getPermanent(source.getFirstTarget());
if (copyFromArtifact == null) {
return true;
}
for (Permanent copyToArtifact : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
if (copyToArtifact.isArtifact() && copyFromArtifact.getId().equals(copyToArtifact.getId())) {
game.copyPermanent(Duration.EndOfTurn, copyFromArtifact, copyToArtifact.getId(), source, new EmptyApplyToPermanent());
}
}
return true;
}
}

View file

@ -123,6 +123,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Manifold Key", 230, Rarity.UNCOMMON, mage.cards.m.ManifoldKey.class));
cards.add(new SetCardInfo("Marauding Raptor", 150, Rarity.RARE, mage.cards.m.MaraudingRaptor.class));
cards.add(new SetCardInfo("Mask of Immolation", 151, Rarity.UNCOMMON, mage.cards.m.MaskOfImmolation.class));
cards.add(new SetCardInfo("Masterful Replication", 65, Rarity.RARE, mage.cards.m.MasterfulReplication.class));
cards.add(new SetCardInfo("Moat Piranhas", 67, Rarity.COMMON, mage.cards.m.MoatPiranhas.class));
cards.add(new SetCardInfo("Moldervine Reclamation", 214, Rarity.UNCOMMON, mage.cards.m.MoldervineReclamation.class));
cards.add(new SetCardInfo("Mu Yanling, Celestial Wind", 286, Rarity.MYTHIC, mage.cards.m.MuYanlingCelestialWind.class));