Implemented Cindervines

This commit is contained in:
Evan Kranzler 2019-01-10 17:40:03 -05:00
parent ec8250e129
commit 0acf5eeac4
2 changed files with 89 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.c;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Cindervines extends CardImpl {
public Cindervines(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}{G}");
// Whenever an opponent casts a noncreature spell, Cindervines deals 1 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(1, false, "that player"),
StaticFilters.FILTER_SPELL_NON_CREATURE, false, SetTargetPointer.PLAYER
));
// {1}, Sacrifice Cindervines: Destroy target artifact or enchantment. Cindervines deals 2 damage to that permanent's controller.
Ability ability = new SimpleActivatedAbility(
new CindervinesEffect(), new GenericManaCost(1)
);
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_ARTIFACT_OR_ENCHANTMENT));
this.addAbility(ability);
}
private Cindervines(final Cindervines card) {
super(card);
}
@Override
public Cindervines copy() {
return new Cindervines(this);
}
}
class CindervinesEffect extends OneShotEffect {
CindervinesEffect() {
super(Outcome.Benefit);
staticText = "Destroy target artifact or enchantment. " +
"{this} deals 2 damage to that permanent's controller.";
}
private CindervinesEffect(final CindervinesEffect effect) {
super(effect);
}
@Override
public CindervinesEffect copy() {
return new CindervinesEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return false;
}
permanent.destroy(source.getSourceId(), game, false);
player.damage(2, source.getSourceId(), game);
return true;
}
}

View file

@ -61,6 +61,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Captive Audience", 160, Rarity.MYTHIC, mage.cards.c.CaptiveAudience.class));
cards.add(new SetCardInfo("Carnival // Carnage", 222, Rarity.UNCOMMON, mage.cards.c.CarnivalCarnage.class));
cards.add(new SetCardInfo("Charging War Boar", 271, Rarity.UNCOMMON, mage.cards.c.ChargingWarBoar.class));
cards.add(new SetCardInfo("Cindervines", 161, Rarity.RARE, mage.cards.c.Cindervines.class));
cards.add(new SetCardInfo("Clan Guildmage", 162, Rarity.UNCOMMON, mage.cards.c.ClanGuildmage.class));
cards.add(new SetCardInfo("Collision // Colossus", 223, Rarity.UNCOMMON, mage.cards.c.CollisionColossus.class));
cards.add(new SetCardInfo("Combine Guildmage", 163, Rarity.UNCOMMON, mage.cards.c.CombineGuildmage.class));