[BRO] Implement Misery's Shadow (#9736)

This commit is contained in:
PurpleCrowbar 2022-11-06 13:37:47 +00:00 committed by GitHub
parent 9a8b9c2ec7
commit 71a718ee72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,88 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class MiserysShadow extends CardImpl {
public MiserysShadow(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.SHADE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// If a creature an opponent controls would die, exile it instead.
this.addAbility(new SimpleStaticAbility(new MiserysShadowReplacementEffect()));
// {1}: Misery's Shadow gets +1/+1 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new GenericManaCost(1)));
}
private MiserysShadow(final MiserysShadow card) {
super(card);
}
@Override
public MiserysShadow copy() {
return new MiserysShadow(this);
}
}
class MiserysShadowReplacementEffect extends ReplacementEffectImpl {
public MiserysShadowReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Exile);
staticText = "If a creature an opponent controls would die, exile it instead";
}
private MiserysShadowReplacementEffect(final MiserysShadowReplacementEffect effect) {
super(effect);
}
@Override
public MiserysShadowReplacementEffect copy() {
return new MiserysShadowReplacementEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
((ZoneChangeEvent) event).setToZone(Zone.EXILED);
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
if (zEvent.isDiesEvent()) {
Permanent permanent = zEvent.getTarget();
if (permanent != null && permanent.isCreature()) {
Player player = game.getPlayer(source.getControllerId());
return player != null && player.hasOpponent(permanent.getControllerId(), game);
}
}
return false;
}
}

View file

@ -156,6 +156,8 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Mechanized Warfare", 139, Rarity.RARE, mage.cards.m.MechanizedWarfare.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mechanized Warfare", 338, Rarity.RARE, mage.cards.m.MechanizedWarfare.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mine Worker", 239, Rarity.COMMON, mage.cards.m.MineWorker.class));
cards.add(new SetCardInfo("Misery's Shadow", 107, Rarity.RARE, mage.cards.m.MiserysShadow.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Misery's Shadow", 330, Rarity.RARE, mage.cards.m.MiserysShadow.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mishra's Command", 141, Rarity.RARE, mage.cards.m.MishrasCommand.class));
cards.add(new SetCardInfo("Mishra's Domination", 142, Rarity.COMMON, mage.cards.m.MishrasDomination.class));
cards.add(new SetCardInfo("Mishra's Foundry", 265, Rarity.RARE, mage.cards.m.MishrasFoundry.class));