[CLB] Implemented Rug of Smothering

This commit is contained in:
Evan Kranzler 2022-06-04 10:29:06 -04:00
parent e3301a6485
commit c91231b5eb
2 changed files with 83 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));