mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +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.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.ZombieToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
/**
|
||||
|
@ -48,22 +51,20 @@ import mage.target.common.TargetCardInYourGraveyard;
|
|||
public class MidnightRitual extends CardImpl {
|
||||
|
||||
private final FilterCreatureCard filter = new FilterCreatureCard("creature card from your graveyard");
|
||||
|
||||
|
||||
public MidnightRitual(UUID ownerId) {
|
||||
super(ownerId, 146, "Midnight Ritual", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{X}{2}{B}");
|
||||
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.
|
||||
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(filter));
|
||||
this.getSpellAbility().addEffect(new MidnightRitualEffect());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game)
|
||||
{
|
||||
if (ability instanceof SpellAbility)
|
||||
{
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetCardInYourGraveyard(ability.getManaCostsToPay().getX(), filter));
|
||||
}
|
||||
|
@ -80,33 +81,32 @@ public class MidnightRitual extends CardImpl {
|
|||
}
|
||||
|
||||
class MidnightRitualEffect extends OneShotEffect {
|
||||
|
||||
|
||||
public MidnightRitualEffect() {
|
||||
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";
|
||||
}
|
||||
|
||||
public MidnightRitualEffect(final MidnightRitualEffect effect)
|
||||
{
|
||||
|
||||
public MidnightRitualEffect(final MidnightRitualEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MidnightRitualEffect copy() {
|
||||
return new MidnightRitualEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source)
|
||||
{
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
if (card.moveToExile(null, null, source.getSourceId(), game)) {
|
||||
new ZombieToken().putOntoBattlefield(1, game, source.getSourceId(), card.getOwnerId());
|
||||
}
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Cards cardsToExile = new CardsImpl(getTargetPointer().getTargets(game, source));
|
||||
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
||||
if (!cardsToExile.isEmpty()) {
|
||||
new ZombieToken().putOntoBattlefield(cardsToExile.size(), game, source.getSourceId(), controller.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@
|
|||
package mage.sets.saviorsofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
|
@ -51,7 +51,6 @@ public class DeathDenied extends CardImpl {
|
|||
this.expansionSetCode = "SOK";
|
||||
this.subtype.add("Arcane");
|
||||
|
||||
|
||||
// Return X target creature cards from your graveyard to your hand.
|
||||
Effect effect = new ReturnFromGraveyardToHandTargetEffect();
|
||||
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) {
|
||||
ability.getTargets().clear();
|
||||
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()));
|
||||
ability.addTarget(target);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ReturnFromGraveyardToHandTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue