Package pp.battleship.message.server
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
A message sent by the server to inform clients about the effects of a shot in the Battleship game.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidaccept(ServerInterpreter interpreter) Accepts a visitor to process this message.Returns the ship that was destroyed by the shot.Returns the key for the informational text associated with this message.Returns the list of opponent's remaining ships after the shot.getShot()Returns the shot fired.static EffectMessageCreates an EffectMessage indicating a hit.booleanChecks if the game is lost by the player.booleanChecks if the game is over.booleanChecks if the game is won by the player.booleanisMyTurn()Checks if it's currently the player's turn.booleanChecks if the shot was fired by the player.static EffectMessagelost(IntPoint pos, Battleship destroyedShip, List<Battleship> remainingOpponentShips) Creates an EffectMessage indicating the player has lost the game.static EffectMessageCreates an EffectMessage indicating a miss.static EffectMessageshipDestroyed(boolean ownShot, IntPoint pos, Battleship destroyedShip) Creates an EffectMessage indicating a ship was destroyed.toString()Returns a string representation of the EffectMessage.static EffectMessagewon(IntPoint pos, Battleship destroyedShip) Creates an EffectMessage indicating the player has won the game.Von Klasse geerbte Methoden com.jme3.network.AbstractMessage
isReliable, setReliable
-
Methodendetails
-
hit
Creates an EffectMessage indicating a hit.- Parameter:
ownShot- true if the shot was fired by the player, false if by the opponentpos- the position of the shot- Gibt zurück:
- an EffectMessage indicating a hit
-
miss
Creates an EffectMessage indicating a miss.- Parameter:
ownShot- true if the shot was fired by the player, false if by the opponentpos- the position of the shot- Gibt zurück:
- an EffectMessage indicating a miss
-
shipDestroyed
Creates an EffectMessage indicating a ship was destroyed.- Parameter:
ownShot- true if the shot was fired by the player, false if by the opponentpos- the position of the shotdestroyedShip- the ship that was destroyed- Gibt zurück:
- an EffectMessage indicating a ship was destroyed
-
won
Creates an EffectMessage indicating the player has won the game.- Parameter:
pos- the position of the shotdestroyedShip- 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 shotdestroyedShip- the ship that was destroyedremainingOpponentShips- the list of opponent's remaining ships- Gibt zurück:
- an EffectMessage indicating the player has lost
-
accept
Accepts a visitor to process this message.- Angegeben von:
acceptin KlasseServerMessage- 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
Returns the shot fired.- Gibt zurück:
- the shot fired
-
getDestroyedShip
Returns the ship that was destroyed by the shot.- Gibt zurück:
- the destroyed ship, null if no ship was destroyed
-
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
Returns a string representation of the EffectMessage. -
getInfoTextKey
Returns the key for the informational text associated with this message.- Angegeben von:
getInfoTextKeyin KlasseServerMessage- Gibt zurück:
- the key for the informational text
-