123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #include "ItemType.h"
- #include "Reader.h"
- class ItemType;
- class BlockType;
- class StoneToolItemType;
- class Item : public virtual Framework::ReferenceCounter
- {
- protected:
- const ItemType* zType;
- const BlockType* zBlockType;
- float hp; // an item will be removed once its hp reaches 0
- float maxHp;
- float durability; // an item will break into another item once its durability reaches 0
- float maxDurability;
- bool eatable;
- bool placeable;
- bool equippable;
- bool solid;
- bool usable;
- int maxStackSize;
- Framework::Text name;
- Item(const ItemType* zType, const char* name);
- public:
- void setHp(float hp);
- virtual void tick();
- const ItemType* zItemType() const;
- const BlockType* zPlacedBlockType() const;
- float getHp() const;
- float getDurability() const;
- bool isUsable() const;
- bool isEatable() const;
- bool isPlaceable() const;
- bool isEquippable() const;
- bool isSolid() const;
- float getMaxDurability() const;
- int getMaxStackSize() const;
- float getMaxHp() const;
- virtual bool canBeStackedWith(const Item* zItem) const;
- virtual void onPlaced();
- virtual void applyInventoryEffects(Entity* zTarget);
- virtual void removeInventoryEffects(Entity* zTarget);
- virtual void applyEquippedEffects(Entity* zTarget);
- virtual void removeEquippedEffects(Entity* zTarget);
- virtual void applyFoodEffects(Entity* zTarget);
- friend ItemType;
- };
|