Implemented Grim Feast

This commit is contained in:
Evan Kranzler 2018-06-21 21:39:57 -04:00
parent 36e5bd3a1d
commit f7a3a6409b
2 changed files with 101 additions and 0 deletions

View file

@ -0,0 +1,100 @@
package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldAllTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageControllerEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.OwnerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
* @author TheElk801
*/
public final class GrimFeast extends CardImpl {
public GrimFeast(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{G}");
// At the beginning of your upkeep, Grim Feast deals 1 damage to you.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
new DamageControllerEffect(1),
TargetController.YOU, false
));
// Whenever a creature is put into an opponent's graveyard from the battlefield, you gain life equal to its toughness.
this.addAbility(new GrimFeastTriggeredAbility());
}
public GrimFeast(final GrimFeast card) {
super(card);
}
@Override
public GrimFeast copy() {
return new GrimFeast(this);
}
}
class GrimFeastTriggeredAbility extends PutIntoGraveFromBattlefieldAllTriggeredAbility {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature");
static {
filter.add(new OwnerPredicate(TargetController.OPPONENT));
}
public GrimFeastTriggeredAbility() {
super(new GrimFeastEffect(), false, filter, true, false);
}
public GrimFeastTriggeredAbility(final GrimFeastTriggeredAbility effect) {
super(effect);
}
@Override
public GrimFeastTriggeredAbility copy() {
return new GrimFeastTriggeredAbility(this);
}
@Override
public String getRule() {
return "Whenever a creature is put into an opponents graveyard from the battlefield, "
+ "you gain life equal to its toughness.";
}
}
class GrimFeastEffect extends OneShotEffect {
public GrimFeastEffect() {
super(Outcome.GainLife);
}
public GrimFeastEffect(final GrimFeastEffect effect) {
super(effect);
}
@Override
public GrimFeastEffect copy() {
return new GrimFeastEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent creature = game.getPermanentOrLKIBattlefield(source.getFirstTarget());
if (creature == null) {
return false;
}
return new GainLifeEffect(creature.getToughness().getValue()).apply(game, source);
}
}

View file

@ -139,6 +139,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Grasslands", 327, Rarity.UNCOMMON, mage.cards.g.Grasslands.class));
cards.add(new SetCardInfo("Grave Servitude", 126, Rarity.COMMON, mage.cards.g.GraveServitude.class));
cards.add(new SetCardInfo("Gravebane Zombie", 127, Rarity.COMMON, mage.cards.g.GravebaneZombie.class));
cards.add(new SetCardInfo("Grim Feast", 325, Rarity.RARE, mage.cards.g.GrimFeast.class));
cards.add(new SetCardInfo("Grinning Totem", 303, Rarity.RARE, mage.cards.g.GrinningTotem.class));
cards.add(new SetCardInfo("Hakim, Loreweaver", 68, Rarity.RARE, mage.cards.h.HakimLoreweaver.class));
cards.add(new SetCardInfo("Hall of Gemstone", 221, Rarity.RARE, mage.cards.h.HallOfGemstone.class));