org.globalse.arena.sword.engine
Class Weapon

java.lang.Object
  |
  +--org.globalse.arena.frag.objects.FRAGObject
        |
        +--org.globalse.arena.sword.engine.Item
              |
              +--org.globalse.arena.sword.engine.Weapon

public class Weapon
extends Item

A Weapon is an Item, used by adventurers that can cause harm on other adventurers.

See Also:
FRAGObject, Sword, Serialized Form

Fields inherited from class org.globalse.arena.sword.engine.Item
weight
 
Fields inherited from class org.globalse.arena.frag.objects.FRAGObject
controller, gameName, influenceRange, objectName, owner, position, visibilityRange
 
Constructor Summary
Weapon()
           
 
Method Summary
 void actionEvent(ObjectActionEvent event)
          Handles all incoming ObjectActionEvents.
 double getDamage()
          Returns the amount of damage the weapon can cause on the target.
 double getRange()
          Returns the range of inflection of the weapon.
 void init(java.lang.String gameName, java.lang.String objectName, double weight, java.lang.String type, double damage, double range)
          Initializes a Weapon with the given properties.
 void init(java.lang.String gameName, java.lang.String objectName, java.lang.String type)
          Creates new Weapon of the specified type and initializes it with the default properties.
 boolean isItemUsableBy(java.lang.String owner)
          Checks if this weapon is currently owned by someone
 boolean useWith(java.lang.String target)
          Called when the Weapon is used with some target (usually an Adventurer)
 
Methods inherited from class org.globalse.arena.sword.engine.Item
checkCollision, draw, getCollisionSphere, getDescription, getDimensions, getImage, getObjectName, getType, getVisible, init, setVisible
 
Methods inherited from class org.globalse.arena.frag.objects.FRAGObject
checkAndResetMark, checkMark, clone, controlAcquired, controlLost, getGameManager, getInfluenceRange, getObjectManager, getPosition, killed, mark, newerVersion, setInfluenceRange, setPosition
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Weapon

public Weapon()
Method Detail

init

public void init(java.lang.String gameName,
                 java.lang.String objectName,
                 java.lang.String type)
Creates new Weapon of the specified type and initializes it with the default properties.
Parameters:
type - a String that denotes the kind of weapon (bow or long sword)

init

public void init(java.lang.String gameName,
                 java.lang.String objectName,
                 double weight,
                 java.lang.String type,
                 double damage,
                 double range)
Initializes a Weapon with the given properties.
Parameters:
weight - the weight (in kg) of the item
type - a String that denotes the kind of weapon (bow or long sword)
damage - the damage of the Weapon
range - the range of the weapon

getDamage

public double getDamage()
Returns the amount of damage the weapon can cause on the target.
Returns:
the damage of the Weapon

getRange

public double getRange()
Returns the range of inflection of the weapon.
Returns:
the range of the Weapon

useWith

public boolean useWith(java.lang.String target)
Called when the Weapon is used with some target (usually an Adventurer)
Parameters:
target - the target on which the weapon is to be used
Returns:
true if this Weapon could be used on the target
Overrides:
useWith in class Item

isItemUsableBy

public boolean isItemUsableBy(java.lang.String owner)
Checks if this weapon is currently owned by someone
Parameters:
owner - the "suspected" owner of this weapon
Returns:
true if this item has an owner
Overrides:
isItemUsableBy in class Item

actionEvent

public void actionEvent(ObjectActionEvent event)
Handles all incoming ObjectActionEvents. Events for which Weapon does not have special behaviour are passed on to the superclass Item.
Parameters:
event - the event, that took place
Overrides:
actionEvent in class Item
See Also:
Item, ObjectActionEvent



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)