Crossfire Server, Trunk
artifact.cpp
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 
38  artifactlist *tl = (artifactlist *)malloc(sizeof(artifactlist));
39  if (tl == NULL)
41  tl->next = NULL;
42  tl->items = NULL;
43  tl->total_chance = 0;
44  return tl;
45 }
46 
57  artifact *t = (artifact *)malloc(sizeof(artifact));
58  if (t == NULL)
60  t->item = NULL;
61  t->next = NULL;
62  t->chance = 0;
63  t->difficulty = 0;
64  t->allowed = NULL;
65  t->allowed_size = 0;
66  return t;
67 }
68 
69 #ifdef MEMORY_DEBUG
70 
79 static void free_artifact(artifact *at) {
80  object *next;
81 
82  if (at->next)
83  free_artifact(at->next);
84  if (at->allowed)
86  while (at->item) {
87  next = at->item->next;
88  if (at->item->name)
89  free_string(at->item->name);
90  if (at->item->name_pl)
91  free_string(at->item->name_pl);
92  if (at->item->msg)
93  free_string(at->item->msg);
94  if (at->item->title)
95  free_string(at->item->title);
97  free(at->item);
98  at->item = next;
99  }
100  free(at);
101 }
102 
109 static void free_artifactlist(artifactlist *al) {
110  artifactlist *nextal;
111 
112  for (; al != NULL; al = nextal) {
113  nextal = al->next;
114  if (al->items) {
115  free_artifact(al->items);
116  }
117  free(al);
118  }
119 }
120 
124 void free_all_artifacts(void) {
125  free_artifactlist(first_artifactlist);
126  first_artifactlist = NULL;
127 }
128 #endif
129 
131 #define ARTIFACT_TRIES 2
132 
141 void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator) {
142  (*numerator) = 0;
143  (*denominator) = 1;
144  const artifactlist *list = find_artifactlist(op->type);
145  if (!list || list->total_chance == 0) {
146  return;
147  }
148 
149  int chance_of_invalid_item = 0;
150  artifact *check = list->items;
151  while (check) {
153  chance_of_invalid_item += check->chance;
154  }
155  check = check->next;
156  }
157 
158  /*
159  Let:
160  - 'ac' be the artifact's chance as given in the list (art->chance)
161  - 'ic' the chance to find an illegal artifact in the list (chance_of_invalid_item)
162  - 'tc' the total chance of the list (list->total_chance)
163 
164  The chance of the artifact being generated at the first try is ac/tc
165  The chance of finding an invalid artifact is ic/tc
166  So the chance of generating an item on the second try is (ic/tc) * (ac/tc)
167  The chance of the artifact being generated is thus (ac/tc) + (ic/tc) * (ac/tc)
168 
169  In numerator/denominator notation, this gives ac * (tc + ic) / (tc²)
170  */
171 
172  (*numerator) = art->chance * (list->total_chance + chance_of_invalid_item);
173  (*denominator) = list->total_chance * list->total_chance;
174 }
175 
187 void generate_artifact(object *op, int difficulty) {
188  const artifactlist *al;
189  const artifact *art;
190  int i;
191 
192  al = find_artifactlist(op->type);
193 
194  if (al == NULL) {
195  return;
196  }
197 
198  for (i = 0; i < ARTIFACT_TRIES; i++) {
199  int roll = RANDOM()%al->total_chance;
200 
201  for (art = al->items; art != NULL; art = art->next) {
202  roll -= art->chance;
203  if (roll < 0)
204  break;
205  }
206 
207  if (art == NULL || roll >= 0) {
208  LOG(llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type);
209  return;
210  }
211  if (!strcmp(art->item->name, "NONE"))
212  return;
213  if (FABS(op->magic) < art->item->magic)
214  continue; /* Not magic enough to be this item */
215 
216  /* Map difficulty not high enough */
217  if (difficulty < art->difficulty)
218  continue;
219 
220  if (!legal_artifact_combination(op, art)) {
221 #ifdef TREASURE_VERBOSE
222  LOG(llevDebug, "%s of %s was not a legal combination.\n", op->name, art->item->name);
223 #endif
224  continue;
225  }
227  return;
228  }
229 }
230 
238 void give_artifact_abilities(object *op, const object *artifact) {
239  char new_name[MAX_BUF];
240 
241  snprintf(new_name, sizeof(new_name), "of %s", artifact->name);
242  if (op->title)
243  free_string(op->title);
244  op->title = add_string(new_name);
245  if (op->artifact)
246  free_string(op->artifact);
247  op->artifact = add_refcount(artifact->name);
248  add_abilities(op, artifact); /* Give out the bonuses */
249 
250  return;
251 }
252 
260 int legal_artifact_combination(const object *op, const artifact *art) {
261  int neg, success = 0;
262  linked_char *tmp;
263  const char *name;
264 
265  if (art->allowed == (linked_char *)NULL)
266  return 1; /* Ie, "all" */
267  for (tmp = art->allowed; tmp; tmp = tmp->next) {
268 #ifdef TREASURE_VERBOSE
269  LOG(llevDebug, "legal_art: %s\n", tmp->name);
270 #endif
271  if (*tmp->name == '!') {
272  name = tmp->name+1;
273  neg = 1;
274  } else {
275  name = tmp->name;
276  neg = 0;
277  }
278 
279  /* If we match name, then return the opposite of 'neg' */
280  if (op->name && (!strcmp(name, op->name) || (op->arch && !strcmp(name, op->arch->name))))
281  return !neg;
282 
283  /* Set success as true, since if the match was an inverse, it means
284  * everything is allowed except what we match
285  */
286  else if (neg)
287  success = 1;
288  }
289  return success;
290 }
291 
299 static void compute_face_name(char* buf, size_t size, const char* name, const char* suffix)
300 {
301  const char* dot = name + strlen(name) - 1;
302  while (dot > name && (isdigit(*dot) || (*dot == 'x')))
303  {
304  dot--;
305  }
306 
307  if (*dot == '.')
308  {
309  buf[0] = '0';
310  strlcpy(buf, name, dot - name + 1);
311  snprintf(buf + strlen(buf), size - strlen(buf), "_%s%s", suffix, dot);
312  }
313  else
314  {
315  snprintf(buf, size, "%s_%s", name, suffix);
316  }
317 }
318 
319 /* Keys used for artifact stuff, not copied */
320 #define KEY_FACE_SUFFIX "face_suffix"
321 #define KEY_ANIMATION_SUFFIX "animation_suffix"
322 
329 void add_abilities(object *op, const object *change) {
330  int i, tmp;
331  char buf[MAX_BUF];
332  sstring key;
333 
334  if (change->face != NULL && change->face != blank_face) {
335 #ifdef TREASURE_VERBOSE
336  LOG(llevDebug, "FACE: %d\n", change->face->number);
337 #endif
338 
339  object_set_value(op, "identified_face", change->face->name, 1);
340  } else if ((key = object_get_value(change, KEY_FACE_SUFFIX)) != NULL) {
341  const Face* face;
342  compute_face_name(buf, sizeof(buf), op->face->name, key);
343  face = try_find_face(buf, op->face);
344  object_set_value(op, "identified_face", face->name, 1);
345  }
346  if (QUERY_FLAG(change, FLAG_CLIENT_ANIM_RANDOM)) {
347  object_set_value(op, "identified_anim_random", "1", 1);
348  }
349  if (change->anim_speed > 0) {
350  snprintf(buf, sizeof(buf), "%d", change->anim_speed);
351  object_set_value(op, "identified_anim_speed", buf, 1);
352  }
353  if (change->animation != NULL && op->arch != NULL) {
354  /* op->arch can be NULL when called from artifact_msg(). */
355  object_set_value(op, "identified_animation", change->animation->name, 1);
356  } else if (op->animation != NULL && (key = object_get_value(change, KEY_ANIMATION_SUFFIX)) != NULL) {
357  const Animations *anim;
358  snprintf(buf, sizeof(buf), "%s_%s", op->animation->name, key);
360  if (anim != NULL) {
361  object_set_value(op, "identified_animation", anim->name, 1);
362  }
363  }
364 
377  if (op->arch && (is_identified(op) || QUERY_FLAG(change, FLAG_IDENTIFIED)))
379 
380  for (i = 0; i < NUM_STATS; i++)
381  change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));
382 
383  op->attacktype |= change->attacktype;
384  op->path_attuned |= change->path_attuned;
385  op->path_repelled |= change->path_repelled;
386  op->path_denied |= change->path_denied;
387  op->move_type |= change->move_type;
388  op->stats.luck += change->stats.luck;
389 
390  if (QUERY_FLAG(change, FLAG_CURSED))
392  if (QUERY_FLAG(change, FLAG_DAMNED))
394  if ((QUERY_FLAG(change, FLAG_CURSED) || QUERY_FLAG(change, FLAG_DAMNED))
395  && op->magic > 0)
396  set_abs_magic(op, -op->magic);
397 
398  if (QUERY_FLAG(change, FLAG_LIFESAVE))
400  if (QUERY_FLAG(change, FLAG_REFL_SPELL))
402  if (QUERY_FLAG(change, FLAG_STEALTH))
404  if (QUERY_FLAG(change, FLAG_XRAYS))
406  if (QUERY_FLAG(change, FLAG_BLIND))
408  if (QUERY_FLAG(change, FLAG_CONFUSED))
410  if (QUERY_FLAG(change, FLAG_SEE_IN_DARK))
412  if (QUERY_FLAG(change, FLAG_REFL_MISSILE))
414  if (QUERY_FLAG(change, FLAG_MAKE_INVIS))
416  if (QUERY_FLAG(change, FLAG_REFLECTING))
418 
419  if (QUERY_FLAG(change, FLAG_STAND_STILL)) {
421  /* so artifacts will join */
422  if (!QUERY_FLAG(op, FLAG_ALIVE))
423  op->speed = 0.0;
425  }
426  if (change->nrof != 0 && change->nrof != 1) {
427  LOG(llevDebug, "archetype %s has nrof set to %d, which will be ignored\n",
428  change->name, change->nrof);
429  }
430  op->stats.exp += change->stats.exp; /* Speed modifier */
431  op->stats.wc += change->stats.wc;
432  op->stats.ac += change->stats.ac;
433 
434  if (change->other_arch) {
435  /* Basically, for horns & potions, the other_arch field is the spell
436  * to cast. So convert that to into a spell and put it into
437  * this object.
438  */
439  if (op->type == ROD || op->type == POTION) {
440  object *tmp_obj;
441 
442  /* Remove any spells this object currently has in it */
443  while (op->inv) {
444  tmp_obj = op->inv;
445  object_remove(tmp_obj);
447  }
448  tmp_obj = arch_to_object(change->other_arch);
449  /* This is an artifact, so this function will be called at load time,
450  * thus we don't need to keep the inventory */
451  SET_FLAG(tmp_obj, FLAG_NO_SAVE);
452  object_insert_in_ob(tmp_obj, op);
453  }
454  /* No harm setting this for potions/horns */
455  op->other_arch = change->other_arch;
456  }
457 
458  if (change->stats.hp < 0)
459  op->stats.hp = -change->stats.hp;
460  else
461  op->stats.hp += change->stats.hp;
462  if (change->stats.maxhp < 0)
463  op->stats.maxhp = -change->stats.maxhp;
464  else
465  op->stats.maxhp += change->stats.maxhp;
466  if (change->stats.sp < 0)
467  op->stats.sp = -change->stats.sp;
468  else
469  op->stats.sp += change->stats.sp;
470  if (change->stats.maxsp < 0)
471  op->stats.maxsp = -change->stats.maxsp;
472  else
473  op->stats.maxsp += change->stats.maxsp;
474  if (change->stats.food < 0)
475  op->stats.food = -(change->stats.food);
476  else
477  op->stats.food += change->stats.food;
478  if (change->level < 0)
479  op->level = -(change->level);
480  else
481  op->level += change->level;
482 
483  op->item_power = change->item_power;
484 
485  for (i = 0; i < NROFATTACKS; i++) {
486  if (change->resist[i]) {
487  op->resist[i] += change->resist[i];
488  }
489  }
490  if (change->stats.dam) {
491  if (change->stats.dam < 0)
492  op->stats.dam = (-change->stats.dam);
493  else if (op->stats.dam) {
494  tmp = (int)(((int)op->stats.dam*(int)change->stats.dam)/10);
495  if (tmp == op->stats.dam) {
496  if (change->stats.dam < 10)
497  op->stats.dam--;
498  else
499  op->stats.dam++;
500  } else
501  op->stats.dam = tmp;
502  }
503  }
504  if (change->weight) {
505  if (change->weight < 0)
506  op->weight = (-change->weight);
507  else
508  op->weight = (op->weight*(change->weight))/100;
509  }
510  if (change->last_sp) {
511  if (change->last_sp < 0)
512  op->last_sp = (-change->last_sp);
513  else
514  op->last_sp = (signed char)(((int)op->last_sp*(int)change->last_sp)/(int)100);
515  }
516  if (change->gen_sp_armour) {
517  if (change->gen_sp_armour < 0)
518  op->gen_sp_armour = (-change->gen_sp_armour);
519  else
520  op->gen_sp_armour = (signed char)(((int)op->gen_sp_armour*((int)change->gen_sp_armour))/(int)100);
521  }
522  op->value *= change->value;
523 
524  if (change->material)
525  op->material = change->material;
526 
527  if (change->materialname) {
528  if (op->materialname)
529  free_string(op->materialname);
530  op->materialname = add_refcount(change->materialname);
531  }
532 
533  if (change->slaying) {
534  if (op->slaying)
535  free_string(op->slaying);
536  op->slaying = add_refcount(change->slaying);
537  }
538  if (change->race) {
539  if (op->race)
540  free_string(op->race);
541  op->race = add_refcount(change->race);
542  }
543  if (change->msg)
544  object_set_msg(op, change->msg);
545 
546  if (change->key_values) {
547  const key_value *kv = change->key_values;
548  while (kv) {
549  if (strcmp(kv->key, KEY_FACE_SUFFIX) != 0 && strcmp(kv->key, KEY_ANIMATION_SUFFIX) != 0) {
550  object_set_value(op, kv->key, kv->value, 1);
551  }
552  kv = kv->next;
553  }
554  }
555 
556  if (change->inv) {
557  object *copy;
558 
559  FOR_INV_PREPARE(change, inv) {
560  copy = object_new();
561  object_copy(inv, copy);
562  SET_FLAG(copy, FLAG_NO_SAVE);
563  object_insert_in_ob(copy, op);
564  } FOR_INV_FINISH();
565  }
566 }
567 
576  artifactlist *al;
577 
578  for (al = first_artifactlist; al != NULL; al = al->next)
579  if (al->type == type)
580  return al;
581  return NULL;
582 }
583 
590 const artifact *find_artifact(const object *op, const char *name) {
592  artifact *at;
593  sstring sname = find_string(name);
594 
595  if (sname == NULL)
596  return NULL;
597 
598  list = find_artifactlist(op->type);
599  if (list == NULL)
600  return NULL;
601 
602  for (at = list->items; at != NULL; at = at->next) {
603  if (at->item->name == sname && legal_artifact_combination(op, at))
604  return at;
605  }
606 
607  return NULL;
608 }
609 
616 void dump_artifacts(void) {
617  artifactlist *al;
618  artifact *art;
619  linked_char *next;
620 
621  fprintf(logfile, "\n");
622  for (al = first_artifactlist; al != NULL; al = al->next) {
623  fprintf(logfile, "Artifact has type %d, total_chance=%d\n", al->type, al->total_chance);
624  for (art = al->items; art != NULL; art = art->next) {
625  fprintf(logfile, "Artifact %-30s Difficulty %3d Chance %5d\n", art->item->name, art->difficulty, art->chance);
626  if (art->allowed != NULL) {
627  fprintf(logfile, "\tAllowed combinations:");
628  for (next = art->allowed; next != NULL; next = next->next)
629  fprintf(logfile, "%s,", next->name);
630  fprintf(logfile, "\n");
631  }
632  }
633  }
634  fprintf(logfile, "\n");
635 }
636 
642 uint16_t artifact_get_face(const artifact *art) {
643  if (art->item->face != blank_face && art->item->face != NULL)
644  return art->item->face->number;
645 
647 
648  if (art->allowed_size > 0) {
649  if (art->allowed->name[0] == '!') {
650  linked_char *allowed;
651  while (arch) {
652  if (!arch->head && arch->clone.type == art->item->type) {
653  for (allowed = art->allowed; allowed != NULL; allowed = allowed->next) {
654  if (strcmp(arch->name, allowed->name + 1) == 0) {
655  break;
656  }
657  }
658  if (allowed == NULL && arch->clone.face != NULL) {
659  return arch->clone.face->number;
660  }
661  }
663  }
664  return (uint16_t)-1;
665  } else {
666  const archetype *arch = try_find_archetype(art->allowed->name);
667  if (arch == NULL) {
669  }
670  if (arch != NULL)
671  return arch->clone.face->number;
672  return (uint16_t)-1;
673  }
674  }
675 
676  while (arch != NULL) {
677  if (arch->clone.type == art->item->type && arch->clone.face != NULL)
678  return arch->clone.face->number;
679 
681  }
682  return (uint16_t)-1;
683 }
Face::name
sstring name
Definition: face.h:19
give.next
def next
Definition: give.py:44
Face
Definition: face.h:14
global.h
compute_face_name
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
Definition: artifact.cpp:299
set_abs_magic
void set_abs_magic(object *op, int magic)
Definition: treasure.cpp:605
liv::dam
int16_t dam
Definition: living.h:46
obj::face
const Face * face
Definition: object.h:339
FLAG_STAND_STILL
#define FLAG_STAND_STILL
Definition: define.h:308
FLAG_CONFUSED
#define FLAG_CONFUSED
Definition: define.h:311
find_artifact
const artifact * find_artifact(const object *op, const char *name)
Definition: artifact.cpp:590
llevError
@ llevError
Definition: logger.h:11
FABS
#define FABS(x)
Definition: define.h:22
FLAG_CLIENT_ANIM_RANDOM
#define FLAG_CLIENT_ANIM_RANDOM
Definition: define.h:241
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:51
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
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
obj::race
sstring race
Definition: object.h:324
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:266
obj::value
int32_t value
Definition: object.h:358
liv::wc
int8_t wc
Definition: living.h:37
FLAG_SEE_IN_DARK
#define FLAG_SEE_IN_DARK
Definition: define.h:337
obj::gen_sp_armour
int8_t gen_sp_armour
Definition: object.h:371
obj::anim_speed
uint8_t anim_speed
Definition: object.h:425
obj::path_attuned
uint32_t path_attuned
Definition: object.h:351
liv::maxhp
int16_t maxhp
Definition: living.h:41
guildoracle.list
list
Definition: guildoracle.py:87
give_artifact_abilities
void give_artifact_abilities(object *op, const object *artifact)
Definition: artifact.cpp:238
_key_value::key
const char * key
Definition: object.h:41
get_empty_artifactlist
artifactlist * get_empty_artifactlist(void)
Definition: artifact.cpp:37
liv::hp
int16_t hp
Definition: living.h:40
commongive.inv
inv
Definition: commongive.py:28
add_abilities
void add_abilities(object *op, const object *change)
Definition: artifact.cpp:329
object_copy
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.cpp:1192
artifactliststruct::items
struct artifactstruct * items
Definition: artifact.h:30
obj::path_denied
uint32_t path_denied
Definition: object.h:353
Ice.tmp
int tmp
Definition: Ice.py:207
blank_face
const Face * blank_face
Definition: image.cpp:36
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
obj::msg
sstring msg
Definition: object.h:328
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.cpp:4339
FLAG_STEALTH
#define FLAG_STEALTH
Definition: define.h:312
FLAG_BLIND
#define FLAG_BLIND
Definition: define.h:336
buf
StringBuffer * buf
Definition: readable.cpp:1611
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.cpp:2851
obj::nrof
uint32_t nrof
Definition: object.h:340
linked_char
Definition: global.h:89
archt
Definition: object.h:472
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
obj::slaying
sstring slaying
Definition: object.h:325
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
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.cpp:1560
artifactstruct::chance
uint16_t chance
Definition: artifact.h:16
obj::name
sstring name
Definition: object.h:317
add_refcount
sstring add_refcount(sstring str)
Definition: shstr.cpp:210
linked_char::name
const char * name
Definition: global.h:90
POTION
@ POTION
Definition: object.h:114
obj::path_repelled
uint32_t path_repelled
Definition: object.h:352
Face::number
uint16_t number
Definition: face.h:15
KEY_FACE_SUFFIX
#define KEY_FACE_SUFFIX
Definition: artifact.cpp:320
artifactstruct::next
struct artifactstruct * next
Definition: artifact.h:18
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
obj::name_pl
sstring name_pl
Definition: object.h:321
ROD
@ ROD
Definition: object.h:112
find_string
sstring find_string(const char *str)
Definition: shstr.cpp:236
FLAG_MAKE_INVIS
#define FLAG_MAKE_INVIS
Definition: define.h:328
is_identified
int is_identified(const object *op)
Definition: item.cpp:1336
object_update_speed
void object_update_speed(object *op)
Definition: object.cpp:1349
artifactliststruct::next
struct artifactliststruct * next
Definition: artifact.h:29
artifactstruct::difficulty
uint8_t difficulty
Definition: artifact.h:17
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:91
artifactliststruct
Definition: artifact.h:26
obj::other_arch
struct archt * other_arch
Definition: object.h:421
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:677
sstring
const typedef char * sstring
Definition: global.h:43
KEY_ANIMATION_SUFFIX
#define KEY_ANIMATION_SUFFIX
Definition: artifact.cpp:321
liv::food
int32_t food
Definition: living.h:48
FLAG_NO_SAVE
#define FLAG_NO_SAVE
Definition: define.h:244
logfile
FILE * logfile
Definition: init.cpp:114
animate.anim
string anim
Definition: animate.py:20
obj::animation
const Animations * animation
Definition: object.h:424
obj::material
uint16_t material
Definition: object.h:355
artifact_compute_chance_for_item
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
Definition: artifact.cpp:141
fatal
void fatal(enum fatal_error err)
Definition: utils.cpp:580
MAX_BUF
#define MAX_BUF
Definition: define.h:35
artifactstruct
Definition: artifact.h:14
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.cpp:222
obj::item_power
int8_t item_power
Definition: object.h:370
object_new
object * object_new(void)
Definition: object.cpp:1273
free_string
void free_string(sstring str)
Definition: shstr.cpp:280
obj::next
struct obj * next
Definition: object.h:283
RANDOM
#define RANDOM()
Definition: define.h:644
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:282
animations_struct::name
sstring name
Definition: face.h:26
obj::title
sstring title
Definition: object.h:323
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:346
Floor.t
t
Definition: Floor.py:62
find_archetype_by_object_name
archetype * find_archetype_by_object_name(const char *name)
Definition: arch.cpp:53
obj::stats
living stats
Definition: object.h:376
bigchest.check
check
Definition: bigchest.py:10
obj::weight
int32_t weight
Definition: object.h:373
change_attr_value
void change_attr_value(living *stats, int attr, int8_t value)
Definition: living.cpp:264
give.op
op
Definition: give.py:33
ARTIFACT_TRIES
#define ARTIFACT_TRIES
Definition: artifact.cpp:131
obj::key_values
key_value * key_values
Definition: object.h:440
object_set_msg
void object_set_msg(object *op, const char *msg)
Definition: object.cpp:4804
artifact_get_face
uint16_t artifact_get_face(const artifact *art)
Definition: artifact.cpp:642
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:366
object_free_key_values
void object_free_key_values(object *op)
Definition: object.cpp:954
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
obj::move_type
MoveType move_type
Definition: object.h:432
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:230
object_give_identified_properties
void object_give_identified_properties(object *op)
Definition: item.cpp:1344
obj::materialname
sstring materialname
Definition: object.h:354
first_artifactlist
artifactlist * first_artifactlist
Definition: init.cpp:109
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
free_all_artifacts
void free_all_artifacts(void)
object_remove
void object_remove(object *op)
Definition: object.cpp:1833
free_charlinks
void free_charlinks(linked_char *lc)
Definition: utils.cpp:606
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:274
_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:290
_key_value::value
const char * value
Definition: object.h:42
FLAG_XRAYS
#define FLAG_XRAYS
Definition: define.h:300
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.cpp:4492
get_attr_value
int8_t get_attr_value(const living *stats, int attr)
Definition: living.cpp:313
obj::attacktype
uint32_t attacktype
Definition: object.h:350
dump_artifacts
void dump_artifacts(void)
Definition: artifact.cpp:616
liv::sp
int16_t sp
Definition: living.h:42
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition: define.h:48
FLAG_CURSED
#define FLAG_CURSED
Definition: define.h:316
get_empty_artifact
artifact * get_empty_artifact(void)
Definition: artifact.cpp:56
artifactliststruct::type
uint8_t type
Definition: artifact.h:27
generate_artifact
void generate_artifact(object *op, int difficulty)
Definition: artifact.cpp:187
obj::magic
int8_t magic
Definition: object.h:356
obj::resist
int16_t resist[NROFATTACKS]
Definition: object.h:349
find_artifactlist
artifactlist * find_artifactlist(int type)
Definition: artifact.cpp:575
NUM_STATS
@ NUM_STATS
Definition: living.h:18
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:670
obj::level
int16_t level
Definition: object.h:359
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
obj::inv
struct obj * inv
Definition: object.h:296
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
legal_artifact_combination
int legal_artifact_combination(const object *op, const artifact *art)
Definition: artifact.cpp:260