World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
Файл Monsters.cpp

См. исходные тексты.

Функции

unsigned int ParseSpellType (struct FrameTableTxtLine *tbl, int *next_token)
 
int ParseAttackType (const char *damage_type_str)
 
void ParseDamage (char *damage_str, unsigned __int8 *dice_rolls, unsigned __int8 *dice_sides, unsigned __int8 *dmg_bonus)
 
int ParseMissleAttackType (const char *missle_attack_str)
 
int ParseSpecialAttack (const char *spec_att_str)
 
int ParseSpecialAttack (char *spec_att_str)
 

Переменные

struct MonsterStatspMonsterStats
 
struct MonsterListpMonsterList
 

Функции

◆ ParseSpellType()

unsigned int ParseSpellType ( struct FrameTableTxtLine tbl,
int *  next_token 
)

См. определение в файле Monsters.cpp строка 20

20  {
21  if (!tbl->pProperties[0]) {
22  ++*next_token;
23  return 0;
24  }
25  if (!_stricmp(tbl->pProperties[0], "Dispel")) { // dispel magic
26  ++*next_token;
27  return 80;
28  } else if (!_stricmp(tbl->pProperties[0], "Day")) { // day of protection
29  *next_token += 2;
30  return 85;
31  } else if (!_stricmp(tbl->pProperties[0], "Hour")) { // hour of power
32  *next_token += 2;
33  return 86;
34  } else if (!_stricmp(tbl->pProperties[0], "Shield")) {
35  return 17;
36  } else if (!_stricmp(tbl->pProperties[0], "Spirit")) {
37  ++*next_token;
38  return 52;
39  } else if (!_stricmp(tbl->pProperties[0], "Power")) { // power cure
40  ++*next_token;
41  return 77;
42  } else if (!_stricmp(tbl->pProperties[0], "Meteor")) { // meteot shower
43  ++*next_token;
44  return 9;
45  } else if (!_stricmp(tbl->pProperties[0], "Lightning")) { // Lightning bolt
46  ++*next_token;
47  return 18;
48  } else if (!_stricmp(tbl->pProperties[0], "Implosion")) {
49  return 20;
50  } else if (!_stricmp(tbl->pProperties[0], "Stone")) {
51  ++*next_token;
52  return 38;
53  } else if (!_stricmp(tbl->pProperties[0], "Haste")) {
54  return 5;
55  } else if (!_stricmp(tbl->pProperties[0], "Heroism")) {
56  return 51;
57  } else if (!_stricmp(tbl->pProperties[0], "Pain")) { // pain reflection
58  ++*next_token;
59  return 95;
60  } else if (!_stricmp(tbl->pProperties[0], "Sparks")) {
61  return 15;
62  } else if (!_stricmp(tbl->pProperties[0], "Light")) {
63  ++*next_token;
64  return 78;
65  } else if (!_stricmp(tbl->pProperties[0], "Toxic")) { // toxic cloud
66  ++*next_token;
67  return 90;
68  } else if (!_stricmp(tbl->pProperties[0], "ShrapMetal")) {
69  return 93;
70  } else if (!_stricmp(tbl->pProperties[0], "Paralyze")) {
71  return 81;
72  } else if (!_stricmp(tbl->pProperties[0], "Fireball")) {
73  return 6;
74  } else if (!_stricmp(tbl->pProperties[0], "Incinerate")) {
75  return 11;
76  } else if (!_stricmp(tbl->pProperties[0], "Fire")) {
77  ++*next_token;
78  return 2;
79  } else if (!_stricmp(tbl->pProperties[0], "Rock")) {
80  ++*next_token;
81  return 41;
82  } else if (!_stricmp(tbl->pProperties[0], "Mass")) {
83  ++*next_token;
84  return 44;
85  } else if (!_stricmp(tbl->pProperties[0], "Ice")) {
86  ++*next_token;
87  return 26;
88  } else if (!_stricmp(tbl->pProperties[0], "Acid")) {
89  ++*next_token;
90  return 29;
91  } else if (!_stricmp(tbl->pProperties[0], "Bless")) {
92  return 46;
93  } else if (!_stricmp(tbl->pProperties[0], "Dragon")) {
94  ++*next_token;
95  return 97;
96  } else if (!_stricmp(tbl->pProperties[0], "Reanimate")) {
97  return 89;
98  } else if (!_stricmp(tbl->pProperties[0], "Summon")) {
99  ++*next_token;
100  return 82;
101  } else if (!_stricmp(tbl->pProperties[0], "Fate")) {
102  return 47;
103  } else if (!_stricmp(tbl->pProperties[0], "Harm")) {
104  return 70;
105  } else if (!_stricmp(tbl->pProperties[0], "Mind")) {
106  ++*next_token;
107  return 57;
108  } else if (!_stricmp(tbl->pProperties[0], "Blades")) {
109  return 39;
110  } else if (!_stricmp(tbl->pProperties[0], "Psychic")) {
111  ++*next_token;
112  return 65;
113  } else if (!_stricmp(tbl->pProperties[0], "Hammerhands")) {
114  return 73;
115  } else {
116  logger->Warning(
117  L"%S", StringPrintf("Unknown monster spell %s", tbl->pProperties[0])
118  .c_str());
119  ++*next_token;
120  return 0;
121  }
122 }

