diff --git a/forge-ai/.classpath b/forge-ai/.classpath index 3deaad2ec71..f4c9e0b5d64 100644 --- a/forge-ai/.classpath +++ b/forge-ai/.classpath @@ -2,8 +2,9 @@ - + + - \ No newline at end of file + diff --git a/forge-core/.classpath b/forge-core/.classpath index 5431f84cdce..f7bf6c0c0ab 100644 --- a/forge-core/.classpath +++ b/forge-core/.classpath @@ -2,8 +2,8 @@ - + diff --git a/forge-game/.classpath b/forge-game/.classpath index 4943383aa49..f82cf56e3b6 100644 --- a/forge-game/.classpath +++ b/forge-game/.classpath @@ -2,9 +2,10 @@ - + + diff --git a/forge-game/src/main/java/forge/game/GameAction.java b/forge-game/src/main/java/forge/game/GameAction.java index 5d7260853ea..766a3593dea 100644 --- a/forge-game/src/main/java/forge/game/GameAction.java +++ b/forge-game/src/main/java/forge/game/GameAction.java @@ -80,7 +80,7 @@ public class GameAction { } public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause) { - return changeZone(zoneFrom, zoneTo, c, position, cause, Maps.newHashMap()); + return changeZone(zoneFrom, zoneTo, c, position, cause, null); } public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause, Map params) { @@ -287,8 +287,10 @@ public class GameAction { repParams.put("Cause", cause); repParams.put("Origin", zoneFrom != null ? zoneFrom.getZoneType() : null); repParams.put("Destination", zoneTo.getZoneType()); - - repParams.putAll(params); + + if (params != null) { + repParams.putAll(params); + } ReplacementResult repres = game.getReplacementHandler().run(repParams); if (repres != ReplacementResult.NotReplaced) { @@ -387,13 +389,19 @@ public class GameAction { runParams.put("Destination", zoneTo.getZoneType().name()); runParams.put("SpellAbilityStackInstance", game.stack.peek()); runParams.put("IndividualCostPaymentInstance", game.costPaymentStack.peek()); - runParams.putAll(params); + + if (params != null) { + runParams.putAll(params); + } + game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, true); if (zoneFrom != null && zoneFrom.is(ZoneType.Battlefield)) { final Map runParams2 = Maps.newHashMap(); runParams2.put("Card", lastKnownInfo); runParams2.put("OriginalController", zoneFrom.getPlayer()); - runParams2.putAll(params); + if(params != null) { + runParams2.putAll(params); + } game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams2, false); } // AllZone.getStack().chooseOrderOfSimultaneousStackEntryAll(); @@ -535,7 +543,7 @@ public class GameAction { } public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause) { - return moveTo(zoneTo, c, cause, Maps.newHashMap()); + return moveTo(zoneTo, c, cause, null); } public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause, Map params) { @@ -545,7 +553,7 @@ public class GameAction { } public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause) { - return moveTo(zoneTo, c, position, cause, Maps.newHashMap()); + return moveTo(zoneTo, c, position, cause, null); } public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause, Map params) { @@ -621,7 +629,7 @@ public class GameAction { } public final Card moveToStack(final Card c, SpellAbility cause) { - return moveToStack(c, cause, Maps.newHashMap()); + return moveToStack(c, cause, null); } public final Card moveToStack(final Card c, SpellAbility cause, Map params) { final Zone stack = game.getStackZone(); @@ -629,7 +637,7 @@ public class GameAction { } public final Card moveToGraveyard(final Card c, SpellAbility cause) { - return moveToGraveyard(c, cause, Maps.newHashMap()); + return moveToGraveyard(c, cause, null); } public final Card moveToGraveyard(final Card c, SpellAbility cause, Map params) { final PlayerZone grave = c.getOwner().getZone(ZoneType.Graveyard); @@ -638,7 +646,7 @@ public class GameAction { } public final Card moveToHand(final Card c, SpellAbility cause) { - return moveToHand(c, cause, Maps.newHashMap()); + return moveToHand(c, cause, null); } public final Card moveToHand(final Card c, SpellAbility cause, Map params) { @@ -647,7 +655,7 @@ public class GameAction { } public final Card moveToPlay(final Card c, SpellAbility cause) { - return moveToPlay(c, cause, Maps.newHashMap()); + return moveToPlay(c, cause, null); } public final Card moveToPlay(final Card c, SpellAbility cause, Map params) { @@ -656,7 +664,7 @@ public class GameAction { } public final Card moveToPlay(final Card c, final Player p, SpellAbility cause) { - return moveToPlay(c, p, cause, Maps.newHashMap()); + return moveToPlay(c, p, cause, null); } public final Card moveToPlay(final Card c, final Player p, SpellAbility cause, Map params) { @@ -666,7 +674,7 @@ public class GameAction { } public final Card moveToBottomOfLibrary(final Card c, SpellAbility cause) { - return moveToBottomOfLibrary(c, cause, Maps.newHashMap()); + return moveToBottomOfLibrary(c, cause, null); } public final Card moveToBottomOfLibrary(final Card c, SpellAbility cause, Map params) { @@ -674,7 +682,7 @@ public class GameAction { } public final Card moveToLibrary(final Card c, SpellAbility cause) { - return moveToLibrary(c, cause, Maps.newHashMap()); + return moveToLibrary(c, cause, null); } public final Card moveToLibrary(final Card c, SpellAbility cause, Map params) { @@ -682,7 +690,7 @@ public class GameAction { } public final Card moveToLibrary(Card c, int libPosition, SpellAbility cause) { - return moveToLibrary(c, libPosition, cause, Maps.newHashMap()); + return moveToLibrary(c, libPosition, cause, null); } public final Card moveToLibrary(Card c, int libPosition, SpellAbility cause, Map params) { @@ -694,7 +702,7 @@ public class GameAction { } public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause) { - return moveToVariantDeck(c, zone, deckPosition, cause, Maps.newHashMap()); + return moveToVariantDeck(c, zone, deckPosition, cause, null); } public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause, Map params) { @@ -706,7 +714,7 @@ public class GameAction { } public final Card exile(final Card c, SpellAbility cause) { - return exile(c, cause, Maps.newHashMap()); + return exile(c, cause, null); } public final Card exile(final Card c, SpellAbility cause, Map params) { if (game.isCardExiled(c)) { @@ -717,7 +725,7 @@ public class GameAction { } public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause) { - return moveTo(name, c, cause, Maps.newHashMap()); + return moveTo(name, c, cause, null); } public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause, Map params) { @@ -725,7 +733,7 @@ public class GameAction { } public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) { - return moveTo(name, c, libPosition, cause, Maps.newHashMap()); + return moveTo(name, c, libPosition, cause, null); } public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause, Map params) { @@ -1095,7 +1103,7 @@ public class GameAction { if (!perm.isInZone(tgtZone) || !perm.canBeEnchantedBy(c, true) || (perm.isPhasedOut() && !c.isPhasedOut())) { c.unEnchantEntity(perm); - moveToGraveyard(c, null, Maps.newHashMap()); + moveToGraveyard(c, null, null); checkAgain = true; } } else if (entity instanceof Player) { @@ -1113,13 +1121,13 @@ public class GameAction { } if (invalid) { c.unEnchantEntity(pl); - moveToGraveyard(c, null, Maps.newHashMap()); + moveToGraveyard(c, null, null); checkAgain = true; } } if (c.isInPlay() && !c.isEnchanting()) { - moveToGraveyard(c, null, Maps.newHashMap()); + moveToGraveyard(c, null, null); checkAgain = true; } return checkAgain; @@ -1310,7 +1318,7 @@ public class GameAction { for (Card c : list) { if (c.getCounters(CounterType.LOYALTY) <= 0) { - moveToGraveyard(c, null, Maps.newHashMap()); + moveToGraveyard(c, null, null); // Play the Destroy sound game.fireEvent(new GameEventCardDestroyed()); recheck = true; @@ -1517,7 +1525,7 @@ public class GameAction { return null; } - final Card newCard = moveToGraveyard(c, cause, Maps.newHashMap()); + final Card newCard = moveToGraveyard(c, cause, null); return newCard; } @@ -1739,7 +1747,7 @@ public class GameAction { if (!isCommander) { toMulligan = new CardCollection(p.getCardsIn(ZoneType.Hand)); for (final Card c : toMulligan) { - moveToLibrary(c, null, Maps.newHashMap()); + moveToLibrary(c, null, null); } try { Thread.sleep(100); //delay for a tiny bit to give UI a chance catch up @@ -1751,7 +1759,7 @@ public class GameAction { } else { List toExile = Lists.newArrayList(toMulligan); for (Card c : toExile) { - exile(c, null, Maps.newHashMap()); + exile(c, null, null); } exiledDuringMulligans.addAll(p, toExile); try { @@ -1777,7 +1785,7 @@ public class GameAction { Player p = kv.getKey(); Collection cc = kv.getValue(); for (Card c : cc) { - moveToLibrary(c, null, Maps.newHashMap()); + moveToLibrary(c, null, null); } p.shuffle(null); } diff --git a/forge-game/src/main/java/forge/game/GameFormat.java b/forge-game/src/main/java/forge/game/GameFormat.java index fda6ebd317f..1554ecf1c9e 100644 --- a/forge-game/src/main/java/forge/game/GameFormat.java +++ b/forge-game/src/main/java/forge/game/GameFormat.java @@ -77,7 +77,7 @@ public class GameFormat implements Comparable { allowedSetCodes = sets == null ? new ArrayList() : Lists.newArrayList(sets); bannedCardNames = bannedCards == null ? new ArrayList() : Lists.newArrayList(bannedCards); restrictedCardNames = restrictedCards == null ? new ArrayList() : Lists.newArrayList(restrictedCards); - allowedRarities = rarities == null ? Lists.newArrayList() : rarities; + allowedRarities = rarities == null ? new ArrayList() : rarities; this.allowedSetCodes_ro = Collections.unmodifiableList(allowedSetCodes); this.bannedCardNames_ro = Collections.unmodifiableList(bannedCardNames); @@ -91,7 +91,7 @@ public class GameFormat implements Comparable { if (!this.allowedSetCodes_ro.isEmpty()) { p = Predicates.and(p, printed ? IPaperCard.Predicates.printedInSets(this.allowedSetCodes_ro, printed) : - StaticData.instance().getCommonCards().wasPrintedInSets(this.allowedSetCodes_ro)); + (Predicate)(StaticData.instance().getCommonCards().wasPrintedInSets(this.allowedSetCodes_ro))); } if (!this.allowedRarities.isEmpty()) { List> crp = Lists.newArrayList(); diff --git a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java index f77769eeb67..df665e7a7cb 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/ChangeZoneEffect.java @@ -467,7 +467,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } } - movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition, sa, Maps.newHashMap()); + movedCard = game.getAction().moveToLibrary(tgtC, libraryPosition, sa, null); } else { if (destination.equals(ZoneType.Battlefield)) { @@ -559,7 +559,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } movedCard = game.getAction().moveTo( - tgtC.getController().getZone(destination), tgtC, sa, Maps.newHashMap()); + tgtC.getController().getZone(destination), tgtC, sa, null); if (sa.hasParam("Unearth")) { movedCard.setUnearthed(true); movedCard.addExtrinsicKeyword("Haste"); @@ -602,7 +602,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } tgtC.setExiledWith(host); } - movedCard = game.getAction().moveTo(destination, tgtC, sa, Maps.newHashMap()); + movedCard = game.getAction().moveTo(destination, tgtC, sa, null); // If a card is Exiled from the stack, remove its spells from the stack if (sa.hasParam("Fizzle")) { if (tgtC.isInZone(ZoneType.Exile) || tgtC.isInZone(ZoneType.Hand) @@ -966,7 +966,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { Card movedCard = null; final Zone originZone = game.getZoneOf(c); if (destination.equals(ZoneType.Library)) { - movedCard = game.getAction().moveToLibrary(c, libraryPos, sa, Maps.newHashMap()); + movedCard = game.getAction().moveToLibrary(c, libraryPos, sa, null); } else if (destination.equals(ZoneType.Battlefield)) { if (sa.hasParam("Tapped")) { @@ -1101,7 +1101,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } } } - movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, sa, Maps.newHashMap()); + movedCard = game.getAction().moveTo(c.getController().getZone(destination), c, sa, null); if (sa.hasParam("Tapped")) { movedCard.setTapped(true); } @@ -1111,7 +1111,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { movedCard.setTimestamp(ts); } else if (destination.equals(ZoneType.Exile)) { - movedCard = game.getAction().exile(c, sa, Maps.newHashMap()); + movedCard = game.getAction().exile(c, sa, null); if (!c.isToken()) { Card host = sa.getOriginalHost(); if (host == null) { @@ -1124,7 +1124,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect { } } else { - movedCard = game.getAction().moveTo(destination, c, sa, Maps.newHashMap()); + movedCard = game.getAction().moveTo(destination, c, sa, null); } movedCards.add(movedCard); diff --git a/forge-game/src/main/java/forge/game/ability/effects/CopyPermanentEffect.java b/forge-game/src/main/java/forge/game/ability/effects/CopyPermanentEffect.java index edc3b5f5f70..72678bb72a6 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/CopyPermanentEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/CopyPermanentEffect.java @@ -342,7 +342,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect { // Temporarily register triggers of an object created with CopyPermanent //game.getTriggerHandler().registerActiveTrigger(copy, false); - final Card copyInPlay = game.getAction().moveToPlay(copy, sa, Maps.newHashMap()); + final Card copyInPlay = game.getAction().moveToPlay(copy, sa, null); // when copying something stolen: copyInPlay.setSetCode(c.getSetCode()); diff --git a/forge-game/src/main/java/forge/game/ability/effects/RepeatEachEffect.java b/forge-game/src/main/java/forge/game/ability/effects/RepeatEachEffect.java index 9bda21e0d06..e43125ea942 100644 --- a/forge-game/src/main/java/forge/game/ability/effects/RepeatEachEffect.java +++ b/forge-game/src/main/java/forge/game/ability/effects/RepeatEachEffect.java @@ -27,9 +27,9 @@ public class RepeatEachEffect extends SpellAbilityEffect { @SuppressWarnings("serial") @Override public void resolve(SpellAbility sa) { - Card source = sa.getHostCard(); + final Card source = sa.getHostCard(); - AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility"); + final AbilitySub repeat = sa.getAdditionalAbility("RepeatSubAbility"); if (repeat != null && !repeat.getHostCard().equalsWithTimestamp(source)) { // TODO: for some reason, the host card of the original additional SA is set to the cloned card when @@ -121,7 +121,7 @@ public class RepeatEachEffect extends SpellAbilityEffect { repeatPlayers.add(size - 1, repeatPlayers.remove(0)); } } - for (Player p : repeatPlayers) { + for (final Player p : repeatPlayers) { if (optional && !p.getController().confirmAction(repeat, null, sa.getParam("RepeatOptionalMessage"))) { continue; } diff --git a/forge-game/src/main/java/forge/game/cost/CostAdjustment.java b/forge-game/src/main/java/forge/game/cost/CostAdjustment.java index 682ac5cc74b..0e65b1a2295 100644 --- a/forge-game/src/main/java/forge/game/cost/CostAdjustment.java +++ b/forge-game/src/main/java/forge/game/cost/CostAdjustment.java @@ -223,7 +223,7 @@ public class CostAdjustment { cardsToDelveOut.add(c); } else if (!test) { sa.getHostCard().addDelved(c); - delved.add(game.getAction().exile(c, null, Maps.newHashMap())); + delved.add(game.getAction().exile(c, null, null)); } } if (!delved.isEmpty()) { diff --git a/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java b/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java index 1018422d0b7..1124ac2562e 100644 --- a/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java +++ b/forge-game/src/main/java/forge/game/mana/ManaCostBeingPaid.java @@ -111,7 +111,7 @@ public class ManaCostBeingPaid { // holds Mana_Part objects // ManaPartColor is stored before ManaPartGeneric - private final Map unpaidShards = Maps.newHashMap(); + private final Map unpaidShards = new HashMap(); private Map xManaCostPaidByColor; private final String sourceRestriction; private byte sunburstMap = 0; diff --git a/forge-game/src/main/java/forge/game/player/Player.java b/forge-game/src/main/java/forge/game/player/Player.java index 5af9d6dda5e..df9a75eab5e 100644 --- a/forge-game/src/main/java/forge/game/player/Player.java +++ b/forge-game/src/main/java/forge/game/player/Player.java @@ -240,7 +240,7 @@ public class Player extends GameEntity implements Comparable { game.getTriggerHandler().suppressMode(TriggerType.ChangesZone); activeScheme = getZone(ZoneType.SchemeDeck).get(0); // gameAction moveTo ? - game.getAction().moveTo(ZoneType.Command, activeScheme, null, Maps.newHashMap()); + game.getAction().moveTo(ZoneType.Command, activeScheme, null, null); game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone); // Run triggers @@ -1212,7 +1212,7 @@ public class Player extends GameEntity implements Comparable { if (toBottom != null) { for(Card c : toBottom) { - getGame().getAction().moveToBottomOfLibrary(c, null, Maps.newHashMap()); + getGame().getAction().moveToBottomOfLibrary(c, null, null); numToBottom++; } } @@ -1220,7 +1220,7 @@ public class Player extends GameEntity implements Comparable { if (toTop != null) { Collections.reverse(toTop); // the last card in list will become topmost in library, have to revert thus. for(Card c : toTop) { - getGame().getAction().moveToLibrary(c, null, Maps.newHashMap()); + getGame().getAction().moveToLibrary(c, null, null); numToTop++; } } @@ -1293,7 +1293,7 @@ public class Player extends GameEntity implements Comparable { } } - c = game.getAction().moveToHand(c, null, Maps.newHashMap()); + c = game.getAction().moveToHand(c, null, null); drawn.add(c); if (topCardRevealed) { @@ -1503,16 +1503,16 @@ public class Player extends GameEntity implements Comparable { sb.append(this).append(" discards ").append(c); final Card newCard; if (discardToTopOfLibrary) { - newCard = game.getAction().moveToLibrary(c, 0, sa, Maps.newHashMap()); + newCard = game.getAction().moveToLibrary(c, 0, sa, null); sb.append(" to the library"); // Play the Discard sound } else if (discardMadness) { - newCard = game.getAction().exile(c, sa, Maps.newHashMap()); + newCard = game.getAction().exile(c, sa, null); sb.append(" with Madness"); } else { - newCard = game.getAction().moveToGraveyard(c, sa, Maps.newHashMap()); + newCard = game.getAction().moveToGraveyard(c, sa, null); // Play the Discard sound } sb.append("."); @@ -1580,7 +1580,7 @@ public class Player extends GameEntity implements Comparable { } for (Card m : milledView) { - game.getAction().moveTo(destination, m, null, Maps.newHashMap()); + game.getAction().moveTo(destination, m, null, null); } return milled; @@ -1648,7 +1648,7 @@ public class Player extends GameEntity implements Comparable { if (land.isFaceDown()) { land.turnFaceUp(); } - game.getAction().moveTo(getZone(ZoneType.Battlefield), land, null, Maps.newHashMap()); + game.getAction().moveTo(getZone(ZoneType.Battlefield), land, null, new HashMap()); // play a sound game.fireEvent(new GameEventLandPlayed(this, land)); @@ -2430,7 +2430,7 @@ public class Player extends GameEntity implements Comparable { game.getView().updatePlanarPlayer(getView()); for (Card c : currentPlanes) { - game.getAction().moveTo(ZoneType.Command,c, null, Maps.newHashMap()); + game.getAction().moveTo(ZoneType.Command,c, null, null); //getZone(ZoneType.PlanarDeck).remove(c); //getZone(ZoneType.Command).add(c); } @@ -2460,7 +2460,7 @@ public class Player extends GameEntity implements Comparable { //game.getZoneOf(plane).remove(plane); plane.clearControllers(); //getZone(ZoneType.PlanarDeck).add(plane); - game.getAction().moveTo(ZoneType.PlanarDeck, plane,-1, null, Maps.newHashMap()); + game.getAction().moveTo(ZoneType.PlanarDeck, plane,-1, null, null); } currentPlanes.clear(); diff --git a/forge-game/src/main/java/forge/game/trigger/Trigger.java b/forge-game/src/main/java/forge/game/trigger/Trigger.java index 8700ff560be..4787878805d 100644 --- a/forge-game/src/main/java/forge/game/trigger/Trigger.java +++ b/forge-game/src/main/java/forge/game/trigger/Trigger.java @@ -121,7 +121,7 @@ public abstract class Trigger extends TriggerReplacementBase { this.id = nextId(); this.intrinsic = intrinsic; - this.setRunParams(Maps.newHashMap()); + this.setRunParams(new HashMap()); // TODO: Consider whether this can be null instead, for performance reasons. this.originalMapParams.putAll(params); this.mapParams.putAll(params); this.setHostCard(host); diff --git a/forge-game/src/main/java/forge/game/zone/MagicStack.java b/forge-game/src/main/java/forge/game/zone/MagicStack.java index 2acc0e9e206..58503569a9c 100644 --- a/forge-game/src/main/java/forge/game/zone/MagicStack.java +++ b/forge-game/src/main/java/forge/game/zone/MagicStack.java @@ -141,7 +141,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable - - - - - + diff --git a/forge-gui-ios/.classpath b/forge-gui-ios/.classpath index ed9f6578cf4..3adcfe5788b 100644 --- a/forge-gui-ios/.classpath +++ b/forge-gui-ios/.classpath @@ -11,11 +11,6 @@ - - - - - @@ -27,5 +22,6 @@ + diff --git a/forge-gui-mobile-dev/.classpath b/forge-gui-mobile-dev/.classpath index 0555295f29f..8eda42e35bb 100644 --- a/forge-gui-mobile-dev/.classpath +++ b/forge-gui-mobile-dev/.classpath @@ -6,11 +6,6 @@ - - - - - @@ -20,5 +15,6 @@ + diff --git a/forge-gui/.classpath b/forge-gui/.classpath index 3c4e0e68461..f2ae73bd5d9 100644 --- a/forge-gui/.classpath +++ b/forge-gui/.classpath @@ -3,8 +3,8 @@ - +