diff --git a/Mage.Sets/src/mage/sets/timespiral/QuilledSliver.java b/Mage.Sets/src/mage/sets/timespiral/QuilledSliver.java index e2383f61e9..1f382c85aa 100644 --- a/Mage.Sets/src/mage/sets/timespiral/QuilledSliver.java +++ b/Mage.Sets/src/mage/sets/timespiral/QuilledSliver.java @@ -30,11 +30,11 @@ package mage.sets.timespiral; import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; -import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.abilities.effects.common.DamageTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityAllEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Duration; @@ -47,7 +47,8 @@ import mage.target.common.TargetAttackingOrBlockingCreature; * * @author HanClinto * - * A relatively straightforward merge between GemhideSliver.java and CrossbowInfantry.java + * A relatively straightforward merge between GemhideSliver.java and + * CrossbowInfantry.java */ public class QuilledSliver extends CardImpl { @@ -78,4 +79,4 @@ public class QuilledSliver extends CardImpl { public QuilledSliver copy() { return new QuilledSliver(this); } -} \ No newline at end of file +} diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index d890e5561d..8beaabca2b 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -29,7 +29,6 @@ package mage.cards; import java.lang.reflect.Constructor; import java.util.*; - import mage.MageObject; import mage.MageObjectImpl; import mage.Mana; @@ -53,10 +52,8 @@ import mage.game.command.Commander; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.game.permanent.Permanent; -import mage.game.permanent.PermanentCard; import mage.game.stack.Spell; import mage.game.stack.StackObject; -import mage.players.Player; import mage.util.GameLog; import mage.watchers.Watcher; import org.apache.log4j.Logger; @@ -315,11 +312,11 @@ public abstract class CardImpl extends MageObjectImpl implements Card { public String getTokenSetCode() { return tokenSetCode; } - + @Override public String getTokenDescriptor() { return tokenDescriptor; - } + } @Override public List getMana() { @@ -342,22 +339,29 @@ public abstract class CardImpl extends MageObjectImpl implements Card { Zone fromZone = game.getState().getZone(objectId); ZoneChangeEvent event = new ZoneChangeEvent(this.objectId, sourceId, ownerId, fromZone, toZone, appliedEffects); ZoneChangeInfo zoneChangeInfo; - if (toZone == Zone.LIBRARY) { - zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */); - } else if (toZone == Zone.BATTLEFIELD) { - zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */); - } else { - zoneChangeInfo = new ZoneChangeInfo(event); + if (null != toZone) { + switch (toZone) { + case LIBRARY: + zoneChangeInfo = new ZoneChangeInfo.Library(event, flag /* put on top */); + break; + case BATTLEFIELD: + zoneChangeInfo = new ZoneChangeInfo.Battlefield(event, flag /* comes into play tapped */); + break; + default: + zoneChangeInfo = new ZoneChangeInfo(event); + break; + } + return ZonesHandler.moveCard(zoneChangeInfo, game); } - return ZonesHandler.moveCard(zoneChangeInfo, game); + return false; } @Override public boolean cast(Game game, Zone fromZone, SpellAbility ability, UUID controllerId) { Card mainCard = getMainCard(); ZoneChangeEvent event = new ZoneChangeEvent(mainCard.getId(), ability.getId(), controllerId, fromZone, Zone.STACK); - ZoneChangeInfo.Stack info = - new ZoneChangeInfo.Stack(event, new Spell(this, ability.copy(), controllerId, event.getFromZone())); + ZoneChangeInfo.Stack info + = new ZoneChangeInfo.Stack(event, new Spell(this, ability.copy(), controllerId, event.getFromZone())); return ZonesHandler.cast(info, game); } @@ -598,7 +602,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { returnCode = false; } } - if(finalAmount > 0) { + if (finalAmount > 0) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTERS_ADDED, objectId, getControllerOrOwner(), counter.getName(), amount)); } } else { @@ -656,7 +660,7 @@ public abstract class CardImpl extends MageObjectImpl implements Card { } return super.getColor(game); } - + @Override public List getSubtype(Game game) { if (game != null) { diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index fe4f3b692c..6a045a8e48 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -863,8 +863,9 @@ public abstract class PlayerImpl implements Player, Serializable { } @Override - public boolean putCardsOnBottomOfLibrary(Cards cards, Game game, Ability source, boolean anyOrder) { - if (!cards.isEmpty()) { + public boolean putCardsOnBottomOfLibrary(Cards cardsToLibrary, Game game, Ability source, boolean anyOrder) { + if (!cardsToLibrary.isEmpty()) { + Cards cards = new CardsImpl(cardsToLibrary); // prevent possible ConcurrentModificationException if (!anyOrder) { for (UUID objectId : cards) { moveObjectToLibrary(objectId, source == null ? null : source.getSourceId(), game, false, false);