rl.common.game.elements
Class InfantrySquad

java.lang.Object
  extended by rl.common.game.elements.GameElement
      extended by rl.common.game.elements.InfantrySquad
All Implemented Interfaces:
java.io.Serializable, ConcealableElement, FiringCapableElement, MovementCapableElement, PaintingCapableElement

public class InfantrySquad
extends GameElement
implements MovementCapableElement, PaintingCapableElement, FiringCapableElement, ConcealableElement

See Also:
Serialized Form

Nested Class Summary
static class InfantrySquad.SquadType
           
 
Nested classes/interfaces inherited from class rl.common.game.elements.GameElement
GameElement.StatusPhase
 
Field Summary
(package private) static long serialVersionUID
           
 
Constructor Summary
InfantrySquad()
           
InfantrySquad(InfantrySquad.SquadType squadType)
           
InfantrySquad(java.lang.String typeName)
           
 
Method Summary
 void addCasualties(int turn, int casualties)
           
 void addDamageListener(InfantrySquadDamageListener l)
           
 void addFiringListener(InfantrySquadFiringListener l)
           
 void addMovementListener(InfantrySquadMovementListener l)
           
 void addPaintingListener(InfantrySquadPaintingListener l)
           
 void addReinforcements(int turn, int troops, InfantrySquad.SquadType troopType)
           
 void applyDamageSummary(GameElementDamageSummary geds)
           
 void applyFiringSummary(GameElementFiringSummary gefs)
          function called to apply firing summary to element.
 void applyMovementSummary(GameElementMovementSummary gems)
          applies the summary of movement to the element.
 void applyPaintingSummary(GameElementPaintingSummary geps)
          This routine will synch the painting summary information from the element on the server to the one on the client.
 GameElementDamageSummary calculateStatus(int turn, GameElement.StatusPhase phase)
           
 boolean canFire(int turn)
          Returns whether this unit can make a firing attempt on a particular turn
 boolean canFireIndirect(int turn)
          Returns whether this unit can make an indirect firing attempt on a particular turn
 boolean canMove(int turn)
          returns whether the element can move in a given turn
 boolean canPaint(int turn)
          Returns whether this unit can make a painting attempt on a particular turn
 void clearConcealment(int turn)
          Sets the state of the element to not concealed
 void consumeTVLG()
           
 boolean didDisembark(int turn)
          checks whether the infantry squad was disembarked this turn
 double getDamageSummary(int turn)
           
 java.lang.String getElementType()
           
 GameElementFiringSummary getFiringSummary(int turn)
          get a new GameElementFiringSummary object appropriate to the object implementing this interface
 Weapon getInfantryFireWeapon(int turn)
           
 double getInternalDamageSummary(int turn)
           
 int getMaximumPaintingRange()
          Returns the maximum range at which this element can paint a target
 int getMortars(int turn)
           
 GameElementMovementSummary getMovementSummary(int turn)
          return a new GameElementMovementSummary appropriate for the element implementing this interface
 java.lang.String getName()
           
 GameElementPaintingSummary getPaintingSummary(int turn)
          returns a new GameElementPaintingSummary appropriate to the object implementing this interface
 int getStrength(int turn)
           
 int getTurnDestroyed()
           
 int getTVLGs(int turn)
           
 InfantrySquad.SquadType getType()
           
 java.lang.String getUnitType()
           
 java.util.Vector<Weapon> getWeapons(int turn, int range, boolean targetMoved)
           
 boolean hasInternalStructure()
           
 boolean hasMoved(int turn)
          returns whether a unit has moved in a given turn
 boolean hasPainted(int turn)
          Returns whether this unit made a painting attempt on a particular turn
 boolean isConcealed(int turn)
          if the element is concealed on the turn supplied
 boolean isDestroyed(int turn)
           
 void removeDamageListener(InfantrySquadDamageListener l)
           
 void removeFiringListener(InfantrySquadFiringListener l)
           
 void removeMovementListener(InfantrySquadMovementListener l)
           
 void removePaintingListener(InfantrySquadPaintingListener l)
           
 void setConcealed(int turn)
          Sets this element into a concealed state
 void setDisembarked(int turn)
          Notify that the infantry squad disembarked this turn
 void setMadePaintingAttempt(int turn)
          Sets that this unit has made a painting attempt on this turn
 void setMoved(int turn)
          sets the status of an element that has moved in a given turn
 java.lang.String toString()
           
 void weaponFired(java.lang.String weaponName, java.lang.String ammoType, int weaponIndex)
          This is called when an element fires a weapon
 
