mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Start major Planar Conquest overhaul
This commit is contained in:
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -16951,8 +16951,6 @@ forge-gui/res/skins/dark_ascension/font1.ttf -text
|
|||||||
forge-gui/res/skins/dark_ascension/sprite_icons.png -text
|
forge-gui/res/skins/dark_ascension/sprite_icons.png -text
|
||||||
forge-gui/res/skins/default/bg_draft_deck.png -text
|
forge-gui/res/skins/default/bg_draft_deck.png -text
|
||||||
forge-gui/res/skins/default/bg_match.jpg -text
|
forge-gui/res/skins/default/bg_match.jpg -text
|
||||||
forge-gui/res/skins/default/bg_monitor.png -text
|
|
||||||
forge-gui/res/skins/default/bg_planar_map.png -text
|
|
||||||
forge-gui/res/skins/default/bg_splash.png -text
|
forge-gui/res/skins/default/bg_splash.png -text
|
||||||
forge-gui/res/skins/default/bg_texture.jpg -text
|
forge-gui/res/skins/default/bg_texture.jpg -text
|
||||||
forge-gui/res/skins/default/font1.ttf -text
|
forge-gui/res/skins/default/font1.ttf -text
|
||||||
@@ -16962,6 +16960,7 @@ forge-gui/res/skins/default/sprite_avatars.png -text
|
|||||||
forge-gui/res/skins/default/sprite_foils.png -text
|
forge-gui/res/skins/default/sprite_foils.png -text
|
||||||
forge-gui/res/skins/default/sprite_icons.png -text
|
forge-gui/res/skins/default/sprite_icons.png -text
|
||||||
forge-gui/res/skins/default/sprite_old_foils.png -text
|
forge-gui/res/skins/default/sprite_old_foils.png -text
|
||||||
|
forge-gui/res/skins/default/sprite_planar_conquest.png -text
|
||||||
forge-gui/res/skins/default/sprite_trophies.png -text
|
forge-gui/res/skins/default/sprite_trophies.png -text
|
||||||
forge-gui/res/skins/firebloom/bg_match.jpg -text
|
forge-gui/res/skins/firebloom/bg_match.jpg -text
|
||||||
forge-gui/res/skins/firebloom/bg_splash.png -text
|
forge-gui/res/skins/firebloom/bg_splash.png -text
|
||||||
@@ -17243,6 +17242,7 @@ forge-gui/src/main/java/forge/planarconquest/ConquestDataIO.java -text
|
|||||||
forge-gui/src/main/java/forge/planarconquest/ConquestDeckMap.java -text
|
forge-gui/src/main/java/forge/planarconquest/ConquestDeckMap.java -text
|
||||||
forge-gui/src/main/java/forge/planarconquest/ConquestPlane.java -text
|
forge-gui/src/main/java/forge/planarconquest/ConquestPlane.java -text
|
||||||
forge-gui/src/main/java/forge/planarconquest/ConquestPlaneData.java -text
|
forge-gui/src/main/java/forge/planarconquest/ConquestPlaneData.java -text
|
||||||
|
forge-gui/src/main/java/forge/planarconquest/ConquestPlaneMap.java -text
|
||||||
forge-gui/src/main/java/forge/planarconquest/ConquestPreferences.java -text
|
forge-gui/src/main/java/forge/planarconquest/ConquestPreferences.java -text
|
||||||
forge-gui/src/main/java/forge/planarconquest/ConquestUtil.java -text
|
forge-gui/src/main/java/forge/planarconquest/ConquestUtil.java -text
|
||||||
forge-gui/src/main/java/forge/planarconquest/IVCommandCenter.java -text
|
forge-gui/src/main/java/forge/planarconquest/IVCommandCenter.java -text
|
||||||
|
|||||||
@@ -1169,8 +1169,6 @@ public class FSkin {
|
|||||||
// Exceptions handled inside method.
|
// Exceptions handled inside method.
|
||||||
SkinIcon.setIcon(FSkinProp.BG_TEXTURE, preferredDir + ForgeConstants.TEXTURE_BG_FILE);
|
SkinIcon.setIcon(FSkinProp.BG_TEXTURE, preferredDir + ForgeConstants.TEXTURE_BG_FILE);
|
||||||
SkinIcon.setIcon(FSkinProp.BG_MATCH, preferredDir + ForgeConstants.MATCH_BG_FILE);
|
SkinIcon.setIcon(FSkinProp.BG_MATCH, preferredDir + ForgeConstants.MATCH_BG_FILE);
|
||||||
SkinIcon.setIcon(FSkinProp.BG_PLANAR_MAP, preferredDir + ForgeConstants.PLANAR_MAP_BG_FILE);
|
|
||||||
SkinIcon.setIcon(FSkinProp.BG_MONITOR, preferredDir + ForgeConstants.MONITOR_BG_FILE);
|
|
||||||
|
|
||||||
// Run through enums and load their coords.
|
// Run through enums and load their coords.
|
||||||
Colors.updateAll();
|
Colors.updateAll();
|
||||||
|
|||||||
@@ -116,6 +116,9 @@ public enum FSkinImage implements FImage {
|
|||||||
TROPHY_CASE_TOP (FSkinProp.IMG_TROPHY_CASE_TOP, SourceFile.TROPHIES),
|
TROPHY_CASE_TOP (FSkinProp.IMG_TROPHY_CASE_TOP, SourceFile.TROPHIES),
|
||||||
TROPHY_SHELF (FSkinProp.IMG_TROPHY_SHELF, SourceFile.TROPHIES),
|
TROPHY_SHELF (FSkinProp.IMG_TROPHY_SHELF, SourceFile.TROPHIES),
|
||||||
|
|
||||||
|
//Achievement Trophies
|
||||||
|
HEXAGON_TILE (FSkinProp.IMG_HEXAGON_TILE, SourceFile.PLANAR_CONQUEST),
|
||||||
|
|
||||||
//Quest Icons
|
//Quest Icons
|
||||||
QUEST_ZEP (FSkinProp.ICO_QUEST_ZEP, SourceFile.ICONS),
|
QUEST_ZEP (FSkinProp.ICO_QUEST_ZEP, SourceFile.ICONS),
|
||||||
QUEST_GEAR (FSkinProp.ICO_QUEST_GEAR, SourceFile.ICONS),
|
QUEST_GEAR (FSkinProp.ICO_QUEST_GEAR, SourceFile.ICONS),
|
||||||
@@ -237,7 +240,8 @@ public enum FSkinImage implements FImage {
|
|||||||
ICONS(ForgeConstants.SPRITE_ICONS_FILE),
|
ICONS(ForgeConstants.SPRITE_ICONS_FILE),
|
||||||
FOILS(ForgeConstants.SPRITE_FOILS_FILE),
|
FOILS(ForgeConstants.SPRITE_FOILS_FILE),
|
||||||
OLD_FOILS(ForgeConstants.SPRITE_OLD_FOILS_FILE),
|
OLD_FOILS(ForgeConstants.SPRITE_OLD_FOILS_FILE),
|
||||||
TROPHIES(ForgeConstants.SPRITE_TROPHIES_FILE);
|
TROPHIES(ForgeConstants.SPRITE_TROPHIES_FILE),
|
||||||
|
PLANAR_CONQUEST(ForgeConstants.SPRITE_PLANAR_CONQUEST_FILE);
|
||||||
|
|
||||||
private final String filename;
|
private final String filename;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ import forge.properties.ForgeConstants;
|
|||||||
|
|
||||||
public enum FSkinTexture implements FImage {
|
public enum FSkinTexture implements FImage {
|
||||||
BG_TEXTURE(ForgeConstants.TEXTURE_BG_FILE, true),
|
BG_TEXTURE(ForgeConstants.TEXTURE_BG_FILE, true),
|
||||||
BG_MATCH(ForgeConstants.MATCH_BG_FILE, false),
|
BG_MATCH(ForgeConstants.MATCH_BG_FILE, false);
|
||||||
BG_PLANAR_MAP(ForgeConstants.PLANAR_MAP_BG_FILE, false),
|
|
||||||
BG_MONITOR(ForgeConstants.MONITOR_BG_FILE, false);
|
|
||||||
|
|
||||||
private final String filename;
|
private final String filename;
|
||||||
private final boolean repeat;
|
private final boolean repeat;
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
|||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
|
import forge.achievement.PlaneswalkerAchievements;
|
||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.assets.FSkin;
|
import forge.assets.FSkin;
|
||||||
import forge.assets.FSkinColor;
|
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
import forge.assets.FSkinImage;
|
import forge.assets.FSkinImage;
|
||||||
import forge.assets.FSkinTexture;
|
|
||||||
import forge.assets.TextRenderer;
|
import forge.assets.TextRenderer;
|
||||||
import forge.card.CardRarity;
|
import forge.card.CardRarity;
|
||||||
import forge.card.CardRenderer;
|
import forge.card.CardRenderer;
|
||||||
@@ -42,15 +41,15 @@ import forge.toolbox.FCardPanel;
|
|||||||
import forge.toolbox.FContainer;
|
import forge.toolbox.FContainer;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.toolbox.FEvent;
|
import forge.toolbox.FEvent;
|
||||||
|
import forge.toolbox.FScrollPane;
|
||||||
import forge.toolbox.FEvent.FEventHandler;
|
import forge.toolbox.FEvent.FEventHandler;
|
||||||
|
import forge.toolbox.FScrollPane.ScrollBounds;
|
||||||
import forge.toolbox.FLabel;
|
import forge.toolbox.FLabel;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
|
|
||||||
public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
||||||
private static final Color BACK_COLOR = FSkinColor.fromRGB(1, 2, 2);
|
|
||||||
private static final float BORDER_THICKNESS = Utils.scale(1);
|
private static final float BORDER_THICKNESS = Utils.scale(1);
|
||||||
private static final FSkinFont REGION_STATS_FONT = FSkinFont.get(12);
|
private static final FSkinFont REGION_STATS_FONT = FSkinFont.get(12);
|
||||||
private static final FSkinFont PLANE_STATS_FONT = FSkinFont.get(14);
|
|
||||||
private static final FSkinFont REGION_NAME_FONT = FSkinFont.get(15);
|
private static final FSkinFont REGION_NAME_FONT = FSkinFont.get(15);
|
||||||
private static final FSkinFont PLANE_NAME_FONT = FSkinFont.get(16);
|
private static final FSkinFont PLANE_NAME_FONT = FSkinFont.get(16);
|
||||||
private static final FSkinFont UNLOCK_WINS_FONT = FSkinFont.get(18);
|
private static final FSkinFont UNLOCK_WINS_FONT = FSkinFont.get(18);
|
||||||
@@ -59,6 +58,7 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
private static final float REGION_FRAME_THICKNESS_MULTIPLIER = 15f / 443f;
|
private static final float REGION_FRAME_THICKNESS_MULTIPLIER = 15f / 443f;
|
||||||
private static final float REGION_FRAME_BASE_HEIGHT_MULTIPLIER = 25f / 317f;
|
private static final float REGION_FRAME_BASE_HEIGHT_MULTIPLIER = 25f / 317f;
|
||||||
|
|
||||||
|
private final PlaneMap map = add(new PlaneMap());
|
||||||
private final RegionDisplay regionDisplay = add(new RegionDisplay());
|
private final RegionDisplay regionDisplay = add(new RegionDisplay());
|
||||||
private final CommanderRow commanderRow = add(new CommanderRow());
|
private final CommanderRow commanderRow = add(new CommanderRow());
|
||||||
private final FLabel btnEndDay = add(new FLabel.ButtonBuilder().font(FSkinFont.get(14)).build());
|
private final FLabel btnEndDay = add(new FLabel.ButtonBuilder().font(FSkinFont.get(14)).build());
|
||||||
@@ -135,25 +135,6 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawBackground(Graphics g) {
|
|
||||||
FImage background = FSkinTexture.BG_PLANAR_MAP;
|
|
||||||
float w = getWidth();
|
|
||||||
float h = w * background.getHeight() / background.getWidth();
|
|
||||||
g.fillRect(BACK_COLOR, 0, 0, w, getHeight());
|
|
||||||
g.drawImage(background, 0, getHeight() - h, w, h); //retain proportions, remaining area will be covered by back color
|
|
||||||
|
|
||||||
//draw stats and name for current plane above buttons
|
|
||||||
float x = COMMANDER_GAP / 3;
|
|
||||||
float y = commanderRow.getBottom();
|
|
||||||
float h1 = btnEndDay.getTop() - y;
|
|
||||||
float h2 = getHeight() - y;
|
|
||||||
w -= 2 * x;
|
|
||||||
g.drawText(unlockRatio, PLANE_STATS_FONT, Color.WHITE, x, y, w, h2, false, HAlignment.LEFT, true);
|
|
||||||
g.drawText("Plane - " + model.getCurrentPlane().getName(), PLANE_NAME_FONT, Color.WHITE, x, y, w, h1, false, HAlignment.CENTER, true);
|
|
||||||
g.drawText(winRatio, PLANE_STATS_FONT, Color.WHITE, x, y, w, h2, false, HAlignment.RIGHT, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawOverlay(Graphics g) {
|
protected void drawOverlay(Graphics g) {
|
||||||
ConquestCommander commander = regionDisplay.deployedCommander.commander;
|
ConquestCommander commander = regionDisplay.deployedCommander.commander;
|
||||||
@@ -200,7 +181,39 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
float commanderRowHeight = commanderWidth * FCardPanel.ASPECT_RATIO + 2 * COMMANDER_ROW_PADDING;
|
float commanderRowHeight = commanderWidth * FCardPanel.ASPECT_RATIO + 2 * COMMANDER_ROW_PADDING;
|
||||||
commanderRow.setBounds(0, btnEndDay.getTop() - PLANE_NAME_FONT.getLineHeight() - 2 * FLabel.DEFAULT_INSETS - commanderRowHeight, width, commanderRowHeight);
|
commanderRow.setBounds(0, btnEndDay.getTop() - PLANE_NAME_FONT.getLineHeight() - 2 * FLabel.DEFAULT_INSETS - commanderRowHeight, width, commanderRowHeight);
|
||||||
|
|
||||||
regionDisplay.setBounds(0, startY, width, commanderRow.getTop() - startY);
|
map.setBounds(0, startY, width, commanderRow.getTop() - startY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PlaneMap extends FScrollPane {
|
||||||
|
private float zoom = 1;
|
||||||
|
private FImage walker = (FImage)PlaneswalkerAchievements.getTrophyImage("Ajani Goldmane");
|
||||||
|
|
||||||
|
public PlaneMap() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ScrollBounds layoutAndGetScrollBounds(float visibleWidth, float visibleHeight) {
|
||||||
|
return new ScrollBounds(visibleWidth, visibleHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawBackground(Graphics g) {
|
||||||
|
float w = getWidth();
|
||||||
|
float h = getHeight();
|
||||||
|
float tileWidth = w / 4 * zoom;
|
||||||
|
float tileHeight = tileWidth * FSkinImage.HEXAGON_TILE.getHeight() / FSkinImage.HEXAGON_TILE.getWidth();
|
||||||
|
|
||||||
|
float x = (w - tileWidth) / 2;
|
||||||
|
float y = (h - tileHeight) / 2;
|
||||||
|
drawTile(g, x, y, tileWidth, tileHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawTile(Graphics g, float x, float y, float w, float h) {
|
||||||
|
g.drawImage(FSkinImage.HEXAGON_TILE, x, y, w, h);
|
||||||
|
|
||||||
|
float pedestalWidth = w * 0.8f;
|
||||||
|
float pedestalHeight = pedestalWidth * walker.getHeight() / walker.getWidth();
|
||||||
|
g.drawImage(walker, x + (w - pedestalWidth) / 2, y + h / 2 - pedestalHeight * 0.8f, pedestalWidth, pedestalHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RegionDisplay extends FContainer {
|
private class RegionDisplay extends FContainer {
|
||||||
@@ -250,7 +263,7 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doLayout(float width, float height) {
|
protected void doLayout(float width, float height) {
|
||||||
float x = COMMANDER_GAP / 2;
|
/*float x = COMMANDER_GAP / 2;
|
||||||
float y = COMMANDER_GAP;
|
float y = COMMANDER_GAP;
|
||||||
float w = width - 2 * x;
|
float w = width - 2 * x;
|
||||||
float h = height - y;
|
float h = height - y;
|
||||||
@@ -279,7 +292,7 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
x = deployedCommander.getRight() + padding;
|
x = deployedCommander.getRight() + padding;
|
||||||
actions[2].setBounds(x, y, actionPanelSize, actionPanelSize);
|
actions[2].setBounds(x, y, actionPanelSize, actionPanelSize);
|
||||||
x += actionPanelSize + padding;
|
x += actionPanelSize + padding;
|
||||||
actions[3].setBounds(x, y, actionPanelSize, actionPanelSize);
|
actions[3].setBounds(x, y, actionPanelSize, actionPanelSize);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -298,8 +311,6 @@ public class CommandCenterScreen extends FScreen implements IVCommandCenter {
|
|||||||
g.drawImage((FImage)region.getArt(), x, y, w, h); //TODO: Maximize in frame while retaining proportions
|
g.drawImage((FImage)region.getArt(), x, y, w, h); //TODO: Maximize in frame while retaining proportions
|
||||||
g.endClip();
|
g.endClip();
|
||||||
|
|
||||||
g.drawImage(FSkinTexture.BG_MONITOR, x, y, w, h);
|
|
||||||
|
|
||||||
y += h - regionFrameBaseHeight;
|
y += h - regionFrameBaseHeight;
|
||||||
h = regionFrameBaseHeight * 0.9f;
|
h = regionFrameBaseHeight * 0.9f;
|
||||||
g.drawText(unlockRatio, REGION_STATS_FONT, Color.BLACK, 2 * x, y, w, h, false, HAlignment.LEFT, true);
|
g.drawText(unlockRatio, REGION_STATS_FONT, Color.BLACK, 2 * x, y, w, h, false, HAlignment.LEFT, true);
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 149 KiB |
BIN
forge-gui/res/skins/default/sprite_planar_conquest.png
Normal file
BIN
forge-gui/res/skins/default/sprite_planar_conquest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -1,5 +1,8 @@
|
|||||||
package forge.achievement;
|
package forge.achievement;
|
||||||
|
|
||||||
|
import forge.GuiBase;
|
||||||
|
import forge.assets.FSkinProp;
|
||||||
|
import forge.assets.ISkinImage;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.item.IPaperCard;
|
import forge.item.IPaperCard;
|
||||||
@@ -9,6 +12,10 @@ import forge.properties.ForgeConstants;
|
|||||||
public class PlaneswalkerAchievements extends AchievementCollection {
|
public class PlaneswalkerAchievements extends AchievementCollection {
|
||||||
public static final PlaneswalkerAchievements instance = new PlaneswalkerAchievements();
|
public static final PlaneswalkerAchievements instance = new PlaneswalkerAchievements();
|
||||||
|
|
||||||
|
public static ISkinImage getTrophyImage(String planeswalkerName) {
|
||||||
|
return GuiBase.getInterface().createLayeredImage(FSkinProp.IMG_SPECIAL_TROPHY, ForgeConstants.CACHE_ACHIEVEMENTS_DIR + "/" + planeswalkerName + ".png", 1);
|
||||||
|
}
|
||||||
|
|
||||||
private PlaneswalkerAchievements() {
|
private PlaneswalkerAchievements() {
|
||||||
super("Planeswalker Ultimates", ForgeConstants.ACHIEVEMENTS_DIR + "planeswalkers.xml", false);
|
super("Planeswalker Ultimates", ForgeConstants.ACHIEVEMENTS_DIR + "planeswalkers.xml", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ public enum FSkinProp {
|
|||||||
BG_SPLASH (null, PropType.BACKGROUND),
|
BG_SPLASH (null, PropType.BACKGROUND),
|
||||||
BG_TEXTURE (null, PropType.BACKGROUND),
|
BG_TEXTURE (null, PropType.BACKGROUND),
|
||||||
BG_MATCH (null, PropType.BACKGROUND),
|
BG_MATCH (null, PropType.BACKGROUND),
|
||||||
BG_PLANAR_MAP (null, PropType.BACKGROUND),
|
|
||||||
BG_MONITOR (null, PropType.BACKGROUND),
|
|
||||||
|
|
||||||
//colors
|
//colors
|
||||||
CLR_THEME (new int[] {70, 10}, PropType.COLOR),
|
CLR_THEME (new int[] {70, 10}, PropType.COLOR),
|
||||||
@@ -243,6 +241,9 @@ public enum FSkinProp {
|
|||||||
IMG_TROPHY_CASE_TOP (new int[] {0, 185, 798, 38}, PropType.TROPHY),
|
IMG_TROPHY_CASE_TOP (new int[] {0, 185, 798, 38}, PropType.TROPHY),
|
||||||
IMG_TROPHY_SHELF (new int[] {0, 223, 798, 257}, PropType.TROPHY),
|
IMG_TROPHY_SHELF (new int[] {0, 223, 798, 257}, PropType.TROPHY),
|
||||||
|
|
||||||
|
//planar conquest images
|
||||||
|
IMG_HEXAGON_TILE (new int[] {0, 0, 220, 192}, PropType.PLANAR_CONQUEST),
|
||||||
|
|
||||||
//button images
|
//button images
|
||||||
IMG_BTN_START_UP (new int[] {480, 200, 160, 80}, PropType.ICON),
|
IMG_BTN_START_UP (new int[] {480, 200, 160, 80}, PropType.ICON),
|
||||||
IMG_BTN_START_OVER (new int[] {480, 280, 160, 80}, PropType.ICON),
|
IMG_BTN_START_OVER (new int[] {480, 280, 160, 80}, PropType.ICON),
|
||||||
@@ -299,5 +300,6 @@ public enum FSkinProp {
|
|||||||
FOIL,
|
FOIL,
|
||||||
OLD_FOIL,
|
OLD_FOIL,
|
||||||
TROPHY,
|
TROPHY,
|
||||||
|
PLANAR_CONQUEST
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class ConquestPlaneData {
|
|||||||
private final Map<String, Integer> winsPerOpponent = new HashMap<String, Integer>();
|
private final Map<String, Integer> winsPerOpponent = new HashMap<String, Integer>();
|
||||||
private final Map<String, Integer> lossesPerOpponent = new HashMap<String, Integer>();
|
private final Map<String, Integer> lossesPerOpponent = new HashMap<String, Integer>();
|
||||||
private final ConquestPlane plane;
|
private final ConquestPlane plane;
|
||||||
|
private final ConquestPlaneMap map;
|
||||||
|
|
||||||
private int wins, losses;
|
private int wins, losses;
|
||||||
private int winStreakBest = 0;
|
private int winStreakBest = 0;
|
||||||
@@ -23,6 +24,7 @@ public class ConquestPlaneData {
|
|||||||
|
|
||||||
public ConquestPlaneData(ConquestPlane plane0) {
|
public ConquestPlaneData(ConquestPlane plane0) {
|
||||||
plane = plane0;
|
plane = plane0;
|
||||||
|
map = new ConquestPlaneMap(plane0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ConquestCommander> getCommanders() {
|
public List<ConquestCommander> getCommanders() {
|
||||||
@@ -92,6 +94,10 @@ public class ConquestPlaneData {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConquestPlaneMap getMap() {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
public RegionData getRegionData(Region region) {
|
public RegionData getRegionData(Region region) {
|
||||||
RegionData regionData = regionDataLookup.get(region);
|
RegionData regionData = regionDataLookup.get(region);
|
||||||
if (regionData == null) {
|
if (regionData == null) {
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package forge.planarconquest;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import forge.util.Aggregates;
|
||||||
|
|
||||||
|
public class ConquestPlaneMap {
|
||||||
|
//use 2 dimensional array to represent tile grid
|
||||||
|
private final int gridSize;
|
||||||
|
private final HexagonTile[][] grid;
|
||||||
|
private int tileCount;
|
||||||
|
|
||||||
|
public ConquestPlaneMap(ConquestPlane plane) {
|
||||||
|
int size = (int)Math.round(Math.sqrt(plane.getCardPool().size() / 3)); //use card pool size to determine grid size
|
||||||
|
if (size % 2 == 0) {
|
||||||
|
size++; //ensure grid size is an odd number
|
||||||
|
}
|
||||||
|
gridSize = size;
|
||||||
|
grid = new HexagonTile[gridSize][gridSize];
|
||||||
|
generateRandomGrid();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateRandomGrid() {
|
||||||
|
int startQ = gridSize / 2; //player will start at center of grid always
|
||||||
|
int startR = startQ;
|
||||||
|
addTile(startQ, startR);
|
||||||
|
|
||||||
|
int max = gridSize - 1;
|
||||||
|
int minCount = Math.round(gridSize * gridSize * 0.8f); //ensure at least 80% of the grid has tiles
|
||||||
|
while (tileCount < minCount) {
|
||||||
|
//add a tile in a random location and then ensure it can be reached from start tile
|
||||||
|
int q = Aggregates.randomInt(0, max);
|
||||||
|
int r = Aggregates.randomInt(0, max);
|
||||||
|
while (addTile(q, r)) {
|
||||||
|
//alternate which coordinate is incremented as we move towards center
|
||||||
|
if (tileCount % 2 == 0 && r != startR) {
|
||||||
|
if (r > startR) {
|
||||||
|
r--;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (q > startQ) {
|
||||||
|
q--;
|
||||||
|
}
|
||||||
|
else if (q < startQ) {
|
||||||
|
q++;
|
||||||
|
}
|
||||||
|
else if (r > startR) {
|
||||||
|
r--;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean addTile(int q, int r) {
|
||||||
|
if (grid[q][r] == null) {
|
||||||
|
grid[q][r] = new HexagonTile(q, r);
|
||||||
|
tileCount++;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class HexagonTile {
|
||||||
|
private int q, r;
|
||||||
|
|
||||||
|
private HexagonTile(int q0, int r0) {
|
||||||
|
q = q0;
|
||||||
|
r = r0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<HexagonTile> getNeighbors() {
|
||||||
|
List<HexagonTile> neighbors = new ArrayList<HexagonTile>();
|
||||||
|
addToList(q, r - 1, neighbors); //tile above
|
||||||
|
addToList(q, r + 1, neighbors); //tile below
|
||||||
|
if (q % 2 == 0) {
|
||||||
|
addToList(q - 1, r - 1, neighbors); //tile left and up
|
||||||
|
addToList(q - 1, r, neighbors); //tile left and down
|
||||||
|
addToList(q + 1, r - 1, neighbors); //tile right and up
|
||||||
|
addToList(q + 1, r, neighbors); //tile right and down
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addToList(q - 1, r, neighbors); //tile left and up
|
||||||
|
addToList(q - 1, r + 1, neighbors); //tile left and down
|
||||||
|
addToList(q + 1, r, neighbors); //tile right and up
|
||||||
|
addToList(q + 1, r + 1, neighbors); //tile right and down
|
||||||
|
}
|
||||||
|
return neighbors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToList(int q, int r, List<HexagonTile> list) {
|
||||||
|
if (r < 0 || q < 0 || q >= grid.length || r >= grid[0].length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HexagonTile tile = grid[q][r];
|
||||||
|
if (tile != null) {
|
||||||
|
list.add(tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,12 +77,11 @@ public final class ForgeConstants {
|
|||||||
public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png";
|
public static final String SPRITE_OLD_FOILS_FILE = "sprite_old_foils.png";
|
||||||
public static final String SPRITE_TROPHIES_FILE = "sprite_trophies.png";
|
public static final String SPRITE_TROPHIES_FILE = "sprite_trophies.png";
|
||||||
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
public static final String SPRITE_AVATARS_FILE = "sprite_avatars.png";
|
||||||
|
public static final String SPRITE_PLANAR_CONQUEST_FILE = "sprite_planar_conquest.png";
|
||||||
public static final String FONT_FILE = "font1.ttf";
|
public static final String FONT_FILE = "font1.ttf";
|
||||||
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
public static final String SPLASH_BG_FILE = "bg_splash.png";
|
||||||
public static final String MATCH_BG_FILE = "bg_match.jpg";
|
public static final String MATCH_BG_FILE = "bg_match.jpg";
|
||||||
public static final String TEXTURE_BG_FILE = "bg_texture.jpg";
|
public static final String TEXTURE_BG_FILE = "bg_texture.jpg";
|
||||||
public static final String PLANAR_MAP_BG_FILE = "bg_planar_map.png";
|
|
||||||
public static final String MONITOR_BG_FILE = "bg_monitor.png";
|
|
||||||
public static final String DRAFT_DECK_IMG_FILE = "bg_draft_deck.png";
|
public static final String DRAFT_DECK_IMG_FILE = "bg_draft_deck.png";
|
||||||
|
|
||||||
// data tree roots
|
// data tree roots
|
||||||
|
|||||||
Reference in New Issue
Block a user