Implemented Embercleave

This commit is contained in:
Evan Kranzler 2019-09-09 20:22:22 -04:00
parent 46b0f0770d
commit c2ed868787
2 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,111 @@
package mage.cards.e;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.game.Game;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Embercleave extends CardImpl {
public Embercleave(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}{R}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.EQUIPMENT);
// Flash
this.addAbility(FlashAbility.getInstance());
// This spell costs {1} less to cast for each attacking creature you control.
this.addAbility(new SimpleStaticAbility(Zone.ALL, new AncientStoneIdolCostReductionEffect()));
// When Embercleave enters the battlefield, attach it to target creature you control.
Ability ability = new EntersBattlefieldTriggeredAbility(new AttachEffect(
Outcome.BoostCreature, "attach it to target creature you control"
), false);
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
// Equipped creature gets +1/+1 and has double strike and trample.
ability = new SimpleStaticAbility(new BoostEquippedEffect(1, 1));
ability.addEffect(new GainAbilityAttachedEffect(
DoubleStrikeAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and has first strike"));
ability.addEffect(new GainAbilityAttachedEffect(
TrampleAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and trample"));
this.addAbility(ability);
// Equip {3}
this.addAbility(new EquipAbility(3));
}
private Embercleave(final Embercleave card) {
super(card);
}
@Override
public Embercleave copy() {
return new Embercleave(this);
}
}
class AncientStoneIdolCostReductionEffect extends CostModificationEffectImpl {
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
static {
filter.add(AttackingPredicate.instance);
}
AncientStoneIdolCostReductionEffect() {
super(Duration.WhileOnStack, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "This spell costs {1} less to cast for each attacking creature you control";
}
private AncientStoneIdolCostReductionEffect(AncientStoneIdolCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
int reductionAmount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
CardUtil.reduceCost(abilityToModify, reductionAmount);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if ((abilityToModify instanceof SpellAbility) && abilityToModify.getSourceId().equals(source.getSourceId())) {
return game.getCard(abilityToModify.getSourceId()) != null;
}
return false;
}
@Override
public AncientStoneIdolCostReductionEffect copy() {
return new AncientStoneIdolCostReductionEffect(this);
}
}

View file

@ -46,6 +46,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Command Tower", 333, Rarity.COMMON, mage.cards.c.CommandTower.class));
cards.add(new SetCardInfo("Corridor Monitor", 41, Rarity.COMMON, mage.cards.c.CorridorMonitor.class));
cards.add(new SetCardInfo("Crystal Slipper", 119, Rarity.COMMON, mage.cards.c.CrystalSlipper.class));
cards.add(new SetCardInfo("Embercleave", 120, Rarity.MYTHIC, mage.cards.e.Embercleave.class));
cards.add(new SetCardInfo("Embereth Paladin", 121, Rarity.COMMON, mage.cards.e.EmberethPaladin.class));
cards.add(new SetCardInfo("Embereth Shieldbreaker", 122, Rarity.UNCOMMON, mage.cards.e.EmberethShieldbreaker.class));
cards.add(new SetCardInfo("Embereth Skyblazer", 321, Rarity.RARE, mage.cards.e.EmberethSkyblazer.class));