Implemented Cry of the Carnarium

This commit is contained in:
Evan Kranzler 2019-01-04 17:46:59 -05:00
parent fd4b6e84d4
commit afde280bf5
3 changed files with 144 additions and 18 deletions

View file

@ -0,0 +1,126 @@
package mage.cards.c;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.watchers.common.CardsPutIntoGraveyardWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CryOfTheCarnarium extends CardImpl {
public CryOfTheCarnarium(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// All creatures get -2/-2 until end of turn. Exile all creature cards in all graveyards that were put there from the battlefield this turn. If a creature would die this turn, exile it instead.
this.getSpellAbility().addEffect(new BoostAllEffect(-2, -2, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new CryOfTheCarnariumExileEffect());
this.getSpellAbility().addEffect(new CryOfTheCarnariumReplacementEffect());
this.getSpellAbility().addWatcher(new CardsPutIntoGraveyardWatcher());
}
private CryOfTheCarnarium(final CryOfTheCarnarium card) {
super(card);
}
@Override
public CryOfTheCarnarium copy() {
return new CryOfTheCarnarium(this);
}
}
class CryOfTheCarnariumExileEffect extends OneShotEffect {
CryOfTheCarnariumExileEffect() {
super(Outcome.Benefit);
staticText = "Exile all creature cards in all graveyards that were put there from the battlefield this turn.";
}
private CryOfTheCarnariumExileEffect(final CryOfTheCarnariumExileEffect effect) {
super(effect);
}
@Override
public CryOfTheCarnariumExileEffect copy() {
return new CryOfTheCarnariumExileEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
CardsPutIntoGraveyardWatcher watcher = (CardsPutIntoGraveyardWatcher) game.getState().getWatchers().get(CardsPutIntoGraveyardWatcher.class.getSimpleName());
if (player == null || watcher == null) {
return false;
}
Cards cards = new CardsImpl();
for (MageObjectReference mor : watcher.getCardsPutToGraveyardFromBattlefield()) {
if (game.getState().getZoneChangeCounter(mor.getSourceId()) == mor.getZoneChangeCounter()) {
Card card = mor.getCard(game);
if (card != null && card.isCreature()) {
cards.add(card);
}
}
}
player.moveCards(cards, Zone.EXILED, source, game);
return true;
}
}
class CryOfTheCarnariumReplacementEffect extends ReplacementEffectImpl {
CryOfTheCarnariumReplacementEffect() {
super(Duration.EndOfTurn, Outcome.Exile);
staticText = "If a creature would die this turn, exile it instead.";
}
private CryOfTheCarnariumReplacementEffect(final CryOfTheCarnariumReplacementEffect effect) {
super(effect);
}
@Override
public CryOfTheCarnariumReplacementEffect copy() {
return new CryOfTheCarnariumReplacementEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return player.moveCards(permanent, Zone.EXILED, source, game);
}
}
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;
return zEvent.getTarget() != null
&& zEvent.getTarget().isCreature()
&& zEvent.getFromZone() == Zone.BATTLEFIELD
&& zEvent.getToZone() == Zone.GRAVEYARD;
}
}

View file

@ -2,7 +2,6 @@
package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -10,39 +9,36 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.BushidoAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author LevelX
*/
public final class SamuraiOfThePaleCurtain extends CardImpl {
public SamuraiOfThePaleCurtain (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}");
public SamuraiOfThePaleCurtain(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
this.subtype.add(SubType.FOX);
this.subtype.add(SubType.SAMURAI);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)
this.addAbility(new BushidoAbility(1));
// If a permanent would be put into a graveyard, exile it instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SamuraiOfThePaleCurtainEffect()));
}
public SamuraiOfThePaleCurtain (final SamuraiOfThePaleCurtain card) {
public SamuraiOfThePaleCurtain(final SamuraiOfThePaleCurtain card) {
super(card);
}
@ -56,12 +52,12 @@ public final class SamuraiOfThePaleCurtain extends CardImpl {
class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl {
public SamuraiOfThePaleCurtainEffect() {
SamuraiOfThePaleCurtainEffect() {
super(Duration.WhileOnBattlefield, Outcome.Exile);
staticText = "If a permanent would be put into a graveyard, exile it instead";
}
public SamuraiOfThePaleCurtainEffect(final SamuraiOfThePaleCurtainEffect effect) {
private SamuraiOfThePaleCurtainEffect(final SamuraiOfThePaleCurtainEffect effect) {
super(effect);
}
@ -72,9 +68,12 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = ((ZoneChangeEvent)event).getTarget();
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
if (permanent != null) {
return permanent.moveToExile(null, "", source.getSourceId(), game);
Player player = game.getPlayer(permanent.getControllerId());
if (player == null) {
return player.moveCards(permanent, Zone.EXILED, source, game);
}
}
return false;
}
@ -83,10 +82,10 @@ class SamuraiOfThePaleCurtainEffect extends ReplacementEffectImpl {
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
return zEvent.getToZone() == Zone.GRAVEYARD;
}

View file

@ -51,6 +51,7 @@ public final class RavnicaAllegiance extends ExpansionSet {
cards.add(new SetCardInfo("Burning-Tree Vandal", 94, Rarity.COMMON, mage.cards.b.BurningTreeVandal.class));
cards.add(new SetCardInfo("Carnival // Carnage", 222, Rarity.UNCOMMON, mage.cards.c.CarnivalCarnage.class));
cards.add(new SetCardInfo("Consecrate // Consume", 224, Rarity.UNCOMMON, mage.cards.c.ConsecrateConsume.class));
cards.add(new SetCardInfo("Cry of the Carnarium", 70, Rarity.UNCOMMON, mage.cards.c.CryOfTheCarnarium.class));
cards.add(new SetCardInfo("Depose // Deploy", 225, Rarity.UNCOMMON, mage.cards.d.DeposeDeploy.class));
cards.add(new SetCardInfo("Deputy of Detention", 165, Rarity.RARE, mage.cards.d.DeputyOfDetention.class));
cards.add(new SetCardInfo("Dovin, Grand Arbiter", 167, Rarity.MYTHIC, mage.cards.d.DovinGrandArbiter.class));