Crossfire Server, Trunk
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 
80 static void free_artifact(artifact *at) {
81  object *next;
82 
83  if (at->next)
84  free_artifact(at->next);
85  if (at->allowed)
87  while (at->item) {
88  next = at->item->next;
89  if (at->item->name)
90  free_string(at->item->name);
91  if (at->item->name_pl)
92  free_string(at->item->name_pl);
93  if (at->item->msg)
94  free_string(at->item->msg);
95  if (at->item->title)
96  free_string(at->item->title);
98  free(at->item);
99  at->item = next;
100  }
101  free(at);
102 }
103 
110 static void free_artifactlist(artifactlist *al) {
111  artifactlist *nextal;
112 
113  for (; al != NULL; al = nextal) {
114  nextal = al->next;
115  if (al->items) {
116  free_artifact(al->items);
117  }
118  free(al);
119  }
120 }
121 
125 void free_all_artifacts(void) {
127  first_artifactlist = NULL;
128 }
129 
131 #define ARTIFACT_TRIES 2
132 
143 void generate_artifact(object *op, int difficulty) {
144  const artifactlist *al;
145  const artifact *art;
146  int i;
147 
148  al = find_artifactlist(op->type);
149 
150  if (al == NULL) {
151  return;
152  }
153 
154  for (i = 0; i < ARTIFACT_TRIES; i++) {
155  int roll = RANDOM()%al->total_chance;
156 
157  for (art = al->items; art != NULL; art = art->next) {
158  roll -= art->chance;
159  if (roll < 0)
160  break;
161  }
162 
163  if (art == NULL || roll >= 0) {
164  LOG(llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type);
165  return;
166  }
167  if (!strcmp(art->item->name, "NONE"))
168  return;
169  if (FABS(op->magic) < art->item->magic)
170  continue; /* Not magic enough to be this item */
171 
172  /* Map difficulty not high enough */
173  if (difficulty < art->difficulty)
174  continue;
175 
176  if (!legal_artifact_combination(op, art)) {
177 #ifdef TREASURE_VERBOSE
178  LOG(llevDebug, "%s of %s was not a legal combination.\n", op->name, art->item->name);
179 #endif
180  continue;
181  }
183  return;
184  }
185 }
186 
194 void give_artifact_abilities(object *op, const object *artifact) {
195  char new_name[MAX_BUF];
196 
197  snprintf(new_name, sizeof(new_name), "of %s", artifact->name);
198  if (op->title)
199  free_string(op->title);
200  op->title = add_string(new_name);
201  if (op->artifact)
202  free_string(op->artifact);
203  op->artifact = add_refcount(artifact->name);
204  add_abilities(op, artifact); /* Give out the bonuses */
205 
206  return;
207 }
208 
216 int legal_artifact_combination(const object *op, const artifact *art) {
217  int neg, success = 0;
218  linked_char *tmp;
219  const char *name;
220 
221  if (art->allowed == (linked_char *)NULL)
222  return 1; /* Ie, "all" */
223  for (tmp = art->allowed; tmp; tmp = tmp->next) {
224 #ifdef TREASURE_VERBOSE
225  LOG(llevDebug, "legal_art: %s\n", tmp->name);
226 #endif
227  if (*tmp->name == '!') {
228  name = tmp->name+1;
229  neg = 1;
230  } else {
231  name = tmp->name;
232  neg = 0;
233  }
234 
235  /* If we match name, then return the opposite of 'neg' */
236  if (!strcmp(name, op->name) || (op->arch && !strcmp(name, op->arch->name)))
237  return !neg;
238 
239  /* Set success as true, since if the match was an inverse, it means
240  * everything is allowed except what we match
241  */
242  else if (neg)
243  success = 1;
244  }
245  return success;
246 }
247 
255 static void compute_face_name(char* buf, size_t size, const char* name, const char* suffix)
256 {
257  const char* dot = name + strlen(name) - 1;
258  while (dot > name && (isdigit(*dot) || (*dot == 'x')))
259  {
260  dot--;
261  }
262 
263  if (*dot == '.')
264  {
265  buf[0] = '0';
266  strlcpy(buf, name, dot - name + 1);
267  snprintf(buf + strlen(buf), size - strlen(buf), "_%s%s", suffix, dot);
268  }
269  else
270  {
271  snprintf(buf, size, "%s_%s", name, suffix);
272  }
273 }
274 
275 /* Keys used for artifact stuff, not copied */
276 #define KEY_FACE_SUFFIX "face_suffix"
277 #define KEY_ANIMATION_SUFFIX "animation_suffix"
278 
285 void add_abilities(object *op, const object *change) {
286  int i, tmp;
287  char buf[MAX_BUF];
288  sstring key;
289 
290  if (change->face != NULL && change->face != blank_face) {
291 #ifdef TREASURE_VERBOSE
292  LOG(llevDebug, "FACE: %d\n", change->face->number);
293 #endif
294 
295  object_set_value(op, "identified_face", change->face->name, 1);
296  } else if ((key = object_get_value(change, KEY_FACE_SUFFIX)) != NULL) {
297  const Face* face;
298  compute_face_name(buf, sizeof(buf), op->face->name, key);
299  face = try_find_face(buf, op->face);
300  object_set_value(op, "identified_face", face->name, 1);
301  }
302  if (QUERY_FLAG(change, FLAG_CLIENT_ANIM_RANDOM)) {
303  object_set_value(op, "identified_anim_random", "1", 1);
304  }
305  if (change->anim_speed > 0) {
306  snprintf(buf, sizeof(buf), "%d", change->anim_speed);
307  object_set_value(op, "identified_anim_speed", buf, 1);
308  }
309  if (change->animation != NULL && op->arch != NULL) {
310  /* op->arch can be NULL when called from artifact_msg(). */
311  object_set_value(op, "identified_animation", change->animation->name, 1);
312  } else if (op->animation != NULL && (key = object_get_value(change, KEY_ANIMATION_SUFFIX)) != NULL) {
313  const Animations *anim;
314  snprintf(buf, sizeof(buf), "%s_%s", op->animation->name, key);
316  if (anim != NULL) {
317  object_set_value(op, "identified_animation", anim->name, 1);
318  }
319  }
320 
333  if (op->arch && (is_identified(op) || QUERY_FLAG(change, FLAG_IDENTIFIED)))
335 
336  for (i = 0; i < NUM_STATS; i++)
337  change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));
338 
339  op->attacktype |= change->attacktype;
340  op->path_attuned |= change->path_attuned;
341  op->path_repelled |= change->path_repelled;
342  op->path_denied |= change->path_denied;
343  op->move_type |= change->move_type;
344  op->stats.luck += change->stats.luck;
345 
346  if (QUERY_FLAG(change, FLAG_CURSED))
348  if (QUERY_FLAG(change, FLAG_DAMNED))
350  if ((QUERY_FLAG(change, FLAG_CURSED) || QUERY_FLAG(change, FLAG_DAMNED))
351  && op->magic > 0)
352  set_abs_magic(op, -op->magic);
353 
354  if (QUERY_FLAG(change, FLAG_LIFESAVE))
356  if (QUERY_FLAG(change, FLAG_REFL_SPELL))
358  if (QUERY_FLAG(change, FLAG_STEALTH))
360  if (QUERY_FLAG(change, FLAG_XRAYS))
362  if (QUERY_FLAG(change, FLAG_BLIND))
364  if (QUERY_FLAG(change, FLAG_CONFUSED))
366  if (QUERY_FLAG(change, FLAG_SEE_IN_DARK))
368  if (QUERY_FLAG(change, FLAG_REFL_MISSILE))
370  if (QUERY_FLAG(change, FLAG_MAKE_INVIS))
372  if (QUERY_FLAG(change, FLAG_REFLECTING))
374 
375  if (QUERY_FLAG(change, FLAG_STAND_STILL)) {
377  /* so artifacts will join */
378  if (!QUERY_FLAG(op, FLAG_ALIVE))
379  op->speed = 0.0;
381  }
382  if (change->nrof != 0 && change->nrof != 1) {
383  LOG(llevDebug, "archetype %s has nrof set to %d, which will be ignored\n",
384  change->name, change->nrof);
385  }
386  op->stats.exp += change->stats.exp; /* Speed modifier */
387  op->stats.wc += change->stats.wc;
388  op->stats.ac += change->stats.ac;
389 
390  if (change->other_arch) {
391  /* Basically, for horns & potions, the other_arch field is the spell
392  * to cast. So convert that to into a spell and put it into
393  * this object.
394  */
395  if (op->type == ROD || op->type == POTION) {
396  object *tmp_obj;
397 
398  /* Remove any spells this object currently has in it */
399  while (op->inv) {
400  tmp_obj = op->inv;
401  object_remove(tmp_obj);
403  }
404  tmp_obj = arch_to_object(change->other_arch);
405  /* This is an artifact, so this function will be called at load time,
406  * thus we don't need to keep the inventory */
407  SET_FLAG(tmp_obj, FLAG_NO_SAVE);
408  object_insert_in_ob(tmp_obj, op);
409  }
410  /* No harm setting this for potions/horns */
411  op->other_arch = change->other_arch;
412  }
413 
414  if (change->stats.hp < 0)
415  op->stats.hp = -change->stats.hp;
416  else
417  op->stats.hp += change->stats.hp;
418  if (change->stats.maxhp < 0)
419  op->stats.maxhp = -change->stats.maxhp;
420  else
421  op->stats.maxhp += change->stats.maxhp;
422  if (change->stats.sp < 0)
423  op->stats.sp = -change->stats.sp;
424  else
425  op->stats.sp += change->stats.sp;
426  if (change->stats.maxsp < 0)
427  op->stats.maxsp = -change->stats.maxsp;
428  else
429  op->stats.maxsp += change->stats.maxsp;
430  if (change->stats.food < 0)
431  op->stats.food = -(change->stats.food);
432  else
433  op->stats.food += change->stats.food;
434  if (change->level < 0)
435  op->level = -(change->level);
436  else
437  op->level += change->level;
438 
439  op->item_power = change->item_power;
440 
441  for (i = 0; i < NROFATTACKS; i++) {
442  if (change->resist[i]) {
443  op->resist[i] += change->resist[i];
444  }
445  }
446  if (change->stats.dam) {
447  if (change->stats.dam < 0)
448  op->stats.dam = (-change->stats.dam);
449  else if (op->stats.dam) {
450  tmp = (int)(((int)op->stats.dam*(int)change->stats.dam)/10);
451  if (tmp == op->stats.dam) {
452  if (change->stats.dam < 10)
453  op->stats.dam--;
454  else
455  op->stats.dam++;
456  } else
457  op->stats.dam = tmp;
458  }
459  }
460  if (change->weight) {
461  if (change->weight < 0)
462  op->weight = (-change->weight);
463  else
464  op->weight = (op->weight*(change->weight))/100;
465  }
466  if (change->last_sp) {
467  if (change->last_sp < 0)
468  op->last_sp = (-change->last_sp);
469  else
470  op->last_sp = (signed char)(((int)op->last_sp*(int)change->last_sp)/(int)100);
471  }
472  if (change->gen_sp_armour) {
473  if (change->gen_sp_armour < 0)
474  op->gen_sp_armour = (-change->gen_sp_armour);
475  else
476  op->gen_sp_armour = (signed char)(((int)op->gen_sp_armour*((int)change->gen_sp_armour))/(int)100);
477  }
478  op->value *= change->value;
479 
480  if (change->material)
481  op->material = change->material;
482 
483  if (change->materialname) {
484  if (op->materialname)
485  free_string(op->materialname);
486  op->materialname = add_refcount(change->materialname);
487  }
488 
489  if (change->slaying) {
490  if (op->slaying)
491  free_string(op->slaying);
492  op->slaying = add_refcount(change->slaying);
493  }
494  if (change->race) {
495  if (op->race)
496  free_string(op->race);
497  op->race = add_refcount(change->race);
498  }
499  if (change->msg)
500  object_set_msg(op, change->msg);
501 
502  if (change->key_values) {
503  const key_value *kv = change->key_values;
504  while (kv) {
505  if (strcmp(kv->key, KEY_FACE_SUFFIX) != 0 && strcmp(kv->key, KEY_ANIMATION_SUFFIX) != 0) {
506  object_set_value(op, kv->key, kv->value, 1);
507  }
508  kv = kv->next;
509  }
510  }
511 
512  if (change->inv) {
513  object *copy;
514 
515  FOR_INV_PREPARE(change, inv) {
516  copy = object_new();
517  object_copy(inv, copy);
518  SET_FLAG(copy, FLAG_NO_SAVE);
519  object_insert_in_ob(copy, op);
520  } FOR_INV_FINISH();
521  }
522 }
523 
534  artifactlist *al;
535 
536  for (al = first_artifactlist; al != NULL; al = al->next)
537  if (al->type == type)
538  return al;
539  return NULL;
540 }
541 
548 void init_artifacts(BufferReader *reader, const char *filename) {
549  char *buf, *cp, *next;
550  artifact *art = NULL;
551  linked_char *tmp;
552  int value;
553  artifactlist *al;
554  archetype dummy_archetype;
555 
556  memset(&dummy_archetype, 0, sizeof(archetype));
557 
558  artifact_init = 1;
559 
560  while ((buf = bufferreader_next_line(reader)) != NULL) {
561  if (*buf == '#')
562  continue;
563  cp = buf;
564  while (*cp == ' ') /* Skip blanks */
565  cp++;
566  if (*cp == '\0')
567  continue;
568 
569  if (!strncmp(cp, "Allowed", 7)) {
570  if (art == NULL) {
571  art = get_empty_artifact();
572  nrofartifacts++;
573  }
574 
575  cp = strchr(cp, ' ')+1;
576  while (*(cp+strlen(cp)-1) == ' ')
577  cp[strlen(cp)-1] = '\0';
578 
579  if (!strcmp(cp, "all"))
580  continue;
581 
582  do {
583  while (*cp == ' ')
584  cp++;
585  nrofallowedstr++;
586  if ((next = strchr(cp, ',')) != NULL)
587  *(next++) = '\0';
588  tmp = (linked_char *)malloc(sizeof(linked_char));
589  tmp->name = add_string(cp);
590  tmp->next = art->allowed;
591  art->allowed = tmp;
592  art->allowed_size++;
593  } while ((cp = next) != NULL);
594  } else if (sscanf(cp, "chance %d", &value))
595  art->chance = (uint16_t)value;
596  else if (sscanf(cp, "difficulty %d", &value))
597  art->difficulty = (uint8_t)value;
598  else if (!strncmp(cp, "Object", 6)) {
599  art->item = (object *)calloc(1, sizeof(object));
600  if (art->item == NULL) {
601  LOG(llevError, "init_artifacts: memory allocation failure.\n");
602  abort();
603  }
604  object_reset(art->item);
605  art->item->arch = &dummy_archetype;
606  if (!load_object_from_reader(reader, art->item, MAP_STYLE))
607  LOG(llevError, "Init_Artifacts: Could not load object.\n");
608  art->item->arch = NULL;
609  art->item->name = add_string((strchr(cp, ' ')+1));
611  if (al == NULL) {
612  al = get_empty_artifactlist();
613  al->type = art->item->type;
614  al->next = first_artifactlist;
615  first_artifactlist = al;
616  }
617  art->next = al->items;
618  al->items = art;
619  art = NULL;
620  } else
621  LOG(llevError, "Unknown input in artifact file %s:%d: %s\n", filename, bufferreader_current_line(reader), buf);
622  }
623 
624  for (al = first_artifactlist; al != NULL; al = al->next) {
625  al->total_chance = 0;
626  for (art = al->items; art != NULL; art = art->next) {
627  if (!art->chance)
628  LOG(llevDebug, "Artifact with no chance: %s\n", art->item->name);
629  else
630  al->total_chance += art->chance;
631  }
632 #if 0
633  LOG(llevDebug, "Artifact list type %d has %d total chance\n", al->type, al->total_chance);
634 #endif
635  }
636 
637  artifact_init = 0;
638 }
639 
649 }
650 
657 const artifact *find_artifact(const object *op, const char *name) {
659  artifact *at;
660  sstring sname = find_string(name);
661 
662  if (sname == NULL)
663  return NULL;
664 
666  if (list == NULL)
667  return NULL;
668 
669  for (at = list->items; at != NULL; at = at->next) {
670  if (at->item->name == sname && legal_artifact_combination(op, at))
671  return at;
672  }
673 
674  return NULL;
675 }
676 
683 void dump_artifacts(void) {
684  artifactlist *al;
685  artifact *art;
686  linked_char *next;
687 
688  fprintf(logfile, "\n");
689  for (al = first_artifactlist; al != NULL; al = al->next) {
690  fprintf(logfile, "Artifact has type %d, total_chance=%d\n", al->type, al->total_chance);
691  for (art = al->items; art != NULL; art = art->next) {
692  fprintf(logfile, "Artifact %-30s Difficulty %3d Chance %5d\n", art->item->name, art->difficulty, art->chance);
693  if (art->allowed != NULL) {
694  fprintf(logfile, "\tAllowed combinations:");
695  for (next = art->allowed; next != NULL; next = next->next)
696  fprintf(logfile, "%s,", next->name);
697  fprintf(logfile, "\n");
698  }
699  }
700  }
701  fprintf(logfile, "\n");
702 }
703 
709 uint16_t artifact_get_face(const artifact *art) {
711 
712  if (art->item->face != blank_face && art->item->face != NULL)
713  return art->item->face->number;
714 
715  if (art->allowed_size > 0) {
716  if (art->allowed->name[0] == '!') {
717  linked_char *allowed;
718  while (arch) {
719  if (arch->clone.type != art->item->type)
721 
722  for (allowed = art->allowed; allowed != NULL; allowed = allowed->next) {
723  if (strcmp(arch->name, allowed->name + 1) == 0) {
724  break;
725  }
726  }
727  if (allowed != NULL)
728  continue;
729 
730  if (arch->clone.face == NULL)
731  continue;
732  return arch->clone.face->number;
733  }
734  return (uint16_t)-1;
735  } else {
736  const archetype *arch = find_archetype(art->allowed->name);
737  if (arch != NULL)
738  return arch->clone.face->number;
739  return (uint16_t)-1;
740  }
741  }
742 
743  while (arch != NULL) {
744  if (arch->clone.type == art->item->type && arch->clone.face != NULL)
745  return arch->clone.face->number;
746 
748  }
749  return (uint16_t)-1;
750 }
artifact_init
int artifact_init
Definition: artifact.c:28
Face::name
sstring name
Definition: face.h:19
give.next
def next
Definition: give.py:44
Face
Definition: face.h:14
nrofallowedstr
EXTERN long nrofallowedstr
Definition: global.h:140
global.h
add_refcount
sstring add_refcount(sstring str)
Definition: shstr.c:210
liv::dam
int16_t dam
Definition: living.h:46
add_string
sstring add_string(const char *str)
Definition: shstr.c:124
object_remove
void object_remove(object *op)
Definition: object.c:1806
obj::face
const Face * face
Definition: object.h:334
FLAG_STAND_STILL
#define FLAG_STAND_STILL
Definition: define.h:308
FLAG_CONFUSED
#define FLAG_CONFUSED
Definition: define.h:311
object_free_key_values
void object_free_key_values(object *op)
Definition: object.c:947
llevError
@ llevError
Definition: logger.h:11
give_artifact_abilities
void give_artifact_abilities(object *op, const object *artifact)
Definition: artifact.c:194
FABS
#define FABS(x)
Definition: define.h:22
FLAG_CLIENT_ANIM_RANDOM
#define FLAG_CLIENT_ANIM_RANDOM
Definition: define.h:241
object_reset
void object_reset(object *op)
Definition: object.c:927
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
artifactliststruct::total_chance
uint16_t total_chance
Definition: artifact.h:28
QUERY_FLAG
#define QUERY_FLAG(xyz, p)
Definition: define.h:226
FLAG_REFL_MISSILE
#define FLAG_REFL_MISSILE
Definition: define.h:273
load_object_from_reader
int load_object_from_reader(BufferReader *reader, object *op, int map_flags)
Definition: loader.c:5216
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
obj::race
sstring race
Definition: object.h:319
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:274
obj::value
int32_t value
Definition: object.h:353
liv::wc
int8_t wc
Definition: living.h:37
FLAG_SEE_IN_DARK
#define FLAG_SEE_IN_DARK
Definition: define.h:337
free_artifact
static void free_artifact(artifact *at)
Definition: artifact.c:80
object_new
object * object_new(void)
Definition: object.c:1242
free_all_artifacts
void free_all_artifacts(void)
Definition: artifact.c:125
obj::gen_sp_armour
int8_t gen_sp_armour
Definition: object.h:366
obj::anim_speed
uint8_t anim_speed
Definition: object.h:421
obj::path_attuned
uint32_t path_attuned
Definition: object.h:346
liv::maxhp
int16_t maxhp
Definition: living.h:41
guildoracle.list
list
Definition: guildoracle.py:87
_key_value::key
const char * key
Definition: object.h:41
liv::hp
int16_t hp
Definition: living.h:40
commongive.inv
inv
Definition: commongive.py:28
blank_face
const Face * blank_face
Definition: image.c:35
first_artifactlist
EXTERN artifactlist * first_artifactlist
Definition: global.h:118
get_empty_artifactlist
static artifactlist * get_empty_artifactlist(void)
Definition: artifact.c:39
bufferreader_next_line
char * bufferreader_next_line(BufferReader *br)
Definition: bufferreader.c:102
bufferreader_current_line
size_t bufferreader_current_line(BufferReader *br)
Definition: bufferreader.c:140
artifactliststruct::items
struct artifactstruct * items
Definition: artifact.h:30
obj::path_denied
uint32_t path_denied
Definition: object.h:348
Ice.tmp
int tmp
Definition: Ice.py:207
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
obj::msg
sstring msg
Definition: object.h:323
npc_dialog.filename
filename
Definition: npc_dialog.py:99
FLAG_STEALTH
#define FLAG_STEALTH
Definition: define.h:312
FLAG_BLIND
#define FLAG_BLIND
Definition: define.h:336
find_artifactlist
const artifactlist * find_artifactlist(int type)
Definition: artifact.c:647
obj::nrof
uint32_t nrof
Definition: object.h:335
find_artifact
const artifact * find_artifact(const object *op, const char *name)
Definition: artifact.c:657
MAP_STYLE
#define MAP_STYLE
Definition: map.h:99
linked_char
Definition: global.h:86
archt
Definition: object.h:468
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.c:4354
obj::slaying
sstring slaying
Definition: object.h:320
free_string
void free_string(sstring str)
Definition: shstr.c:280
liv::maxsp
int16_t maxsp
Definition: living.h:43
liv::luck
int8_t luck
Definition: living.h:39
liv::exp
int64_t exp
Definition: living.h:47
artifactstruct::chance
uint16_t chance
Definition: artifact.h:16
obj::name
sstring name
Definition: object.h:312
linked_char::name
const char * name
Definition: global.h:87
object_copy
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.c:1053
POTION
@ POTION
Definition: object.h:111
obj::path_repelled
uint32_t path_repelled
Definition: object.h:347
Face::number
uint16_t number
Definition: face.h:15
artifactstruct::next
struct artifactstruct * next
Definition: artifact.h:18
obj::name_pl
sstring name_pl
Definition: object.h:316
fatal
void fatal(enum fatal_error err)
Definition: utils.c:597
ROD
@ ROD
Definition: object.h:109
ARTIFACT_TRIES
#define ARTIFACT_TRIES
Definition: artifact.c:131
find_string
sstring find_string(const char *str)
Definition: shstr.c:236
FLAG_MAKE_INVIS
#define FLAG_MAKE_INVIS
Definition: define.h:328
generate_artifact
void generate_artifact(object *op, int difficulty)
Definition: artifact.c:143
artifactliststruct::next
struct artifactliststruct * next
Definition: artifact.h:29
artifactstruct::difficulty
uint8_t difficulty
Definition: artifact.h:17
free_artifactlist
static void free_artifactlist(artifactlist *al)
Definition: artifact.c:110
FLAG_DAMNED
#define FLAG_DAMNED
Definition: define.h:317
artifactstruct::allowed_size
int allowed_size
Definition: artifact.h:20
linked_char::next
struct linked_char * next
Definition: global.h:88
artifactliststruct
Definition: artifact.h:26
obj::other_arch
struct archt * other_arch
Definition: object.h:417
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:675
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.c:4489
sstring
const typedef char * sstring
Definition: global.h:40
object_give_identified_properties
void object_give_identified_properties(object *op)
Definition: item.c:1343
find_artifactlist_internal
static artifactlist * find_artifactlist_internal(int type)
Definition: artifact.c:533
liv::food
int32_t food
Definition: living.h:48
FLAG_NO_SAVE
#define FLAG_NO_SAVE
Definition: define.h:244
animate.anim
string anim
Definition: animate.py:20
logfile
EXTERN FILE * logfile
Definition: global.h:136
obj::animation
const Animations * animation
Definition: object.h:420
obj::material
uint16_t material
Definition: object.h:350
free_charlinks
void free_charlinks(linked_char *lc)
Definition: utils.c:623
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.c:220
MAX_BUF
#define MAX_BUF
Definition: define.h:35
artifactstruct
Definition: artifact.h:14
obj::item_power
int8_t item_power
Definition: object.h:365
add_abilities
void add_abilities(object *op, const object *change)
Definition: artifact.c:285
obj::next
struct obj * next
Definition: object.h:278
RANDOM
#define RANDOM()
Definition: define.h:642
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:294
dump_artifacts
void dump_artifacts(void)
Definition: artifact.c:683
animations_struct::name
sstring name
Definition: face.h:26
obj::title
sstring title
Definition: object.h:318
obj::arch
struct archt * arch
Definition: object.h:416
object_set_msg
void object_set_msg(object *op, const char *msg)
Definition: object.c:4798
animations_struct
Definition: face.h:25
FLAG_REFL_SPELL
#define FLAG_REFL_SPELL
Definition: define.h:275
obj::type
uint8_t type
Definition: object.h:341
Floor.t
t
Definition: Floor.py:62
obj::stats
living stats
Definition: object.h:371
obj::weight
int32_t weight
Definition: object.h:368
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
give.op
op
Definition: give.py:33
autojail.value
value
Definition: autojail.py:6
find_archetype
archetype * find_archetype(const char *name)
Definition: assets.cpp:278
obj::key_values
key_value * key_values
Definition: object.h:437
FLAG_REFLECTING
#define FLAG_REFLECTING
Definition: define.h:262
_key_value
Definition: object.h:40
obj::last_sp
int32_t last_sp
Definition: object.h:361
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
buf
StringBuffer * buf
Definition: readable.c:1606
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.c:2820
artifact_get_face
uint16_t artifact_get_face(const artifact *art)
Definition: artifact.c:709
object_update_speed
void object_update_speed(object *op)
Definition: object.c:1317
obj::move_type
MoveType move_type
Definition: object.h:428
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:232
obj::materialname
sstring materialname
Definition: object.h:349
artifactstruct::item
object * item
Definition: artifact.h:15
castle_read.key
key
Definition: castle_read.py:64
make_face_from_files.int
int
Definition: make_face_from_files.py:26
FLAG_ANIMATE
#define FLAG_ANIMATE
Definition: define.h:242
liv::ac
int8_t ac
Definition: living.h:38
loader.h
KEY_FACE_SUFFIX
#define KEY_FACE_SUFFIX
Definition: artifact.c:276
get_attr_value
int8_t get_attr_value(const living *stats, int attr)
Definition: living.c:314
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1533
_key_value::next
struct _key_value * next
Definition: object.h:43
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:306
KEY_ANIMATION_SUFFIX
#define KEY_ANIMATION_SUFFIX
Definition: artifact.c:277
nrofartifacts
EXTERN long nrofartifacts
Definition: global.h:139
set_abs_magic
void set_abs_magic(object *op, int magic)
Definition: treasure.c:591
_key_value::value
const char * value
Definition: object.h:42
FLAG_XRAYS
#define FLAG_XRAYS
Definition: define.h:300
obj::attacktype
uint32_t attacktype
Definition: object.h:345
legal_artifact_combination
int legal_artifact_combination(const object *op, const artifact *art)
Definition: artifact.c:216
liv::sp
int16_t sp
Definition: living.h:42
compute_face_name
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
Definition: artifact.c:255
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition: define.h:48
FLAG_CURSED
#define FLAG_CURSED
Definition: define.h:316
artifactliststruct::type
uint8_t type
Definition: artifact.h:27
BufferReader
Definition: bufferreader.c:21
obj::magic
int8_t magic
Definition: object.h:351
obj::resist
int16_t resist[NROFATTACKS]
Definition: object.h:344
NUM_STATS
@ NUM_STATS
Definition: living.h:18
change_attr_value
void change_attr_value(living *stats, int attr, int8_t value)
Definition: living.c:265
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:668
obj::level
int16_t level
Definition: object.h:354
llevDebug
@ llevDebug
Definition: logger.h:13
FLAG_LIFESAVE
#define FLAG_LIFESAVE
Definition: define.h:305
artifactstruct::allowed
linked_char * allowed
Definition: artifact.h:19
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
get_empty_artifact
static artifact * get_empty_artifact(void)
Definition: artifact.c:58
obj::inv
struct obj * inv
Definition: object.h:291
FLAG_IDENTIFIED
#define FLAG_IDENTIFIED
Definition: define.h:261
give.name
name
Definition: give.py:27
castle_read.suffix
string suffix
Definition: castle_read.py:30
init_artifacts
void init_artifacts(BufferReader *reader, const char *filename)
Definition: artifact.c:548
is_identified
int is_identified(const object *op)
Definition: item.c:1335