diff --git a/Mage.Sets/src/mage/cards/b/BattleAngelsOfTyr.java b/Mage.Sets/src/mage/cards/b/BattleAngelsOfTyr.java index 06fec1cd742..5d8b9294daa 100644 --- a/Mage.Sets/src/mage/cards/b/BattleAngelsOfTyr.java +++ b/Mage.Sets/src/mage/cards/b/BattleAngelsOfTyr.java @@ -42,7 +42,7 @@ public final class BattleAngelsOfTyr extends CardImpl { this.addAbility(FlyingAbility.getInstance()); // Myriad - this.addAbility(new MyriadAbility()); + this.addAbility(new MyriadAbility(false)); // Whenever Battle Angels of Tyr deals combat damage to a player, draw a card if that player has more cards in hand than each other player. Then you create a Treasure token if that player controls more lands than each other player. Then you gain 3 life if that player has more life than each other player. this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( diff --git a/Mage.Sets/src/mage/cards/e/ElturelSurvivors.java b/Mage.Sets/src/mage/cards/e/ElturelSurvivors.java index 608468f5966..910a77ad7c5 100644 --- a/Mage.Sets/src/mage/cards/e/ElturelSurvivors.java +++ b/Mage.Sets/src/mage/cards/e/ElturelSurvivors.java @@ -44,7 +44,7 @@ public final class ElturelSurvivors extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // Myriad - this.addAbility(new MyriadAbility()); + this.addAbility(new MyriadAbility(false)); // As long as Elturel Survivors is attacking, it gets +X/+0, where X is the number of lands defending player controls. this.addAbility(new SimpleStaticAbility(new BoostSourceEffect( diff --git a/Mage.Sets/src/mage/cards/t/TheMasterMultiplied.java b/Mage.Sets/src/mage/cards/t/TheMasterMultiplied.java new file mode 100644 index 00000000000..a063228f7c6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheMasterMultiplied.java @@ -0,0 +1,115 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; +import mage.abilities.effects.common.ruleModifying.LegendRuleDoesntApplyEffect; +import mage.abilities.keyword.MyriadAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.game.stack.StackObject; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author PurpleCrowbar + */ +public final class TheMasterMultiplied extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature tokens you control"); + + static { + filter.add(TokenPredicate.TRUE); + } + + public TheMasterMultiplied(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}{R}"); + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.TIME_LORD, SubType.ROGUE); + this.power = new MageInt(4); + this.toughness = new MageInt(3); + + // Myriad + this.addAbility(new MyriadAbility(false)); + + // The "legend rule" doesn't apply to creature tokens you control. + this.addAbility(new SimpleStaticAbility(new LegendRuleDoesntApplyEffect(filter))); + + // Triggered abilities you control can't cause you to sacrifice or exile creature tokens you control. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TheMasterMultipliedEffect())); + } + + private TheMasterMultiplied(final TheMasterMultiplied card) { + super(card); + } + + @Override + public TheMasterMultiplied copy() { + return new TheMasterMultiplied(this); + } +} + +class TheMasterMultipliedEffect extends ContinuousRuleModifyingEffectImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("creature tokens you control"); + + static { + filter.add(TokenPredicate.TRUE); + } + + public TheMasterMultipliedEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "Triggered abilities you control can't cause you to sacrifice or exile creature tokens you control"; + } + + private TheMasterMultipliedEffect(final TheMasterMultipliedEffect effect) { + super(effect); + } + + @Override + public TheMasterMultipliedEffect copy() { + return new TheMasterMultipliedEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT + || event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + UUID eventSourceControllerId = game.getControllerId(event.getSourceId()); + Permanent permanent = game.getPermanent(event.getTargetId()); + + StackObject stackObject = game.getStack().getStackObject(event.getSourceId()); + if (stackObject == null) { + return false; + } + Ability stackAbility = stackObject.getStackAbility(); + + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (!zEvent.getToZone().equals(Zone.EXILED)) { + return false; + } + } + + return controller != null && permanent != null + && filter.match(permanent, source.getControllerId(), source, game) + && stackAbility instanceof TriggeredAbility + && source.getControllerId().equals(eventSourceControllerId); + } +} diff --git a/Mage.Sets/src/mage/sets/DoctorWho.java b/Mage.Sets/src/mage/sets/DoctorWho.java index e6e73959999..dcb57b33c18 100644 --- a/Mage.Sets/src/mage/sets/DoctorWho.java +++ b/Mage.Sets/src/mage/sets/DoctorWho.java @@ -213,6 +213,9 @@ public final class DoctorWho extends ExpansionSet { cards.add(new SetCardInfo("The Flood of Mars", 45, Rarity.RARE, mage.cards.t.TheFloodOfMars.class)); cards.add(new SetCardInfo("The Flux", 86, Rarity.RARE, mage.cards.t.TheFlux.class)); cards.add(new SetCardInfo("The Fugitive Doctor", 130, Rarity.RARE, mage.cards.t.TheFugitiveDoctor.class)); + cards.add(new SetCardInfo("The Master, Multiplied", 146, Rarity.RARE, mage.cards.t.TheMasterMultiplied.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Master, Multiplied", 429, Rarity.RARE, mage.cards.t.TheMasterMultiplied.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Master, Multiplied", 545, Rarity.RARE, mage.cards.t.TheMasterMultiplied.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Ninth Doctor", 148, Rarity.RARE, mage.cards.t.TheNinthDoctor.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Ninth Doctor", 432, Rarity.RARE, mage.cards.t.TheNinthDoctor.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Ninth Doctor", 560, Rarity.RARE, mage.cards.t.TheNinthDoctor.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java index fbe8d588f73..fe3d3b6f35c 100644 --- a/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/MyriadAbility.java @@ -23,12 +23,15 @@ import org.apache.log4j.Logger; public class MyriadAbility extends AttacksTriggeredAbility { public MyriadAbility() { - super(new MyriadEffect(), false, - "myriad (Whenever this creature attacks, for each opponent other than the defending player, " - + "put a token that's a copy of this creature onto the battlefield tapped and attacking " - + "that player or a planeswalker they control. Exile those tokens at the end of combat.)", - SetTargetPointer.PLAYER - ); + this(true); + } + + public MyriadAbility(boolean showAbilityHint) { + super(new MyriadEffect(), false, "myriad" + (showAbilityHint ? + " (Whenever this creature attacks, for each opponent other than the defending player, " + + "put a token that's a copy of this creature onto the battlefield tapped and attacking " + + "that player or a planeswalker they control. Exile those tokens at the end of combat.)" : ""), + SetTargetPointer.PLAYER); } protected MyriadAbility(final MyriadAbility ability) { diff --git a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java index 5b72d560dc4..04e40c63fd1 100644 --- a/Mage/src/main/java/mage/game/permanent/PermanentImpl.java +++ b/Mage/src/main/java/mage/game/permanent/PermanentImpl.java @@ -1931,7 +1931,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { } boolean successfullyMoved = ZonesHandler.moveCard(zoneChangeInfo, game, source); //20180810 - 701.3d - detachAllAttachments(game); + if (successfullyMoved) { + detachAllAttachments(game); + } return successfullyMoved; } return false; @@ -1945,7 +1947,9 @@ public abstract class PermanentImpl extends CardImpl implements Permanent { boolean successfullyMoved = ZonesHandler.moveCard(zcInfo, game, source); //20180810 - 701.3d - detachAllAttachments(game); + if (successfullyMoved) { + detachAllAttachments(game); + } return successfullyMoved; } }