forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitem_factory.h
64 lines (53 loc) · 1.73 KB
/
item_factory.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _ITEM_FACTORY
#define _ITEM_FACTORY
#include <map>
#include <string>
#include <functional>
#include "util.h"
#include "name_generator.h"
#include "item.h"
class Item;
class ItemFactory {
public:
vector<PItem> random(Optional<int> seed = Nothing());
vector<PItem> getAll();
static ItemFactory dungeon();
static ItemFactory chest();
static ItemFactory armory();
static ItemFactory potions();
static ItemFactory scrolls();
static ItemFactory mushrooms();
static ItemFactory amulets();
static ItemFactory villageShop();
static ItemFactory dwarfShop();
static ItemFactory goblinShop();
static ItemFactory workshop();
static ItemFactory singleType(ItemId);
static PItem fromId(ItemId);
static vector<PItem> fromId(ItemId, int num);
static PItem corpse(const string& name, const string& rottenName, double weight, ItemType = ItemType::CORPSE,
Item::CorpseInfo corpseInfo = {false, false, false});
static PItem corpse(CreatureId, ItemType type = ItemType::CORPSE,
Item::CorpseInfo corpseInfo = {false, false, false});
static PItem trapItem(PTrigger trigger, string trapName);
static void init();
private:
struct ItemInfo {
ItemInfo(ItemId _id, double _weight) : id(_id), weight(_weight) {}
ItemInfo(ItemId _id, double _weight, int minC, int maxC)
: id(_id), weight(_weight), minCount(minC), maxCount(maxC) {}
ItemId id;
double weight;
int minCount = 1;
int maxCount = 2;
};
ItemFactory(const vector<ItemInfo>&, const vector<ItemId>& unique = vector<ItemId>());
ItemFactory& addItem(ItemInfo);
ItemFactory& addUniqueItem(ItemId);
vector<ItemId> items;
vector<double> weights;
vector<int> minCount;
vector<int> maxCount;
vector<ItemId> unique;
};
#endif