gecco.game.dke
Class WarUnit

java.lang.Object
  extended bygecco.server.core.Unit
      extended bygecco.game.dke.WarUnit
All Implemented Interfaces:
Comparable, ReplayReady
Direct Known Subclasses:
BlueWarUnit, RedWarUnit

public abstract class WarUnit
extends Unit
implements ReplayReady


Field Summary
 boolean attackInitiated
           
 int DECREASE_HEALTH
           
 int SET_ADVANCING
           
 int SET_ATTACKING
           
 int SET_DISTURNED
           
 int SET_FIRING_INDIRECT
           
 int SET_MARCHING
           
 int SET_POSITION
           
 int SET_RELOADING
           
 int SET_UNDER_ATTACK
           
 int SET_UNDER_INDIRECT_FIRE
           
 boolean underAttackInitiated
           
 int UPDATE_STATUS
           
 
Fields inherited from class gecco.server.core.Unit
activeAction, blockedActions, commander, handle, intX, intY, isDestroyed, name, observers, properties, type, unitType, updatedActions, updatedProperties, x, y
 
Fields inherited from interface gecco.server.replaymanager.ReplayReady
UNIT
 
Constructor Summary
WarUnit()
           
 
Method Summary
 void advanceAfterCombat(double enemyX, double enemyY)
           
 boolean attack(WarUnit target)
          Starts an attack on target.
 boolean cantMoveTo(int automatonState)
           
 void combatEnded()
           
 void combatEnded(int result, double enemyX, double enemyY)
           
 void combatResult(int result, double enemyX, double enemyY)
           
 int decreaseAttackFactor(int n)
           
 int decreaseDefenceFactor(int n)
           
 int decreaseHealth(int n)
           
 int decreaseIndirectFireFactor(int n)
           
 int getAttackFactor()
           
 boolean getAttacking()
           
 int getAttackValue()
           
 int getDefenceFactor()
           
 int getDefenceValue()
           
 int getForce()
           
 int getHealth()
           
 WarUnit getInCombatWhith()
           
 int getIndirectFireDispersion()
           
 double getIndirectFireExtendTime()
           
 int getIndirectFireFactor()
           
 double getReloadExtendTime()
           
 WarUnit getSupports()
           
 boolean getUnderAttack()
           
 WarUnit initUnderAttack(WarUnit attacker)
           
 boolean isAdvancing()
           
 boolean isAttacking()
           
 boolean isDisturbed()
           
 boolean isFiringIndirect()
           
 boolean isInCombat()
           
 boolean isMarching()
           
 boolean isOutsideMap(double x, double y)
           
 boolean isReloading()
           
 boolean isUnderAttack()
           
 boolean isUnderIndirectFire()
           
 void joinForCombat(WarUnit brotherInArms)
           
 void markAsDestroyed()
          Mark the unit as destroyed.
 void playReplayData(int method, Object[] parameters)
           
 void printWriteMe(PrintWriter out)
           
 void releaseFiringIndirect()
           
 void resetCombatants()
           
 void resetDisturbed(int actionHandle)
           
 void retreatAfterCombat(double enemyX, double enemyY)
           
 void saveReplayData(int method, Object[] parameters)
           
 void setAdvancing(boolean b)
           
 void setAttackFactor(int n)
           
 void setAttacking(boolean b)
           
 void setDefenceFactor(int n)
           
 void setDisturbed(boolean b)
           
 void setFiringIndirect(boolean b)
           
 void setForce(int force)
           
 void setHealth(int n)
           
 void setInCombatWhith(WarUnit u)
           
 void setIndirectFireFactor(int n)
           
 void setMarching(boolean b)
           
 void setPosition(double x, double y)
          Sets the Position attribute of the Unit object
 void setPosition(double x, double y, boolean autoAttack)
           
 void setReloading(boolean b)
           
 void setSupports(WarUnit wU)
           
 void setUnderAttack(boolean b)
           
 void setUnderIndirectFire(boolean b)
           
 String toString()
           
 void underIndirectFire(int factor)
           
 void underIndirectFireCompleted()
          Calculates the effect of indirect fire
 void updateStatus()
           
 
Methods inherited from class gecco.server.core.Unit
abortAllActions, addBlockedAction, addObserver, canSeeAutomatonAtPosition, compareTo, equals, getActiveAction, getBlockedActions, getCommander, getDoubleProperty, getHandle, getIntProperty, getIntX, getIntY, getName, getObservers, getProperties, getProperty, getPropertyType, getStringProperty, getUnitType, getUpdatedActions, getUpdatedProperties, getX, getY, hashCode, isDestroyed, isObserver, removeBlockedAction, removeObserver, resetUpdatedActions, resetUpdatedProperties, sendUnitMessage, setActiveAction, setCommander, setHandle, setName, setProperty, setProperty, setProperty, setUnitType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

underAttackInitiated

public boolean underAttackInitiated

attackInitiated

public boolean attackInitiated

SET_POSITION

public final int SET_POSITION
See Also:
Constant Field Values

DECREASE_HEALTH

public final int DECREASE_HEALTH
See Also:
Constant Field Values

SET_FIRING_INDIRECT

public final int SET_FIRING_INDIRECT
See Also:
Constant Field Values

SET_UNDER_INDIRECT_FIRE

public final int SET_UNDER_INDIRECT_FIRE
See Also:
Constant Field Values

