[VOW] Implemented Undying Malice

This commit is contained in:
Daniel Bomar 2021-11-08 09:14:04 -06:00
parent a2334c3f9a
commit 2ed7aff291
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.u;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author weirddan455
*/
public final class UndyingMalice extends CardImpl {
public UndyingMalice(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Until end of turn, target creature gains "When this creature dies, return it to the battlefield tapped under its owner's control with a +1/+1 counter on it."
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(new DiesSourceTriggeredAbility(new UndyingMaliceReturnToBattlefieldEffect()))
.setText("Until end of turn, target creature gains \"When this creature dies, return it to the battlefield tapped under its owner's control with a +1/+1 counter on it.\""));
}
private UndyingMalice(final UndyingMalice card) {
super(card);
}
@Override
public UndyingMalice copy() {
return new UndyingMalice(this);
}
}
class UndyingMaliceReturnToBattlefieldEffect extends ReturnSourceFromGraveyardToBattlefieldEffect {
public UndyingMaliceReturnToBattlefieldEffect() {
super(true);
staticText = "return it to the battlefield tapped under its owner's control with a +1/+1 counter on it";
}
private UndyingMaliceReturnToBattlefieldEffect(final UndyingMaliceReturnToBattlefieldEffect effect) {
super(effect);
}
@Override
public UndyingMaliceReturnToBattlefieldEffect copy() {
return new UndyingMaliceReturnToBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
UndyingMaliceCounterEffect counterEffect = new UndyingMaliceCounterEffect();
game.addEffect(counterEffect, source);
return super.apply(game, source);
}
}
class UndyingMaliceCounterEffect extends ReplacementEffectImpl {
public UndyingMaliceCounterEffect() {
super(Duration.EndOfStep, Outcome.BoostCreature);
}
private UndyingMaliceCounterEffect(final UndyingMaliceCounterEffect effect) {
super(effect);
}
@Override
public UndyingMaliceCounterEffect copy() {
return new UndyingMaliceCounterEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId().equals(source.getSourceId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature == null) {
return false;
}
creature.addCounters(CounterType.P1P1.createInstance(), source.getControllerId(), source, game, event.getAppliedEffects());
discard();
return false;
}
}

View file

@ -284,6 +284,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
cards.add(new SetCardInfo("Twinblade Invocation", 40, Rarity.UNCOMMON, mage.cards.t.TwinbladeInvocation.class));
cards.add(new SetCardInfo("Ulvenwald Behemoth", 225, Rarity.RARE, mage.cards.u.UlvenwaldBehemoth.class));
cards.add(new SetCardInfo("Ulvenwald Oddity", 225, Rarity.RARE, mage.cards.u.UlvenwaldOddity.class));
cards.add(new SetCardInfo("Undying Malice", 134, Rarity.COMMON, mage.cards.u.UndyingMalice.class));
cards.add(new SetCardInfo("Unhallowed Phalanx", 135, Rarity.COMMON, mage.cards.u.UnhallowedPhalanx.class));
cards.add(new SetCardInfo("Unholy Officiant", 41, Rarity.COMMON, mage.cards.u.UnholyOfficiant.class));
cards.add(new SetCardInfo("Valorous Stance", 42, Rarity.UNCOMMON, mage.cards.v.ValorousStance.class));