Items¶
-
class
pyzork.equipment.
Weapon
(**kwargs)[source]¶ -
classmethod
add_buff
(**kwargs)¶ Decorator function to allow the user to define a buff by decorating a function. Takes the same parameters as the class. Since this specifically adds a buff, the stat_type parameter is required
-
classmethod
add_effect
(**kwargs)¶ Decorator function to allow the user to define an effect by decorating a function. Takes the same parameters as the class.
-
buff
(entity)¶ Abstract method that must be implemented by every piece of equipment, this is the method used when calculating damage that dictates the various modifiers and buffs gotten
-
effect
(target)¶ Abstract class that applies an effect when attacking
-
classmethod
-
class
pyzork.equipment.
Armor
(**kwargs)[source]¶ -
classmethod
add_buff
(**kwargs)¶ Decorator function to allow the user to define a buff by decorating a function. Takes the same parameters as the class. Since this specifically adds a buff, the stat_type parameter is required
-
classmethod
add_effect
(**kwargs)¶ Decorator function to allow the user to define an effect by decorating a function. Takes the same parameters as the class.
-
buff
(entity)¶ Abstract method that must be implemented by every piece of equipment, this is the method used when calculating damage that dictates the various modifiers and buffs gotten
-
effect
(target)¶ Abstract class that applies an effect when attacking
-
classmethod
-
class
pyzork.equipment.
Consumable
(**kwargs)[source]¶ Consumable are items which the entity can use at pretty much anytime to gain an effect, kinda like an ability with limited uses which costs no energy. Each consumable can be used a certain number of times before it disappears, if the entity buys more of the consumable then the charges will be added together. When selling a consumable the charges will be split up based on how many charges the buyer accepts, for example if the shop takes consumables with 2 charges and you have one with 5 then it will make two sales and discrd the remainer.
Parameters:
-
class
pyzork.equipment.
QuestItem
(**kwargs)[source]¶ Quest items are special item which do nothing on their own but can be used as requirement for certain part of the story, for example the guards at the palace entrance won’t let you enter unless you have a letter of recommendation in your inventory.
Parameters:
-
class
pyzork.equipment.
ShopItem
(**kwargs)[source]¶ A shop item is an item that can be sold or bought in a shop.
Parameters: - item (Union[Consumable, QuestItem, Equipment]) – The item to sell, this is the class itself, not an instance of the object
- price (int) – The price of the item
- amount (int) – The number of items that are available for sale, if a entity sells an item it will increment the amount
-
item
¶ The item being sold or bought
Type: Union[Consumable, QuestItem, Equipment]
-
description
¶ The description of the item being sold
-
class
pyzork.equipment.
Inventory
(**kwargs)[source]¶ Inventories store all items: Equipment, Consumables and QuestItem.
Parameters: - items (List[Union[Consumable, Equipment, QuestItem]]) – A list of items this inventory starts with
- weapon (Weapon) – The weapon this inventory comes equipped with by default
- armor (Armor) – The armor this inventory comes equipped with by default
-
add_item
(item: pyzork.equipment.Item)[source]¶ Add an item to the entity’s inventory
Parameters: item (Item) – The item you want to add to the inventory, the method will sort out where it needs to go.
-
equip_item
(item: pyzork.equipment.Equipment)[source]¶ Equip either a weapon or armor
Parameters: item (Equipment) – The piece of equipment to add
-
get_consumable
(**kwargs)[source]¶ Get an consumable instance based on a parameter. The parameter is any kwarg to you pass, if you want the parameter to be the name of the item then you can do something like get_consumable(name=’Health Potion’)
-
get_equipment
(**kwargs)[source]¶ Get an equipment instance based on a parameter. The parameter is any kwarg to you pass, if you want the parameter to be the name of the item then you can do something like get_equipment(name=’Big Sword’)
-
get_item
(**kwargs)[source]¶ Get an equipment, consumable or quest instance based on a parameter. The parameter is any kwarg to you pass, if you want the parameter to be the name of the item then you can do something like get_item(name=’Big Sword’)
-
get_quest
(**kwargs)[source]¶ Get an quest instance based on a parameter. The parameter is any kwarg to you pass, if you want the parameter to be the name of the item then you can do something like get_quest(name=’Old Key’)
-
remove_item
(item: pyzork.equipment.Item)[source]¶ Remove an item from the inventory
Parameters: item (Item) – The item to remove
-
use_item
(item: pyzork.equipment.Consumable, target)[source]¶ Use a consumable on a target
Parameters: - item (Consumable) – The item to use
- target (Entity) – The entity to use it on