Methods inherited from class rl.common.game.elements.GameElement
equals, getID, getIdentifier, getUnit, hashCode, setUnit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

InfantrySquad

public InfantrySquad()

InfantrySquad

public InfantrySquad(InfantrySquad.SquadType squadType)

InfantrySquad

public InfantrySquad(java.lang.String typeName)
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class GameElement

getTurnDestroyed

public int getTurnDestroyed()

isDestroyed

public boolean isDestroyed(int turn)
Specified by:
isDestroyed in class GameElement

addMovementListener

public void addMovementListener(InfantrySquadMovementListener l)

removeMovementListener

public void removeMovementListener(InfantrySquadMovementListener l)

addPaintingListener

public void addPaintingListener(InfantrySquadPaintingListener l)

removePaintingListener

public void removePaintingListener(InfantrySquadPaintingListener l)

addFiringListener

public void addFiringListener(InfantrySquadFiringListener l)

removeFiringListener

public void removeFiringListener(InfantrySquadFiringListener l)

addDamageListener

public void addDamageListener(InfantrySquadDamageListener l)

removeDamageListener

public void removeDamageListener(InfantrySquadDamageListener l)

getType

public InfantrySquad.SquadType getType()

getStrength

public int getStrength(int turn)

getMortars

public int getMortars(int turn)

getTVLGs

public int getTVLGs(int turn)

consumeTVLG

public void consumeTVLG()

addCasualties

public void addCasualties(int turn,
                          int casualties)

addReinforcements

public void addReinforcements(int turn,
                              int troops,
                              InfantrySquad.SquadType troopType)

getUnitType

public java.lang.String getUnitType()

toString

public java.lang.String toString()
Overrides:
toString in class GameElement

getElementType

public java.lang.String getElementType()
Specified by:
getElementType in class GameElement

getInfantryFireWeapon

public Weapon getInfantryFireWeapon(int turn)

calculateStatus

public GameElementDamageSummary calculateStatus(int turn,
                                                GameElement.StatusPhase phase)
Specified by:
calculateStatus in class GameElement

applyDamageSummary

public void applyDamageSummary(GameElementDamageSummary geds)
Specified by:
applyDamageSummary in class GameElement

hasInternalStructure

public boolean hasInternalStructure()
Specified by:
hasInternalStructure in class GameElement

getDamageSummary

public double getDamageSummary(int turn)
Specified by:
getDamageSummary in class GameElement

getInternalDamageSummary

public double getInternalDamageSummary(int turn)
Specified by:
getInternalDamageSummary in class GameElement

canMove

public boolean canMove(int turn)
Description copied from interface: MovementCapableElement
returns whether the element can move in a given turn

Specified by:
canMove in interface MovementCapableElement
Returns:
whether the element is capable of being moved on the turn supplied

hasMoved

public boolean hasMoved(int turn)
Description copied from interface: MovementCapableElement
returns whether a unit has moved in a given turn

Specified by:
hasMoved in interface MovementCapableElement
Returns:
if the element has moved on the turn supplied

setMoved

public void setMoved(int turn)
Description copied from interface: MovementCapableElement
sets the status of an element that has moved in a given turn

Specified by:
setMoved in interface MovementCapableElement

getMovementSummary

public GameElementMovementSummary getMovementSummary(int turn)
Description copied from interface: MovementCapableElement
return a new GameElementMovementSummary appropriate for the element implementing this interface

Specified by:
getMovementSummary in interface MovementCapableElement

applyMovementSummary

public void applyMovementSummary(GameElementMovementSummary gems)
Description copied from interface: MovementCapableElement
applies the summary of movement to the element. This is to provide a synch between the element on the server and the one on the client.

Specified by:
applyMovementSummary in interface MovementCapableElement

canPaint

public boolean canPaint(int turn)
Description copied from interface: PaintingCapableElement
Returns whether this unit can make a painting attempt on a particular turn

Specified by:
canPaint in interface PaintingCapableElement
Returns:
whether this unit can paint on the turn supplied

hasPainted

public boolean hasPainted(int turn)
Description copied from interface: PaintingCapableElement
Returns whether this unit made a painting attempt on a particular turn

