* Some more move actions replaced and added missing methods for move to command zone.

This commit is contained in:
LevelX2 2020-01-09 23:17:39 +01:00
parent 349a2cc612
commit 47a8686958
5 changed files with 64 additions and 65 deletions

View file

@ -1,10 +1,8 @@
package mage.abilities.effects.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
@ -37,9 +35,9 @@ public class ReturnToHandFromGraveyardAllEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (Card card : player.getGraveyard().getCards(filter, source.getSourceId(), source.getControllerId(), game)) {
card.moveToZone(Zone.HAND, playerId, game, false);
}
player.moveCards(player.getGraveyard()
.getCards(filter, source.getSourceId(), player.getId(), game),
Zone.HAND, source, game);
}
}

View file

@ -20,8 +20,8 @@ import mage.players.Player;
*/
public class ExploreSourceEffect extends OneShotEffect {
// "it explores. <i>(Reveal the top card of your library. Put that card into
// your hand if it's a land. Otherwise, put a +1/+1 counter on this creature,
// "it explores. <i>(Reveal the top card of your library. Put that card into
// your hand if it's a land. Otherwise, put a +1/+1 counter on this creature,
// then put the card back or put it into your graveyard.)</i>";
private static final String RULE_TEXT_START = "explores.";
private static final String RULE_TEXT_HINT = "<i>(Reveal the top card of your library. "
@ -98,7 +98,7 @@ public class ExploreSourceEffect extends OneShotEffect {
if (permanentController == null) {
return false;
}
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLORED, permanentId,
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.EXPLORED, permanentId,
source.getSourceId(), permanent.getControllerId()));
if (permanentController.getLibrary().hasCards()) {
Card card = permanentController.getLibrary().getFromTop(game);
@ -108,6 +108,7 @@ public class ExploreSourceEffect extends OneShotEffect {
cardWasRevealed = true;
if (card != null) {
if (card.isLand()) {
permanentController.moveCardToHandWithInfo(card, source.getSourceId(), game);
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
} else {
if (game.getState().getZone(permanentId) == Zone.BATTLEFIELD) { // needed in case LKI object is used
@ -124,7 +125,7 @@ public class ExploreSourceEffect extends OneShotEffect {
}
if (!cardWasRevealed
&& game.getState().getZone(permanentId) == Zone.BATTLEFIELD) {
// If no card is revealed, most likely because that player's library is empty,
// If no card is revealed, most likely because that player's library is empty,
// the exploring creature receives a +1/+1 counter.
permanent.addCounters(CounterType.P1P1.createInstance(), source, game);
}

View file

@ -1,5 +1,6 @@
package mage.abilities.keyword;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
@ -20,8 +21,6 @@ import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
* 702.47. Ninjutsu
* <p>
@ -149,11 +148,12 @@ class ReturnAttackerToHandTargetCost extends CostImpl {
if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) {
for (UUID targetId : targets.get(0).getTargets()) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
Player controller = game.getPlayer(controllerId);
if (permanent == null || controller == null) {
return false;
}
defendingPlayerId = game.getCombat().getDefenderId(permanent.getId());
paid |= permanent.moveToZone(Zone.HAND, sourceId, game, false);
paid |= controller.moveCardToHandWithInfo(permanent, sourceId, game);
}
}
return paid;