Перекрестные ссылки logger, FrameTableTxtLine::pProperties, StringPrintf() и Log::Warning().

Используется в MonsterStats::Initialize().

+ Граф вызовов:
+ Граф вызова функции:

◆ ParseAttackType()

int ParseAttackType ( const char *  damage_type_str)

См. определение в файле Monsters.cpp строка 125

125  {
126  switch (tolower(*damage_type_str)) {
127  case 'f':
128  return 0; // fire
129  case 'a':
130  return 1; // air
131  case 'w':
132  return 2; // water
133  case 'e':
134  return 3; // earth
135 
136  case 's':
137  return 6; // spirit
138  case 'm':
139  return 7; // mind
140  // m ?? 8
141  case 'l':
142  return 9; // light
143  case 'd':
144  return 10; // dark
145  // d?? 11
146  }
147  return 4; // phis
148 }

Используется в MonsterStats::Initialize().

+ Граф вызова функции:

◆ ParseDamage()

void ParseDamage ( char *  damage_str,
unsigned __int8 *  dice_rolls,
unsigned __int8 *  dice_sides,
unsigned __int8 *  dmg_bonus 
)

См. определение в файле Monsters.cpp строка 151

152  {
153  int str_len = 0;
154  int str_pos = 0;
155  bool dice_flag = false;
156 
157  *dice_rolls = 0;
158  *dice_sides = 1;
159  *dmg_bonus = 0;
160 
161  str_len = strlen(damage_str);
162  if (str_len <= 0) return;
163  for (str_pos = 0; str_pos < str_len; ++str_pos) {
164  if (tolower(damage_str[str_pos]) == 'd') {
165  damage_str[str_pos] = '\0';
166  *dice_rolls = atoi(damage_str);
167  *dice_sides = atoi(&damage_str[str_pos + 1]);
168  dice_flag = true;
169  damage_str[str_pos] = 'd';
170  } else if (tolower(damage_str[str_pos]) == '+') {
171  *dmg_bonus = atoi(&damage_str[str_pos + 1]);
172  }
173  }
174  if (!dice_flag) {
175  if ((*damage_str >= '0') && (*damage_str <= '9')) {
176  *dice_rolls = atoi(damage_str);
177  *dice_sides = 1;
178  }
179  }
180 }

Используется в MonsterStats::Initialize().

+ Граф вызова функции:

◆ ParseMissleAttackType()

int ParseMissleAttackType ( const char *  missle_attack_str)

См. определение в файле Monsters.cpp строка 183