Specified by:
hasPainted in interface PaintingCapableElement
Returns:
whether this unit has painted on the turn supplied

setMadePaintingAttempt

public void setMadePaintingAttempt(int turn)
Description copied from interface: PaintingCapableElement
Sets that this unit has made a painting attempt on this turn

Specified by:
setMadePaintingAttempt in interface PaintingCapableElement

getMaximumPaintingRange

public int getMaximumPaintingRange()
Description copied from interface: PaintingCapableElement
Returns the maximum range at which this element can paint a target

Specified by:
getMaximumPaintingRange in interface PaintingCapableElement
Returns:
the maximum range that this unit can perform painting at

getPaintingSummary

public GameElementPaintingSummary getPaintingSummary(int turn)
Description copied from interface: PaintingCapableElement
returns a new GameElementPaintingSummary appropriate to the object implementing this interface

Specified by:
getPaintingSummary in interface PaintingCapableElement
Returns:
the painting summary for the element on the turn supplied

applyPaintingSummary

public void applyPaintingSummary(GameElementPaintingSummary geps)
Description copied from interface: PaintingCapableElement
This routine will synch the painting summary information from the element on the server to the one on the client.

Specified by:
applyPaintingSummary in interface PaintingCapableElement

canFire

public boolean canFire(int turn)
Description copied from interface: FiringCapableElement
Returns whether this unit can make a firing attempt on a particular turn

Specified by:
canFire in interface FiringCapableElement
Parameters:
turn - The turn that we're checking the element can fire
Returns:
If the element can fire on the turn supplied

canFireIndirect

public boolean canFireIndirect(int turn)
Description copied from interface: FiringCapableElement
Returns whether this unit can make an indirect firing attempt on a particular turn

Specified by:
canFireIndirect in interface FiringCapableElement
Parameters:
turn - The turn that we're checking the element can fire indirectly
Returns:
If the element can fire indirectly on the turn supplied

getFiringSummary

public GameElementFiringSummary getFiringSummary(int turn)
Description copied from interface: FiringCapableElement
get a new GameElementFiringSummary object appropriate to the object implementing this interface

Specified by:
getFiringSummary in interface FiringCapableElement
Returns:
A GameElementFiringSummary object containing all of the information for all of the outgoing fire from this element

applyFiringSummary

public void applyFiringSummary(GameElementFiringSummary gefs)
Description copied from interface: FiringCapableElement
function called to apply firing summary to element. This is used as a synch between the element on the server and one on the client.

Specified by:
applyFiringSummary in interface FiringCapableElement
Parameters:
gefs - Applies all of the firing information contained in the GameElementFiringSummary. This is primarily used to capture ammunition expenditure

weaponFired

public void weaponFired(java.lang.String weaponName,
                        java.lang.String ammoType,
                        int weaponIndex)
Description copied from interface: FiringCapableElement
This is called when an element fires a weapon

Specified by:
weaponFired in interface FiringCapableElement
Parameters:
weaponName - The name of the weapon system firing
ammoType - The ammo type used in the firing attempt
weaponIndex - The index of the weapon system firing

getWeapons

public java.util.Vector<Weapon> getWeapons(int turn,
                                           int range,
                                           boolean targetMoved)

isConcealed

public boolean isConcealed(int turn)
Description copied from interface: ConcealableElement
if the element is concealed on the turn supplied

Specified by:
isConcealed in interface ConcealableElement
Parameters:
turn - the turn used to check concealment
Returns:
whether the element is concealed

setConcealed

public void setConcealed(int turn)
Description copied from interface: ConcealableElement
Sets this element into a concealed state

Specified by:
setConcealed in interface ConcealableElement
Parameters:
turn - the turn which the element is concealed

clearConcealment

public void clearConcealment(int turn)
Description copied from interface: ConcealableElement
Sets the state of the element to not concealed

Specified by:
clearConcealment in interface ConcealableElement
Parameters:
turn - the turn that the concealment is lifted

setDisembarked

public void setDisembarked(int turn)
Notify that the infantry squad disembarked this turn

Parameters:
turn - the turn of dismbarkation

didDisembark

public boolean didDisembark(int turn)
checks whether the infantry squad was disembarked this turn

Parameters:
turn - the turn in question
Returns:
whether the infantry squad was disembarked this turn