Klasse EffectMessage

java.lang.Object
com.jme3.network.AbstractMessage
pp.battleship.message.server.ServerMessage
pp.battleship.message.server.EffectMessage
Alle implementierten Schnittstellen:
com.jme3.network.Message

public class EffectMessage extends ServerMessage
A message sent by the server to inform clients about the effects of a shot in the Battleship game.
  • Methodendetails

    • hit

      public static EffectMessage hit(boolean ownShot, IntPoint pos)
      Creates an EffectMessage indicating a hit.
      Parameter:
      ownShot - true if the shot was fired by the player, false if by the opponent
      pos - the position of the shot
      Gibt zurück:
      an EffectMessage indicating a hit
    • miss

      public static EffectMessage miss(boolean ownShot, IntPoint pos)
      Creates an EffectMessage indicating a miss.
      Parameter:
      ownShot - true if the shot was fired by the player, false if by the opponent
      pos - the position of the shot
      Gibt zurück:
      an EffectMessage indicating a miss
    • shipDestroyed

      public static EffectMessage shipDestroyed(boolean ownShot, IntPoint pos, Battleship destroyedShip)
      Creates an EffectMessage indicating a ship was destroyed.
      Parameter:
      ownShot - true if the shot was fired by the player, false if by the opponent
      pos - the position of the shot
      destroyedShip - the ship that was destroyed
      Gibt zurück:
      an EffectMessage indicating a ship was destroyed
    • won

      public static EffectMessage won(IntPoint pos, Battleship destroyedShip)
      Creates an EffectMessage indicating the player has won the game.
      Parameter:
      pos - the position of the shot
      destroyedShip - the ship that was destroyed
      Gibt zurück:
      an EffectMessage indicating the player has won
    • lost

      public static EffectMessage lost(IntPoint pos, Battleship destroyedShip, List<Battleship> remainingOpponentShips)
      Creates an EffectMessage indicating the player has lost the game.
      Parameter:
      pos - the position of the shot
      destroyedShip - the ship that was destroyed
      remainingOpponentShips - the list of opponent's remaining ships
      Gibt zurück:
      an EffectMessage indicating the player has lost
    • accept

      public void accept(ServerInterpreter interpreter)
      Accepts a visitor to process this message.
      Angegeben von:
      accept in Klasse ServerMessage
      Parameter:
      interpreter - the visitor to process this message
    • isOwnShot

      public boolean isOwnShot()
      Checks if the shot was fired by the player.
      Gibt zurück:
      true if the shot was fired by the player, false otherwise
    • getShot

      public Shot getShot()
      Returns the shot fired.
      Gibt zurück:
      the shot fired
    • getDestroyedShip

      public Battleship getDestroyedShip()
      Returns the ship that was destroyed by the shot.
      Gibt zurück:
      the destroyed ship, null if no ship was destroyed
    • getRemainingOpponentShips

      public List<Battleship> getRemainingOpponentShips()
      Returns the list of opponent's remaining ships after the shot.
      Gibt zurück:
      the list of opponent's remaining ships, null if the game is not yet over
    • isGameOver

      public boolean isGameOver()
      Checks if the game is over.
      Gibt zurück:
      true if the game is over, false otherwise
    • isGameWon

      public boolean isGameWon()
      Checks if the game is won by the player.
      Gibt zurück:
      true if the game is won by the player, false otherwise
    • isGameLost

      public boolean isGameLost()
      Checks if the game is lost by the player.
      Gibt zurück:
      true if the game is lost by the player, false otherwise
    • isMyTurn

      public boolean isMyTurn()
      Checks if it's currently the player's turn.
      Gibt zurück:
      true if it's the player's turn, false otherwise
    • toString

      public String toString()
      Returns a string representation of the EffectMessage.
      Setzt außer Kraft:
      toString in Klasse Object
      Gibt zurück:
      a string representation of the EffectMessage
    • getInfoTextKey

      public String getInfoTextKey()
      Returns the key for the informational text associated with this message.
      Angegeben von:
      getInfoTextKey in Klasse ServerMessage
      Gibt zurück:
      the key for the informational text