[MOM] Implement Etched Host Doombringer

This commit is contained in:
theelk801 2023-04-06 20:37:24 -04:00
parent c1ac88102e
commit ae0773de4e
5 changed files with 145 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.e;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.permanent.ProtectedByOpponentPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class EtchedHostDoombringer extends CardImpl {
public EtchedHostDoombringer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.subtype.add(SubType.PHYREXIAN);
this.subtype.add(SubType.DEMON);
this.power = new MageInt(3);
this.toughness = new MageInt(5);
// When Etched Host Doombringer enters the battlefield, choose one
// * Target opponent loses 2 life and you gain 2 life.
Ability ability = new EntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(2));
ability.addEffect(new GainLifeEffect(2).concatBy("and"));
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
// * Choose target battle. If an opponent protects it, remove three defense counters from it. Otherwise, put three defense counters on it.
ability.addMode(new Mode(new EtchedHostDoombringerEffect())
.addTarget(new TargetPermanent(StaticFilters.FILTER_PERMANENT_BATTLE)));
}
private EtchedHostDoombringer(final EtchedHostDoombringer card) {
super(card);
}
@Override
public EtchedHostDoombringer copy() {
return new EtchedHostDoombringer(this);
}
}
class EtchedHostDoombringerEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(ProtectedByOpponentPredicate.instance);
}
EtchedHostDoombringerEffect() {
super(Outcome.Benefit);
staticText = "choose target battle. If an opponent protects it, " +
"remove three defense counters from it. Otherwise, put three defense counters on it";
}
private EtchedHostDoombringerEffect(final EtchedHostDoombringerEffect effect) {
super(effect);
}
@Override
public EtchedHostDoombringerEffect copy() {
return new EtchedHostDoombringerEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
if (!filter.match(permanent, source.getControllerId(), source, game)) {
return permanent.addCounters(CounterType.DEFENSE.createInstance(3), source, game);
}
permanent.removeCounters(CounterType.DEFENSE.createInstance(3), source, game);
return true;
}
}

View file

@ -80,6 +80,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Errant and Giada", 224, Rarity.RARE, mage.cards.e.ErrantAndGiada.class));
cards.add(new SetCardInfo("Essence of Orthodoxy", 323, Rarity.RARE, mage.cards.e.EssenceOfOrthodoxy.class));
cards.add(new SetCardInfo("Etched Familiar", 101, Rarity.COMMON, mage.cards.e.EtchedFamiliar.class));
cards.add(new SetCardInfo("Etched Host Doombringer", 102, Rarity.COMMON, mage.cards.e.EtchedHostDoombringer.class));
cards.add(new SetCardInfo("Expedition Lookout", 56, Rarity.COMMON, mage.cards.e.ExpeditionLookout.class));
cards.add(new SetCardInfo("Eyes of Gitaxias", 57, Rarity.COMMON, mage.cards.e.EyesOfGitaxias.class));
cards.add(new SetCardInfo("Faerie Mastermind", 58, Rarity.RARE, mage.cards.f.FaerieMastermind.class));

View file

@ -46,6 +46,7 @@ public enum CounterType {
CURRENCY("currency"),
DEATH("death"),
DEATHTOUCH("deathtouch"),
DEFENSE("defense"),
DELAY("delay"),
DEPLETION("depletion"),
DESCENT("descent"),

View file

@ -763,6 +763,18 @@ public final class StaticFilters {
FILTER_PERMANENT_PLANESWALKERS.setLockedFilter(true);
}
public static final FilterBattlePermanent FILTER_PERMANENT_BATTLE = new FilterBattlePermanent();
static {
FILTER_PERMANENT_BATTLE.setLockedFilter(true);
}
public static final FilterBattlePermanent FILTER_PERMANENT_BATTLES = new FilterBattlePermanent("battles");
static {
FILTER_PERMANENT_BATTLES.setLockedFilter(true);
}
public static final FilterNonlandPermanent FILTER_PERMANENT_NON_LAND = new FilterNonlandPermanent();
static {

View file

@ -0,0 +1,35 @@
package mage.filter.common;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.filter.FilterPermanent;
/**
* @author TheElk801
*/
public class FilterBattlePermanent extends FilterPermanent {
public FilterBattlePermanent() {
this("battle");
}
public FilterBattlePermanent(String name) {
super(name);
this.add(CardType.BATTLE.getPredicate());
}
public FilterBattlePermanent(SubType subtype, String name) {
super(name);
this.add(CardType.BATTLE.getPredicate());
this.add(subtype.getPredicate());
}
public FilterBattlePermanent(final FilterBattlePermanent filter) {
super(filter);
}
@Override
public FilterBattlePermanent copy() {
return new FilterBattlePermanent(this);
}
}