|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.haphazard.item.Item
A class that denotes an item in the world
Field Summary | |
protected Container |
mContainer
A container (if the item can contain other things) |
protected java.lang.String |
mName
The name of the item |
int |
mQuality
|
Constructor Summary | |
Item()
Creates an item |
|
Item(java.lang.String name)
Creates an item of a certain type |
Method Summary | |
boolean |
add(Item item)
Adds an item to this container |
boolean |
canHold(Item item)
Checks if this container can hold the specified item |
boolean |
contains(Item item)
Checks if this container contains this item |
int |
getAttackBonus()
Returns the attack bonus of the item |
Dimension3D |
getContainerDimension()
Gets the total volume of the container |
int |
getContainerWeight()
Gets the total weight of the container |
int |
getDamageBonus()
Gets the items damage bonus The damage bonus is dependant on the items weight and if it is solid and has edges |
int |
getDefenceBonus()
Returns the defence bonus of the item |
java.lang.String |
getDescription()
Gets the description of the item |
Dimension3D |
getDimension()
Gets this objects dimension |
int |
getFreeSpecializationSlots()
Gets the number of free slots |
int |
getFreeVolume()
Gets the total free volume of the inventory |
GeneralItem |
getGeneralItem()
Gets the general item of this type from Global Items |
java.lang.String |
getName()
Returns the type of the item |
java.util.Vector |
getRestrictions()
Gets a vector with the restrictions for equipping this object. |
java.lang.String |
getSkill()
Gets the attack skill of the item |
javax.swing.tree.DefaultMutableTreeNode |
getTreeNode()
Gets the treenode of the item |
int |
getWeight()
Gets the weight of the item |
boolean |
hasEdges()
Checks if the item has edges |
boolean |
isContainer()
Checks if this item is a container |
boolean |
isSolid()
Checks if the item is solid |
boolean |
isSpecialization(Item item)
Checks if an item is a specialization of this container |
boolean |
remove(Item item)
Removes an item from this container |
void |
setName(java.lang.String name)
Sets the type of item |
java.lang.String |
toString()
Translates this item into a String notation |
java.lang.String |
toXML(int indent)
Translates this item into an XML notation |
void |
wear(int chance)
Calculates the wear of the item and modifies quality accordingly The higher the quality of the item, the lower the chance of wear to take effect |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String mName
protected Container mContainer
public int mQuality
Constructor Detail |
public Item()
public Item(java.lang.String name)
name
- The type of the item to createMethod Detail |
public void setName(java.lang.String name)
name
- The type of the itempublic java.lang.String getName()
public int getWeight()
public java.lang.String getDescription()
public Dimension3D getDimension()
public void wear(int chance)
chance
- The percentage chance of lowering the qualitypublic boolean hasEdges()
public boolean isSolid()
public java.util.Vector getRestrictions()
public int getDamageBonus()
public java.lang.String getSkill()
public int getAttackBonus()
public int getDefenceBonus()
public boolean add(Item item)
add
in interface Containing
item
- The item to add
public boolean remove(Item item)
remove
in interface Containing
item
- The item to remove
public boolean canHold(Item item)
canHold
in interface Containing
item
- The item to check against
public boolean contains(Item item)
contains
in interface Containing
item
- The item to check for
public Dimension3D getContainerDimension()
getContainerDimension
in interface Containing
public int getFreeSpecializationSlots()
getFreeSpecializationSlots
in interface Containing
public boolean isSpecialization(Item item)
isSpecialization
in interface Containing
item
- The item to checkpublic int getFreeVolume()
getFreeVolume
in interface Containing
public int getContainerWeight()
getContainerWeight
in interface Containing
public boolean isContainer()
public java.lang.String toXML(int indent)
indent
- The indentation level
public javax.swing.tree.DefaultMutableTreeNode getTreeNode()
getTreeNode
in interface Containing
public java.lang.String toString()
public GeneralItem getGeneralItem()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |