mapcreator git · master
SDL3 2.5D game and engine using assets, with map editor
C++ 99.3%git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gzsrc/inventory/item.hpp raw
#pragma once
#include "objects/object.hpp"
#include "building/building_data.hpp"
#include "resource/resource.hpp"
class Inventory;
class Messages;
enum class EquipmentSlot {
HEAD,
CAPE,
CHEST,
HAND_LEFT,
HAND_RIGHT,
LEGS,
NONE,
LAST
};
// also add Item::stats if adding to ItemType!
enum class ItemType : uint32_t {
NONE,
HAND,
BUILDING_TOOL,
SWORD_WOOD,
SWORD_STONE,
WOODAXE_STONE,
BONE_BREASTPLATE,
PICKAXE_STONE,
CULTIVATOR,
LAST
};
struct ItemStats {
ItemType type;
std::string title;
std::initializer_list<BuildingCost> cost;
int base_damage;
int base_armor;
int base_health;
float base_speed;
int dmg_per_level;
int armor_per_level;
int health_per_level;
int max_level;
float crafting_duration;
EquipmentSlot equipement_slot;
size_t research_level;
BuildingType research_station;
};
struct ItemCrafting {
ItemType type = ItemType::NONE;
ItemStats stats = {};
float duration = 0;
float duration_max = 0;
bool is_crafting = false;
};
namespace Item {
extern ItemCrafting crafting_item;
extern std::vector<ItemStats> stats;
const ItemStats& get(ItemType t);
bool is_Weapon(ItemType&);
int get_Damage(ItemType t, int lvl);
int get_Health(ItemType t, int lvl);
std::vector<ItemType>
get_ResearchedItems(const std::vector<bool>& researched);
bool craft_ItemStart(Inventory*, ItemType item, ItemCrafting& = Item::crafting_item);
bool craft_Item(Inventory*, ItemCrafting&, Messages*);
void craft_Stop(ItemCrafting& = Item::crafting_item);
std::string to_String(ItemType);
}