soc.game
Class SOCFortress

java.lang.Object
  extended by soc.game.SOCPlayingPiece
      extended by soc.game.SOCFortress
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SOCFortress
extends SOCPlayingPiece

A fortress playing piece, used on the large sea board (SOCBoardLarge) with some scenarios. Fortresses are in a game only if scenario game option _SC_PIRI is set.

A player "owns" one fortress, but doesn't control it until after they have conquered the pirates there and its getStrength() is 0. At that time it becomes a SOCSettlement. New fortresses cannot be built after the game starts. So, game.putPiece(SOCFortress) assumes initial placement.

For details of fortress recapture / conquest, see SOCGame.attackPirateFortress(SOCShip).

Since:
2.0.00
Author:
Jeremy D Monin <jeremy@nand.net>
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
static int STARTING_STRENGTH
          Default starting strength for a fortress (3).
private  int strength
          What is this fortress' strength? Begins at STARTING_STRENGTH.
 
Fields inherited from class soc.game.SOCPlayingPiece
board, CITY, coord, FORTRESS, MAXPLUSONE, MIN, pieceType, player, ROAD, SETTLEMENT, SHIP, specialVP, specialVPEvent, VILLAGE
 
Constructor Summary
SOCFortress(SOCPlayer pl, int node, SOCBoard board)
          Make a new fortress, with strength STARTING_STRENGTH.
 
Method Summary
 int getStrength()
          Get the current strength of this fortress.
 void setStrength(int strength)
          Set the current strength of this fortress.
 
Methods inherited from class soc.game.SOCPlayingPiece
equals, getAdjacentEdges, getCoordinates, getPlayer, getPlayerNumber, getResourcesToBuild, getType, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

STARTING_STRENGTH

public static final int STARTING_STRENGTH
Default starting strength for a fortress (3).

See Also:
Constant Field Values

strength

private int strength
What is this fortress' strength? Begins at STARTING_STRENGTH.

Constructor Detail

SOCFortress

public SOCFortress(SOCPlayer pl,
                   int node,
                   SOCBoard board)
            throws java.lang.IllegalArgumentException
Make a new fortress, with strength STARTING_STRENGTH.

Parameters:
pl - Player who will own the fortress
node - node coordinate of fortress
board - board
Throws:
java.lang.IllegalArgumentException - if board null
Method Detail

getStrength

public int getStrength()
Get the current strength of this fortress.


setStrength

public void setStrength(int strength)
Set the current strength of this fortress. For use at client based on messages from server.

Parameters:
strength - New strength