Skip to content

Commit

Permalink
feat: final commit at least I hope
Browse files Browse the repository at this point in the history
  • Loading branch information
Ozon committed May 24, 2020
1 parent e1cfe61 commit 43f90a6
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion core/src/com/knightwars/game/KnightWarsGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions core/src/com/knightwars/game/players/ComputerPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void makeMoves(KnightWarsGame game) {
List<Building> 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<Building, Integer> remainingUnits = new HashMap<>();
for (Building building : buildings) {
remainingUnits.put(building, building.getKnights());
Expand Down Expand Up @@ -127,9 +126,6 @@ public void makeMoves(KnightWarsGame game) {
List<Object> 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);
}
Expand All @@ -139,7 +135,6 @@ public void makeMoves(KnightWarsGame game) {
}

for (List<Object> 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));
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/knightwars/game/players/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 0 additions & 2 deletions core/src/com/knightwars/userInterface/EventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions core/src/com/knightwars/userInterface/MainMenuScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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() {
Expand All @@ -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);

Expand Down

0 comments on commit 43f90a6

Please sign in to comment.