|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.globalse.arena.frag.objects.FRAGObject | +--org.globalse.arena.sword.engine.Adventurer
The Adventurer represents the player's SWORD Character.
FRAGObject
,
Sword
, Serialized Form
Fields inherited from class org.globalse.arena.frag.objects.FRAGObject |
controller,
gameName,
influenceRange,
objectName,
owner,
position,
visibilityRange |
Constructor Summary | |
Adventurer()
|
Method Summary | |
void |
actionEvent(ObjectActionEvent event)
Processes the ObjectActionEvent s that the ObjectManager
receives for this object. |
MathVector |
checkCollision(java.lang.String other,
MathVector oldPos,
MathVector delta)
Called whenever another object has changed its position to allow the current object to react. |
void |
controlAcquired()
Called whenever the current peer has acquired control over the object. |
void |
controlLost()
Called when the peer decides or is forced to release control over an object. |
void |
draw(DrawManager drawManager)
Draws the Adventurer on the map/screen, according to his current coordinates |
void |
drop(java.lang.String itemName)
Drops the selected item on the map and removes it from the adventurer's inventory. |
double |
getCollisionSphere()
Returns the collision sphere, the Adventurer has around him |
java.lang.String |
getFocusedObject()
Returns the object, that the adventurer is currently looking at |
long |
getHealth()
Returns the Adventurer's health value |
double |
getHealthMax()
Returns the Adventurer's max health value |
java.awt.Image |
getImage()
Returns the Adventurer's image, stored with all other object images in the IconLibrary |
java.util.Set |
getInventory()
Returns the Adventurer's inventory property, a Set where all items are stored |
long |
getInventoryMax()
Returns the max number of items that Adventurer may carry |
long |
getMagicPower()
Returns the Adventurer's magic power value |
long |
getMana()
Returns the Adventurer's mana value |
long |
getManaMax()
Returns the Adventurer's max mana value |
long |
getStrength()
Returns the Adventurer's strength value |
void |
increaseHealth(double value)
Increases Adventurer's health according to the specified value |
void |
increaseHealthMax(double value)
Increases Adventurer's max health according to the specified value |
void |
increaseInventoryMax(double value)
Increases Adventurer's max number of allowed inventory items according to the specified value |
void |
increaseMagicPower(double value)
Increases Adventurer's magic power according to the specified value |
void |
increaseMana(double value)
Increases Adventurer's mana according to the specified value |
void |
increaseManaMax(double value)
Increases Adventurer's max mana according to the specified value |
void |
increaseStrength(double value)
Increases Adventurer's strength according to the specified value |
void |
init(java.lang.String gameName,
java.lang.String objectName)
The constructor creates a new adventurer object with the default properties |
void |
init(java.lang.String gameName,
java.lang.String objectName,
double health,
double healthMax,
double mana,
double manaMax,
int magicPower,
int inventoryMax,
double strength,
double influenceRange,
double visibilityRange)
The constructor creates a new adventurer object, depending on the following parameters |
boolean |
isItemInInventory(java.lang.String itemName)
Checks if the asked item is contained in the inventory. |
void |
lookAt(java.lang.String object)
Gets information for the object the adventurer is looking at. |
void |
moveToPosition(MathVector pos)
Causes the adventurer to start moving towards the specified position. |
boolean |
pickUp(java.lang.String itemName)
Picks up an item for the adventurer and adds it to his/her inventory. |
void |
rotate(double speed)
Causes the adventurer to start or stop rotating. |
void |
setHealth(long value)
Sets Adventurer's health according to the specified value |
void |
setHealthMax(long value)
Sets Adventurer's max health according to the specified value |
void |
setInventoryMax(long value)
Sets max numer of items in Adventurer's inventory according to the specified value |
void |
setMagicPower(long value)
Sets Adventurer's magic power according to the specified value |
void |
setMana(long value)
Sets Adventurer's mana according to the specified value |
void |
setManaMax(long value)
Sets Adventurer's max mana according to the specified value |
void |
setStrength(long value)
Sets Adventurer's strength according to the specified value |
boolean |
useItem(java.lang.String item)
Provides a service for the adventurer to use the selected item. |
boolean |
useItemWith(java.lang.String itemName,
java.lang.String target)
Provides a service for the adventurer to use the selected item with another item or adventurer. |
void |
walk(double speed)
Causes the adventurer to start moving forward or backward, or to stop moving. |
Methods inherited from class org.globalse.arena.frag.objects.FRAGObject |
checkAndResetMark,
checkMark,
clone,
getGameManager,
getInfluenceRange,
getObjectManager,
getObjectName,
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 |
public Adventurer()
Method Detail |
public void init(java.lang.String gameName, java.lang.String objectName, double health, double healthMax, double mana, double manaMax, int magicPower, int inventoryMax, double strength, double influenceRange, double visibilityRange)
health
- adventurer's current healthhealthMax
- adventurer's curretn maximum healthmana
- adventurer's current manamanaMax
- adventurer's current maximum manamagicPower
- adventurer's current magic power ability statusinventoryMax
- max number of items allowedstrength
- adventurer's strengthpublic void init(java.lang.String gameName, java.lang.String objectName)
public void moveToPosition(MathVector pos)
pos
- the target position of the adventurerpublic void walk(double speed)
speed
- the speed of motion of the adventurer. (>0: forward, <0: backward)Math.abs(speed) <= 1
public void rotate(double speed)
speed
- the speed of rotation of the adventurer.
(>0: counterclockwise, <0: clockwise)Math.abs(speed) <= 1
public boolean pickUp(java.lang.String itemName)
itemName
- the new item that the adventurer wants to pick upfalse
if the inventory is full.(item != null) && (! inventory.contains(item))
Item
,
#inventory
public void lookAt(java.lang.String object)
object
- the object the adventurer is looking atFRAGObject
public java.lang.String getFocusedObject()
focusesObject
public void drop(java.lang.String itemName)
itemName
- the item the adventurer wants to drop downinventory.contains(itemName) = true
org.globalse.arena.frag.objects.Item
,
#inventory
public boolean useItem(java.lang.String item)
item.
useWith(self)
, i.e. the first argument is the active object and the Adventurer object
is the passive object.item
- the item the adventurer wants to usefalse
if the item couldn't be usedItem#useWith(FRAGObject object)
,
FRAGObject
public boolean useItemWith(java.lang.String itemName, java.lang.String target)
item.useWith(object)
, i.e. the first argument is
the active and the second argument is the passive object. This method checks wheter an attempt
is made to use ConsumableItem on target other than this Adventurer and returns false
in that case. It further checks if an attempt is made to use Weapon on a ConsumableItem
returns false in that case too. In both cases the status of the target remains unaffected.item
- the item the adventurer wants to useobject
- the object the adventurer selects to use the item withfalse
if the item couldn't be used with the selected objectItem#useWith(FRAGObject object)
,
FRAGObject
public void setHealth(long value)
value
- Adventurer's new health valuevalue >= 0 and value <= healthMax
public void increaseHealth(double value)
value
- Adventurer's new health value0 < = health <= healthMax
public long getHealth()
public void setHealthMax(long value)
value
- Adventurer's new max health valuevalue >= 0
public void increaseHealthMax(double value)
value
- Adventurer's new health value0 <= healthMax
public double getHealthMax()
public void setMana(long value)
value
- Adventurer's new health valuevalue >= 0 and value <= manaMax
public void increaseMana(double value)
value
- Adventurer's new mana value0 < = mana <= manaMax
public long getMana()
public void setManaMax(long value)
value
- Adventurer's new max mana valuevalue >= 0
public void increaseManaMax(double value)
value
- Adventurer's new max mana value0 < = mana
public long getManaMax()
public void setMagicPower(long value)
value
- Adventurer's new magic power valuevalue >= 0
public void increaseMagicPower(double value)
value
- Adventurer's new magic power value0 < = magic power
public long getMagicPower()
public void setInventoryMax(long value)
value
- Adventurer's new inventoryMax valuevalue >= 0
public void increaseInventoryMax(double value)
value
- Adventurer's new inventoryMax value0 < = inventoryMax
public long getInventoryMax()
public void setStrength(long value)
value
- Adventurer's new strength valuevalue >= 0
public void increaseStrength(double value)
value
- Adventurer's new strength value0 < = strength
public long getStrength()
public java.util.Set getInventory()
public java.awt.Image getImage()
IconLibrary
public void draw(DrawManager drawManager)
drawManager
- an instance of the responisble DrawManagerDrawManager
public boolean isItemInInventory(java.lang.String itemName)
itemName
- the item that is being checkedpublic MathVector checkCollision(java.lang.String other, MathVector oldPos, MathVector delta)
object
- the current instance of FRAGObjectother
- the other instance of FRAGObject, that has changed its positionoldPos
- the old Position (instanceOf MathVector)delta
- the delta vector, that the other instance has
movedpublic void controlAcquired()
object
- the object that was taken in possession by the peerFRAGObject
public void controlLost()
object
- the object that gets unbound from the peerFRAGObject
public double getCollisionSphere()
public void actionEvent(ObjectActionEvent event)
ObjectActionEvent
s that the ObjectManager
receives for this object.event
- the event, that took placeObjectActionEvent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |