es.upv.dsic.gti_ia.jgomas
Class CFieldOps

java.lang.Object
  extended by jade.core.Agent
      extended by es.upv.dsic.gti_ia.jgomas.CJGomasAgent
          extended by es.upv.dsic.gti_ia.jgomas.CBasicTroop
              extended by es.upv.dsic.gti_ia.jgomas.CTroop
                  extended by es.upv.dsic.gti_ia.jgomas.CFieldOps
All Implemented Interfaces:
jade.core.TimerListener, java.io.Serializable, java.lang.Runnable

public class CFieldOps
extends CTroop

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jade.core.Agent
jade.core.Agent.Interrupted
 
Field Summary
protected static int m_iPacksDelivered
          inner variable used to name packs
 
Fields inherited from class es.upv.dsic.gti_ia.jgomas.CBasicTroop
ARG_TEAM, CLASS_ENGINEER, CLASS_FIELDOPS, CLASS_MEDIC, CLASS_NONE, CLASS_SOLDIER, m_AimedAgent, m_AStarPath, m_bEscaping, m_bFighting, m_bObjectiveCarried, m_ControlPoints, m_CurrentTask, m_eClass, m_eTeam, m_FOVObjects, m_iAStarPathIndex, m_iControlPointsIndex, m_iEngineersCount, m_iFieldOpsCount, m_iMedicsCount, m_iSoldiersCount, m_iTeamCount, m_Manager, m_Map, m_Movement, m_sAmmoService, m_sBackupService, m_sMedicService, m_TaskList, m_TaskPriority, m_Threshold, MV_CANNOT_GET_POSITION, MV_NOT_MOVED_BY_TIME, MV_OK, TEAM_ALLIED, TEAM_AXIS, TEAM_NONE, TRANSITION_DEFAULT, TRANSITION_TO_FIGHTING, TRANSITION_TO_GOTO_TARGET, TRANSITION_TO_STANDING, TRANSITION_TO_TARGET_REACHED
 
Fields inherited from class es.upv.dsic.gti_ia.jgomas.CJGomasAgent
m_ID, m_ServiceList
 
Fields inherited from class jade.core.Agent
AP_ACTIVE, AP_DELETED, AP_IDLE, AP_INITIATED, AP_MAX, AP_MIN, AP_SUSPENDED, AP_WAITING, D_ACTIVE, D_MAX, D_MIN, D_RETIRED, D_SUSPENDED, D_UNKNOWN
 
Constructor Summary
CFieldOps()
           
 
Method Summary
protected  boolean checkAmmoAction(java.lang.String _sContent)
          Decides if agent accepts the CFA request This method is a decision function invoked when a CALL FOR AMMO request has arrived.
protected  int CreateAmmoPack()
          Creates ammo packs if possible.
protected  void PerformTargetReached(CTask _CurrentTask)
          Action to do when this agent reaches the target of current task.
protected  void setup()
          'setup' method of jade agents.
protected  void SetUpPriorities()
          Definition of priorities for each kind of task.
 
Methods inherited from class es.upv.dsic.gti_ia.jgomas.CTroop
takeDown
 
Methods inherited from class es.upv.dsic.gti_ia.jgomas.CBasicTroop
AddServiceType, AddTask, AddTask, CallForAmmo, CallForBackup, CallForMedic, CheckStaticPosition, CheckStaticPosition, CreateControlPoints, GenerateEscapePosition, GeneratePath, GetAgentToAim, GetAmmo, GetHealth, GetPower, GetStamina, HaveAgentToShot, Look, Move, ObjectivePackTaken, PerformAimAction, PerformInjuryAction, PerformLookAction, PerformNoAmmoAction, PerformThresholdAction, Shot, ShouldUpdateTargets, UpdateTargets, UsePower, UseStamina
 
Methods inherited from class es.upv.dsic.gti_ia.jgomas.CJGomasAgent
AddService
 
Methods inherited from class jade.core.Agent
addBehaviour, afterClone, afterMove, beforeClone, beforeMove, blockingReceive, blockingReceive, blockingReceive, blockingReceive, changeStateTo, clean, doActivate, doClone, doDelete, doMove, doSuspend, doTimeOut, doWait, doWait, doWake, getAgentState, getAID, getAMS, getArguments, getContainerController, getContentManager, getCurQueueSize, getDefaultDF, getHap, getHelper, getLocalName, getName, getO2AObject, getProperty, getQueueSize, getState, here, notifyChangeBehaviourState, notifyRestarted, postMessage, putBack, putO2AObject, receive, receive, removeBehaviour, restartLater, restore, restoreBufferedState, run, send, setArguments, setEnabledO2ACommunication, setGenerateBehaviourEvents, setQueueSize, waitUntilStarted, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_iPacksDelivered

protected static int m_iPacksDelivered
inner variable used to name packs

Constructor Detail

CFieldOps

public CFieldOps()
Method Detail

setup

protected void setup()
'setup' method of jade agents. This method perform actions in common to CFieldOps agents (and derived classes) and calls parent's setup.

Overrides:
setup in class CTroop

SetUpPriorities

protected void SetUpPriorities()
Description copied from class: CBasicTroop
Definition of priorities for each kind of task. This method can be implemented in CBasicTroop's derived classes to define the task's priorities in agreement to the role of the new class. Priorities must be defined in the array m_TaskPriority. It's very useful to overload this method.

Overrides:
SetUpPriorities in class CBasicTroop

checkAmmoAction

protected boolean checkAmmoAction(java.lang.String _sContent)
Decides if agent accepts the CFA request This method is a decision function invoked when a CALL FOR AMMO request has arrived. Parameter sContent is the content of message received in CFA responder behaviour as result of a CallForAmmo request, so it must be: ( x , y , z ) ( ammo ) . By default, the return value is TRUE, so agents always accept all CFA requests. It's very useful to overload this method.

Parameters:
_sContent -
Returns:
TRUE

PerformTargetReached

protected void PerformTargetReached(CTask _CurrentTask)
Action to do when this agent reaches the target of current task. This method is called when this agent goes to state TARGET_REACHED. If current task is TASK_GIVE_AMMOPACKS, agent must give ammo packs, but in other case, it calls to parent's method. It's very useful to overload this method.

Overrides:
PerformTargetReached in class CBasicTroop
Parameters:
_CurrentTask -

CreateAmmoPack

protected final int CreateAmmoPack()
Creates ammo packs if possible. This method allows to create medic packs if there is enough power in the agent's power bar.

Returns:
iPacksDelivered: number of ammo packs created