|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavoids.Item
public class Item
A class to represent an item in the game (weapon, or other usable tool)
Nested Class Summary | |
---|---|
static class |
Item.Direction
An enumeration of directions that you can travel along the weapon list (left, right or choose best). |
static class |
Item.Type
The type of item. |
Field Summary | |
---|---|
private int |
count
the number of uses left |
private int |
defaultCount
the default number of uses |
private ImageMap.Name |
defaultImage
the default image to use for drawing |
private ImageMap.Name |
image
the current image to use for drawing |
private boolean |
limitless
is the item limitless? |
private int |
maximumCount
the maximum number of uses |
private java.lang.String |
name
the text version of the item name |
private static long |
serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object |
private int |
size
the size of the item (for drawing) |
private SoundMap.Sound |
sound
the sound to play when used |
private Item.Type |
type
the type of item (the item name) |
Constructor Summary | |
---|---|
Item()
Constructor (default) |
|
Item(Item item)
Constructor (copy) |
Method Summary | |
---|---|
static Item.Type |
cycleWeapon(java.util.HashMap<Item.Type,Item> items,
Item.Type currentItem,
Item.Direction direction)
Determine what weapon to select next. |
int |
getCount()
|
int |
getDefaultCount()
|
ImageMap.Name |
getDefaultImage()
|
ImageMap.Name |
getImage()
|
int |
getMaximumCount()
|
java.lang.String |
getName()
|
int |
getSize()
|
SoundMap.Sound |
getSound()
|
Item.Type |
getType()
|
boolean |
isLimitless()
|
boolean |
isWeapon()
|
static boolean |
isWeapon(Item.Type item)
|
void |
modifyCount(int _count)
|
void |
reset()
reset the item's information to non-immortal and a default count |
void |
setCount(int _count)
|
void |
setDefaultCount(int _defaultCount)
|
void |
setDefaultImage(ImageMap.Name _defaultImage)
|
void |
setImage(ImageMap.Name _image)
|
Item.Type |
setItem(Item.Type item)
|
void |
setLimitless(boolean _immortal)
|
void |
setMaximumCount(int _maximumCount)
|
void |
setName(java.lang.String _name)
|
void |
setSize(int _size)
|
void |
setSound(SoundMap.Sound _sound)
|
void |
setType(Item.Type _type)
|
static Item.Type |
setWeapon(Item.Type item)
|
java.lang.String |
toString()
Provide a String representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private Item.Type type
private java.lang.String name
private boolean limitless
private ImageMap.Name defaultImage
private ImageMap.Name image
private SoundMap.Sound sound
private int maximumCount
private int count
private int defaultCount
private int size
Constructor Detail |
---|
public Item()
public Item(Item item)
item
- the item to copyMethod Detail |
---|
public java.lang.String getName()
public Item.Type getType()
public boolean isLimitless()
public ImageMap.Name getImage()
public ImageMap.Name getDefaultImage()
public SoundMap.Sound getSound()
public int getCount()
public int getDefaultCount()
public int getMaximumCount()
public int getSize()
public void setName(java.lang.String _name)
_name
- set the item name to thispublic void setType(Item.Type _type)
_type
- set the type of the itempublic void setLimitless(boolean _immortal)
_immortal
- set the immortality of this item (true/false)public void setImage(ImageMap.Name _image)
_image
- set the current image this item is usingpublic void setDefaultImage(ImageMap.Name _defaultImage)
_defaultImage
- set the default image this item usespublic void setSound(SoundMap.Sound _sound)
_sound
- set the sound this item makespublic void setCount(int _count)
_count
- set the current number of uses left to this valuepublic void setDefaultCount(int _defaultCount)
_defaultCount
- set the default number of uses to this valuepublic void setMaximumCount(int _maximumCount)
_maximumCount
- set the maximum number of uses to this valuepublic void setSize(int _size)
_size
- set the size of the image to represent this itempublic void modifyCount(int _count)
_count
- modify the number of uses by this amount (if not immortal)public void reset()
public boolean isWeapon()
public static boolean isWeapon(Item.Type item)
item
- the item to test for weapon status
public static Item.Type cycleWeapon(java.util.HashMap<Item.Type,Item> items, Item.Type currentItem, Item.Direction direction)
items
- a mapping of item types to itemscurrentItem
- the currently selected itemdirection
- the direction to go through the list (left or right)
public static Item.Type setWeapon(Item.Type item)
item
- the weapon item type to set
public Item.Type setItem(Item.Type item)
item
- the non-weapon item type to set
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |