own->opponent

This commit is contained in:
Luca Puderbach 2024-10-06 15:20:18 +02:00
parent 9ca08c3d0c
commit f6699c2a0a

View File

@ -7,14 +7,14 @@
package pp.battleship.game.client; package pp.battleship.game.client;
import java.lang.System.Logger.Level;
import pp.battleship.message.client.ShootMessage; import pp.battleship.message.client.ShootMessage;
import pp.battleship.message.server.EffectMessage; import pp.battleship.message.server.EffectMessage;
import pp.battleship.model.IntPoint; import pp.battleship.model.IntPoint;
import pp.battleship.model.ShipMap; import pp.battleship.model.ShipMap;
import pp.battleship.notification.Sound; import pp.battleship.notification.Sound;
import java.lang.System.Logger.Level;
/** /**
* Represents the state of the client where players take turns to attack each other's ships. * Represents the state of the client where players take turns to attack each other's ships.
*/ */
@ -60,7 +60,7 @@ class BattleState extends ClientState {
if (destroyedOpponentShip(msg)) if (destroyedOpponentShip(msg))
logic.getOpponentMap().add(msg.getDestroyedShip()); logic.getOpponentMap().add(msg.getDestroyedShip());
if (msg.isGameOver()) { if (msg.isGameOver()) {
msg.getRemainingOpponentShips().forEach(logic.getOwnMap()::add); msg.getRemainingOpponentShips().forEach(logic.getOpponentMap()::add);
logic.setState(new GameOverState(logic)); logic.setState(new GameOverState(logic));
} }
} }