183  {
184  if (!_stricmp(missle_attack_str, "ARROW"))
185  return 1;
186  else if (!_stricmp(missle_attack_str, "ARROWF"))
187  return 2;
188  else if (!_stricmp(missle_attack_str, "FIRE"))
189  return 3;
190  else if (!_stricmp(missle_attack_str, "AIR"))
191  return 4;
192  else if (!_stricmp(missle_attack_str, "WATER"))
193  return 5;
194  else if (!_stricmp(missle_attack_str, "EARTH"))
195  return 6;
196  else if (!_stricmp(missle_attack_str, "SPIRIT"))
197  return 7;
198  else if (!_stricmp(missle_attack_str, "MIND"))
199  return 8;
200  else if (!_stricmp(missle_attack_str, "BODY"))
201  return 9;
202  else if (!_stricmp(missle_attack_str, "LIGHT"))
203  return 10;
204  else if (!_stricmp(missle_attack_str, "DARK"))
205  return 11;
206  else if (!_stricmp(missle_attack_str, "ENER"))
207  return 13;
208  else
209  return 0;
210 }

Используется в MonsterStats::Initialize().

+ Граф вызова функции:

◆ ParseSpecialAttack() [1/2]

int ParseSpecialAttack ( const char *  spec_att_str)

Используется в MonsterStats::Initialize().

+ Граф вызова функции:

◆ ParseSpecialAttack() [2/2]

int ParseSpecialAttack ( char *  spec_att_str)

См. определение в файле Monsters.cpp строка 212

212  {
213  _strlwr(spec_att_str);
214  if (strstr(spec_att_str, "curse"))
215  return 1;
216  else if (strstr(spec_att_str, "weak"))
217  return 2;
218  else if (strstr(spec_att_str, "asleep"))
219  return 3;
220  else if (strstr(spec_att_str, "afraid"))
221  return 23;
222  else if (strstr(spec_att_str, "drunk"))
223  return 4;
224  else if (strstr(spec_att_str, "insane"))
225  return 5;
226  else if (strstr(spec_att_str, "poison weak"))
227  return 6;
228  else if (strstr(spec_att_str, "poison medium"))
229  return 7;
230  else if (strstr(spec_att_str, "poison severe"))
231  return 8;
232  else if (strstr(spec_att_str, "disease weak"))
233  return 9;
234  else if (strstr(spec_att_str, "disease medium"))
235  return 10;
236  else if (strstr(spec_att_str, "disease severe"))
237  return 11;
238  else if (strstr(spec_att_str, "paralyze"))
239  return 12;
240  else if (strstr(spec_att_str, "uncon"))
241  return 13;
242  else if (strstr(spec_att_str, "dead"))
243  return 14;
244  else if (strstr(spec_att_str, "stone"))
245  return 15;
246  else if (strstr(spec_att_str, "errad"))
247  return 16;
248  else if (strstr(spec_att_str, "brkitem"))
249  return 17;
250  else if (strstr(spec_att_str, "brkarmor"))
251  return 18;
252  else if (strstr(spec_att_str, "brkweapon"))
253  return 19;
254  else if (strstr(spec_att_str, "steal"))
255  return 20;
256  else if (strstr(spec_att_str, "age"))
257  return 21;
258  else if (strstr(spec_att_str, "drainsp"))
259  return 22;
260  else
261  return 0;
262 }

Перекрестные ссылки _strlwr().

+ Граф вызовов:

Переменные

◆ pMonsterStats

◆ pMonsterList

FrameTableTxtLine::pProperties
const char * pProperties[30]
Definition: FrameTableInc.h:13
_strlwr
void _strlwr(char *src)
Definition: PlatformLinux.h:8
Log::Warning
void Warning(const wchar_t *pFormat,...)
Definition: Log.cpp:28
logger
Log * logger
Definition: IocContainer.cpp:47
StringPrintf
String StringPrintf(const char *fmt,...)
Definition: Strings.cpp:9