mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[ONE] Implement Melira, the Living Cure (closes #10173)
This commit is contained in:
parent
2fbd6b3f57
commit
e943d62577
2 changed files with 144 additions and 0 deletions
143
Mage.Sets/src/mage/cards/m/MeliraTheLivingCure.java
Normal file
143
Mage.Sets/src/mage/cards/m/MeliraTheLivingCure.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.delayed.WhenTargetDiesDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.common.ExileSourceCost;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author huangn, TheElk801
|
||||
*/
|
||||
public final class MeliraTheLivingCure extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("another target artifact or creature");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
filter.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
public MeliraTheLivingCure(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SCOUT);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// If you would get one or more poison counters, instead you get one poison counter and you can't get additional poison counters this turn.
|
||||
this.addAbility(new SimpleStaticAbility(new MeliraTheLivingCurePreventionEffect()));
|
||||
|
||||
// Exile Melira, the Living Cure: Choose another target creature or artifact. When it's put into a graveyard this turn, return that card to the battlefield under its owner's control.
|
||||
Ability ability = new SimpleActivatedAbility(new CreateDelayedTriggeredAbilityEffect(
|
||||
new WhenTargetDiesDelayedTriggeredAbility(
|
||||
new ReturnFromGraveyardToBattlefieldTargetEffect()
|
||||
.setText("return that card to the battlefield under its owner's control"),
|
||||
SetTargetPointer.CARD
|
||||
).setTriggerPhrase("Choose another target creature or artifact. " +
|
||||
"When it's put into a graveyard this turn, ")
|
||||
), new ExileSourceCost());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private MeliraTheLivingCure(final MeliraTheLivingCure card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeliraTheLivingCure copy() {
|
||||
return new MeliraTheLivingCure(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MeliraTheLivingCureReplacmentEffect extends ReplacementEffectImpl {
|
||||
|
||||
MeliraTheLivingCureReplacmentEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "if you would get one or more poison counters, instead you get " +
|
||||
"one poison counter and you can't get additional poison counters this turn";
|
||||
}
|
||||
|
||||
private MeliraTheLivingCureReplacmentEffect(final MeliraTheLivingCureReplacmentEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
event.setAmount(1);
|
||||
game.addEffect(new MeliraTheLivingCurePreventionEffect(), source);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ADD_COUNTERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return source.isControlledBy(event.getTargetId())
|
||||
&& CounterType.POISON.getName().equals(event.getData())
|
||||
&& event.getAmount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeliraTheLivingCureReplacmentEffect copy() {
|
||||
return new MeliraTheLivingCureReplacmentEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MeliraTheLivingCurePreventionEffect extends ReplacementEffectImpl {
|
||||
|
||||
MeliraTheLivingCurePreventionEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||
}
|
||||
|
||||
private MeliraTheLivingCurePreventionEffect(final MeliraTheLivingCurePreventionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ADD_COUNTERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return source.isControlledBy(event.getTargetId())
|
||||
&& CounterType.POISON.getName().equals(event.getData())
|
||||
&& event.getAmount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeliraTheLivingCurePreventionEffect copy() {
|
||||
return new MeliraTheLivingCurePreventionEffect(this);
|
||||
}
|
||||
}
|
|
@ -168,6 +168,7 @@ public final class PhyrexiaAllWillBeOne extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Maze's Mantle", 174, Rarity.COMMON, mage.cards.m.MazesMantle.class));
|
||||
cards.add(new SetCardInfo("Meldweb Curator", 59, Rarity.COMMON, mage.cards.m.MeldwebCurator.class));
|
||||
cards.add(new SetCardInfo("Meldweb Strider", 60, Rarity.COMMON, mage.cards.m.MeldwebStrider.class));
|
||||
cards.add(new SetCardInfo("Melira, the Living Cure", 209, Rarity.RARE, mage.cards.m.MeliraTheLivingCure.class));
|
||||
cards.add(new SetCardInfo("Mercurial Spelldancer", 61, Rarity.RARE, mage.cards.m.MercurialSpelldancer.class));
|
||||
cards.add(new SetCardInfo("Mesmerizing Dose", 62, Rarity.COMMON, mage.cards.m.MesmerizingDose.class));
|
||||
cards.add(new SetCardInfo("Migloz, Maze Crusher", 210, Rarity.RARE, mage.cards.m.MiglozMazeCrusher.class));
|
||||
|
|
Loading…
Reference in a new issue