|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectwyvern.kernel.properties.PList
wyvern.kernel.maps.MapObject
wyvern.lib.classes.armor.ArmorImpl
wyvern.lib.classes.armor.Cloak
wyvern.lib.magic.armor.Trenchcoat
A cloak that can hold things in internal pockets, reducing their weight. You have to admit, this class would have been a piece of cake if Java supported multiple inheritance, or even delegation. C'mon, admit it.
| Nested Class Summary |
| Nested classes inherited from class wyvern.lib.Bag |
Bag.FullBagException, Bag.InvalidItemException |
| Field Summary |
| Fields inherited from class wyvern.kernel.maps.MapObject |
IN_MAP_EDITOR, listenerList_ |
| Fields inherited from class wyvern.kernel.properties.PList |
readOnly_ |
| Fields inherited from interface wyvern.lib.Bag |
BAG_CUT_PERCENT_CAP, BAG_DEFAULT_CAPACITY |
| Fields inherited from interface wyvern.lib.PropertyList |
PROPERTY_PACKAGE |
| Constructor Summary | |
Trenchcoat()
|
|
| Method Summary | |
GameObject |
add(GameObject item)
Adds an item to the bag (at the end). |
void |
adjust(GameObject item,
int index)
Adjusts an item in the bag to the specified index. |
boolean |
canHoldMore()
Returns true if we're not at our max count for this bag. |
boolean |
contains(GameObject item)
Returns true if the container contains the passed item. |
boolean |
filter(GameObject item)
Returns true if the container can hold this type of item. |
GameObject |
find(Predicate p)
Returns an object satisfying the specified Predicate, without actually removing the object. |
GameObject |
findByName(java.lang.String name)
Returns the first object that matches the passed name. |
long |
getCapacity()
Returns the carrying capacity of the bag. |
protected java.util.List |
getItems()
Returns the actual list in which the items are contained. |
long |
getItemWeight()
Returns the (unadjusted) weight of the items in this bag. |
int |
getMaxCount()
Returns the maximum number of items that can be stored in this bag. |
TrenchcoatPocket |
getPocket()
Gets or creates the pocket container. |
int |
getPosition(GameObject item)
Returns position of item in bag. |
long |
getRemainingCapacity()
Returns how much more can be put in the bag. |
long |
getWeight()
Returns the weight of the bag, in grams. |
boolean |
hasRoomFor(GameObject obj)
Returns true if the specified object could be added to the bag's current contents without exceeding the bag's weight capacity. |
boolean |
hasRoomFor(long weight)
Returns true if the specified weight could be added to the bag's current contents without exceeding the bag's weight capacity. |
int |
indexOf(GameObject item)
Returns the index of the specified object in the bag. |
void |
initialize()
MapObject initialization. |
void |
insert(GameObject item,
int index)
Inserts an item into the bag at the specified index. |
void |
invalidate(GameObject item)
Visually invalidates the specified object in the container. |
boolean |
isBag()
Returns true if this container is a Bag (or Inventory, or other implementation of the Bag interface). |
boolean |
isEmpty()
Returns true if the bag contains no items. |
boolean |
isInventory()
Returns true if this container is an Inventory |
boolean |
isMap()
Returns true if this container is a GameMap. |
java.util.Iterator |
iterator()
Returns an Iterator over the items in the bag. |
GameObject |
objectAt(int index)
Returns the object at the specified index, or null if the index is out-of-bounds. |
java.lang.String |
printItemList()
Prints a list of the items in the container, without any heading. |
boolean |
remove(GameObject item)
Removes an item from the bag; does nothing if the item isn't in the bag. |
GameObject |
remove(int index)
Removes and returns the object at the specified index. |
java.util.List |
removeAll()
Removes all items and returns them as a list. |
java.util.List |
removeAll(Predicate p)
Removes all items matching the specified Predicate and returns them in a List. |
GameObject |
removeFirst()
Removes and returns the first object from the inventory. |
GameObject |
removeFirst(Predicate p)
Removes the first instance of an object satisfying a Predicate. |
void |
setCapacity(long capacity)
Sets the max carrying-capacity of the bag. |
void |
setCapacity(Weight w)
Sets the max carrying-capacity of the bag. |
GameObject |
setObjectAt(int index,
GameObject item)
Replaces the object at the specified index with a new object. |
int |
size()
Returns the number of objects in the bag. |
void |
updateDescription(java.lang.String desc)
Copies the internal bag description, so we can see what's inside the cloak. |
void |
visitObjects(Visitor v)
Visits the objects in the inventory with the passed Visitor. |
| Methods inherited from class wyvern.lib.classes.armor.Cloak |
getRequiredSlots |
| Methods inherited from class wyvern.lib.classes.armor.ArmorImpl |
adjustHP, applyBonus, applyBonuses, applySpecial, canWear, checkDrop, destroy, dropped, forceRemoval, getAC, getDescription, getHP, getMaxHP, getValue, isWorn, kill, pickedUp, setWorn, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface wyvern.lib.MethodHookable |
addMethodHook, removeMethodHook, runMethodHook |
| Methods inherited from interface wyvern.lib.Broadcaster |
broadcast, broadcast, broadcast, broadcast, broadcast |
| Constructor Detail |
public Trenchcoat()
| Method Detail |
public void initialize()
initialize in interface GameObjectinitialize in class Cloak
public GameObject add(GameObject item)
throws Bag.FullBagException
add in interface Bagitem - a GameObject to add
FullBagException - bag doesn't have space for the item
Bag.FullBagExceptionpublic boolean contains(GameObject item)
contains in interface Bagpublic boolean filter(GameObject item)
filter in interface Bagpublic GameObject find(Predicate p)
find in interface Bagp - a Predicate returning true or false for a given object
Predicatepublic long getCapacity()
getCapacity in interface Bagpublic long getRemainingCapacity()
getRemainingCapacity in interface Bagpublic boolean hasRoomFor(GameObject obj)
hasRoomFor in interface Bagobj - the object to check
public boolean hasRoomFor(long weight)
hasRoomFor in interface Bagpublic boolean canHoldMore()
canHoldMore in interface Bagpublic int getMaxCount()
getMaxCount in interface Bagpublic int indexOf(GameObject item)
indexOf in interface Bagitem - the object to look for
public void insert(GameObject item,
int index)
throws Bag.FullBagException
insert in interface Bagindex - the index to insert at. An index less than zero
will be changed to zero (put obj at front), and an index larger
than the size of the bag will put the object at the end.item - the item to insert
Bag.FullBagException
public void adjust(GameObject item,
int index)
adjust in interface Bagindex - the index to adjust to. An index less than zero
will be changed to zero (put obj at front), and an index larger
than the size of the bag will put the object at the end.item - the item to adjustpublic boolean isEmpty()
isEmpty in interface Bagpublic void invalidate(GameObject item)
invalidate in interface Bagitem - the item whose appearance has changed in some waypublic java.util.Iterator iterator()
Warning: You *MUST* place iteration in a "synchronized (list)" block during the iteration, as others may also be going through the item list.
iterator in interface Bagpublic GameObject objectAt(int index)
objectAt in interface Bagindex - the index to retrieve
public GameObject remove(int index)
remove in interface Bagindex - the 0-based index of the element to remove.
java.lang.IndexOutOfBoundsException - if the index is out of boundspublic boolean remove(GameObject item)
remove in interface Bagitem - the item to remove, or null if not found
public java.util.List removeAll()
removeAll in interface Bagpublic java.util.List removeAll(Predicate p)
removeAll in interface Bagpublic GameObject removeFirst()
removeFirst in interface Bagjava.lang.IndexOutOfBoundsException - if the list is emptypublic GameObject removeFirst(Predicate p)
removeFirst in interface Bagp - a Predicate that returns true if the object is "the one"Predicatepublic void setCapacity(long capacity)
setCapacity in interface Bagcapacity - the new capacity, stored in "capacity" property
as a Weight object.public void setCapacity(Weight w)
setCapacity in interface Bagw - the weight to use as the new capacity
public GameObject setObjectAt(int index,
GameObject item)
throws Bag.FullBagException
setObjectAt in interface Bagindex - the index to replace; if greater than the end of
the list, the object will be appended; if less than zero, the
object will be prepended.item - the object to replace
Bag.FullBagExceptionpublic int size()
size in interface Bagpublic void visitObjects(Visitor v)
visitObjects in interface Bagpublic GameObject findByName(java.lang.String name)
findByName in interface Bagname - the name substring to match
public void updateDescription(java.lang.String desc)
public java.lang.String printItemList()
printItemList in interface Bagpublic long getWeight()
The reduction percentage is actually stored as an integer property with a default of zero (making the property optional). A value of zero means the weight isn't reduced at all. A positive number is treated as a percentage reduction (with a ceiling of 100). 100 means the items weigh nothing while in the bag. A negative value is treated as a percentage multiplier to add to the weight of the items; for example, a value of -50 tells the bag to add 50% to the weight of the items.
The reduction-percentage int property is "cut-%".
getWeight in interface GameObjectgetWeight in class ArmorImplpublic long getItemWeight()
getItemWeight in interface Bagprotected java.util.List getItems()
public int getPosition(GameObject item)
getPosition in interface Bagitem - the item to look for
public TrenchcoatPocket getPocket()
public boolean isMap()
isMap in interface Containerpublic boolean isBag()
isBag in interface Containerpublic boolean isInventory()
isInventory in interface Container
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||