rl.common.game.elements
Class Vehicle

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

public class Vehicle
extends GameElement
implements MovementCapableElement, PaintingCapableElement, FiringCapableElement, PaintableElement

See Also:
Serialized Form

Nested Class Summary
static class Vehicle.Compartment
           
static class Vehicle.CrewStatus
           
 class Vehicle.DamagedSystem
          This class captures the information around a damaged internal system
 class Vehicle.EquipmentMountStatus
          This class captures the information about an equipment mount
 class Vehicle.MultiBlockSystemStatus
          This class captures the information about a system that has more than one internal block and the statuses of those blocks
static class Vehicle.Side
           
 
Nested classes/interfaces inherited from class rl.common.game.elements.GameElement
GameElement.StatusPhase
 
Field Summary
(package private) static long serialVersionUID
           
 
Constructor Summary
Vehicle(VehicleDesign design, VehicleInternalStructureTemplate internalStructureTemplate)
           
 
Method Summary
 void addDamageListener(VehicleDamageListener Listener)
           
 void addFiringListener(VehicleFiringListener Listener)
           
 void addMovementListener(VehicleMovementListener Listener)
           
 void addPaintingListener(VehiclePaintingListener Listener)
           
 void applyCrashDamage(int damage, int turn)
           
 void applyDamageSummary(GameElementDamageSummary geds)
           
 void applyFiringSummary(GameElementFiringSummary gefs)
          function called to apply firing summary to element.
 void applyGroundingDamage(int damage, int turn)
           
 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.
 void applyWeaponDamage(int turn, WeaponDamageTemplate wdt, Vehicle.Side side, int column)
           
 GameElementDamageSummary calculateStatus(int turn, GameElement.StatusPhase phase)
           
 boolean canCallArtillery()
           
 boolean canFire(int turn)
          Returns whether this unit can make a firing attempt on a particular turn
 boolean canFireDiggingCannon()
           
 boolean canFireHull1Weapons()
           
 boolean canFireHull2Weapons()
           
 boolean canFireIndirect(int turn)
          Returns whether this unit can make an indirect firing attempt on a particular turn
 boolean canFireTurretWeapons()
           
 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
 boolean canTurnLeft()
           
 boolean canTurnRight()
           
 boolean canUseOtherPainting()
           
 boolean destroyedByExplosion()
           
 java.util.Vector<EquipmentMount> getAllHullWeapons(int turn, int range)
           
 java.util.Vector<EquipmentMount> getAllWeapons(int turn, int range)
           
 VehicleArmour getArmour()
           
 Vehicle.CrewStatus getCommanderStatus()
           
 int getDamageGunneryModifier()
           
 double getDamageSummary(int turn)
           
 VehicleDesign getDesign()
           
 Vehicle.CrewStatus getDriverStatus()
           
 java.lang.String getElementType()
           
 java.util.Vector<Vehicle.EquipmentMountStatus> getEquipmentMountStatuses()
           
 GameElementFiringSummary getFiringSummary(int turn)
          get a new GameElementFiringSummary object appropriate to the object implementing this interface
 Vehicle.CrewStatus getGunnerStatus()
           
 java.util.Vector<EquipmentMount> getHull1Weapons(int turn, int range)
           
 java.util.Vector<EquipmentMount> getHull2Weapons(int turn, int range)
           
 java.util.Vector<EquipmentMount> getIndirectWeapons(EquipmentMount.EquipmentLocation location, int turn, int range)
           
 int getInfantryCompartmentCellsDestroyed(int turn)
           
 double getInternalDamageSummary(int turn)
           
 VehicleInternalStructure getInternalStructure()
           
 int getMaximumPaintingRange()
          Returns the maximum range at which this element can paint a target
 int getMaximumWeaponRange(java.util.Vector<EquipmentMount> weapons)
           
 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
 java.util.Vector<EquipmentMount> getPointDefenceWeapons(int turn)
           
 int getShieldModifier(Vehicle.Side side)
           
 int getShieldModifier(VehicleSystem vehicleSystem, Vehicle.Side vehicleSide)
           
 int getThrust()
           
 java.util.Vector<EquipmentMount> getTurretWeapons(int turn, int range)
           
 java.lang.String getUnitType()
           
 EquipmentMount getWeaponMountByIndex(int index)
           
 java.util.Vector<EquipmentMount> getWeapons(EquipmentMount.EquipmentLocation location, int turn, int range)
           
 void handleGeneralSystemDamaged(int gameTurn, VehicleSystem system)
           
 void handleShieldSystemDamaged(int gameTurn, VehicleSystem system, Vehicle.Side side, int blockIndex)
           
 void handleTSRSystemDamaged(int gameTurn, int blockIndex)
           
 boolean hasGravDriveFailed(int turn)
           
 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 isDestroyed(int turn)
           
 boolean isGravElement()
           
 boolean isInfantryCompartmentDestroyed(int turn)
           
 boolean isTSROk()
           
 void processDamagedArmourAndInternal()
           
 void removeDamageListener(VehicleDamageListener Listener)
           
 void removeFiringListener(VehicleFiringListener Listener)
           
 void removeMovementListener(VehicleMovementListener Listener)
           
 void removePaintingListener(VehiclePaintingListener Listener)
           
 void setCrashed(int turn)
          Called when the vehicle has exceeded the speed limit and failed the piloting check
 void setGrounded(int turn)
          Called when the vehicle is grounded either voluntarily or involuntarily
 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
 void systemDamaged(VehicleSystem system, int gameTurn, int blockIndex)
           
 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
 void widowArmour()
           
 
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

Vehicle

public Vehicle(VehicleDesign design,
               VehicleInternalStructureTemplate internalStructureTemplate)
Method Detail

getName

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

isGravElement

public boolean isGravElement()

getDesign

public VehicleDesign getDesign()

getUnitType

public java.lang.String getUnitType()

addMovementListener

public void addMovementListener(VehicleMovementListener Listener)

removeMovementListener

public void removeMovementListener(VehicleMovementListener Listener)

addPaintingListener

public void addPaintingListener(VehiclePaintingListener Listener)

removePaintingListener

public void removePaintingListener(VehiclePaintingListener Listener)

addFiringListener

public void addFiringListener(VehicleFiringListener Listener)

removeFiringListener

public void removeFiringListener(VehicleFiringListener Listener)

addDamageListener

public void addDamageListener(VehicleDamageListener Listener)

removeDamageListener

public void removeDamageListener(VehicleDamageListener Listener)

toString

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

getElementType

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

getInternalStructure

public final VehicleInternalStructure getInternalStructure()

getArmour

public final VehicleArmour getArmour()

isDestroyed

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

hasGravDriveFailed

public boolean hasGravDriveFailed(int turn)

getThrust

public int getThrust()

canTurnLeft

public boolean canTurnLeft()

canTurnRight

public boolean canTurnRight()

canCallArtillery

public boolean canCallArtillery()

getDamageGunneryModifier

public int getDamageGunneryModifier()

getShieldModifier

public int getShieldModifier(Vehicle.Side side)

canFireTurretWeapons

public boolean canFireTurretWeapons()

canFireHull1Weapons

public boolean canFireHull1Weapons()

canFireHull2Weapons

public boolean canFireHull2Weapons()

canUseOtherPainting

public boolean canUseOtherPainting()

isTSROk

public boolean isTSROk()

canFireDiggingCannon

public boolean canFireDiggingCannon()

getCommanderStatus

public Vehicle.CrewStatus getCommanderStatus()

getDriverStatus

public Vehicle.CrewStatus getDriverStatus()

getGunnerStatus

public Vehicle.CrewStatus getGunnerStatus()

destroyedByExplosion

public boolean destroyedByExplosion()

getAllWeapons

public java.util.Vector<EquipmentMount> getAllWeapons(int turn,
                                                      int range)

getTurretWeapons

public java.util.Vector<EquipmentMount> getTurretWeapons(int turn,
                                                         int range)

getAllHullWeapons

public java.util.Vector<EquipmentMount> getAllHullWeapons(int turn,
                                                          int range)

getHull1Weapons

public java.util.Vector<EquipmentMount> getHull1Weapons(int turn,
                                                        int range)

getHull2Weapons

public java.util.Vector<EquipmentMount> getHull2Weapons(int turn,
                                                        int range)

getWeapons

public java.util.Vector<EquipmentMount> getWeapons(EquipmentMount.EquipmentLocation location,
                                                   int turn,
                                                   int range)

getIndirectWeapons

public java.util.Vector<EquipmentMount> getIndirectWeapons(EquipmentMount.EquipmentLocation location,
                                                           int turn,
                                                           int range)

getPointDefenceWeapons

public java.util.Vector<EquipmentMount> getPointDefenceWeapons(int turn)

getMaximumWeaponRange

public int getMaximumWeaponRange(java.util.Vector<EquipmentMount> weapons)

getWeaponMountByIndex

public EquipmentMount getWeaponMountByIndex(int index)

calculateStatus

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

getShieldModifier

public int getShieldModifier(VehicleSystem vehicleSystem,
                             Vehicle.Side vehicleSide)

systemDamaged

public void systemDamaged(VehicleSystem system,
                          int gameTurn,
                          int blockIndex)

handleGeneralSystemDamaged

public void handleGeneralSystemDamaged(int gameTurn,
                                       VehicleSystem system)

handleShieldSystemDamaged

public void handleShieldSystemDamaged(int gameTurn,
                                      VehicleSystem system,
                                      Vehicle.Side side,
                                      int blockIndex)

handleTSRSystemDamaged

public void handleTSRSystemDamaged(int gameTurn,
                                   int blockIndex)

getEquipmentMountStatuses

public java.util.Vector<Vehicle.EquipmentMountStatus> getEquipmentMountStatuses()

applyWeaponDamage

public void applyWeaponDamage(int turn,
                              WeaponDamageTemplate wdt,
                              Vehicle.Side side,
                              int column)

applyCrashDamage

public void applyCrashDamage(int damage,
                             int turn)

applyGroundingDamage

public void applyGroundingDamage(int damage,
                                 int turn)

processDamagedArmourAndInternal

public void processDamagedArmourAndInternal()

widowArmour

public void widowArmour()

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

setCrashed

public void setCrashed(int turn)
Called when the vehicle has exceeded the speed limit and failed the piloting check

Parameters:
turn -

setGrounded

public void setGrounded(int turn)
Called when the vehicle is grounded either voluntarily or involuntarily

Parameters:
turn -

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

isInfantryCompartmentDestroyed

public boolean isInfantryCompartmentDestroyed(int turn)

getInfantryCompartmentCellsDestroyed

public int getInfantryCompartmentCellsDestroyed(int turn)