Crossfire Server, Trunk  R20513
check_item.c
Go to the documentation of this file.
1 /*
2  * static char *rcsid_check_item_c =
3  * "$Id: check_item.c 20228 2016-02-29 18:58:03Z ryo_saeba $";
4  */
5 
6 /*
7  * CrossFire, A Multiplayer game for X-windows
8  *
9  * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
10  * Copyright (C) 1992 Frank Tore Johansen
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25  *
26  * The authors can be reached via e-mail at crossfire-devel@real-time.com
27  */
28 
29 /*
30  * This is the unit tests file for common/item.c
31  */
32 
33 #include <global.h>
34 #include <stdlib.h>
35 #include <check.h>
36 #include <loader.h>
37 #include <toolkit_common.h>
38 
39 static void setup(void) {
40  cctk_setdatadir(BUILD_ROOT "lib");
41  cctk_setlog(LOGDIR "/unit/common/item.out");
43  init_gods();
44  init_formulae();
45 }
46 
47 static void teardown(void) {
48  /* put any cleanup steps here, they will be run after each testcase */
49 }
50 
51 START_TEST(test_describe_item) {
52  object *test;
53  char *buf;
54  int check;
55  treasurelist *list;
56 
57  static const char *archs[] = {
58  "gem",
59  "food",
60  "lantern_1",
61  "blood",
62  "ring",
63  "amulet",
64  "goblin",
65  "potion_restoration",
66  "axe_2",
67  "elven_bow",
68  "helmet_of_brilliance",
69  "holy_avenger",
70  "scimitar",
71  "shield",
72  "fl_corpse",
73  "booze",
74  "poison",
75  "deathshead",
76  "zombie",
77  "talisman_evocation",
78  "talisman_sorcery",
79  "dragon",
80  "titan",
81  "speedboots",
82  "t_star1",
83  "girdle_con",
84  "god_finger",
85  "shining_finger",
86  "high_boots_w",
87  "plate_mail",
88  "robe",
89  "scale_mail",
90  "DShieldms",
91  "holy_shield",
92  NULL };
93  static const char *arch_results[] = {
94  "",
95  "(food+600)",
96  "(glowing)",
97  "",
98  "",
99  "",
100  "(slow movement)(wield weapon)(archer)(wear armour)(wear ring)",
101  "",
102  "(dam+6)(weapon speed 10)(Attacks: physical)",
103  "(wc+1)(dam+15)(Attacks: physical)",
104  "(Int+2)(Pow+2)(ac+2)(item_power +5)(magic+1)[color=#FF15CD](armour +5)[/color]",
105  "(Str+1)(Wis+2)(Cha+2)(dam+15)(item_power +25)(weapon speed 6)(Attacks: weaponmagic, blinding)[color=#930C76](resist magic +30)[/color][ul](resist drain +100)[/ul]",
106  "(dam+8)(weapon speed 8)(Attacks: physical)",
107  "(ac+1)[color=#FF15CD](armour +5)[/color]",
108  "(food+600)",
109  "(food+65)(slay vial_poison:poison)",
110  "",
111  "(extremely fast movement)(undead)(spellcaster)(Spell abilities:)(paralyze)(fear ability)(cause black death)(cause red death)(face of death)(meteor swarm)(hellfire)(burning hands)(large fireball)(mass confusion)(negative energy bolt)(negative energy ball)(slow ability)(Attacks: physical, cold)(armour +75)(resist magic +100)(resist fire +100)(resist electricity +90)(resist cold +100)(resist confusion +100)(resist acid +90)(resist drain +100)(resist weaponmagic +80)(resist ghosthit +100)(resist poison +100)(resist slow +100)(resist paralyzation +100)(resist fear +100)(resist cancellation +65)(resist depletion +100)(resist death +100)(resist chaos +100)(resist counterspell +65)(resist god power +80)(resist blindness +100)",
112  "(slow movement)(undead)(Attacks: physical)(resist cold +50)(resist fear +100)",
113  "",
114  "",
115  "(normal movement)(see invisible)(spellcaster)(Spell abilities:)(breath flame)(medium fireball ability)(fear ability)(Attacks: physical)(resist fire +100)(resist cold -100)(resist confusion -100)(resist fear +100)(resist blindness +50)",
116  "(fast movement)(see invisible)(wield weapon)(archer)(wear armour)(wear ring)(read scroll)(fires wand/rod/horn)(spellcaster)(Spell abilities:)(paralyze)(fear ability)(small lightning)(large lightning)(slow ability)(resist magic +50)(resist electricity +100)(resist fear +100)",
117  "(speed +6)(item_power +6)[color=#FF15CD](armour +3)[/color]",
118  "(dam+3)(weapon speed 2)(Attacks: physical)",
119  "(Con+2)(item_power +1)",
120  "(Str+2)(Dex-1)(dam+3)(item_power +2)[color=#FF15CD](armour +3)[/color]",
121  "(Str+2)(dam+3)(item_power +1)[color=#FF15CD](armour +3)[/color]",
122  "(Cha+1)(ac+1)(Spell regen penalty 4)[color=#FF15CD](armour +4)[/color](resist blindness +1)",
123  "(ac+5)(Max speed 0.70)(Spell regen penalty 30)[color=#FF15CD](armour +40)[/color]",
124  "(ac+1)(Max speed 1.20)",
125  "(ac+3)(Max speed 0.90)(Spell regen penalty 10)[color=#FF15CD](armour +20)[/color]",
126  "(Cha-5)(ac+7)(item_power +10)(reflect spells)(reflect missiles)[color=#FF15CD](armour +15)[/color][color=red](resist fire +30)[/color][ul](resist drain +100)[/ul](resist ghosthit +80)",
127  "(ac+4)(item_power +6)[color=#FF15CD](armour +10)[/color][ul](resist drain +100)[/ul](resist ghosthit +50)",
128  NULL };
129 
130  /* if you change the order, the result will quite certainly change, as the generation depends on the value returned
131  * by rand() - changing the order changes the item generated...
132  */
133  static const char *treasures[] = {
134  "random_knowledge",
135  "missile_weapons",
136  "random_talisman",
137  "rare_weapons",
138  "random_food",
139  "random_artifact",
140  "random_read",
141  "random_amulet",
142  "random_artifact",
143  "random_amulet",
144  "random_artifact",
145  "standard_old",
146  NULL
147  };
148  static const char *treasure_results[] = {
149  "",
150  "(wc+1)(dam+2)(Attacks: physical)",
151  "",
152  "(dam+6)(weapon speed 9)(Attacks: physical)",
153  "(food+70)",
154  "(Con+2)(Cha-1)(dam+10)(item_power +15)(weapon speed 5)(regeneration+1)(Attacks: weaponmagic)[ul](resist drain +100)[/ul][color=green](resist poison +30)[/color]",
155  "",
156  "",
157  "(Str+1)(dam+9)(item_power +20)(weapon speed 6)(regeneration+1)(Attacks: electricity, drain)[color=#930C76](resist magic +30)[/color][color=blue](resist electricity +30)[/color][ul](resist drain +100)[/ul]",
158  "",
159  "(Str+1)[color=#FF15CD](armour +3)[/color]",
160  "",
161  NULL
162  };
163 
164  for (check = 0; archs[check] != NULL; check++) {
165  test = cctk_create_game_object(archs[check]);
166  fail_unless(test != NULL, "couldn't create arch %s", archs[check]);
167  SET_FLAG(test, FLAG_IDENTIFIED);
168  buf = stringbuffer_finish(describe_item(test, NULL, 0, NULL));
169 
170  /* if you're adding items, uncomment that so make finding the good value easier. */
171  /*
172  if (strcmp(buf, arch_results[check]))
173  printf("describe_item(%s) returned \"%s\" instead of \"%s\"\n", archs[check], buf, arch_results[check]);
174  */
175 
176  fail_unless(strcmp(buf, arch_results[check]) == 0, "describe_item(%s) returned \"%s\" instead of \"%s\"", archs[check], buf, arch_results[check]);
177 
178  free(buf);
180  }
181 
182  /* we initialize the random generator to always be able to reproduce, and we use rand() in case RANDOM is something else. */
183  srand(100);
184  for (check = 0; treasures[check] != NULL; check++) {
185  list = find_treasurelist(treasures[check]);
186  fail_unless(list != NULL, "couldn't find treasure list %s", treasures[check]);
187  test = generate_treasure(list, 50);
188  fail_if(test == NULL, "couldn't create item from treasure list %s", treasures[check]);
189  SET_FLAG(test, FLAG_IDENTIFIED);
190  buf = stringbuffer_finish(describe_item(test, NULL, 0, NULL));
191 
192  /* if you're adding lists, uncomment that so make finding the good value easier. */
193  /*
194  if (strcmp(buf, treasure_results[check]))
195  printf("Item %d describe_item(treasure %s) returned \"%s\" instead of \"%s\"\n", check, treasures[check], buf, treasure_results[check]);
196  */
197 
198  fail_unless(strcmp(buf, treasure_results[check]) == 0, "describe_item(treasure %s) returned \"%s\" instead of \"%s\"", treasures[check], buf, treasure_results[check]);
199 
200  free(buf);
202 
203  }
204 }
205 END_TEST
206 
207 #define DESCRIBE_PATH_SAFE(retbuf, variable, name, len, maxlen) \
208  if (variable) { \
209  int i, j = 0; \
210  safe_strcat(retbuf, "(" name ": ", len, maxlen); \
211  for (i = 0; i < NRSPELLPATHS; i++) \
212  if (variable&(1<<i)) { \
213  if (j) \
214  safe_strcat(retbuf, ", ", len, maxlen); \
215  else \
216  j = 1; \
217  safe_strcat(retbuf, spellpathnames[i], len, maxlen); \
218  } \
219  safe_strcat(retbuf, ")", len, maxlen); \
220  }
221 
222 #define DESCRIBE_ABILITY_SAFE(retbuf, variable, name, len, maxlen) \
223  if (variable) { \
224  int i, j = 0; \
225  safe_strcat(retbuf, "(" name ": ", len, maxlen); \
226  for (i = 0; i < NROFATTACKS; i++) \
227  if (variable&(1<<i)) { \
228  if (j) \
229  safe_strcat(retbuf, ", ", len, maxlen); \
230  else \
231  j = 1; \
232  safe_strcat(retbuf, attacks[i], len, maxlen); \
233  } \
234  safe_strcat(retbuf, ")", len, maxlen); \
235  }
236 
237 static void old_describe_monster(const object *op, char *retbuf, size_t size) {
238  int i;
239  size_t len;
240 
241  retbuf[0] = '\0';
242 
243  /* Note that the resolution this provides for players really isn't
244  * very good. Any player with a speed greater than .67 will
245  * fall into the 'lightning fast movement' category.
246  */
247  if (FABS(op->speed) > MIN_ACTIVE_SPEED) {
248  switch ((int)((FABS(op->speed))*15)) {
249  case 0:
250  snprintf(retbuf, size, "(very slow movement)");
251  break;
252 
253  case 1:
254  snprintf(retbuf, size, "(slow movement)");
255  break;
256 
257  case 2:
258  snprintf(retbuf, size, "(normal movement)");
259  break;
260 
261  case 3:
262  case 4:
263  snprintf(retbuf, size, "(fast movement)");
264  break;
265 
266  case 5:
267  case 6:
268  snprintf(retbuf, size, "(very fast movement)");
269  break;
270 
271  case 7:
272  case 8:
273  case 9:
274  case 10:
275  snprintf(retbuf, size, "(extremely fast movement)");
276  break;
277 
278  default:
279  snprintf(retbuf, size, "(lightning fast movement)");
280  break;
281  }
282  }
283  if (QUERY_FLAG(op, FLAG_UNDEAD))
284  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(undead)");
286  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(see invisible)");
287  if (QUERY_FLAG(op, FLAG_USE_WEAPON))
288  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wield weapon)");
289  if (QUERY_FLAG(op, FLAG_USE_BOW))
290  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(archer)");
291  if (QUERY_FLAG(op, FLAG_USE_ARMOUR))
292  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wear armour)");
293  if (QUERY_FLAG(op, FLAG_USE_RING))
294  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(wear ring)");
295  if (QUERY_FLAG(op, FLAG_USE_SCROLL))
296  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(read scroll)");
297  if (QUERY_FLAG(op, FLAG_USE_RANGE))
298  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(fires wand/rod/horn)");
300  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(skill user)");
301  if (QUERY_FLAG(op, FLAG_CAST_SPELL))
302  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(spellcaster)");
303  if (QUERY_FLAG(op, FLAG_FRIENDLY))
304  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(friendly)");
305  if (QUERY_FLAG(op, FLAG_UNAGGRESSIVE))
306  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(unaggressive)");
307  if (QUERY_FLAG(op, FLAG_HITBACK))
308  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(hitback)");
309  if (QUERY_FLAG(op, FLAG_STEALTH))
310  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(stealthy)");
311  if (op->randomitems != NULL) {
312  treasure *t;
313  int first = 1;
314 
315  for (t = op->randomitems->items; t != NULL; t = t->next)
316  if (t->item && (t->item->clone.type == SPELL)) {
317  if (first) {
318  first = 0;
319  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(Spell abilities:)");
320  }
321  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(%s)", t->item->clone.name);
322  }
323  }
324  if (op->type == PLAYER) {
325  if (op->contr->digestion) {
326  if (op->contr->digestion != 0)
327  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(sustenance%+d)", op->contr->digestion);
328  }
329  if (op->contr->gen_grace) {
330  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(grace%+d)", op->contr->gen_grace);
331  }
332  if (op->contr->gen_sp) {
333  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(magic%+d)", op->contr->gen_sp);
334  }
335  if (op->contr->gen_hp) {
336  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(regeneration%+d)", op->contr->gen_hp);
337  }
338  if (op->stats.luck) {
339  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(luck%+d)", op->stats.luck);
340  }
341  }
342 
343  /* describe attacktypes */
344  len = strlen(retbuf);
345  if (is_dragon_pl(op)) {
346  /* for dragon players display the attacktypes from clawing skill
347  * Break apart the for loop - move the comparison checking down -
348  * this makes it more readable.
349  */
350  object *tmp;
351 
352  tmp = object_find_by_type_and_name(op, SKILL, "clawing");
353  if (tmp && tmp->attacktype != 0) {
354  DESCRIBE_ABILITY_SAFE(retbuf, tmp->attacktype, "Claws", &len, size);
355  } else {
356  DESCRIBE_ABILITY_SAFE(retbuf, op->attacktype, "Attacks", &len, size);
357  }
358  } else {
359  DESCRIBE_ABILITY_SAFE(retbuf, op->attacktype, "Attacks", &len, size);
360  }
361  DESCRIBE_PATH_SAFE(retbuf, op->path_attuned, "Attuned", &len, size);
362  DESCRIBE_PATH_SAFE(retbuf, op->path_repelled, "Repelled", &len, size);
363  DESCRIBE_PATH_SAFE(retbuf, op->path_denied, "Denied", &len, size);
364  for (i = 0; i < NROFATTACKS; i++) {
365  if (op->resist[i]) {
366  snprintf(retbuf+strlen(retbuf), size-strlen(retbuf), "(%s %+d)", resist_plus[i], op->resist[i]);
367  }
368  }
369 }
370 
371 START_TEST(test_describe_monster_rewrite) {
372  char buf[HUGE_BUF], *compat, *final;
373  archetype *arch;
374  object *ob;
375  player pl;
376 
377  memset(&pl, 0, sizeof(pl));
378 
379  for (arch = first_archetype; arch; arch = arch->next) {
380 
381  if (!QUERY_FLAG(&arch->clone, FLAG_MONSTER) && arch->clone.type != PLAYER)
382  continue;
383 
384  ob = object_create_arch(arch);
385  ob->contr = &pl;
386 
387  old_describe_monster(ob, buf, sizeof(buf));
388  compat = stringbuffer_finish(describe_item(ob, NULL, 0, NULL));
389  fail_unless(strcmp(buf, compat) == 0, "(compat) description change:\n%s\n === vs ===\n%s", buf, compat);
390  free(compat);
391 
392  final = stringbuffer_finish(describe_monster(ob, 0, NULL));
393 
394  fail_unless(strcmp(buf, final) == 0, "description change: \"%s\" vs \"%s\"", buf, final);
395  free(final);
397  }
398 
399 } END_TEST
400 
401 static Suite *item_suite(void) {
402  Suite *s = suite_create("item");
403  TCase *tc_core = tcase_create("Core");
404 
405  /*setup and teardown will be called before each test in testcase 'tc_core' */
406  tcase_add_checked_fixture(tc_core, setup, teardown);
407 
408  suite_add_tcase(s, tc_core);
409  tcase_add_test(tc_core, test_describe_item);
410  tcase_add_test(tc_core, test_describe_monster_rewrite);
411 
412  return s;
413 }
414 
415 int main(void) {
416 #ifndef __GLIBC__
417  /* This test makes calls into the common library, and that
418  * library makes calls to the random function. But the random function
419  * in different libraries return different results - GLIBC seems
420  * consistent - so far - but even that could change. But if GLIBC
421  * is not being used, almost certain in that case that the random
422  * numbers returned are different.
423  */
424  printf("Skipping item test - need glibc to get same results to check against\n");
425  return EXIT_SUCCESS;
426 #else
427  int nf;
428  Suite *s = item_suite();
429  SRunner *sr = srunner_create(s);
430 
431  /* to debug, uncomment this line */
432  srunner_set_fork_status(sr, CK_NOFORK);
433 
434  srunner_set_xml(sr, LOGDIR "/unit/common/item.xml");
435  srunner_set_log(sr, LOGDIR "/unit/common/item.out");
436  srunner_run_all(sr, CK_ENV); /*verbosity from env variable*/
437  nf = srunner_ntests_failed(sr);
438  srunner_free(sr);
439  return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
440 #endif
441 }
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
Definition: object.c:3999
One player.
Definition: player.h:92
int16_t gen_hp
Bonuses to regeneration speed of hp.
Definition: player.h:113
treasureliststruct represents one logical group of items to be generated together.
Definition: treasure.h:82
#define FLAG_HITBACK
Object will hit back when hit.
Definition: define.h:267
#define FLAG_USE_SCROLL
(Monster) can read scroll
Definition: define.h:292
#define SET_FLAG(xyz, p)
Definition: define.h:223
#define FABS(x)
Decstations have trouble with fabs()...
Definition: define.h:22
#define FLAG_USE_ARMOUR
(Monster) can wear armour/shield/helmet
Definition: define.h:296
void cctk_setdatadir(const char *datadir)
#define DESCRIBE_ABILITY_SAFE(retbuf, variable, name, len, maxlen)
Definition: check_item.c:222
#define FLAG_FRIENDLY
Will help players.
Definition: define.h:246
int16_t gen_grace
Bonuses to regeneration speed of grace.
Definition: player.h:116
treasurelist * find_treasurelist(const char *name)
Searches for the given treasurelist in the globally linked list of treasurelists which has been built...
Definition: treasure.c:292
#define HUGE_BUF
Used for messages - some can be quite long.
Definition: define.h:37
struct treasureliststruct * randomitems
Items to be generated.
Definition: object.h:385
object clone
An object from which to do object_copy()
Definition: object.h:470
#define FLAG_STEALTH
Will wake monsters with less range.
Definition: define.h:313
#define FLAG_USE_WEAPON
(Monster) can wield weapons
Definition: define.h:297
#define FREE_OBJ_NO_DESTROY_CALLBACK
Do not run the destroy callback.
Definition: object.h:533
treasure is one element in a linked list, which together consist of a complete treasure-list.
Definition: treasure.h:63
uint32_t path_attuned
Paths the object is attuned to.
Definition: object.h:343
Global type definitions and header inclusions.
uint32_t path_repelled
Paths the object is repelled from.
Definition: object.h:344
object * cctk_create_game_object(const char *archname)
Initialize a simple object.
#define FLAG_USE_RING
(Monster) can use rings, boots, gauntlets, etc
Definition: define.h:298
The archetype structure is a set of rules on how to generate and manipulate objects which point to ar...
Definition: object.h:465
static END_TEST Suite * item_suite(void)
Definition: check_item.c:401
struct archt * item
Which item this link can be.
Definition: treasure.h:64
void init_formulae(void)
Builds up the lists of formula from the file in the libdir.
Definition: recipe.c:161
int main(void)
Definition: check_item.c:415
#define FLAG_SEE_INVISIBLE
Will see invisible player.
Definition: define.h:253
#define FLAG_UNDEAD
Monster is undead.
Definition: define.h:270
#define DESCRIBE_PATH_SAFE(retbuf, variable, name, len, maxlen)
Definition: check_item.c:207
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
Definition: object.c:1368
#define FREE_OBJ_FREE_INVENTORY
Free inventory objects; if not set, drop inventory.
Definition: object.h:532
uint32_t path_denied
Paths the object is denied access to.
Definition: object.h:345
int16_t gen_sp
Bonuses to regeneration speed of sp.
Definition: player.h:114
Defines for loader.l / loader.c.
#define FLAG_CAN_USE_SKILL
The monster can use skills.
Definition: define.h:322
#define FLAG_UNAGGRESSIVE
Monster doesn&#39;t attack players.
Definition: define.h:272
#define FLAG_USE_RANGE
(Monster) can apply and use range items
Definition: define.h:293
int is_dragon_pl(const object *op)
Checks if player is a dragon.
Definition: player.c:114
#define snprintf
Definition: win32.h:46
#define FLAG_IDENTIFIED
Player knows full info about item.
Definition: define.h:261
const char * name
The name of the object, obviously...
Definition: object.h:311
void cctk_setlog(const char *logfile)
set the logdir to use
struct pl * contr
Pointer to the player which control this object.
Definition: object.h:276
static void teardown(void)
Definition: check_item.c:47
int8_t luck
Affects thaco and ac from time to time.
Definition: living.h:38
float speed
The overall speed of this object.
Definition: object.h:328
See Spell.
Definition: object.h:214
#define QUERY_FLAG(xyz, p)
Definition: define.h:225
object * object_create_arch(archetype *at)
Create a full object using the given archetype.
Definition: arch.c:736
#define FLAG_CAST_SPELL
(Monster) can learn and cast spells
Definition: define.h:291
struct treasurestruct * items
Items in this list, linked.
Definition: treasure.h:90
int16_t resist[NROFATTACKS]
Resistance adjustments for attacks.
Definition: object.h:341
See Player.
Definition: object.h:107
uint32_t attacktype
Bitmask of attacks this object does.
Definition: object.h:342
StringBuffer * describe_item(const object *op, const object *owner, int use_media_tags, StringBuffer *buf)
Describes an item, in all its details.
Definition: item.c:980
Also see SKILL_TOOL (74) below.
Definition: object.h:143
StringBuffer * describe_monster(const object *op, int use_media_tags, StringBuffer *buf)
Describes a monster.
Definition: item.c:806
living stats
Str, Con, Dex, etc.
Definition: object.h:368
uint8_t type
PLAYER, BULLET, etc.
Definition: object.h:338
START_TEST(test_describe_item)
Definition: check_item.c:51
void object_free2(object *ob, int flags)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
Definition: object.c:1391
struct archt * next
Next archetype in a linked list.
Definition: object.h:467
static void setup(void)
Definition: check_item.c:39
#define NROFATTACKS
Definition: attack.h:17
EXTERN const char *const resist_plus[NROFATTACKS]
Definition: attack.h:136
void init_gods(void)
This takes a look at all of the archetypes to find the objects which correspond to the GODS (type GOD...
Definition: holy.c:53
#define MIN_ACTIVE_SPEED
Cut off point of when an object is put on the active list or not.
Definition: define.h:674
#define FLAG_MONSTER
Will attack players.
Definition: define.h:245
void cctk_init_std_archetypes(void)
Loads up to archetype initialisation using standard crossfire files in source tree.
static void old_describe_monster(const object *op, char *retbuf, size_t size)
Definition: check_item.c:237
object * generate_treasure(treasurelist *t, int difficulty)
Generate a treasure from a list generating a single item.
Definition: treasure.c:518
struct treasurestruct * next
Next treasure-item in a linked list.
Definition: treasure.h:66
EXTERN archetype * first_archetype
First archetype.
Definition: global.h:122
int16_t digestion
Any bonuses/penalties to digestion.
Definition: player.h:112
#define FLAG_USE_BOW
(Monster) can apply and fire bows
Definition: define.h:294
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
Definition: stringbuffer.c:76