Implemented Redcap Melee

This commit is contained in:
Evan Kranzler 2019-09-13 18:15:06 -04:00
parent 9af127d880
commit 946ed82f24
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
package mage.cards.r;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeControllerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreatureOrPlaneswalker;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class RedcapMelee extends CardImpl {
public RedcapMelee(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{R}");
// Redcap Melee deals 4 damage to target creature or planeswalker. If a nonred permanent is dealt damage this way, you sacrifice a land.
this.getSpellAbility().addEffect(new RedcapMeleeEffect());
this.getSpellAbility().addTarget(new TargetCreatureOrPlaneswalker());
}
private RedcapMelee(final RedcapMelee card) {
super(card);
}
@Override
public RedcapMelee copy() {
return new RedcapMelee(this);
}
}
class RedcapMeleeEffect extends OneShotEffect {
private static final Effect effect = new SacrificeControllerEffect(StaticFilters.FILTER_LAND, 1, "");
RedcapMeleeEffect() {
super(Outcome.Benefit);
staticText = "{this} deals 4 damage to target creature or planeswalker. " +
"If a nonred permanent is dealt damage this way, you sacrifice a land.";
}
private RedcapMeleeEffect(final RedcapMeleeEffect effect) {
super(effect);
}
@Override
public RedcapMeleeEffect copy() {
return new RedcapMeleeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
boolean isRed = permanent.getColor(game).isRed();
if (permanent.damage(4, source.getSourceId(), game) > 0 && !isRed) {
return effect.apply(game, source);
}
return true;
}
}

View file

@ -130,6 +130,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Raging Redcap", 134, Rarity.COMMON, mage.cards.r.RagingRedcap.class));
cards.add(new SetCardInfo("Rankle, Master of Pranks", 101, Rarity.MYTHIC, mage.cards.r.RankleMasterOfPranks.class));
cards.add(new SetCardInfo("Reave Soul", 103, Rarity.COMMON, mage.cards.r.ReaveSoul.class));
cards.add(new SetCardInfo("Redcap Melee", 135, Rarity.UNCOMMON, mage.cards.r.RedcapMelee.class));
cards.add(new SetCardInfo("Return to Nature", 173, Rarity.COMMON, mage.cards.r.ReturnToNature.class));
cards.add(new SetCardInfo("Righteousness", 27, Rarity.UNCOMMON, mage.cards.r.Righteousness.class));
cards.add(new SetCardInfo("Robber of the Rich", 138, Rarity.MYTHIC, mage.cards.r.RobberOfTheRich.class));