forked from miki151/keeperrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollective_config.h
133 lines (113 loc) · 4.61 KB
/
collective_config.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/* Copyright (C) 2013-2014 Michal Brzozowski (rusolis@poczta.fm)
This file is part of KeeperRL.
KeeperRL is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
KeeperRL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.gnu.org/licenses/ . */
#pragma once
#include "enum_variant.h"
#include "util.h"
#include "minion_trait.h"
#include "workshop_type.h"
#include "cost_info.h"
#include "position.h"
#include "game_time.h"
#include "furniture_type.h"
#include "conquer_condition.h"
#include "creature_id.h"
#include "achievement_id.h"
enum class ItemClass;
class Game;
class Workshops;
class Technology;
class ImmigrantInfo;
struct ResourceInfo;
class ContentFactory;
class FurnitureUsageType;
struct GuardianInfo {
CreatureId SERIAL(creature);
double SERIAL(probability);
int SERIAL(minEnemies);
int SERIAL(minVictims);
template <class Archive>
void serialize(Archive& ar, const unsigned int version);
};
struct MinionActivityInfo {
enum Type { FURNITURE, EXPLORE, COPULATE, EAT, SPIDER, WORKER, ARCHERY, IDLE, MINION_ABUSE, GUARD1, GUARD2, GUARD3 } type;
MinionActivityInfo();
MinionActivityInfo(FurnitureType);
MinionActivityInfo(BuiltinUsageId);
using UsagePredicate = function<bool(const ContentFactory*, const Collective*, const Creature*, FurnitureType)>;
using SecondaryPredicate = function<bool(const Furniture*, const Collective*)>;
MinionActivityInfo(UsagePredicate, SecondaryPredicate = nullptr);
MinionActivityInfo(Type);
UsagePredicate furniturePredicate =
[](const ContentFactory*, const Collective*, const Creature*, FurnitureType) { return true; };
SecondaryPredicate secondaryPredicate;
};
struct FloorInfo {
FurnitureType type;
CostInfo cost;
string name;
double efficiencyBonus;
};
class CollectiveConfig {
public:
static CollectiveConfig keeper(TimeInterval immigrantInterval, int maxPopulation, string populationString,
bool prisoners, ConquerCondition, bool requireQuartersForExp);
static CollectiveConfig noImmigrants();
bool isLeaderFighter() const;
bool getManageEquipment() const;
bool getFollowLeaderIfNoTerritory() const;
bool stayInTerritory() const;
TimeInterval getImmigrantInterval() const;
bool getStripSpawns() const;
bool getEnemyPositions() const;
bool getWarnings() const;
bool getConstructions() const;
int getMaxPopulation() const;
const string& getPopulationString() const;
int getNumGhostSpawns() const;
TimeInterval getImmigrantTimeout() const;
double getGhostProb() const;
bool hasVillainSleepingTask() const;
bool allowHealingTaskOutsideTerritory() const;
const optional<GuardianInfo>& getGuardianInfo() const;
bool isConquered(const Collective*) const;
bool xCanEnemyRetire() const;
CollectiveConfig& setConquerCondition(ConquerCondition);
bool canCapturePrisoners() const;
bool alwaysMountSteeds() const;
bool minionsRequireQuarters() const;
static void addBedRequirementToImmigrants(vector<ImmigrantInfo>&, ContentFactory*);
static BedType getPrisonBedType(const Creature*);
bool hasImmigrantion(bool currentlyActiveModel) const;
static const MinionActivityInfo& getActivityInfo(MinionActivity);
SERIALIZATION_DECL(CollectiveConfig)
CollectiveConfig(const CollectiveConfig&);
CollectiveConfig(CollectiveConfig&&) noexcept;
CollectiveConfig& operator = (CollectiveConfig&&) = default;
CollectiveConfig& operator = (const CollectiveConfig&) = default;
~CollectiveConfig();
optional<AchievementId> SERIAL(discoverAchievement);
private:
enum CollectiveType { KEEPER, VILLAGE };
CollectiveConfig(TimeInterval immigrantInterval, CollectiveType, int maxPopulation, ConquerCondition);
TimeInterval SERIAL(immigrantInterval);
int SERIAL(maxPopulation) = 10000;
CollectiveType SERIAL(type) = CollectiveType::VILLAGE;
bool SERIAL(leaderAsFighter) = false;
int SERIAL(spawnGhosts) = 0;
double SERIAL(ghostProb) = 0;
optional<GuardianInfo> SERIAL(guardianInfo);
bool SERIAL(canEnemyRetire) = true;
ConquerCondition SERIAL(conquerCondition) = ConquerCondition::KILL_FIGHTERS_AND_LEADER;
string SERIAL(populationString);
bool SERIAL(prisoners) = false;
bool SERIAL(alwaysMount) = false;
bool SERIAL(requireQuartersForExp) = true;
};