From 43f90a6808215a0c71dc18d6d87f7c20f80c1ec7 Mon Sep 17 00:00:00 2001 From: Ozon Date: Sun, 24 May 2020 23:02:02 +0200 Subject: [PATCH] feat: final commit at least I hope --- core/src/com/knightwars/game/KnightWarsGame.java | 1 - core/src/com/knightwars/game/players/ComputerPlayer.java | 5 ----- core/src/com/knightwars/game/players/Player.java | 2 +- core/src/com/knightwars/userInterface/EventHandler.java | 2 -- core/src/com/knightwars/userInterface/MainMenuScreen.java | 5 ----- 5 files changed, 1 insertion(+), 14 deletions(-) diff --git a/core/src/com/knightwars/game/KnightWarsGame.java b/core/src/com/knightwars/game/KnightWarsGame.java index b0000cf..996c7b6 100644 --- a/core/src/com/knightwars/game/KnightWarsGame.java +++ b/core/src/com/knightwars/game/KnightWarsGame.java @@ -54,7 +54,6 @@ public KnightWarsGame() { /** Attribute a building to each player. Every other buildings are attributed to the neutral player. */ public void attributeBuildings(Player playerRed, Player playerBlue) throws NoBuildingFoundException { - // TODO That should be done at generation time try { map.getBuildings().get(0).setOwner(playerRed); map.getBuildings().get(0).setKnights(startNumberOfKnights); diff --git a/core/src/com/knightwars/game/players/ComputerPlayer.java b/core/src/com/knightwars/game/players/ComputerPlayer.java index 9257065..b370a82 100644 --- a/core/src/com/knightwars/game/players/ComputerPlayer.java +++ b/core/src/com/knightwars/game/players/ComputerPlayer.java @@ -56,7 +56,6 @@ public void makeMoves(KnightWarsGame game) { List buildings = game.getMap().getBuildings(); int reserveUnits = 0; // Total number of the computer's units - // TODO Temporary workaround, that can be fixed by adding more details to buildings Map remainingUnits = new HashMap<>(); for (Building building : buildings) { remainingUnits.put(building, building.getKnights()); @@ -127,9 +126,6 @@ public void makeMoves(KnightWarsGame game) { List move = new ArrayList<>(); move.add(source); move.add(target); - // TODO This sends in the end 100% of the building units - // because the synchronized attack is sent multiple times. That won't happen - // with a more detailed game state, that also contains incoming and in progress attacks. move.add(0.5f); moves.add(move); } @@ -139,7 +135,6 @@ public void makeMoves(KnightWarsGame game) { } for (List move : moves) { - // TODO Remove those unchecked casts; implement an event system with a stack game.getMap().sendUnit((Building) move.get(0), (Building) move.get(1), (float) move.get(2)); } diff --git a/core/src/com/knightwars/game/players/Player.java b/core/src/com/knightwars/game/players/Player.java index a138e09..dea7ea0 100644 --- a/core/src/com/knightwars/game/players/Player.java +++ b/core/src/com/knightwars/game/players/Player.java @@ -24,7 +24,7 @@ public Player(String name, ColorPlayer color) { this.name = name; this.color = color; this.unitLevel = 1f; - this.gold = 5000f; // Default golds, to modify if necessary + this.gold = 1000f; // Default golds, to modify if necessary this.unitPercentage = 0.25f; // Default percentage of units to send } diff --git a/core/src/com/knightwars/userInterface/EventHandler.java b/core/src/com/knightwars/userInterface/EventHandler.java index 26abd0d..731af47 100644 --- a/core/src/com/knightwars/userInterface/EventHandler.java +++ b/core/src/com/knightwars/userInterface/EventHandler.java @@ -48,8 +48,6 @@ public void handleTouchUp(Vector2 lastTouchDown, Vector2 lastTouchUp) { Building destinationBuilding = getSelectedBuilding(destinationBuildingCoords); if (selectedBuilding != null && destinationBuilding != null) { - // TODO Extract this code to fit the principle of an event-based game (we'll use the very same - // events for the AI to play) if (selectedBuilding == destinationBuilding) { // Display upgrade options actorBuildings.showUpgrade(selectedBuilding); diff --git a/core/src/com/knightwars/userInterface/MainMenuScreen.java b/core/src/com/knightwars/userInterface/MainMenuScreen.java index c032a4b..a33c286 100644 --- a/core/src/com/knightwars/userInterface/MainMenuScreen.java +++ b/core/src/com/knightwars/userInterface/MainMenuScreen.java @@ -23,7 +23,6 @@ public class MainMenuScreen implements Screen { private final FillViewport viewport; private final Stage stage; - public MainMenuScreen(final Display display, GameManager gameManager) { SpriteBatch batch = new SpriteBatch(); @@ -51,9 +50,6 @@ public void clicked(InputEvent event, float x, float y) { } }); - // Create the options button - TextButton optionsButton = new TextButton("Settings", skin); - // Create the quit button TextButton quitButton = new TextButton("Quit", skin); quitButton.addListener(new ClickListener() { @@ -72,7 +68,6 @@ public void clicked(InputEvent event, float x, float y) { // Create a table to contain the buttons, scale them and add padding Table menuTable = new Table(); menuTable.add(playButton).width(playButton.getWidth()*buttonScale).height(playButton.getHeight()*buttonScale).pad(buttonPadding).row(); - menuTable.add(optionsButton).width(playButton.getWidth()*buttonScale).height(playButton.getHeight()*buttonScale).pad(buttonPadding).row(); menuTable.add(quitButton).width(playButton.getWidth()*buttonScale).height(playButton.getHeight()*buttonScale).pad(buttonPadding).row(); menuTable.setPosition(mapSize.x*SCALE/2f, buttonPosY, Align.center);