diff --git a/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java b/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java index 0920ecc99c7..28ce2824584 100644 --- a/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java +++ b/Mage.Sets/src/mage/cards/c/CityscapeLeveler.java @@ -2,19 +2,19 @@ package mage.cards.c; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.AttacksTriggeredAbility; import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.CastSourceTriggeredAbility; import mage.abilities.effects.common.CreateTokenControllerTargetEffect; import mage.abilities.effects.common.DestroyTargetEffect; import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.UnearthAbility; +import mage.abilities.meta.OrTriggeredAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; import mage.game.permanent.token.PowerstoneToken; import mage.target.common.TargetNonlandPermanent; @@ -36,7 +36,12 @@ public final class CityscapeLeveler extends CardImpl { this.addAbility(TrampleAbility.getInstance()); // When you cast this spell and whenever Cityscape Leveler attacks, destroy up to one target nonland permanent. Its controller creates a tapped Powerstone token. - Ability ability = new CityscapeLevelerAbility(); + Ability ability = new OrTriggeredAbility( + Zone.ALL, + new DestroyTargetEffect(), + new CastSourceTriggeredAbility(null), + new AttacksTriggeredAbility(null) + ).setTriggerPhrase("When you cast this spell and whenever {this} attacks, "); ability.addEffect(new CreateTokenControllerTargetEffect(new PowerstoneToken(), 1, true)); ability.addTarget(new TargetNonlandPermanent(0, 1)); this.addAbility(ability); @@ -53,47 +58,4 @@ public final class CityscapeLeveler extends CardImpl { public CityscapeLeveler copy() { return new CityscapeLeveler(this); } -} - -class CityscapeLevelerAbility extends TriggeredAbilityImpl { - - public CityscapeLevelerAbility() { - super(Zone.ALL, new DestroyTargetEffect()); - setTriggerPhrase("When you cast this spell and whenever {this} attacks, "); - } - - private CityscapeLevelerAbility(final CityscapeLevelerAbility ability) { - super(ability); - } - - @Override - public CityscapeLevelerAbility copy() { - return new CityscapeLevelerAbility(this); - } - - @Override - public boolean checkEventType(GameEvent event, Game game) { - switch (event.getType()) { - case SPELL_CAST: - case DECLARED_ATTACKERS: - return true; - default: - return false; - } - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (sourceId == null) { - return false; - } - switch (event.getType()) { - case SPELL_CAST: - return sourceId.equals(event.getSourceId()); - case DECLARED_ATTACKERS: - return game.getCombat().getAttackers().contains(sourceId); - default: - return false; - } - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/t/TitansVanguard.java b/Mage.Sets/src/mage/cards/t/TitansVanguard.java new file mode 100644 index 00000000000..20cba544d8c --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TitansVanguard.java @@ -0,0 +1,66 @@ +package mage.cards.t; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.common.CastSourceTriggeredAbility; +import mage.abilities.effects.common.counter.AddCountersAllEffect; +import mage.abilities.keyword.DevoidAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.meta.OrTriggeredAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.counters.CounterType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorlessPredicate; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class TitansVanguard extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledCreaturePermanent("colorless creature you control"); + + static { + filter.add(ColorlessPredicate.instance); + } + + public TitansVanguard(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{G}"); + + this.subtype.add(SubType.ELDRAZI); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // Devoid + this.addAbility(new DevoidAbility(this.color)); + + // When you cast this spell and whenever Titans' Vanguard attacks, put a +1/+1 counter on each colorless creature you control. + Ability ability = new OrTriggeredAbility( + Zone.ALL, + new AddCountersAllEffect(CounterType.P1P1.createInstance(), filter), + new CastSourceTriggeredAbility(null), + new AttacksTriggeredAbility(null) + ).setTriggerPhrase("When you cast this spell and whenever {this} attacks, "); + this.addAbility(ability); + + + // Trample + this.addAbility(TrampleAbility.getInstance()); + } + + private TitansVanguard(final TitansVanguard card) { + super(card); + } + + @Override + public TitansVanguard copy() { + return new TitansVanguard(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons3.java b/Mage.Sets/src/mage/sets/ModernHorizons3.java index 12e93a5d12f..bee341ca849 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons3.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons3.java @@ -267,6 +267,7 @@ public final class ModernHorizons3 extends ExpansionSet { cards.add(new SetCardInfo("The Necrobloom", 194, Rarity.RARE, mage.cards.t.TheNecrobloom.class)); cards.add(new SetCardInfo("Thraben Charm", 45, Rarity.COMMON, mage.cards.t.ThrabenCharm.class)); cards.add(new SetCardInfo("Thriving Skyclaw", 141, Rarity.COMMON, mage.cards.t.ThrivingSkyclaw.class)); + cards.add(new SetCardInfo("Titans' Vanguard", 206, Rarity.UNCOMMON, mage.cards.t.TitansVanguard.class)); cards.add(new SetCardInfo("Toxic Deluge", 277, Rarity.RARE, mage.cards.t.ToxicDeluge.class)); cards.add(new SetCardInfo("Tranquil Landscape", 231, Rarity.COMMON, mage.cards.t.TranquilLandscape.class)); cards.add(new SetCardInfo("Trickster's Elk", 175, Rarity.UNCOMMON, mage.cards.t.TrickstersElk.class));