* Reworked some card movement to player methods (#4866).

This commit is contained in:
LevelX2 2020-06-22 15:38:36 +02:00
parent cd624b2158
commit c8ddd62e3b
4 changed files with 39 additions and 29 deletions

View file

@ -49,7 +49,9 @@ public final class DireFleetDaredevil extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// When this enters the battlefield, exile target instant or sorcery card from an opponent's graveyard. You may cast that card this turn and you may spend mana as though it were mana of any color. If that card would be put into a graveyard this turn, exile it instead.
// When Dire Fleet Daredevil enters the battlefield, exile target instant or sorcery card from an opponent's graveyard.
// You may cast it this turn, and you may spend mana as though it were mana of any type to cast that spell.
// If that spell would be put into a graveyard this turn, exile it instead.
Ability ability = new EntersBattlefieldTriggeredAbility(new DireFleetDaredevilEffect());
ability.addTarget(new TargetCardInOpponentsGraveyard(filter));
this.addAbility(ability);
@ -167,8 +169,9 @@ class DireFleetDaredevilReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Card card = game.getCard(event.getTargetId());
if (card != null) {
return card.moveToZone(Zone.EXILED, source.getSourceId(), game, false);
Player controller = game.getPlayer(source.getControllerId());
if (card != null && controller != null) {
return controller.moveCards(card, Zone.EXILED, source, game);
}
return false;
}

View file

@ -65,7 +65,7 @@ class DistantMemoriesEffect extends OneShotEffect {
if (controller.searchLibrary(target, source, game)) {
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);
if (card != null) {
card.moveToZone(Zone.EXILED, source.getSourceId(), game, false);
controller.moveCards(card, Zone.EXILED, source, game);
controller.shuffleLibrary(source, game);
StringBuilder sb = new StringBuilder();
@ -76,9 +76,13 @@ class DistantMemoriesEffect extends OneShotEffect {
Set<UUID> opponents = game.getOpponents(source.getControllerId());
for (UUID opponentUuid : opponents) {
Player opponent = game.getPlayer(opponentUuid);
if (opponent != null
&& opponent.chooseUse(Outcome.Detriment, sb.toString(), source, game)) {
if (opponent != null) {
if (opponent.chooseUse(Outcome.Detriment, sb.toString(), source, game)) {
putInHand = true;
game.informPlayers(opponent.getName() + " decides to put the selected card into the player's hand.");
} else {
game.informPlayers(opponent.getName() + " decides to leave the card in exile.");
}
}
}

View file

@ -5,8 +5,10 @@ import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.replacement.PutToGraveyardReplacementEffect;
import mage.abilities.keyword.BushidoAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -22,6 +24,7 @@ import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -126,13 +129,13 @@ class ToshiroUmezawaReplacementEffect extends ReplacementEffectImpl {
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
UUID eventObject = event.getTargetId();
StackObject stackObject = game.getStack().getStackObject(eventObject);
if (stackObject != null) {
Player controller = game.getPlayer(source.getControllerId());
if (stackObject != null && controller != null) {
if (stackObject instanceof Spell) {
game.rememberLKI(stackObject.getId(), Zone.STACK, stackObject);
}
if (stackObject instanceof Card && eventObject.equals(cardId)) {
((Card) stackObject).moveToExile(null, null, source.getSourceId(), game);
return true;
return controller.moveCards((Card) stackObject, Zone.EXILED, source, game);
}
}
return false;

View file

@ -52,7 +52,7 @@ public class DiesReplacementEffect extends ReplacementEffectImpl {
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && permanent != null) {
return controller.moveCardToExileWithInfo(permanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
return controller.moveCards(permanent, Zone.EXILED, source, game);
}
return false;
}