Crossfire Server, Trunk  R21524
artifact.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
20 #include "global.h"
21 
22 #include <stdlib.h>
23 #include <string.h>
24 #include <ctype.h>
25 
26 #include "loader.h"
27 
40  artifactlist *tl = (artifactlist *)malloc(sizeof(artifactlist));
41  if (tl == NULL)
43  tl->next = NULL;
44  tl->items = NULL;
45  tl->total_chance = 0;
46  return tl;
47 }
48 
59  artifact *t = (artifact *)malloc(sizeof(artifact));
60  if (t == NULL)
62  t->item = NULL;
63  t->next = NULL;
64  t->chance = 0;
65  t->difficulty = 0;
66  t->allowed = NULL;
67  t->allowed_size = 0;
68  return t;
69 }
70 
77 static void free_charlinks(linked_char *lc) {
78  if (lc->next)
79  free_charlinks(lc->next);
80  free(lc);
81 }
82 
95 static void free_artifact(artifact *at) {
96  object *next;
97 
98  if (at->next)
99  free_artifact(at->next);
100  if (at->allowed)
101  free_charlinks(at->allowed);
102  while (at->item) {
103  next = at->item->next;
104  if (at->item->name)
105  free_string(at->item->name);
106  if (at->item->name_pl)
107  free_string(at->item->name_pl);
108  if (at->item->msg)
109  free_string(at->item->msg);
110  if (at->item->title)
111  free_string(at->item->title);
113  free(at->item);
114  at->item = next;
115  }
116  free(at);
117 }
118 
125 static void free_artifactlist(artifactlist *al) {
126  artifactlist *nextal;
127 
128  for (; al != NULL; al = nextal) {
129  nextal = al->next;
130  if (al->items) {
131  free_artifact(al->items);
132  }
133  free(al);
134  }
135 }
136 
140 void free_all_artifacts(void) {
142  first_artifactlist = NULL;
143 }
144 
146 #define ARTIFACT_TRIES 2
147 
155 void generate_artifact(object *op, int difficulty) {
156  const artifactlist *al;
157  const artifact *art;
158  int i;
159 
160  al = find_artifactlist(op->type);
161 
162  if (al == NULL) {
163  return;
164  }
165 
166  for (i = 0; i < ARTIFACT_TRIES; i++) {
167  int roll = RANDOM()%al->total_chance;
168 
169  for (art = al->items; art != NULL; art = art->next) {
170  roll -= art->chance;
171  if (roll < 0)
172  break;
173  }
174 
175  if (art == NULL || roll >= 0) {
176  LOG(llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type);
177  return;
178  }
179  if (!strcmp(art->item->name, "NONE"))
180  return;
181  if (FABS(op->magic) < art->item->magic)
182  continue; /* Not magic enough to be this item */
183 
184  /* Map difficulty not high enough */
185  if (difficulty < art->difficulty)
186  continue;
187 
188  if (!legal_artifact_combination(op, art)) {
189 #ifdef TREASURE_VERBOSE
190  LOG(llevDebug, "%s of %s was not a legal combination.\n", op->name, art->item->name);
191 #endif
192  continue;
193  }
194  give_artifact_abilities(op, art->item);
195  return;
196  }
197 }
198 
203 void give_artifact_abilities(object *op, const object *artifact) {
204  char new_name[MAX_BUF];
205 
206  snprintf(new_name, sizeof(new_name), "of %s", artifact->name);
207  if (op->title)
208  free_string(op->title);
209  op->title = add_string(new_name);
210  if (op->artifact)
211  free_string(op->artifact);
212  op->artifact = add_refcount(artifact->name);
213  add_abilities(op, artifact); /* Give out the bonuses */
214 
215  return;
216 }
217 
221 int legal_artifact_combination(const object *op, const artifact *art) {
222  int neg, success = 0;
223  linked_char *tmp;
224  const char *name;
225 
226  if (art->allowed == (linked_char *)NULL)
227  return 1; /* Ie, "all" */
228  for (tmp = art->allowed; tmp; tmp = tmp->next) {
229 #ifdef TREASURE_VERBOSE
230  LOG(llevDebug, "legal_art: %s\n", tmp->name);
231 #endif
232  if (*tmp->name == '!') {
233  name = tmp->name+1;
234  neg = 1;
235  } else {
236  name = tmp->name;
237  neg = 0;
238  }
239 
240  /* If we match name, then return the opposite of 'neg' */
241  if (!strcmp(name, op->name) || (op->arch && !strcmp(name, op->arch->name)))
242  return !neg;
243 
244  /* Set success as true, since if the match was an inverse, it means
245  * everything is allowed except what we match
246  */
247  else if (neg)
248  success = 1;
249  }
250  return success;
251 }
252 
260 static void compute_face_name(char* buf, size_t size, const char* name, const char* suffix)
261 {
262  const char* dot = name + strlen(name) - 1;
263  while (dot > name && (isdigit(*dot) || (*dot == 'x')))
264  {
265  dot--;
266  }
267 
268  if (*dot == '.')
269  {
270  buf[0] = '0';
271  strlcpy(buf, name, dot - name + 1);
272  snprintf(buf + strlen(buf), size - strlen(buf), "_%s%s", suffix, dot);
273  }
274  else
275  {
276  snprintf(buf, size, "%s_%s", name, suffix);
277  }
278 }
279 
284 void add_abilities(object *op, const object *change) {
285  int i, tmp;
286  char buf[MAX_BUF];
287  sstring key;
288 
289  if (change->face != blank_face) {
290 #ifdef TREASURE_VERBOSE
291  LOG(llevDebug, "FACE: %d\n", change->face->number);
292 #endif
293 
294  object_set_value(op, "identified_face", change->face->name, 1);
295  } else if ((key = object_get_value(change, "face_suffix")) != NULL) {
296  const Face* face;
297  compute_face_name(buf, sizeof(buf), op->face->name, key);
298  face = find_face(buf, op->face);
299  object_set_value(op, "identified_face", face->name, 1);
300  }
301  if (QUERY_FLAG(change, FLAG_CLIENT_ANIM_RANDOM)) {
302  object_set_value(op, "identified_anim_random", "1", 1);
303  }
304  if (change->anim_speed > 0) {
305  snprintf(buf, sizeof(buf), "%d", change->anim_speed);
306  object_set_value(op, "identified_anim_speed", buf, 1);
307  }
308  if (change->animation != NULL && op->arch != NULL) {
309  /* op->arch can be NULL when called from artifact_msg(). */
310  object_set_value(op, "identified_animation", change->animation->name, 1);
311  } else if (op->animation != NULL && (key = object_get_value(change, "animation_suffix")) != NULL) {
312  const Animations *anim;
313  snprintf(buf, sizeof(buf), "%s_%s", op->animation->name, key);
314  anim = try_find_animation(buf);
315  if (anim != NULL) {
316  object_set_value(op, "identified_animation", anim->name, 1);
317  }
318  }
319 
332  if (op->arch && (is_identified(op) || QUERY_FLAG(change, FLAG_IDENTIFIED)))
334 
335  for (i = 0; i < NUM_STATS; i++)
336  change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));
337 
338  op->attacktype |= change->attacktype;
339  op->path_attuned |= change->path_attuned;
340  op->path_repelled |= change->path_repelled;
341  op->path_denied |= change->path_denied;
342  op->move_type |= change->move_type;
343  op->stats.luck += change->stats.luck;
344 
345  if (QUERY_FLAG(change, FLAG_CURSED))
346  SET_FLAG(op, FLAG_CURSED);
347  if (QUERY_FLAG(change, FLAG_DAMNED))
348  SET_FLAG(op, FLAG_DAMNED);
349  if ((QUERY_FLAG(change, FLAG_CURSED) || QUERY_FLAG(change, FLAG_DAMNED))
350  && op->magic > 0)
351  set_abs_magic(op, -op->magic);
352 
353  if (QUERY_FLAG(change, FLAG_LIFESAVE))
354  SET_FLAG(op, FLAG_LIFESAVE);
355  if (QUERY_FLAG(change, FLAG_REFL_SPELL))
357  if (QUERY_FLAG(change, FLAG_STEALTH))
358  SET_FLAG(op, FLAG_STEALTH);
359  if (QUERY_FLAG(change, FLAG_XRAYS))
360  SET_FLAG(op, FLAG_XRAYS);
361  if (QUERY_FLAG(change, FLAG_BLIND))
362  SET_FLAG(op, FLAG_BLIND);
363  if (QUERY_FLAG(change, FLAG_CONFUSED))
364  SET_FLAG(op, FLAG_CONFUSED);
365  if (QUERY_FLAG(change, FLAG_SEE_IN_DARK))
367  if (QUERY_FLAG(change, FLAG_REFL_MISSILE))
369  if (QUERY_FLAG(change, FLAG_MAKE_INVIS))
371 
372  if (QUERY_FLAG(change, FLAG_STAND_STILL)) {
374  /* so artifacts will join */
375  if (!QUERY_FLAG(op, FLAG_ALIVE))
376  op->speed = 0.0;
378  }
379  if (change->nrof)
380  op->nrof = RANDOM()%((int)change->nrof)+1;
381  op->stats.exp += change->stats.exp; /* Speed modifier */
382  op->stats.wc += change->stats.wc;
383  op->stats.ac += change->stats.ac;
384 
385  if (change->other_arch) {
386  /* Basically, for horns & potions, the other_arch field is the spell
387  * to cast. So convert that to into a spell and put it into
388  * this object.
389  */
390  if (op->type == ROD || op->type == POTION) {
391  object *tmp_obj;
392 
393  /* Remove any spells this object currently has in it */
394  while (op->inv) {
395  tmp_obj = op->inv;
396  object_remove(tmp_obj);
398  }
399  tmp_obj = arch_to_object(change->other_arch);
400  /* This is an artifact, so this function will be called at load time,
401  * thus we don't need to keep the inventory */
402  SET_FLAG(tmp_obj, FLAG_NO_SAVE);
403  object_insert_in_ob(tmp_obj, op);
404  }
405  /* No harm setting this for potions/horns */
406  op->other_arch = change->other_arch;
407  }
408 
409  if (change->stats.hp < 0)
410  op->stats.hp = -change->stats.hp;
411  else
412  op->stats.hp += change->stats.hp;
413  if (change->stats.maxhp < 0)
414  op->stats.maxhp = -change->stats.maxhp;
415  else
416  op->stats.maxhp += change->stats.maxhp;
417  if (change->stats.sp < 0)
418  op->stats.sp = -change->stats.sp;
419  else
420  op->stats.sp += change->stats.sp;
421  if (change->stats.maxsp < 0)
422  op->stats.maxsp = -change->stats.maxsp;
423  else
424  op->stats.maxsp += change->stats.maxsp;
425  if (change->stats.food < 0)
426  op->stats.food = -(change->stats.food);
427  else
428  op->stats.food += change->stats.food;
429  if (change->level < 0)
430  op->level = -(change->level);
431  else
432  op->level += change->level;
433 
434  op->item_power = change->item_power;
435 
436  for (i = 0; i < NROFATTACKS; i++) {
437  if (change->resist[i]) {
438  op->resist[i] += change->resist[i];
439  }
440  }
441  if (change->stats.dam) {
442  if (change->stats.dam < 0)
443  op->stats.dam = (-change->stats.dam);
444  else if (op->stats.dam) {
445  tmp = (int)(((int)op->stats.dam*(int)change->stats.dam)/10);
446  if (tmp == op->stats.dam) {
447  if (change->stats.dam < 10)
448  op->stats.dam--;
449  else
450  op->stats.dam++;
451  } else
452  op->stats.dam = tmp;
453  }
454  }
455  if (change->weight) {
456  if (change->weight < 0)
457  op->weight = (-change->weight);
458  else
459  op->weight = (op->weight*(change->weight))/100;
460  }
461  if (change->last_sp) {
462  if (change->last_sp < 0)
463  op->last_sp = (-change->last_sp);
464  else
465  op->last_sp = (signed char)(((int)op->last_sp*(int)change->last_sp)/(int)100);
466  }
467  if (change->gen_sp_armour) {
468  if (change->gen_sp_armour < 0)
469  op->gen_sp_armour = (-change->gen_sp_armour);
470  else
471  op->gen_sp_armour = (signed char)(((int)op->gen_sp_armour*((int)change->gen_sp_armour))/(int)100);
472  }
473  op->value *= change->value;
474 
475  if (change->material)
476  op->material = change->material;
477 
478  if (change->materialname) {
479  if (op->materialname)
481  op->materialname = add_refcount(change->materialname);
482  }
483 
484  if (change->slaying) {
485  if (op->slaying)
486  free_string(op->slaying);
487  op->slaying = add_refcount(change->slaying);
488  }
489  if (change->race) {
490  if (op->race)
491  free_string(op->race);
492  op->race = add_refcount(change->race);
493  }
494  if (change->msg)
495  object_set_msg(op, change->msg);
496 
497  if (change->inv) {
498  object *copy;
499 
500  FOR_INV_PREPARE(change, inv) {
501  copy = object_new();
502  object_copy(inv, copy);
503  object_insert_in_ob(copy, op);
504  } FOR_INV_FINISH();
505  }
506 }
507 
517  artifactlist *al;
518 
519  for (al = first_artifactlist; al != NULL; al = al->next)
520  if (al->type == type)
521  return al;
522  return NULL;
523 }
524 
529 void init_artifacts(void) {
530  static int has_been_inited = 0;
531  FILE *fp;
532  char filename[MAX_BUF], buf[HUGE_BUF], *cp, *next;
533  artifact *art = NULL;
534  linked_char *tmp;
535  int value;
536  artifactlist *al;
537  archetype dummy_archetype;
538 
539  memset(&dummy_archetype, 0, sizeof(archetype));
540 
541  if (has_been_inited)
542  return;
543  else
544  has_been_inited = 1;
545 
546  artifact_init = 1;
547 
548  snprintf(filename, sizeof(filename), "%s/artifacts", settings.datadir);
549  LOG(llevDebug, "Reading artifacts from %s...\n", filename);
550  if ((fp = fopen(filename, "r")) == NULL) {
551  LOG(llevError, "Can't open %s.\n", filename);
552  return;
553  }
554 
555  while (fgets(buf, HUGE_BUF, fp) != NULL) {
556  if (*buf == '#')
557  continue;
558  if ((cp = strchr(buf, '\n')) != NULL)
559  *cp = '\0';
560  cp = buf;
561  while (*cp == ' ') /* Skip blanks */
562  cp++;
563  if (*cp == '\0')
564  continue;
565 
566  if (!strncmp(cp, "Allowed", 7)) {
567  if (art == NULL) {
568  art = get_empty_artifact();
569  nrofartifacts++;
570  }
571 
572  cp = strchr(cp, ' ')+1;
573  while (*(cp+strlen(cp)-1) == ' ')
574  cp[strlen(cp)-1] = '\0';
575 
576  if (!strcmp(cp, "all"))
577  continue;
578 
579  do {
580  while (*cp == ' ')
581  cp++;
582  nrofallowedstr++;
583  if ((next = strchr(cp, ',')) != NULL)
584  *(next++) = '\0';
585  tmp = (linked_char *)malloc(sizeof(linked_char));
586  tmp->name = add_string(cp);
587  tmp->next = art->allowed;
588  art->allowed = tmp;
589  art->allowed_size++;
590  } while ((cp = next) != NULL);
591  } else if (sscanf(cp, "chance %d", &value))
592  art->chance = (uint16_t)value;
593  else if (sscanf(cp, "difficulty %d", &value))
594  art->difficulty = (uint8_t)value;
595  else if (!strncmp(cp, "Object", 6)) {
596  art->item = (object *)calloc(1, sizeof(object));
597  if (art->item == NULL) {
598  LOG(llevError, "init_artifacts: memory allocation failure.\n");
599  abort();
600  }
601  object_reset(art->item);
602  art->item->arch = &dummy_archetype;
603  if (!load_object(fp, art->item, LO_LINEMODE, MAP_STYLE))
604  LOG(llevError, "Init_Artifacts: Could not load object.\n");
605  art->item->arch = NULL;
606  art->item->name = add_string((strchr(cp, ' ')+1));
608  if (al == NULL) {
609  al = get_empty_artifactlist();
610  al->type = art->item->type;
611  al->next = first_artifactlist;
612  first_artifactlist = al;
613  }
614  art->next = al->items;
615  al->items = art;
616  art = NULL;
617  } else
618  LOG(llevError, "Unknown input in artifact file: %s\n", buf);
619  }
620 
621  fclose(fp);
622 
623  for (al = first_artifactlist; al != NULL; al = al->next) {
624  for (art = al->items; art != NULL; art = art->next) {
625  if (!art->chance)
626  LOG(llevDebug, "Artifact with no chance: %s\n", art->item->name);
627  else
628  al->total_chance += art->chance;
629  }
630 #if 0
631  LOG(llevDebug, "Artifact list type %d has %d total chance\n", al->type, al->total_chance);
632 #endif
633  }
634 
635  LOG(llevDebug, "done artifacts.\n");
636  artifact_init = 0;
637 }
638 
646 const artifactlist *find_artifactlist(int type) {
647  return find_artifactlist_internal(type);
648 }
649 
656 const artifact *find_artifact(const object *op, const char *name) {
657  artifactlist *list;
658  artifact *at;
659  sstring sname = find_string(name);
660 
661  if (sname == NULL)
662  return NULL;
663 
664  list = find_artifactlist_internal(op->type);
665  if (list == NULL)
666  return NULL;
667 
668  for (at = list->items; at != NULL; at = at->next) {
669  if (at->item->name == sname && legal_artifact_combination(op, at))
670  return at;
671  }
672 
673  return NULL;
674 }
675 
682 void dump_artifacts(void) {
683  artifactlist *al;
684  artifact *art;
685  linked_char *next;
686 
687  fprintf(logfile, "\n");
688  for (al = first_artifactlist; al != NULL; al = al->next) {
689  fprintf(logfile, "Artifact has type %d, total_chance=%d\n", al->type, al->total_chance);
690  for (art = al->items; art != NULL; art = art->next) {
691  fprintf(logfile, "Artifact %-30s Difficulty %3d Chance %5d\n", art->item->name, art->difficulty, art->chance);
692  if (art->allowed != NULL) {
693  fprintf(logfile, "\tAllowed combinations:");
694  for (next = art->allowed; next != NULL; next = next->next)
695  fprintf(logfile, "%s,", next->name);
696  fprintf(logfile, "\n");
697  }
698  }
699  }
700  fprintf(logfile, "\n");
701 }
702 
708 unsigned artifact_get_face(const artifact *art) {
709  const archetype *arch = first_archetype;
710 
711  if (art->item->face != blank_face && art->item->face != NULL)
712  return art->item->face->number;
713 
714  if (art->allowed_size > 0) {
715  if (art->allowed->name[0] == '!') {
716  linked_char *allowed;
717  while (arch) {
718  if (arch->clone.type != art->item->type)
719  arch = arch->next;
720 
721  for (allowed = art->allowed; allowed != NULL; allowed = allowed->next) {
722  if (strcmp(arch->name, allowed->name + 1) == 0) {
723  break;
724  }
725  }
726  if (allowed != NULL)
727  continue;
728 
729  if (arch->clone.face == NULL)
730  continue;
731  return arch->clone.face->number;
732  }
733  return (unsigned)-1;
734  } else {
735  const archetype *arch = find_archetype(art->allowed->name);
736  if (arch != NULL)
737  return arch->clone.face->number;
738  return (unsigned)-1;
739  }
740  }
741 
742  while (arch != NULL) {
743  if (arch->clone.type == art->item->type && arch->clone.face != NULL)
744  return arch->clone.face->number;
745 
746  arch = arch->next;
747  }
748  return (unsigned)-1;
749 }
EXTERN FILE * logfile
Definition: global.h:140
static artifactlist * find_artifactlist_internal(int type)
Definition: artifact.c:516
#define FLAG_SEE_IN_DARK
Definition: define.h:338
archetype * find_archetype(const char *name)
Definition: arch.c:696
#define FLAG_DAMNED
Definition: define.h:318
int8_t ac
Definition: living.h:38
#define MAP_STYLE
Definition: map.h:98
MoveType move_type
Definition: object.h:426
#define LO_LINEMODE
Definition: loader.h:16
const char * race
Definition: object.h:318
void object_give_identified_properties(object *op)
Definition: item.c:1321
#define SET_FLAG(xyz, p)
Definition: define.h:223
sstring add_refcount(sstring str)
Definition: shstr.c:210
const artifactlist * find_artifactlist(int type)
Definition: artifact.c:646
#define FABS(x)
Definition: define.h:22
unsigned artifact_get_face(const artifact *art)
Definition: artifact.c:708
unsigned char uint8_t
Definition: win32.h:161
uint16_t material
Definition: object.h:348
const char * name
Definition: face.h:26
uint8_t anim_speed
Definition: object.h:419
sstring artifact
Definition: object.h:314
#define FLAG_STAND_STILL
Definition: define.h:309
const Face * blank_face
Definition: image.c:39
void fatal(enum fatal_error err)
Definition: utils.c:597
struct artifactstruct * items
Definition: artifact.h:30
Definition: face.h:14
void free_string(sstring str)
Definition: shstr.c:280
const Animations * try_find_animation(const char *name)
Definition: anim.c:188
#define HUGE_BUF
Definition: define.h:37
const char * object_get_value(const object *op, const char *const key)
Definition: object.c:4135
object clone
Definition: object.h:472
const char * slaying
Definition: object.h:319
const char * name
Definition: face.h:19
#define FLAG_CONFUSED
Definition: define.h:312
int32_t last_sp
Definition: object.h:359
#define FLAG_STEALTH
Definition: define.h:313
Definition: object.h:109
int64_t exp
Definition: living.h:47
int8_t get_attr_value(const living *stats, int attr)
Definition: living.c:314
uint32_t path_attuned
Definition: object.h:344
int16_t sp
Definition: living.h:42
static void free_artifactlist(artifactlist *al)
Definition: artifact.c:125
uint32_t path_repelled
Definition: object.h:345
struct archt * other_arch
Definition: object.h:415
Definition: object.h:467
int16_t maxsp
Definition: living.h:43
int16_t hp
Definition: living.h:40
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:4258
void object_free_drop_inventory(object *ob)
Definition: object.c:1325
const char * title
Definition: object.h:317
static artifactlist * get_empty_artifactlist(void)
Definition: artifact.c:39
int16_t maxhp
Definition: living.h:41
sstring find_string(const char *str)
Definition: shstr.c:236
#define FLAG_CLIENT_ANIM_RANDOM
Definition: define.h:241
uint32_t path_denied
Definition: object.h:346
uint16_t total_chance
Definition: artifact.h:28
#define FLAG_ALIVE
Definition: define.h:230
#define FLAG_REFL_SPELL
Definition: define.h:275
int legal_artifact_combination(const object *op, const artifact *art)
Definition: artifact.c:221
int is_identified(const object *op)
Definition: item.c:1313
struct artifactliststruct * next
Definition: artifact.h:29
object * object_new(void)
Definition: object.c:1019
const char * name_pl
Definition: object.h:315
object * object_insert_in_ob(object *op, object *where)
Definition: object.c:2601
const char * materialname
Definition: object.h:347
int32_t weight
Definition: object.h:366
#define snprintf
Definition: win32.h:46
void dump_artifacts(void)
Definition: artifact.c:682
#define FLAG_NO_SAVE
Definition: define.h:244
uint8_t difficulty
Definition: artifact.h:17
const artifact * find_artifact(const object *op, const char *name)
Definition: artifact.c:656
struct linked_char * next
Definition: global.h:88
#define FLAG_IDENTIFIED
Definition: define.h:261
#define FOR_INV_FINISH()
Definition: define.h:715
int16_t dam
Definition: living.h:46
void change_attr_value(living *stats, int attr, int8_t value)
Definition: living.c:265
const char * name
Definition: object.h:311
linked_char * allowed
Definition: artifact.h:19
int8_t gen_sp_armour
Definition: object.h:364
void object_reset(object *op)
Definition: object.c:698
uint32_t nrof
Definition: object.h:333
Definition: object.h:111
int8_t item_power
Definition: object.h:363
#define FLAG_XRAYS
Definition: define.h:301
uint16_t number
Definition: face.h:15
int8_t luck
Definition: living.h:39
float speed
Definition: object.h:328
#define QUERY_FLAG(xyz, p)
Definition: define.h:225
#define CLEAR_FLAG(xyz, p)
Definition: define.h:224
EXTERN artifactlist * first_artifactlist
Definition: global.h:119
#define ARTIFACT_TRIES
Definition: artifact.c:146
#define MAX_BUF
Definition: define.h:35
const Animations * animation
Definition: object.h:418
void generate_artifact(object *op, int difficulty)
Definition: artifact.c:155
void give_artifact_abilities(object *op, const object *artifact)
Definition: artifact.c:203
int8_t wc
Definition: living.h:37
unsigned short uint16_t
Definition: win32.h:163
void free_all_artifacts(void)
Definition: artifact.c:140
struct obj * next
Definition: object.h:277
int16_t resist[NROFATTACKS]
Definition: object.h:342
EXTERN long nrofartifacts
Definition: global.h:144
const char * sstring
Definition: global.h:40
#define FLAG_CURSED
Definition: define.h:317
const char * datadir
Definition: global.h:247
EXTERN long nrofallowedstr
Definition: global.h:145
#define FLAG_ANIMATE
Definition: define.h:242
static void free_artifact(artifact *at)
Definition: artifact.c:95
const char * name
Definition: global.h:87
static void free_charlinks(linked_char *lc)
Definition: artifact.c:77
uint32_t attacktype
Definition: object.h:343
#define FLAG_BLIND
Definition: define.h:337
#define RANDOM()
Definition: define.h:682
living stats
Definition: object.h:369
int load_object(FILE *fp, object *op, int bufstate, int map_flags)
struct archt * arch
Definition: object.h:414
int allowed_size
Definition: artifact.h:20
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
Definition: artifact.c:260
uint8_t type
Definition: object.h:339
struct Settings settings
Definition: init.c:39
static artifact * get_empty_artifact(void)
Definition: artifact.c:58
struct archt * next
Definition: object.h:469
#define NROFATTACKS
Definition: attack.h:17
#define FLAG_LIFESAVE
Definition: define.h:306
void add_abilities(object *op, const object *change)
Definition: artifact.c:284
const char * msg
Definition: object.h:322
#define FLAG_MAKE_INVIS
Definition: define.h:329
sstring add_string(const char *str)
Definition: shstr.c:124
int artifact_init
Definition: artifact.c:28
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.c:826
struct obj * inv
Definition: object.h:290
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
void set_abs_magic(object *op, int magic)
Definition: treasure.c:834
void object_set_msg(object *op, const char *msg)
Definition: object.c:4569
object * item
Definition: artifact.h:15
uint16_t chance
Definition: artifact.h:16
const Face * find_face(const char *name, const Face *error)
Definition: image.c:316
const Face * face
Definition: object.h:332
#define FLAG_REFL_MISSILE
Definition: define.h:273
void object_free_key_values(object *op)
Definition: object.c:718
int16_t level
Definition: object.h:352
EXTERN archetype * first_archetype
Definition: global.h:120
object * arch_to_object(archetype *at)
Definition: arch.c:572
void object_update_speed(object *op)
Definition: object.c:1095
int32_t value
Definition: object.h:351
int8_t magic
Definition: object.h:349
const char * name
Definition: object.h:468
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.c:366
void init_artifacts(void)
Definition: artifact.c:529
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:708
void object_remove(object *op)
Definition: object.c:1587
struct artifactstruct * next
Definition: artifact.h:18
int32_t food
Definition: living.h:48