SET_DISTURNED

public final int SET_DISTURNED
See Also:
Constant Field Values

SET_MARCHING

public final int SET_MARCHING
See Also:
Constant Field Values

SET_ADVANCING

public final int SET_ADVANCING
See Also:
Constant Field Values

SET_RELOADING

public final int SET_RELOADING
See Also:
Constant Field Values

UPDATE_STATUS

public final int UPDATE_STATUS
See Also:
Constant Field Values

SET_ATTACKING

public final int SET_ATTACKING
See Also:
Constant Field Values

SET_UNDER_ATTACK

public final int SET_UNDER_ATTACK
See Also:
Constant Field Values
Constructor Detail

WarUnit

public WarUnit()
Method Detail

markAsDestroyed

public void markAsDestroyed()
Description copied from class: Unit
Mark the unit as destroyed.

Overrides:
markAsDestroyed in class Unit

setPosition

public void setPosition(double x,
                        double y)
Description copied from class: Unit
Sets the Position attribute of the Unit object

Overrides:
setPosition in class Unit
Parameters:
x - The x coordinate of the new position
y - The y coordinate of the new position

setPosition

public void setPosition(double x,
                        double y,
                        boolean autoAttack)

setAttacking

public void setAttacking(boolean b)

setUnderAttack

public void setUnderAttack(boolean b)

getAttacking

public boolean getAttacking()

getUnderAttack

public boolean getUnderAttack()

setSupports

public void setSupports(WarUnit wU)

getSupports

public WarUnit getSupports()

attack

public boolean attack(WarUnit target)
Starts an attack on target. if target is allready in combat, that combat is joined. Returns true if there wasn't another combat going on.

Parameters:
target - a WarUnit value
Returns:
a boolean value

initUnderAttack

public WarUnit initUnderAttack(WarUnit attacker)

joinForCombat

public void joinForCombat(WarUnit brotherInArms)

combatEnded

public void combatEnded()

combatEnded

public void combatEnded(int result,
                        double enemyX,
                        double enemyY)

combatResult

public void combatResult(int result,
                         double enemyX,
                         double enemyY)

retreatAfterCombat

public void retreatAfterCombat(double enemyX,
                               double enemyY)

isOutsideMap

public boolean isOutsideMap(double x,
                            double y)

advanceAfterCombat

public void advanceAfterCombat(double enemyX,
                               double enemyY)

getAttackValue

public int getAttackValue()

getDefenceValue

public int getDefenceValue()

resetCombatants

public void resetCombatants()

isInCombat

public boolean isInCombat()

getInCombatWhith

public WarUnit getInCombatWhith()

setInCombatWhith

public void setInCombatWhith(WarUnit u)

getAttackFactor

public int getAttackFactor()

setAttackFactor

public void setAttackFactor(int n)

decreaseAttackFactor

public int decreaseAttackFactor(int n)

getDefenceFactor

public int getDefenceFactor()

setDefenceFactor

public void setDefenceFactor(int n)

decreaseDefenceFactor

public int decreaseDefenceFactor(int n)

getIndirectFireFactor

public int getIndirectFireFactor()

setIndirectFireFactor

public void setIndirectFireFactor(int n)

decreaseIndirectFireFactor

public int decreaseIndirectFireFactor(int n)

releaseFiringIndirect

public void releaseFiringIndirect()

getHealth

public int getHealth()

setHealth

public void setHealth(int n)

decreaseHealth

public int decreaseHealth(int n)

setFiringIndirect

public void setFiringIndirect(boolean b)

setUnderIndirectFire

public void setUnderIndirectFire(boolean b)

setDisturbed

public void setDisturbed(boolean b)

setMarching

public void setMarching(boolean b)

setAdvancing

public void setAdvancing(boolean b)

setReloading

public void setReloading(boolean b)

isDisturbed

public boolean isDisturbed()

isMarching

public boolean isMarching()

isAdvancing

public boolean isAdvancing()

isUnderIndirectFire

public boolean isUnderIndirectFire()

isFiringIndirect

public boolean isFiringIndirect()

isAttacking

public boolean isAttacking()

isUnderAttack

public boolean isUnderAttack()

isReloading

public boolean isReloading()

updateStatus

public void updateStatus()

getForce

public int getForce()

setForce

public void setForce(int force)

getReloadExtendTime

public double getReloadExtendTime()

getIndirectFireExtendTime

public double getIndirectFireExtendTime()

getIndirectFireDispersion

public int getIndirectFireDispersion()

underIndirectFire

public void underIndirectFire(int factor)

underIndirectFireCompleted

public void underIndirectFireCompleted()
Calculates the effect of indirect fire


resetDisturbed

public void resetDisturbed(int actionHandle)

cantMoveTo

public boolean cantMoveTo(int automatonState)

toString

public String toString()
Overrides:
toString in class Unit
Returns:
description of instance

printWriteMe

public void printWriteMe(PrintWriter out)
Overrides:
printWriteMe in class Unit

saveReplayData

public void saveReplayData(int method,
                           Object[] parameters)
Specified by:
saveReplayData in interface ReplayReady

playReplayData

public void playReplayData(int method,
                           Object[] parameters)
Specified by:
playReplayData in interface ReplayReady
Parameters:
method - the method that should be called
parameters - an Object[] containing the parameters for the method