cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric
Class Weapon

java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weapon

public class Weapon
extends java.lang.Object

Class that holds information about the weapon the bot has in its inventory.

It provides information about number of primary and secondary ammo the bot has for the weapon as well as weapon's WeaponDescriptor, its ItemType and inventory UnrealId.


Field Summary
protected  WeaponDescriptor descriptor
           
protected  UnrealId inventoryId
           
protected  int primaryAmmo
           
protected  int secondaryAmmo
           
protected  ItemType weaponType
           
 
Constructor Summary
protected Weapon(AddInventoryMsg weaponGained, int primaryAmmo, int secondaryAmmo)
           
 
Method Summary
 int getAmmo()
          Returns total ammount of ammo the bot has for the weapon (both primary and secondary).
 WeaponDescriptor getDescriptor()
          Returns complete descriptor of the weapon containing various information about the weapon behavior in game.
 ItemType.Group getGroup()
          Returns group of the weapon.
 UnrealId getInventoryId()
          Returns inventory ID of the weapon.
 int getPrimaryAmmo()
          Returns how many primary ammo the bot is wielding for this weapon.
 int getSecondaryAmmo()
          Returns how many secondary ammo the bot is wielding for this weapon.
 ItemType getType()
          Returns type of the weapon.
 boolean hasSecondaryAmmoType()
          Whether the weapon has secondary ammo different from the primary.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

weaponType

protected ItemType weaponType

primaryAmmo

protected int primaryAmmo

secondaryAmmo

protected int secondaryAmmo

inventoryId

protected UnrealId inventoryId

descriptor

protected WeaponDescriptor descriptor
Constructor Detail

Weapon

protected Weapon(AddInventoryMsg weaponGained,
                 int primaryAmmo,
                 int secondaryAmmo)
Method Detail

getType

public ItemType getType()
Returns type of the weapon.

Returns:

getGroup

public ItemType.Group getGroup()
Returns group of the weapon.

Returns:

getPrimaryAmmo

public int getPrimaryAmmo()
Returns how many primary ammo the bot is wielding for this weapon.

Returns:

getSecondaryAmmo

public int getSecondaryAmmo()
Returns how many secondary ammo the bot is wielding for this weapon.

Returns:

getInventoryId

public UnrealId getInventoryId()
Returns inventory ID of the weapon.

This id is sought to be used with ChangeWeapon command, use WorldObjectId.getStringId() to obtain the string representation of the weapon's inventory ID.

Returns:

getDescriptor

public WeaponDescriptor getDescriptor()
Returns complete descriptor of the weapon containing various information about the weapon behavior in game.


hasSecondaryAmmoType

public boolean hasSecondaryAmmoType()
Whether the weapon has secondary ammo different from the primary.

Returns:

getAmmo

public int getAmmo()
Returns total ammount of ammo the bot has for the weapon (both primary and secondary).

Returns:

toString

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