* Scrap Mastery - Fixed a bug that card movement caused an exception.

This commit is contained in:
LevelX2 2015-10-28 17:02:46 +01:00
parent a84a560327
commit f47a2d9384

View file

@ -33,9 +33,8 @@ import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
@ -90,12 +89,12 @@ class ScrapMasteryEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Map<UUID, Set<UUID>> exiledCards = new HashMap<>();
Map<UUID, Set<Card>> exiledCards = new HashMap<>();
// exile artifacts from graveyard
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Set cards = player.getGraveyard().getCards(new FilterArtifactCard(), game);
Set<Card> cards = player.getGraveyard().getCards(new FilterArtifactCard(), game);
controller.moveCards(cards, Zone.EXILED, source, game);
exiledCards.put(player.getId(), cards);
}
@ -113,8 +112,7 @@ class ScrapMasteryEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
Cards playersExiledCards = new CardsImpl(exiledCards.get(playerId));
controller.moveCards(playersExiledCards, Zone.BATTLEFIELD, source, game);
controller.moveCards(exiledCards.get(playerId), Zone.BATTLEFIELD, source, game);
}
}
return true;