diff --git a/forge-core/pom.xml b/forge-core/pom.xml
index 7de7afa6e3d..58e5275cf98 100644
--- a/forge-core/pom.xml
+++ b/forge-core/pom.xml
@@ -21,7 +21,7 @@
org.apache.commons
commons-lang3
- 3.3
+ 3.7
diff --git a/forge-core/src/main/java/forge/StaticData.java b/forge-core/src/main/java/forge/StaticData.java
index 5bf271be201..57411a0434b 100644
--- a/forge-core/src/main/java/forge/StaticData.java
+++ b/forge-core/src/main/java/forge/StaticData.java
@@ -29,6 +29,7 @@ public class StaticData {
private final String blockDataFolder;
private final CardDb commonCards;
private final CardDb variantCards;
+ private final CardDb allCards;
private final TokenDb allTokens;
private final CardEdition.Collection editions;
@@ -54,6 +55,7 @@ public class StaticData {
lastInstance = this;
{
+ final Map allCardsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
final Map regularCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
final Map variantsCards = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@@ -61,6 +63,7 @@ public class StaticData {
if (null == card) continue;
final String cardName = card.getName();
+ allCardsMap.put(cardName, card);
if (card.isVariant()) {
variantsCards.put(cardName, card);
} else {
@@ -68,10 +71,12 @@ public class StaticData {
}
}
+ allCards = new CardDb(allCardsMap, editions);
commonCards = new CardDb(regularCards, editions);
variantCards = new CardDb(variantsCards, editions);
- //muse initialize after establish field values for the sake of card image logic
+ //must initialize after establish field values for the sake of card image logic
+ allCards.initialize(false, false);
commonCards.initialize(false, false);
variantCards.initialize(false, false);
}
@@ -184,6 +189,8 @@ public class StaticData {
return variantCards;
}
+ public CardDb getAllCards() { return allCards; }
+
public TokenDb getAllTokens() { return allTokens; }
public PaperCard getCardByEditionDate(PaperCard card, Date editionDate) {
diff --git a/forge-core/src/main/java/forge/item/PaperCard.java b/forge-core/src/main/java/forge/item/PaperCard.java
index 17d113d723b..c77903541ed 100644
--- a/forge-core/src/main/java/forge/item/PaperCard.java
+++ b/forge-core/src/main/java/forge/item/PaperCard.java
@@ -212,7 +212,7 @@ public final class PaperCard implements Comparable, InventoryItemFro
// default deserialization
ois.defaultReadObject();
- final IPaperCard pc = StaticData.instance().getCommonCards().getCard(name, edition, artIndex);
+ final IPaperCard pc = StaticData.instance().getAllCards().getCard(name, edition, artIndex);
if (pc == null) {
throw new IOException(TextUtil.concatWithSpace("Card", name, "not found"));
}
diff --git a/forge-game/src/main/java/forge/game/player/PlayerView.java b/forge-game/src/main/java/forge/game/player/PlayerView.java
index f8dffa5482b..b5aeb4874a7 100644
--- a/forge-game/src/main/java/forge/game/player/PlayerView.java
+++ b/forge-game/src/main/java/forge/game/player/PlayerView.java
@@ -129,6 +129,12 @@ public class PlayerView extends GameEntityView {
}
final FCollectionView opponents = getOpponents();
+ for (PlayerView opponent: opponents) {
+ if (opponent.getCommanders() == null) {
+ return Collections.emptyList();
+ }
+ }
+
final List info = Lists.newArrayListWithExpectedSize(opponents.size());
info.add(TextUtil.concatWithSpace("Commanders:", Lang.joinHomogenous(commanders)));
for (final PlayerView p : Iterables.concat(Collections.singleton(this), opponents)) {
diff --git a/forge-gui-android/pom.xml b/forge-gui-android/pom.xml
index be648139038..e12e0d8ce53 100644
--- a/forge-gui-android/pom.xml
+++ b/forge-gui-android/pom.xml
@@ -91,7 +91,7 @@
org.apache.commons
commons-lang3
- 3.3
+ 3.7
xmlpull
diff --git a/forge-gui-desktop/pom.xml b/forge-gui-desktop/pom.xml
index c4b422a477b..e1db3d54ea3 100644
--- a/forge-gui-desktop/pom.xml
+++ b/forge-gui-desktop/pom.xml
@@ -228,7 +228,7 @@
org.apache.commons
commons-lang3
- 3.3
+ 3.7
org.freemarker
diff --git a/forge-gui-desktop/src/main/java/forge/screens/home/VLobby.java b/forge-gui-desktop/src/main/java/forge/screens/home/VLobby.java
index 9e8fc2f93d9..b6908eee5d3 100644
--- a/forge-gui-desktop/src/main/java/forge/screens/home/VLobby.java
+++ b/forge-gui-desktop/src/main/java/forge/screens/home/VLobby.java
@@ -94,7 +94,7 @@ public class VLobby implements ILobbyView {
private final VariantCheckBox vntArchenemy = new VariantCheckBox(GameType.Archenemy);
private final VariantCheckBox vntArchenemyRumble = new VariantCheckBox(GameType.ArchenemyRumble);
private final ImmutableList vntBoxes =
- ImmutableList.of(vntVanguard, vntMomirBasic, vntCommander, vntTinyLeaders, vntPlanechase, vntArchenemy, vntArchenemyRumble);
+ ImmutableList.of(vntVanguard, vntMomirBasic, vntCommander, vntTinyLeaders /*, vntPlanechase, vntArchenemy, vntArchenemyRumble */);
// Player frame elements
private final JPanel playersFrame = new JPanel(new MigLayout("insets 0, gap 0 5, wrap, hidemode 3"));
@@ -302,7 +302,7 @@ public class VLobby implements ILobbyView {
}
void setReady(final int index, final boolean ready) {
- if (ready && decks[index] == null) {
+ if (ready && decks[index] == null && !vntMomirBasic.isSelected()) {
SOptionPane.showErrorDialog("Select a deck before readying!");
update(false);
return;
diff --git a/forge-gui-mobile/pom.xml b/forge-gui-mobile/pom.xml
index fa856665d3e..07a19da76ee 100644
--- a/forge-gui-mobile/pom.xml
+++ b/forge-gui-mobile/pom.xml
@@ -58,7 +58,7 @@
org.apache.commons
commons-lang3
- 3.3
+ 3.7
com.badlogicgames.gdx
diff --git a/forge-gui/pom.xml b/forge-gui/pom.xml
index 5fb3c8ed742..bcad2f56a62 100644
--- a/forge-gui/pom.xml
+++ b/forge-gui/pom.xml
@@ -49,7 +49,7 @@
org.apache.commons
commons-lang3
- 3.3
+ 3.7
io.netty
diff --git a/forge-gui/src/main/java/forge/net/client/GameClientHandler.java b/forge-gui/src/main/java/forge/net/client/GameClientHandler.java
index 08955a4d2c1..93f11d7be96 100644
--- a/forge-gui/src/main/java/forge/net/client/GameClientHandler.java
+++ b/forge-gui/src/main/java/forge/net/client/GameClientHandler.java
@@ -7,7 +7,10 @@ import forge.game.player.RegisteredPlayer;
import forge.interfaces.ILobbyListener;
import forge.match.LobbySlot;
import forge.player.LobbyPlayerHuman;
+import forge.player.PlayerZoneUpdate;
+import forge.player.PlayerZoneUpdates;
import forge.trackable.TrackableObject;
+import forge.trackable.TrackableTypes;
import forge.trackable.Tracker;
import io.netty.channel.ChannelHandlerContext;
import forge.game.player.PlayerView;
@@ -88,6 +91,7 @@ final class GameClientHandler extends GameProtocolHandler {
}
if (!(this.tracker == null)) {
updateTrackers(args);
+ replicateProps(args);
}
}
@@ -99,12 +103,26 @@ final class GameClientHandler extends GameProtocolHandler {
private GameRules createGameRules(GameType gameType, GameView gameView) {
// FIXME: how do we know the rules are the same on each side???
GameRules gameRules = new GameRules(gameType);
+ // is this always safe to do?
+ gameRules.setAppliedVariants(Collections.singleton(gameType));
gameRules.setGamesPerMatch(gameView.getNumGamesInMatch());
gameRules.setPoisonCountersToLose(gameView.getPoisonCountersToLose());
return gameRules;
}
+ /**
+ * Retrieve the desired GameType from the Lobby
+ *
+ * @return GameType
+ */
+ private GameType getGameType() {
+ List lobbyListeners = client.getLobbyListeners();
+ ILobbyListener lobbyListener = lobbyListeners.get(0);
+ ClientGameLobby myLobby = lobbyListener.getLobby();
+ return myLobby.getGameType();
+ }
+
/**
* This method retrieves enough of the existing (incomplete) game state to
* recreate a new viable Match object
@@ -121,7 +139,7 @@ final class GameClientHandler extends GameProtocolHandler {
final IGuiGame gui = client.getGui();
GameView gameView = gui.getGameView();
- final GameType gameType = gameView.getGameType();
+ final GameType gameType = getGameType();
final GameRules gameRules = createGameRules(gameType, gameView);
final List registeredPlayers = createRegisteredPlayers(gameType);
@@ -231,6 +249,41 @@ final class GameClientHandler extends GameProtocolHandler {
}
}
+ private void replicateProps(final Object[] objs) {
+ for (Object obj: objs) {
+ if (obj instanceof PlayerView) {
+ replicatePlayerView((PlayerView) obj);
+ }
+ else if (obj instanceof PlayerZoneUpdate) {
+ replicatePlayerView(((PlayerZoneUpdate) obj).getPlayer());
+ }
+ else if (obj instanceof PlayerZoneUpdates) {
+ Iterator itrPlayerZoneUpdates = ((PlayerZoneUpdates) obj).iterator();
+ while (itrPlayerZoneUpdates.hasNext()) {
+ PlayerView newPlayerView = ((PlayerZoneUpdate)itrPlayerZoneUpdates.next()).getPlayer();
+ /**
+ * FIXME: this should be handled by the original call to updateTrackers
+ * However, PlayerZoneUpdates aren't a TrackableCollection.
+ * So, additional logic will be needed. Leaving here for now.
+ */
+ updateTrackers(new Object[]{newPlayerView});
+ replicatePlayerView(newPlayerView);
+ }
+ }
+ /*
+ else {
+ System.err.println("replicateProps - did not handle : " + obj.getClass().toString());
+ }
+ */
+ }
+ }
+
+ private void replicatePlayerView(final PlayerView newPlayerView) {
+ PlayerView existingPlayerView = tracker.getObj(TrackableTypes.PlayerViewType, newPlayerView.getId());
+ existingPlayerView.copyChangedProps(newPlayerView);
+ System.err.println("replicated PlayerView properties - " + existingPlayerView.toString());
+ }
+
@Override
public void channelActive(final ChannelHandlerContext ctx) {
// Don't use send() here, as this.channel is not yet set!