obj
Class Player

java.lang.Object
  extended by obj.Entity
      extended by obj.Character
          extended by obj.Player

public class Player
extends Character


Constructor Summary
Player(Grid startingGrid, Room startingRoom)
           
Player(java.lang.String name, int age, java.lang.String gender, Grid startingGrid, Room startingRoom)
          Initializes basic player characteristics, such as name, gender, etc.
 
Method Summary
 void addToInventory(Item i)
          Adds an item to the player's inventory.
 Grid getGrid()
           
 java.util.ArrayList<Item> getInventory()
           
 Item getItem(java.lang.String itemName)
           
 Room getRoom()
           
 boolean removeItem(java.lang.String itemName)
           
 void setGrid(Grid newGrid)
          Effectively moves the player to the Grid specified.
 void setRoom(Room newRoom)
          Effectively moves the player to whatever room is specified.
 
Methods inherited from class obj.Character
getAge, getGender, setAge, setGender
 
Methods inherited from class obj.Entity
addIdentifier, addIdentifiers, getDesc, getName, getRoomDesc, hasIdentifier, makeInvisible, makeVisible, setDesc, setIdentifiers, setName, setRoomDesc, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(java.lang.String name,
              int age,
              java.lang.String gender,
              Grid startingGrid,
              Room startingRoom)
Initializes basic player characteristics, such as name, gender, etc. Sets the starting grid and room.


Player

public Player(Grid startingGrid,
              Room startingRoom)
Method Detail

getItem

public Item getItem(java.lang.String itemName)
Returns:
A specific item from the player's inventory If the item is not found, null is returned instead.

addToInventory

public void addToInventory(Item i)
Adds an item to the player's inventory.


removeItem

public boolean removeItem(java.lang.String itemName)
Returns:
true if item was removed, false if not

setRoom

public void setRoom(Room newRoom)
Effectively moves the player to whatever room is specified.

Parameters:
newRoom - The room to move the player to.

getRoom

public Room getRoom()
Returns:
the room that the player is in.

setGrid

public void setGrid(Grid newGrid)
Effectively moves the player to the Grid specified.

Parameters:
newGrid - The Grid to move the player to.

getGrid

public Grid getGrid()
Returns:
The Grid that the player is on.

getInventory

public java.util.ArrayList<Item> getInventory()
Returns:
Player's inventory in an arrayList.