-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattribute.h
More file actions
339 lines (304 loc) · 9.65 KB
/
attribute.h
File metadata and controls
339 lines (304 loc) · 9.65 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#pragma pack(1)
#ifndef ATTRIBUT_H
#define ATTRIBUT_H
#include<vector>
#include<set>
#define PERSON_MAX 200 /*最大武将数*/
#define CITY_MAX 38 /*最大城市数*/
#define GOODS_MAX 33 /*最大道具数*/
#define PERSON_DEATH_AGE 90 /*武将寿命*/
#define PERSON_APPEAR_AGE 16 /*武将出现年龄*/
/*------------------------
君主性格定义
------------------------*/
#define CHARACTER_PEACE 4 /*和平*/
#define CHARACTER_JUSTICE 3 /*大义*/
#define CHARACTER_DUPLICITY 2 /*奸诈*/
#define CHARACTER_CRAZY 1 /*狂人*/
#define CHARACTER_RASH 0 /*冒进*/
/*------------------------
君主性格劝降机率
------------------------*/
#define PERSUADE_PEACE 15 /*和平*/
#define PERSUADE_JUSTICE 5 /*大义*/
#define PERSUADE_DUPLICITY 20 /*奸诈*/
#define PERSUADE_CRAZY 1 /*狂人*/
#define PERSUADE_RASH 10 /*冒进*/
/*------------------------
性格定义
------------------------*/
#define CHARACTER_LOYALISM 4 /*忠义*/
#define CHARACTER_IDEAL 3 /*大志*/
#define CHARACTER_AVARICE 2 /*贪财*/
#define CHARACTER_DREAD 1 /*怕死*/
#define CHARACTER_TEMERITY 0 /*卤莽*/
/*------------------------
性格离间机率
------------------------*/
#define ALIENATE_LOYALISM 5 /*忠义*/
#define ALIENATE_IDEAL 30 /*大志*/
#define ALIENATE_AVARICE 40 /*贪财*/
#define ALIENATE_DREAD 30 /*怕死*/
#define ALIENATE_TEMERITY 50 /*卤莽*/
/*------------------------
性格招揽机率
------------------------*/
#define CANVASS_LOYALISM 5 /*忠义*/
#define CANVASS_IDEAL 20 /*大志*/
#define CANVASS_AVARICE 30 /*贪财*/
#define CANVASS_DREAD 40 /*怕死*/
#define CANVASS_TEMERITY 15 /*卤莽*/
/*------------------------
性格策反机率
------------------------*/
#define COUNTERESPIONGE_LOYALISM 5 /*忠义*/
#define COUNTERESPIONGE_IDEAL 60 /*大志*/
#define COUNTERESPIONGE_AVARICE 20 /*贪财*/
#define COUNTERESPIONGE_DREAD 10 /*怕死*/
#define COUNTERESPIONGE_TEMERITY 30 /*卤莽*/
/*------------------------
性格招降机率
------------------------*/
#define SURRENDER_LOYALISM 5 /*忠义*/
#define SURRENDER_IDEAL 20 /*大志*/
#define SURRENDER_AVARICE 30 /*贪财*/
#define SURRENDER_DREAD 60 /*怕死*/
#define SURRENDER_TEMERITY 15 /*卤莽*/
/*------------------------
性格招降机率系数
------------------------*/
#define SURRENDER_LOYALISM_MOD 1 /*忠义*/
#define SURRENDER_IDEAL_MOD 3 /*大志*/
#define SURRENDER_AVARICE_MOD 4 /*贪财*/
#define SURRENDER_DREAD_MOD 5 /*怕死*/
#define SURRENDER_TEMERITY_MOD 2 /*卤莽*/
/*------------------------
方向定义
------------------------*/
#define DIRECT_N 0 /* 方向——北 */
#define DIRECT_EN 1 /* 方向——东北 */
#define DIRECT_E 2 /* 方向——东 */
#define DIRECT_ES 3 /* 方向——东南 */
#define DIRECT_S 4 /* 方向——南 */
#define DIRECT_WS 5 /* 方向——西南 */
#define DIRECT_W 6 /* 方向——西 */
#define DIRECT_WN 7 /* 方向——西北 */
/*------------------------
城市状态定义
------------------------*/
#define STATE_NORMAL 0 /*正常*/
#define STATE_FAMINE 1 /*饥荒*/
#define STATE_DROUGHT 2 /*旱灾*/
#define STATE_FLOOD 3 /*水灾*/
#define STATE_REBELLION 4 /*暴动*/
#define THREW_RENEW 4 /*每月恢复体力*/
#define THREW_TREAT 50 /*宴请恢复体力*/
typedef struct {
U8 idx; /* 道具序号 */
U8 useflag; /* 使用标志:是被使用还是被装备*/
U8 name[10]; /* 道具名字 */
U8 inf[50]; /* 道具说明 */
U8 at; /* 对武力的加层 */
U8 iq; /* 对智力的加层 */
U8 move; /* 对移动力的加层 */
U8 arm; /* 对兵种的改变 */
}GOODS;
typedef struct PersonRes /*人才属性*/
{
U8 Id; /*编号*/
U8 Belong; /*归属*/
U8 Level; /*等级*/
U8 Force; /*武力*/
U8 IQ; /*智力*/
U8 Devotion; /*忠诚*/
U8 Character; /*性格*/
U8 Experience; /*经验*/
U8 Thew; /*体力*/
U8 ArmsType; /*兵种*/
U16 Arms; /*兵力*/
U8 Equip[2]; /*装备*/
U8 Age; /*年龄*/
U8 name[10]; /*名称*/
U8 Birth; /*出生年*/
U8 SearchId; /*搜索者编号*/
U8 AppearCityId; /*出现城市编号*/
}PersonResType;
typedef struct Person /*人才属性 (12 Bytes) */
{
U8 Id; /*编号*/
U8 Belong; /*归属*/
U8 Level; /*等级*/
U8 Force; /*武力*/
U8 IQ; /*智力*/
U8 Devotion; /*忠诚*/
U8 Character; /*性格*/
U8 Experience; /*经验*/
U8 Thew; /*体力*/
U8 ArmsType; /*兵种*/
U16 Arms; /*兵力*/
U8 Equip[2]; /*装备*/
U8 Age; /*年龄*/
}PersonType;
//todo: add new filed like gbkName,
// support third equipment
class NewPerson /*人才属性 (12 Bytes) */
{
public:
U8 Id; /*编号*/
U8 Belong; /*归属*/
U8 Level; /*等级*/
U8 Force; /*武力*/
U8 IQ; /*智力*/
U8 Devotion; /*忠诚*/
U8 Character; /*性格*/
U8 Experience; /*经验*/
U8 Thew; /*体力*/
U8 ArmsType; /*兵种*/
U16 Arms; /*兵力*/
U8 Equip[2]; /*装备*/
U8 Age; /*年龄*/
U8 city; /* 出现城市编号 */
std::string Name; /*名称*/
// Constructor
NewPerson() : Id(0), Belong(0), Level(0), Force(0), IQ(0), Devotion(0),
Character(0), Experience(0), Thew(0), ArmsType(0), Arms(0), Age(0), city(0) {
Equip[0] = 0;
Equip[1] = 0;
}
// Constructor from PersonType
NewPerson(const PersonType& person) : Id(person.Id), Belong(person.Belong), Level(person.Level),
Force(person.Force), IQ(person.IQ), Devotion(person.Devotion), Character(person.Character),
Experience(person.Experience), Thew(person.Thew), ArmsType(person.ArmsType), Arms(person.Arms),
Age(person.Age), city(0), Name("") {
Equip[0] = person.Equip[0];
Equip[1] = person.Equip[1];
}
// Constructor from PersonType pointer
NewPerson(const PersonType* person) : Id(0), Belong(0), Level(0), Force(0), IQ(0), Devotion(0),
Character(0), Experience(0), Thew(0), ArmsType(0), Arms(0), Age(0), city(0), Name("") {
if (person != nullptr) {
Id = person->Id;
Belong = person->Belong;
Level = person->Level;
Force = person->Force;
IQ = person->IQ;
Devotion = person->Devotion;
Character = person->Character;
Experience = person->Experience;
Thew = person->Thew;
ArmsType = person->ArmsType;
Arms = person->Arms;
Age = person->Age;
Equip[0] = person->Equip[0];
Equip[1] = person->Equip[1];
} else {
Equip[0] = 0;
Equip[1] = 0;
}
}
// Copy constructor
NewPerson(const NewPerson& other) : Id(other.Id), Belong(other.Belong), Level(other.Level),
Force(other.Force), IQ(other.IQ), Devotion(other.Devotion), Character(other.Character),
Experience(other.Experience), Thew(other.Thew), ArmsType(other.ArmsType), Arms(other.Arms),
Age(other.Age), city(other.city), Name(other.Name) {
Equip[0] = other.Equip[0];
Equip[1] = other.Equip[1];
}
// Assignment operator
NewPerson& operator=(const NewPerson& other) {
if (this != &other) {
Id = other.Id;
Belong = other.Belong;
Level = other.Level;
Force = other.Force;
IQ = other.IQ;
Devotion = other.Devotion;
Character = other.Character;
Experience = other.Experience;
Thew = other.Thew;
ArmsType = other.ArmsType;
Arms = other.Arms;
Age = other.Age;
city = other.city;
Name = other.Name;
Equip[0] = other.Equip[0];
Equip[1] = other.Equip[1];
}
return *this;
}
};
typedef NewPerson NewPersonType;
// maybe still use the current framework, addperson, delperson, getcitypersons
//for assign: need to list all persons
typedef struct CityRes /*城市属性*/
{
U8 Id; /*编号*/
U8 Belong; /*归属*/
U8 SatrapId; /*太守编号*/
U16 FarmingLimit; /*农业上限*/
U16 Farming; /*农业开发度*/
U16 CommerceLimit; /*商业上限*/
U16 Commerce; /*商业开发度*/
U8 PeopleDevotion; /*民忠*/
U8 AvoidCalamity; /*防灾*/
U32 PopulationLimit; /*人口上限*/
U32 Population; /*人口*/
U16 Money; /*金钱*/
U16 Food; /*粮食*/
U16 MothballArms; /*后备兵力*/
U8 PersonQueue; /*人才队列*/
U8 Persons; /*人才数*/
U8 ToolQueue; /*道具队列*/
U8 Tools; /*道具数*/
U8 name[10]; /*名称*/
U8 Links[8]; /*城市连接(北、东北、东、东南、南、西南、西、西北)*/
U8 Distances[8]; /*城市间距离*/
}CityResType;
typedef struct OldCity /*城市属性(30 Bytes)*/
{
U8 Id;
U8 Belong; /*归属*/
U8 SatrapId; /*太守编号*/
U16 FarmingLimit; /*农业上限*/
U16 Farming; /*农业开发度*/
U16 CommerceLimit; /*商业上限*/
U16 Commerce; /*商业开发度*/
U8 PeopleDevotion; /*民忠*/
U8 AvoidCalamity; /*防灾*/
U32 PopulationLimit; /*人口上限*/
U32 Population; /*人口*/
U16 Money; /*金钱*/
U16 Food; /*粮食*/
U16 MothballArms; /*后备兵力*/
U8 PersonQueue; /*人才队列*/
U8 Persons; /*人才数*/
U8 ToolQueue; /*道具队列*/
U8 Tools; /*道具数*/
} OldCityType;
typedef struct City /*城市属性(30 Bytes)*/
{
U8 Id;
U8 Belong; /*归属*/
U8 SatrapId; /*太守编号*/
U16 FarmingLimit; /*农业上限*/
U16 Farming; /*农业开发度*/
U16 CommerceLimit; /*商业上限*/
U16 Commerce; /*商业开发度*/
U8 PeopleDevotion; /*民忠*/
U8 AvoidCalamity; /*防灾*/
U32 PopulationLimit; /*人口上限*/
U32 Population; /*人口*/
U16 Money; /*金钱*/
U16 Food; /*粮食*/
U16 MothballArms; /*后备兵力*/
U8 PersonQueue; /*人才队列*/
U8 Persons; /*人才数*/
U8 ToolQueue; /*道具队列*/
U8 Tools; /*道具数*/
std::vector<U8> ToolsV;
std::vector<U8> PersonV;
std::set<U8> usedPersonsV;
bool autoManage; // if auto manage
std::string Name; /*城市名称*/ // Added name field
} CityType;
#endif