diff --git a/forge-gui-mobile/src/forge/screens/planarconquest/ConquestMapScreen.java b/forge-gui-mobile/src/forge/screens/planarconquest/ConquestMapScreen.java index 099a43a0f00..29c79d18cb5 100644 --- a/forge-gui-mobile/src/forge/screens/planarconquest/ConquestMapScreen.java +++ b/forge-gui-mobile/src/forge/screens/planarconquest/ConquestMapScreen.java @@ -14,6 +14,7 @@ import forge.card.CardDetailUtil.DetailColors; import forge.model.FModel; import forge.planarconquest.ConquestData; import forge.planarconquest.ConquestLocation; +import forge.planarconquest.ConquestPlane; import forge.planarconquest.ConquestPlane.Region; import forge.planarconquest.ConquestPlaneData; import forge.screens.FScreen; @@ -81,6 +82,10 @@ public class ConquestMapScreen extends FScreen { int rows = Region.ROWS_PER_REGION; float colWidth = w / cols; float rowHeight = regionHeight / rows; + + ConquestPlane plane = model.getCurrentPlane(); + FCollectionView regions = plane.getRegions(); + int regionCount = regions.size(); ConquestPlaneData planeData = model.getCurrentPlaneData(); ConquestLocation currentLocation = model.getCurrentLocation(); @@ -91,8 +96,6 @@ public class ConquestMapScreen extends FScreen { float y = -getScrollTop(); float colLineStartY = 0; float colLineEndY = h; - FCollectionView regions = model.getCurrentPlane().getRegions(); - int regionCount = regions.size(); //draw top portal row if (y + rowHeight > 0) { @@ -148,7 +151,7 @@ public class ConquestMapScreen extends FScreen { color = FOG_OF_WAR_COLOR; //if any bordering grid square has been conquered, instead show unconquered color - for (ConquestLocation loc : currentLocation.getNeighbors(i, r, c)) { + for (ConquestLocation loc : ConquestLocation.getNeighbors(plane, i, r, c)) { if (planeData.getEventResult(loc.getRegionIndex(), loc.getRow(), loc.getCol()) > 0) { color = UNCONQUERED_COLOR; break; @@ -184,6 +187,8 @@ public class ConquestMapScreen extends FScreen { x0 += colWidth; } + //draw planeswalker avatar + g.endClip(); } diff --git a/forge-gui/src/main/java/forge/planarconquest/ConquestLocation.java b/forge-gui/src/main/java/forge/planarconquest/ConquestLocation.java index 5935f9f3bc7..cc8201163dc 100644 --- a/forge-gui/src/main/java/forge/planarconquest/ConquestLocation.java +++ b/forge-gui/src/main/java/forge/planarconquest/ConquestLocation.java @@ -53,41 +53,42 @@ public class ConquestLocation { } public List getNeighbors() { - return getNeighbors(regionIndex, row, col); + return getNeighbors(plane, regionIndex, row, col); } - public List getNeighbors(int regionIndex0, int row0, int col0) { - int regionCount = plane.getRegions().size(); + + public static List getNeighbors(ConquestPlane plane0, int regionIndex0, int row0, int col0) { + int regionCount = plane0.getRegions().size(); List locations = new ArrayList(); //add location above if (row0 < Region.ROWS_PER_REGION - 1) { - locations.add(new ConquestLocation(plane, regionIndex0, row0 + 1, col0)); + locations.add(new ConquestLocation(plane0, regionIndex0, row0 + 1, col0)); } else if (regionIndex0 < regionCount - 1) { - locations.add(new ConquestLocation(plane, regionIndex0 + 1, 0, col0)); + locations.add(new ConquestLocation(plane0, regionIndex0 + 1, 0, col0)); } else if (regionIndex0 == regionCount - 1 && col0 == Region.PORTAL_COL) { - locations.add(new ConquestLocation(plane, regionCount, 0, col0)); + locations.add(new ConquestLocation(plane0, regionCount, 0, col0)); } //add location below if (row0 > 0) { - locations.add(new ConquestLocation(plane, regionIndex0, row0 - 1, col0)); + locations.add(new ConquestLocation(plane0, regionIndex0, row0 - 1, col0)); } else if (regionIndex0 > 0) { - locations.add(new ConquestLocation(plane, regionIndex0 - 1, Region.ROWS_PER_REGION - 1, col0)); + locations.add(new ConquestLocation(plane0, regionIndex0 - 1, Region.ROWS_PER_REGION - 1, col0)); } else if (regionIndex0 == 0 && col0 == Region.PORTAL_COL) { - locations.add(new ConquestLocation(plane, -1, 0, col0)); + locations.add(new ConquestLocation(plane0, -1, 0, col0)); } //add locations left and right if (regionIndex0 >= 0 && regionIndex0 < regionCount) { //not options in portal row if (col0 > 0) { - locations.add(new ConquestLocation(plane, regionIndex0, row0, col0 - 1)); + locations.add(new ConquestLocation(plane0, regionIndex0, row0, col0 - 1)); } if (col0 < Region.COLS_PER_REGION - 1) { - locations.add(new ConquestLocation(plane, regionIndex0, row0, col0 + 1)); + locations.add(new ConquestLocation(plane0, regionIndex0, row0, col0 + 1)); } }