mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Midnight Ritual - Changes to card movement handling.
This commit is contained in:
parent
3ed457e705
commit
0f4294a66c
3 changed files with 30 additions and 31 deletions
|
@ -32,13 +32,16 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.filter.common.FilterCreatureCard;
|
|
||||||
import mage.cards.Card;
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.ZombieToken;
|
import mage.game.permanent.token.ZombieToken;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,22 +51,20 @@ import mage.target.common.TargetCardInYourGraveyard;
|
||||||
public class MidnightRitual extends CardImpl {
|
public class MidnightRitual extends CardImpl {
|
||||||
|
|
||||||
private final FilterCreatureCard filter = new FilterCreatureCard("creature card from your graveyard");
|
private final FilterCreatureCard filter = new FilterCreatureCard("creature card from your graveyard");
|
||||||
|
|
||||||
public MidnightRitual(UUID ownerId) {
|
public MidnightRitual(UUID ownerId) {
|
||||||
super(ownerId, 146, "Midnight Ritual", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{2}{B}");
|
super(ownerId, 146, "Midnight Ritual", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{2}{B}");
|
||||||
this.expansionSetCode = "MMQ";
|
this.expansionSetCode = "MMQ";
|
||||||
|
|
||||||
// Exile X target creature cards from your graveyard.
|
// Exile X target creature cards from your graveyard.
|
||||||
// For each creature card exiled this way, put a 2/2 black Zombie creature token onto the battlefield.
|
// For each creature card exiled this way, put a 2/2 black Zombie creature token onto the battlefield.
|
||||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(filter));
|
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(filter));
|
||||||
this.getSpellAbility().addEffect(new MidnightRitualEffect());
|
this.getSpellAbility().addEffect(new MidnightRitualEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void adjustTargets(Ability ability, Game game)
|
public void adjustTargets(Ability ability, Game game) {
|
||||||
{
|
if (ability instanceof SpellAbility) {
|
||||||
if (ability instanceof SpellAbility)
|
|
||||||
{
|
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
ability.addTarget(new TargetCardInYourGraveyard(ability.getManaCostsToPay().getX(), filter));
|
ability.addTarget(new TargetCardInYourGraveyard(ability.getManaCostsToPay().getX(), filter));
|
||||||
}
|
}
|
||||||
|
@ -80,33 +81,32 @@ public class MidnightRitual extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MidnightRitualEffect extends OneShotEffect {
|
class MidnightRitualEffect extends OneShotEffect {
|
||||||
|
|
||||||
public MidnightRitualEffect() {
|
public MidnightRitualEffect() {
|
||||||
super(Outcome.Neutral);
|
super(Outcome.Neutral);
|
||||||
this.staticText = "Exile X target creature cards from your graveyard. For each creature card exiled this way, put a 2/2 black Zombie creature token onto the battlefield";
|
this.staticText = "Exile X target creature cards from your graveyard. For each creature card exiled this way, put a 2/2 black Zombie creature token onto the battlefield";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MidnightRitualEffect(final MidnightRitualEffect effect)
|
public MidnightRitualEffect(final MidnightRitualEffect effect) {
|
||||||
{
|
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MidnightRitualEffect copy() {
|
public MidnightRitualEffect copy() {
|
||||||
return new MidnightRitualEffect(this);
|
return new MidnightRitualEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source)
|
public boolean apply(Game game, Ability source) {
|
||||||
{
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
if (controller != null) {
|
||||||
Card card = game.getCard(targetId);
|
Cards cardsToExile = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||||
if (card != null) {
|
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
||||||
if (card.moveToExile(null, null, source.getSourceId(), game)) {
|
if (!cardsToExile.isEmpty()) {
|
||||||
new ZombieToken().putOntoBattlefield(1, game, source.getSourceId(), card.getOwnerId());
|
new ZombieToken().putOntoBattlefield(cardsToExile.size(), game, source.getSourceId(), controller.getId());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,13 @@
|
||||||
package mage.sets.saviorsofkamigawa;
|
package mage.sets.saviorsofkamigawa;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
|
@ -51,7 +51,6 @@ public class DeathDenied extends CardImpl {
|
||||||
this.expansionSetCode = "SOK";
|
this.expansionSetCode = "SOK";
|
||||||
this.subtype.add("Arcane");
|
this.subtype.add("Arcane");
|
||||||
|
|
||||||
|
|
||||||
// Return X target creature cards from your graveyard to your hand.
|
// Return X target creature cards from your graveyard to your hand.
|
||||||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||||
effect.setText("Return X target creature cards from your graveyard to your hand");
|
effect.setText("Return X target creature cards from your graveyard to your hand");
|
||||||
|
@ -65,8 +64,8 @@ public class DeathDenied extends CardImpl {
|
||||||
if (ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
ability.getTargets().clear();
|
ability.getTargets().clear();
|
||||||
int xValue = ability.getManaCostsToPay().getX();
|
int xValue = ability.getManaCostsToPay().getX();
|
||||||
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard(new StringBuilder(xValue).append(xValue != 1?" creature cards":"creature card").append(" from your graveyard").toString()));
|
Target target = new TargetCardInYourGraveyard(xValue, new FilterCreatureCard(new StringBuilder(xValue).append(xValue != 1 ? " creature cards" : "creature card").append(" from your graveyard").toString()));
|
||||||
ability.addTarget(target);
|
ability.addTarget(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
return controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)), null, Zone.HAND, source, game);
|
return controller.moveCards(new CardsImpl(getTargetPointer().getTargets(game, source)), Zone.HAND, source, game);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue