diff --git a/Mage.Sets/src/mage/cards/r/RugOfSmothering.java b/Mage.Sets/src/mage/cards/r/RugOfSmothering.java new file mode 100644 index 00000000000..f8ff34ed3bc --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RugOfSmothering.java @@ -0,0 +1,82 @@ +package mage.cards.r; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SpellCastAllTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SetTargetPointer; +import mage.constants.SubType; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.watchers.common.SpellsCastWatcher; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class RugOfSmothering extends CardImpl { + + public RugOfSmothering(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}"); + + this.subtype.add(SubType.CONSTRUCT); + this.power = new MageInt(1); + this.toughness = new MageInt(3); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // Whenever a player casts a spell, they lose 1 life for each spell they've cast this turn. + this.addAbility(new SpellCastAllTriggeredAbility( + new RugOfSmotheringEffect(), StaticFilters.FILTER_SPELL_A, + false, SetTargetPointer.PLAYER + ), new SpellsCastWatcher()); + } + + private RugOfSmothering(final RugOfSmothering card) { + super(card); + } + + @Override + public RugOfSmothering copy() { + return new RugOfSmothering(this); + } +} + +class RugOfSmotheringEffect extends OneShotEffect { + + RugOfSmotheringEffect() { + super(Outcome.Benefit); + staticText = "they lose 1 life for each spell they've cast this turn"; + } + + private RugOfSmotheringEffect(final RugOfSmotheringEffect effect) { + super(effect); + } + + @Override + public RugOfSmotheringEffect copy() { + return new RugOfSmotheringEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(getTargetPointer().getFirst(game, source)); + if (player == null) { + return false; + } + int count = game + .getState() + .getWatcher(SpellsCastWatcher.class) + .getSpellsCastThisTurn(player.getId()) + .size(); + return count > 0 && player.loseLife(count, game, source, false) > 0; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index 8d19bc1e4ed..422a5e5c0fe 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -453,6 +453,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Rogue's Passage", 913, Rarity.UNCOMMON, mage.cards.r.RoguesPassage.class)); cards.add(new SetCardInfo("Roving Harper", 40, Rarity.COMMON, mage.cards.r.RovingHarper.class)); cards.add(new SetCardInfo("Rowan Kenrith", 805, Rarity.MYTHIC, mage.cards.r.RowanKenrith.class)); + cards.add(new SetCardInfo("Rug of Smothering", 336, Rarity.UNCOMMON, mage.cards.r.RugOfSmothering.class)); cards.add(new SetCardInfo("Rumor Gatherer", 705, Rarity.UNCOMMON, mage.cards.r.RumorGatherer.class)); cards.add(new SetCardInfo("Run Away Together", 92, Rarity.COMMON, mage.cards.r.RunAwayTogether.class)); cards.add(new SetCardInfo("Ryusei, the Falling Star", 806, Rarity.RARE, mage.cards.r.RyuseiTheFallingStar.class));