Adventure at Umalu  22nd March, 2013
Rogue-like Dungeon Crawler, written in Java
 All Classes Functions Variables Pages
Public Member Functions | List of all members
rogue.creature.util.Inventory Class Reference

Public Member Functions

 Inventory (int maximumItems, int gold)
 
boolean addItem (Item item) throws NotEnoughSpaceException
 
void removeItem (Item item)
 
void removeItem (int index)
 
void sellItem (int index)
 
void buyItem (Item item) throws NotEnoughSpaceException, NotEnoughGoldException
 
void increaseGold (int amount)
 
void decreaseStability ()
 
boolean decreaseGold (int amount) throws NotEnoughGoldException
 
ArrayList< ItemlistBackpack ()
 
int getBonusDamageOfWornItems ()
 
int getHealthBonus ()
 
Item[] getWornItems ()
 
void showWorn (int index, Terminal term)
 
void showInfo (int place, Terminal term)
 
void equip (Item item)
 
void fullInventoryScreen (Item item)
 

Detailed Description

Represents an Inventory for player.

Constructor & Destructor Documentation

rogue.creature.util.Inventory.Inventory ( int  maximumItems,
int  gold 
)

Creates a new Inventory Object.

Parameters
maximumItemsAmount of Items, a character can carry
goldAmount of Gold character initially starts with

Member Function Documentation

boolean rogue.creature.util.Inventory.addItem ( Item  item) throws NotEnoughSpaceException

Adds an Item if Inventory is not full.

Parameters
itemNew Item in Inventory
Returns
Returns true, if adding Item is successfull, otherwise false (e.g. Inventory is full)
Exceptions
NotEnoughSpaceExceptionPlayers inventory is already full
void rogue.creature.util.Inventory.buyItem ( Item  item) throws NotEnoughSpaceException, NotEnoughGoldException

Adds an Item to inventory, if he has enough gold and at least on free inventory space left

Parameters
itemItem to be bought
Exceptions
NotEnoughSpaceExceptionInventory has no free Spaces left
NotEnoughGoldExceptionPlayer has not collected Gold for this Action
boolean rogue.creature.util.Inventory.decreaseGold ( int  amount) throws NotEnoughGoldException

Takes away amount of Players gold

Parameters
amountAmount of Gold, Player looses
Returns
true if amount could be decreased, false if an error occured (e.g. not enough gold)
Exceptions
NotEnoughGoldExceptionUser has not enough Gold for this Operation
void rogue.creature.util.Inventory.decreaseStability ( )

Redzuiert die Haltbarkeit der angelegten Waffe

void rogue.creature.util.Inventory.equip ( Item  item)

Starts to wear an unequipped Item

Parameters
itemItem to equip
void rogue.creature.util.Inventory.fullInventoryScreen ( Item  item)

Let user select an Item to destroy and auto add new item

Parameters
itemNew Item
int rogue.creature.util.Inventory.getBonusDamageOfWornItems ( )

Returns the sum of all Bonusdamage

Returns
Bonusdamage for user
int rogue.creature.util.Inventory.getHealthBonus ( )

Returns sum of all Bonushealth

Returns
Bonushealth for user
Item [] rogue.creature.util.Inventory.getWornItems ( )

Returns all Items currently worn by user

Returns
List of all worn Items by user
void rogue.creature.util.Inventory.increaseGold ( int  amount)

Adds amount to Players gold stash

Parameters
amountAmount of Gold to add to players gold stash
ArrayList<Item> rogue.creature.util.Inventory.listBackpack ( )

Returns the List of all Items in Inventory

Returns
list of all items in inventory
void rogue.creature.util.Inventory.removeItem ( Item  item)

Deletes an item from Inventory

Parameters
itemItem to be deleted from Inventory
void rogue.creature.util.Inventory.removeItem ( int  index)

Deletes an item from Inventory at given index

Parameters
indexIndex from which item should be deleted
void rogue.creature.util.Inventory.sellItem ( int  index)

Sells Item at Index (adding GoldValue to amount of Gold to players inventory)

Parameters
indexIndex of Item to be sold
void rogue.creature.util.Inventory.showInfo ( int  place,
Terminal  term 
)

Calls showItem for Item in backpack

Parameters
placeIndex of Item to be shown
termUsed Terminal
void rogue.creature.util.Inventory.showWorn ( int  index,
Terminal  term 
)

Calls showItem Method for worn Item

Parameters
indexIndex of Item to be shown
termUsed Terminal

The documentation for this class was generated from the following file: