Package battleship.model.game
Class AttackReport
java.lang.Object
battleship.model.game.AttackReport
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Hit result (Miss, nit or sunk). -
Constructor Summary
ConstructorsConstructorDescriptionAttackReport
(Ship ship, AttackReport.HitResult result, Point point, int fleetHealthRemaining, List<Point> points) -
Method Summary
Modifier and TypeMethodDescriptionint
static AttackReport.HitResult
Get the position being attacked.static AttackReport.HitResult
getResult
(int health) getShip()
Ship which was under attack
-
Constructor Details
-
AttackReport
public AttackReport(Ship ship, AttackReport.HitResult result, Point point, int fleetHealthRemaining, List<Point> points)
-
-
Method Details
-
getPointsOccupiedByShip
- Returns:
- List of points occupied by ship
-
getShip
Ship which was under attack- Returns:
- null if missed, ship type if sunk
-
getResult
- Returns:
- HitResult
-
getPosition
Get the position being attacked.- Returns:
- Point (x, y)
-
getFleetHealthRemaining
public int getFleetHealthRemaining()- Returns:
- total health remaining.
-
getResult
- Parameters:
health
- health remaining of the ship.- Returns:
- HitResult
-
getMissedResult
- Returns:
- HitResult.MISS
-