Package com.bdtripp.hauntedhouse.model
Class Item
java.lang.Object
com.bdtripp.hauntedhouse.model.Item
Represents an item in the game world.
Items have names, descriptions, weights, and optional effects on player statistics. Some items
may also be edible.
- Author:
- Brian Tripp
-
Constructor Summary
ConstructorsConstructorDescriptionItem(String name, String description, int weight, boolean isEdible, PlayerStat statToAffect, int affectValue) Creates a new item -
Method Summary
Modifier and TypeMethodDescriptionintReturns the amount to change a stat's value byReturns the description of the itemgetName()Returns the name of the itemReturns the stat the item has an effect onintReturns the weight of the itembooleanisEdible()Returns whether this item is edible or not
-
Constructor Details
-
Item
public Item(String name, String description, int weight, boolean isEdible, PlayerStat statToAffect, int affectValue) Creates a new item- Parameters:
name- the name of the itemdescription- a description of the itemweight- the items weightisEdible- whether or not the item is ediblestatToAffect- the stat of a player that the item has an affect on (eg. strength)affectValue- the amount to change the stat's value by
-
-
Method Details
-
getName
Returns the name of the item- Returns:
- the name
-
getDescription
Returns the description of the item- Returns:
- the description
-
getWeight
public int getWeight()Returns the weight of the item- Returns:
- the weight
-
isEdible
public boolean isEdible()Returns whether this item is edible or not- Returns:
- true if this item is edible
-
getStatToAffect
Returns the stat the item has an effect on- Returns:
- the stat
-
getAffectValue
public int getAffectValue()Returns the amount to change a stat's value by- Returns:
- the amount
-