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.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;
|
||||
|
||||
/**
|
||||
|
@ -60,10 +63,8 @@ public class MidnightRitual extends CardImpl {
|
|||
}
|
||||
|
||||
@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));
|
||||
}
|
||||
|
@ -86,8 +87,7 @@ class MidnightRitualEffect extends OneShotEffect {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -97,16 +97,16 @@ class MidnightRitualEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
@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 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,7 +64,7 @@ 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()));
|
||||
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