nl.tudelft.pogamut.unreal.agent.module.shooting
Class WeaponryShooting

Package class diagram package WeaponryShooting
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
      extended by cz.cuni.amis.pogamut.base.agent.module.SensorModule<UT2004Bot>
          extended by nl.tudelft.pogamut.unreal.agent.module.shooting.WeaponryShooting
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.component.IComponent

public class WeaponryShooting
extends cz.cuni.amis.pogamut.base.agent.module.SensorModule<UT2004Bot>

Module that handles shooting other players in an intelligent manner.

Will utilize WeaponPrefs to determine which weapon to use for the target its WeaponShooting modules to effectively use the weapon.

The targets for shooting can be set on the logic thread, but the actual shooting is evaluated by listening to the EndMessage.

This module obeys the restrictions set by ImprovedShooting.setChangeWeaponCooldown(long) and uses WeaponPrefs.getWeaponPreference(ILocated) to determine which weapon to use.

The UT2004Navigation.setFocus(ILocated) is used to indicate where the bot wants to look. It should be honored for best results.

Author:
mpkorstanje

Field Summary
protected  cz.cuni.amis.pogamut.base3d.worldview.object.ILocated currentTarget
          Current target.
protected  WeaponPref currentWeaponPref
          Current weapon pref to use.
protected  WeaponShooting currentWeaponShooting
          Currently active shooting.
protected  FocusProvider focus
          Focus provider, use to set where you want to look.
protected  AgentInfo info
          Info about the agent.
protected  cz.cuni.amis.pogamut.base3d.worldview.object.ILocated lastTarget
          Previous target.
protected  WeaponPref lastWeaponPref
          Weapon pref used in the previous evaluation of shoot().
protected  WeaponShooting lastWeaponShooting
          Shooting active in the previous evaluation of shoot().
protected  ImprovedShooting shoot
          Reference to shooting module to shoot stuff.
protected  WeaponPrefs weaponPrefs
          Reference to WeaponPrefs
protected  Weaponry weaponry
          Reference to all the weapons we have.
protected  Map<ItemType,WeaponShooting> weaponShootings
          Map of weapon shooting and associated weapons.
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensorModule
worldView
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
agent, controller, eventBus, log
 
Constructor Summary
WeaponryShooting(UT2004Bot bot, AgentInfo info, Weaponry weaponry, WeaponPrefs weaponPrefs, ImprovedShooting shoot)
          Creates a new WeaponryShooting module.
 
Method Summary
 WeaponShooting addWeaponShooting(WeaponShooting weaponShooting)
          Adds a new WeaponShooting.
 cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getFocus()
           
 cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getLastTarget()
           
 cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getTarget()
           
 WeaponPref getWeaponPref()
           
 WeaponShooting getWeaponShooting()
           
 WeaponShooting removeWeaponShooting(ItemType weapon)
          Removes the WeaponShooting for the given weapon.
 void shoot(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated target)
          Sets the target to be shot at.
 void stopShoot()
          Clears the target and stops the shooting.
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
cleanUp, getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentTarget

protected cz.cuni.amis.pogamut.base3d.worldview.object.ILocated currentTarget
Current target. Null if none.


currentWeaponPref

protected WeaponPref currentWeaponPref
Current weapon pref to use.


currentWeaponShooting

protected WeaponShooting currentWeaponShooting
Currently active shooting.


focus

protected FocusProvider focus
Focus provider, use to set where you want to look.


info

protected AgentInfo info
Info about the agent.


lastTarget

protected cz.cuni.amis.pogamut.base3d.worldview.object.ILocated lastTarget
Previous target.


lastWeaponPref

protected WeaponPref lastWeaponPref
Weapon pref used in the previous evaluation of shoot().


lastWeaponShooting

protected WeaponShooting lastWeaponShooting
Shooting active in the previous evaluation of shoot().


shoot

protected ImprovedShooting shoot
Reference to shooting module to shoot stuff.


weaponPrefs

protected WeaponPrefs weaponPrefs
Reference to WeaponPrefs


weaponry

protected Weaponry weaponry
Reference to all the weapons we have.


weaponShootings

protected Map<ItemType,WeaponShooting> weaponShootings
Map of weapon shooting and associated weapons.

Constructor Detail

WeaponryShooting

public WeaponryShooting(UT2004Bot bot,
                        AgentInfo info,
                        Weaponry weaponry,
                        WeaponPrefs weaponPrefs,
                        ImprovedShooting shoot)
Creates a new WeaponryShooting module.

Parameters:
bot -
info -
weaponry -
weaponPrefs -
shoot -
Method Detail

addWeaponShooting

public WeaponShooting addWeaponShooting(WeaponShooting weaponShooting)
Adds a new WeaponShooting. The module will be used as soon as the bot changes weapons to the weapon associated with the shooting.

Parameters:
weaponShooting -
Returns:
the previous WeaponShooting for the associated weapon.

removeWeaponShooting

public WeaponShooting removeWeaponShooting(ItemType weapon)
Removes the WeaponShooting for the given weapon.

Parameters:
weapon - the weapon for which the WeaponShooting should be removed.
Returns:
the removed WeaponShooting or null if none.

getFocus

public cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getFocus()
Returns:
location bot wants to look.

getLastTarget

public cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getLastTarget()
Returns:
the previous target.

getTarget

public cz.cuni.amis.pogamut.base3d.worldview.object.ILocated getTarget()
Returns:
the target

getWeaponPref

public WeaponPref getWeaponPref()
Returns:
the current weaponPref

getWeaponShooting

public WeaponShooting getWeaponShooting()
Returns:
the currently active shooting.

shoot

public void shoot(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated target)
Sets the target to be shot at. When set to null the bot will continue to charge up any weapons it has, but not actually shoot.

Parameters:
target -

stopShoot

public void stopShoot()
Clears the target and stops the shooting.



Copyright © 2014 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.