-
Notifications
You must be signed in to change notification settings - Fork 1
Items
All existing items are subclasses of the Abstract Item class which manages the item's properties and provides players special effects to improve their game performance i.e. improve their stats and restore their health and hunger when convenient. Items will represent in-game items a player can hold in their inventory or around the map. Here is an overview of how the Items are structured:
-
AbstractItems: The abstract class with variables and methods to supply information about the items. This includes the item's
name
,itemCode
,limit
andquantity
. These fields will be used to differentiate each item and categorise them in the Inventory -
ConsumableItem: A class that overrides AbstrcatItems to implement the generic functionality of the function
useItems
, This class is for expendable items and are used to improve players' stat performance. -
TimedUsedItem: Overides methods from the ConsumableClass to implement temporary effects towards player's stats. This class introduces a field
effectAmount
- the amount to be applied towards their designated player stat. - ItemProximityTask - This is the list of actions the player must take to pick up an item on the map. It detects when a player is in proximity to the item
-
ConsumedException: Throws an error if the item has no
quantity
left to use the item. - ItemUsageContext: This class is used to keep track of the items usage activity through the game
#Example Usage ##AbstractItems
The test plan is as follows:
- Creation: Ensures the items have been created with the correct fields
- Interaction: Ensures the items can be picked up on the map and interact with the Inventory Display. They can also interact with the player stats to apply their effects to their stat.
Concrete subclasses (actual in-game items) include various Food classes and the healing potion class. Food classes include:
Potions classes include:
- Health Potion
- Defense Potion
- Attack Potion
- Speed Potion
The expected interaction between the player and items is that when a user comes in a certain range (2.0f) of the item the functionality @pickUpItem
can be activated which is also displayed as a pop-up dialogue to inform the user can pick up the certain item in range using key command "P". This is all handled in ItemProximityTask
and ItemFactory
this is the Item sequence diagram
This diagram represents the overview of the Items and their action in the game and their interaction with the display and player stats
* package com.csse3200.game.inventory.items.food
* package com.csse3200.game.inventory.items
This package contains all the item classes required for the game
AbstractItems: An abstract class that contains the fields that are used to identify each item and their details of usage and applications
Attributes
-
useItem()
- This method is to be defined by other subclasses as some items may have different functionality and effects when this function is trigegered -
isEmpty()
- Checks if the the item's quantity has been depleted -
setTexturePath()
- Sets a texture path for the items to be displayed on the map -
getTexturePath()
- retieves the texture path of the item