stuff fix

This commit is contained in:
Sem van der Hoeven
2020-06-07 16:34:27 +02:00
parent 8344cbab0b
commit 133310a3e2
2 changed files with 18 additions and 12 deletions

View File

@@ -378,7 +378,6 @@ public class MainGame extends Game implements ClientCallback {
}
public void send(Data data) {
System.out.println("[MAINGAME] sending data " + data);
this.client.writeData(data);
}
@@ -416,7 +415,7 @@ public class MainGame extends Game implements ClientCallback {
}
} else if (data instanceof DamageData) {
DamageData damageData = (DamageData) data;
team.get(damageData.getName()).damage(10);
team.get(damageData.getName()).damage(100);
} else if (data instanceof TurnData) {
this.playersTurn = !this.playersTurn;
}

View File

@@ -166,26 +166,33 @@ public class GameInputProcessor implements InputProcessor {
// clicking on enemy
if (mainGame.hasCharacterSelected() && gameTile.containsCharacter() && gameTile.getCharacter().getFaction() != mainGame.getChosenFaction()) {
if (mainGame.mapRenderer.getSurroundedTilesOfCurrentCharacter().contains(gameTile)) {
gameTile.getCharacter().damage(10);
if (!gameTile.getCharacter().isDead()) {
gameTile.getCharacter().damage(100);
mainGame.increaseTurn();
mainGame.send(new DamageData(gameTile.getCharacter().getName()));
}
}
}
}
// set selected character
if (!mainGame.hasCharacterSelected() && gameTile.containsCharacter()) {
if (gameTile.getCharacter().getFaction() == mainGame.getChosenFaction()) {
if (!gameTile.getCharacter().isDead()) {
mainGame.setSelectedCharacter(gameTile.getCharacter());
mainGame.mapRenderer.setSurroundedTilesOfCurrentCharacter(col, row);
}
}
}
// switch character
if (gameTile.containsCharacter()
&& !mainGame.getSelectedCharacter().equals(gameTile.getCharacter())
&& gameTile.getCharacter().getFaction() == mainGame.getChosenFaction()) {
if (!gameTile.getCharacter().isDead()) {
mainGame.setSelectedCharacter(gameTile.getCharacter());
mainGame.mapRenderer.setSurroundedTilesOfCurrentCharacter(col, row);
}
}
return true;
}
}