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 = new artifactlist();
39  if (tl == NULL)
41  tl->next = NULL;
42  tl->total_chance = 0;
43  return tl;
44 }
45 
56  artifact *t = new artifact();
57  if (t == NULL)
59  t->item = NULL;
60  t->chance = 0;
61  t->difficulty = 0;
62  return t;
63 }
64 
74 static void free_artifact(artifact *at) {
75  object *next;
76 
77  for (auto allowed : at->allowed)
78  free_string(allowed);
79  while (at->item) {
80  next = at->item->next;
81  if (at->item->name)
82  free_string(at->item->name);
83  if (at->item->name_pl)
84  free_string(at->item->name_pl);
85  if (at->item->msg)
86  free_string(at->item->msg);
87  if (at->item->title)
88  free_string(at->item->title);
90  free(at->item);
91  at->item = next;
92  }
93  delete at;
94 }
95 
102 static void free_artifactlist(artifactlist *al) {
103  artifactlist *nextal;
104 
105  for (; al != NULL; al = nextal) {
106  nextal = al->next;
107  for (auto art : al->items) {
108  free_artifact(art);
109  }
110  delete al;
111  }
112 }
113 
117 void free_all_artifacts(void) {
119  first_artifactlist = NULL;
120 }
121 
123 #define ARTIFACT_TRIES 2
124 
133 void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator) {
134  (*numerator) = 0;
135  (*denominator) = 1;
136  const artifactlist *list = find_artifactlist(op->type);
137  if (!list || list->total_chance == 0) {
138  return;
139  }
140 
141  int chance_of_invalid_item = 0;
142  for (auto check : list->items) {
144  chance_of_invalid_item += check->chance;
145  }
146  }
147 
148  /*
149  Let:
150  - 'ac' be the artifact's chance as given in the list (art->chance)
151  - 'ic' the chance to find an illegal artifact in the list (chance_of_invalid_item)
152  - 'tc' the total chance of the list (list->total_chance)
153 
154  The chance of the artifact being generated at the first try is ac/tc
155  The chance of finding an invalid artifact is ic/tc
156  So the chance of generating an item on the second try is (ic/tc) * (ac/tc)
157  The chance of the artifact being generated is thus (ac/tc) + (ic/tc) * (ac/tc)
158 
159  In numerator/denominator notation, this gives ac * (tc + ic) / (tc²)
160  */
161 
162  (*numerator) = art->chance * (list->total_chance + chance_of_invalid_item);
163  (*denominator) = list->total_chance * list->total_chance;
164 }
165 
177 void generate_artifact(object *op, int difficulty) {
178  const artifactlist *al;
179  const artifact *art = NULL;
180  int i;
181 
182  al = find_artifactlist(op->type);
183 
184  if (al == NULL) {
185  return;
186  }
187 
188  for (i = 0; i < ARTIFACT_TRIES; i++) {
189  int roll = RANDOM()%al->total_chance;
190 
191  for (auto r : al->items) {
192  roll -= r->chance;
193  if (roll < 0) {
194  art = r;
195  break;
196  }
197  }
198 
199  if (art == NULL || roll >= 0) {
200  LOG(llevError, "Got null entry and non zero roll in generate_artifact, type %d\n", op->type);
201  return;
202  }
203  if (!strcmp(art->item->name, "NONE"))
204  return;
205  if (FABS(op->magic) < art->item->magic)
206  continue; /* Not magic enough to be this item */
207 
208  /* Map difficulty not high enough */
209  if (difficulty < art->difficulty)
210  continue;
211 
212  if (!legal_artifact_combination(op, art)) {
213 #ifdef TREASURE_VERBOSE
214  LOG(llevDebug, "%s of %s was not a legal combination.\n", op->name, art->item->name);
215 #endif
216  continue;
217  }
219  return;
220  }
221 }
222 
230 void give_artifact_abilities(object *op, const object *artifact) {
231  char new_name[MAX_BUF];
232 
233  snprintf(new_name, sizeof(new_name), "of %s", artifact->name);
234  if (op->title)
235  free_string(op->title);
236  op->title = add_string(new_name);
237  if (op->artifact)
238  free_string(op->artifact);
239  op->artifact = add_refcount(artifact->name);
240  add_abilities(op, artifact); /* Give out the bonuses */
241 
242  return;
243 }
244 
252 int legal_artifact_combination(const object *op, const artifact *art) {
253  int neg, success = 0;
254  const char *name;
255 
256  if (art->allowed.empty())
257  return 1; /* Ie, "all" */
258  for (auto tmp : art->allowed) {
259 #ifdef TREASURE_VERBOSE
260  LOG(llevDebug, "legal_art: %s\n", tmp->name);
261 #endif
262  if (*tmp == '!') {
263  name = tmp+1;
264  neg = 1;
265  } else {
266  name = tmp;
267  neg = 0;
268  }
269 
270  /* If we match name, then return the opposite of 'neg' */
271  if (op->name && (!strcmp(name, op->name) || (op->arch && !strcmp(name, op->arch->name))))
272  return !neg;
273 
274  /* Set success as true, since if the match was an inverse, it means
275  * everything is allowed except what we match
276  */
277  else if (neg)
278  success = 1;
279  }
280  return success;
281 }
282 
290 static void compute_face_name(char* buf, size_t size, const char* name, const char* suffix)
291 {
292  const char* dot = name + strlen(name) - 1;
293  while (dot > name && (isdigit(*dot) || (*dot == 'x')))
294  {
295  dot--;
296  }
297 
298  if (*dot == '.')
299  {
300  buf[0] = '0';
301  strlcpy(buf, name, dot - name + 1);
302  snprintf(buf + strlen(buf), size - strlen(buf), "_%s%s", suffix, dot);
303  }
304  else
305  {
306  snprintf(buf, size, "%s_%s", name, suffix);
307  }
308 }
309 
310 /* Keys used for artifact stuff, not copied */
311 #define KEY_FACE_SUFFIX "face_suffix"
312 #define KEY_ANIMATION_SUFFIX "animation_suffix"
313 
320 void add_abilities(object *op, const object *change) {
321  int i, tmp;
322  char buf[MAX_BUF];
323  sstring key;
324 
325  if (change->face != NULL && change->face != blank_face) {
326 #ifdef TREASURE_VERBOSE
327  LOG(llevDebug, "FACE: %d\n", change->face->number);
328 #endif
329 
330  object_set_value(op, "identified_face", change->face->name, 1);
331  } else if ((key = object_get_value(change, KEY_FACE_SUFFIX)) != NULL) {
332  const Face* face;
333  compute_face_name(buf, sizeof(buf), op->face->name, key);
334  face = try_find_face(buf, op->face);
335  object_set_value(op, "identified_face", face->name, 1);
336  }
337  if (QUERY_FLAG(change, FLAG_CLIENT_ANIM_RANDOM)) {
338  object_set_value(op, "identified_anim_random", "1", 1);
339  }
340  if (change->anim_speed > 0) {
341  snprintf(buf, sizeof(buf), "%d", change->anim_speed);
342  object_set_value(op, "identified_anim_speed", buf, 1);
343  }
344  if (change->animation != NULL && op->arch != NULL) {
345  /* op->arch can be NULL when called from artifact_msg(). */
346  object_set_value(op, "identified_animation", change->animation->name, 1);
347  } else if (op->animation != NULL && (key = object_get_value(change, KEY_ANIMATION_SUFFIX)) != NULL) {
348  const Animations *anim;
349  snprintf(buf, sizeof(buf), "%s_%s", op->animation->name, key);
351  if (anim != NULL) {
352  object_set_value(op, "identified_animation", anim->name, 1);
353  }
354  }
355 
368  if (op->arch && (is_identified(op) || QUERY_FLAG(change, FLAG_IDENTIFIED)))
370 
371  for (i = 0; i < NUM_STATS; i++)
372  change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));
373 
374  op->attacktype |= change->attacktype;
375  op->path_attuned |= change->path_attuned;
376  op->path_repelled |= change->path_repelled;
377  op->path_denied |= change->path_denied;
378  op->move_type |= change->move_type;
379  op->stats.luck += change->stats.luck;
380 
381  if (QUERY_FLAG(change, FLAG_CURSED))
383  if (QUERY_FLAG(change, FLAG_DAMNED))
385  if ((QUERY_FLAG(change, FLAG_CURSED) || QUERY_FLAG(change, FLAG_DAMNED))
386  && op->magic > 0)
387  set_abs_magic(op, -op->magic);
388 
389  if (QUERY_FLAG(change, FLAG_LIFESAVE))
391  if (QUERY_FLAG(change, FLAG_REFL_SPELL))
393  if (QUERY_FLAG(change, FLAG_STEALTH))
395  if (QUERY_FLAG(change, FLAG_XRAYS))
397  if (QUERY_FLAG(change, FLAG_BLIND))
399  if (QUERY_FLAG(change, FLAG_CONFUSED))
401  if (QUERY_FLAG(change, FLAG_SEE_IN_DARK))
403  if (QUERY_FLAG(change, FLAG_REFL_MISSILE))
405  if (QUERY_FLAG(change, FLAG_MAKE_INVIS))
407  if (QUERY_FLAG(change, FLAG_REFLECTING))
409 
410  if (QUERY_FLAG(change, FLAG_STAND_STILL)) {
412  /* so artifacts will join */
413  if (!QUERY_FLAG(op, FLAG_ALIVE))
414  op->speed = 0.0;
416  }
417  if (change->nrof != 0 && change->nrof != 1) {
418  LOG(llevDebug, "archetype %s has nrof set to %d, which will be ignored\n",
419  change->name, change->nrof);
420  }
421  op->stats.exp += change->stats.exp; /* Speed modifier */
422  op->stats.wc += change->stats.wc;
423  op->stats.ac += change->stats.ac;
424 
425  if (change->other_arch) {
426  /* Basically, for horns & potions, the other_arch field is the spell
427  * to cast. So convert that to into a spell and put it into
428  * this object.
429  */
430  if (op->type == ROD || op->type == POTION) {
431  object *tmp_obj;
432 
433  /* Remove any spells this object currently has in it */
434  while (op->inv) {
435  tmp_obj = op->inv;
436  object_remove(tmp_obj);
438  }
439  tmp_obj = arch_to_object(change->other_arch);
440  /* This is an artifact, so this function will be called at load time,
441  * thus we don't need to keep the inventory */
442  SET_FLAG(tmp_obj, FLAG_NO_SAVE);
443  object_insert_in_ob(tmp_obj, op);
444  }
445  /* No harm setting this for potions/horns */
446  op->other_arch = change->other_arch;
447  }
448 
449  if (change->stats.hp < 0)
450  op->stats.hp = -change->stats.hp;
451  else
452  op->stats.hp += change->stats.hp;
453  if (change->stats.maxhp < 0)
454  op->stats.maxhp = -change->stats.maxhp;
455  else
456  op->stats.maxhp += change->stats.maxhp;
457  if (change->stats.sp < 0)
458  op->stats.sp = -change->stats.sp;
459  else
460  op->stats.sp += change->stats.sp;
461  if (change->stats.maxsp < 0)
462  op->stats.maxsp = -change->stats.maxsp;
463  else
464  op->stats.maxsp += change->stats.maxsp;
465  if (change->stats.grace < 0)
466  op->stats.grace = -change->stats.grace;
467  else
468  op->stats.grace += change->stats.grace;
469  if (change->stats.maxgrace < 0)
470  op->stats.maxgrace = -change->stats.maxgrace;
471  else
472  op->stats.maxgrace += change->stats.maxgrace;
473  if (change->stats.food < 0)
474  op->stats.food = -(change->stats.food);
475  else
476  op->stats.food += change->stats.food;
477  if (change->level < 0)
478  op->level = -(change->level);
479  else
480  op->level += change->level;
481 
482  op->item_power = change->item_power;
483 
484  for (i = 0; i < NROFATTACKS; i++) {
485  if (change->resist[i]) {
486  op->resist[i] += change->resist[i];
487  }
488  }
489  if (change->stats.dam) {
490  if (change->stats.dam < 0)
491  op->stats.dam = (-change->stats.dam);
492  else if (op->stats.dam) {
493  tmp = (int)(((int)op->stats.dam*(int)change->stats.dam)/10);
494  if (tmp == op->stats.dam) {
495  if (change->stats.dam < 10)
496  op->stats.dam--;
497  else
498  op->stats.dam++;
499  } else
500  op->stats.dam = tmp;
501  }
502  }
503  if (change->weight) {
504  if (change->weight < 0)
505  op->weight = (-change->weight);
506  else
507  op->weight = (op->weight*(change->weight))/100;
508  }
509  if (change->last_sp) {
510  if (change->last_sp < 0)
511  op->last_sp = (-change->last_sp);
512  else
513  op->last_sp = (signed char)(((int)op->last_sp*(int)change->last_sp)/(int)100);
514  }
515  if (change->gen_sp_armour) {
516  if (change->gen_sp_armour < 0)
517  op->gen_sp_armour = (-change->gen_sp_armour);
518  else
519  op->gen_sp_armour = (signed char)(((int)op->gen_sp_armour*((int)change->gen_sp_armour))/(int)100);
520  }
521  op->value *= change->value;
522 
523  if (change->material)
524  op->material = change->material;
525 
526  if (change->materialname) {
527  if (op->materialname)
528  free_string(op->materialname);
529  op->materialname = add_refcount(change->materialname);
530  }
531 
532  if (change->slaying) {
533  if (op->slaying)
534  free_string(op->slaying);
535  op->slaying = add_refcount(change->slaying);
536  }
537  if (change->race) {
538  if (op->race)
539  free_string(op->race);
540  op->race = add_refcount(change->race);
541  }
542  if (change->msg)
543  object_set_msg(op, change->msg);
544 
545  if (change->key_values) {
546  const key_value *kv = change->key_values;
547  while (kv) {
548  if (strcmp(kv->key, KEY_FACE_SUFFIX) != 0 && strcmp(kv->key, KEY_ANIMATION_SUFFIX) != 0) {
549  object_set_value(op, kv->key, kv->value, 1);
550  }
551  kv = kv->next;
552  }
553  }
554 
555  if (change->inv) {
556  object *copy;
557 
558  FOR_INV_PREPARE(change, inv) {
559  copy = object_new();
560  object_copy(inv, copy);
561  SET_FLAG(copy, FLAG_NO_SAVE);
562  object_insert_in_ob(copy, op);
563  } FOR_INV_FINISH();
564  }
565 }
566 
575  artifactlist *al;
576 
577  for (al = first_artifactlist; al != NULL; al = al->next)
578  if (al->type == type)
579  return al;
580  return NULL;
581 }
582 
589 const artifact *find_artifact(const object *op, const char *name) {
591  sstring sname = find_string(name);
592 
593  if (sname == NULL)
594  return NULL;
595 
596  list = find_artifactlist(op->type);
597  if (list == NULL)
598  return NULL;
599 
600  for (const auto at : list->items) {
601  if (at->item->name == sname && legal_artifact_combination(op, at))
602  return at;
603  }
604 
605  return NULL;
606 }
607 
614 void dump_artifacts(void) {
615  artifactlist *al;
616 
617  fprintf(logfile, "\n");
618  for (al = first_artifactlist; al != NULL; al = al->next) {
619  fprintf(logfile, "Artifact has type %d, total_chance=%d\n", al->type, al->total_chance);
620  for (const auto art : al->items) {
621  fprintf(logfile, "Artifact %-30s Difficulty %3d Chance %5d\n", art->item->name, art->difficulty, art->chance);
622  if (!art->allowed.empty()) {
623  fprintf(logfile, "\tAllowed combinations:");
624  for (auto allowed : art->allowed)
625  fprintf(logfile, "%s,", allowed);
626  fprintf(logfile, "\n");
627  }
628  }
629  }
630  fprintf(logfile, "\n");
631 }
632 
638 uint16_t artifact_get_face(const artifact *art) {
639  if (art->item->face != blank_face && art->item->face != NULL)
640  return art->item->face->number;
641 
643 
644  if (!art->allowed.empty()) {
645  if (*art->allowed[0] == '!') {
646  while (arch) {
647  if (!arch->head && arch->clone.type == art->item->type) {
648  bool allowed = std::none_of(art->allowed.cbegin(), art->allowed.cend(),
649  [&] (const auto name) { return strcmp(arch->name, name + 1) == 0; });
650  if (allowed && arch->clone.face != NULL) {
651  return arch->clone.face->number;
652  }
653  }
655  }
656  return (uint16_t)-1;
657  } else {
658  const archetype *arch = try_find_archetype(art->allowed[0]);
659  if (arch == NULL) {
661  }
662  if (arch != NULL)
663  return arch->clone.face->number;
664  return (uint16_t)-1;
665  }
666  }
667 
668  while (arch != NULL) {
669  if (arch->clone.type == art->item->type && arch->clone.face != NULL)
670  return arch->clone.face->number;
671 
673  }
674  return (uint16_t)-1;
675 }
Face::name
sstring name
Definition: face.h:19
object::name_pl
sstring name_pl
Definition: object.h:323
give.next
def next
Definition: give.py:44
Face
Definition: face.h:14
living::exp
int64_t exp
Definition: living.h:47
global.h
compute_face_name
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
Definition: artifact.cpp:290
set_abs_magic
void set_abs_magic(object *op, int magic)
Definition: treasure.cpp:618
living::maxhp
int16_t maxhp
Definition: living.h:41
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:589
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
object::path_attuned
uint32_t path_attuned
Definition: object.h:353
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.cpp:58
SET_FLAG
#define SET_FLAG(xyz, p)
Definition: define.h:224
object::inv
object * inv
Definition: object.h:298
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
get_next_archetype
archetype * get_next_archetype(archetype *current)
Definition: assets.cpp:262
FLAG_SEE_IN_DARK
#define FLAG_SEE_IN_DARK
Definition: define.h:337
object::item_power
int8_t item_power
Definition: object.h:372
artifactlist::items
std::vector< artifact * > items
Definition: artifact.h:28
guildoracle.list
list
Definition: guildoracle.py:87
give_artifact_abilities
void give_artifact_abilities(object *op, const object *artifact)
Definition: artifact.cpp:230
key_value
Definition: object.h:42
free_artifact
static void free_artifact(artifact *at)
Definition: artifact.cpp:74
get_empty_artifactlist
artifactlist * get_empty_artifactlist(void)
Definition: artifact.cpp:37
artifact::item
object * item
Definition: artifact.h:15
commongive.inv
inv
Definition: commongive.py:29
add_abilities
void add_abilities(object *op, const object *change)
Definition: artifact.cpp:320
object_copy
void object_copy(const object *src_ob, object *dest_ob)
Definition: object.cpp:1192
Ice.tmp
int tmp
Definition: Ice.py:207
artifactlist::next
artifactlist * next
Definition: artifact.h:27
artifact::allowed
std::vector< sstring > allowed
Definition: artifact.h:18
blank_face
const Face * blank_face
Definition: image.cpp:36
object::key_values
key_value * key_values
Definition: object.h:444
NROFATTACKS
#define NROFATTACKS
Definition: attack.h:17
object::title
sstring title
Definition: object.h:325
object_get_value
const char * object_get_value(const object *op, const char *const key)
Definition: object.cpp:4346
object::level
int16_t level
Definition: object.h:361
FLAG_STEALTH
#define FLAG_STEALTH
Definition: define.h:312
FLAG_BLIND
#define FLAG_BLIND
Definition: define.h:336
buf
StringBuffer * buf
Definition: readable.cpp:1565
object_insert_in_ob
object * object_insert_in_ob(object *op, object *where)
Definition: object.cpp:2857
object::resist
int16_t resist[NROFATTACKS]
Definition: object.h:351
FLAG_ALIVE
#define FLAG_ALIVE
Definition: define.h:230
object::path_denied
uint32_t path_denied
Definition: object.h:355
key_value::value
const char * value
Definition: object.h:44
object::path_repelled
uint32_t path_repelled
Definition: object.h:354
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.cpp:1560
add_refcount
sstring add_refcount(sstring str)
Definition: shstr.cpp:210
key_value::next
key_value * next
Definition: object.h:45
object::anim_speed
uint8_t anim_speed
Definition: object.h:429
POTION
@ POTION
Definition: object.h:116
Face::number
uint16_t number
Definition: face.h:15
free_all_artifacts
void free_all_artifacts(void)
Definition: artifact.cpp:117
KEY_FACE_SUFFIX
#define KEY_FACE_SUFFIX
Definition: artifact.cpp:311
add_string
sstring add_string(const char *str)
Definition: shstr.cpp:124
ROD
@ ROD
Definition: object.h:114
object::move_type
MoveType move_type
Definition: object.h:436
object::face
const Face * face
Definition: object.h:341
find_string
sstring find_string(const char *str)
Definition: shstr.cpp:236
FLAG_MAKE_INVIS
#define FLAG_MAKE_INVIS
Definition: define.h:328
object::value
int32_t value
Definition: object.h:360
is_identified
int is_identified(const object *op)
Definition: item.cpp:1348
object_update_speed
void object_update_speed(object *op)
Definition: object.cpp:1349
object::type
uint8_t type
Definition: object.h:348
FLAG_DAMNED
#define FLAG_DAMNED
Definition: define.h:317
living::dam
int16_t dam
Definition: living.h:46
object::magic
int8_t magic
Definition: object.h:358
object::materialname
sstring materialname
Definition: object.h:356
artifactlist
Definition: artifact.h:24
FOR_INV_FINISH
#define FOR_INV_FINISH()
Definition: define.h:677
living::food
int32_t food
Definition: living.h:48
KEY_ANIMATION_SUFFIX
#define KEY_ANIMATION_SUFFIX
Definition: artifact.cpp:312
archetype
Definition: object.h:483
FLAG_NO_SAVE
#define FLAG_NO_SAVE
Definition: define.h:244
logfile
FILE * logfile
Definition: init.cpp:114
living::sp
int16_t sp
Definition: living.h:42
animate.anim
string anim
Definition: animate.py:20
object::race
sstring race
Definition: object.h:326
object::animation
const Animations * animation
Definition: object.h:428
object::other_arch
struct archetype * other_arch
Definition: object.h:425
artifact_compute_chance_for_item
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
Definition: artifact.cpp:133
fatal
void fatal(enum fatal_error err)
Definition: utils.cpp:590
free_artifactlist
static void free_artifactlist(artifactlist *al)
Definition: artifact.cpp:102
MAX_BUF
#define MAX_BUF
Definition: define.h:35
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.cpp:222
object_new
object * object_new(void)
Definition: object.cpp:1273
object::weight
int32_t weight
Definition: object.h:375
free_string
void free_string(sstring str)
Definition: shstr.cpp:280
living::wc
int8_t wc
Definition: living.h:37
RANDOM
#define RANDOM()
Definition: define.h:644
try_find_animation
Animations * try_find_animation(const char *name)
Definition: assets.cpp:278
living::maxgrace
int16_t maxgrace
Definition: living.h:45
key_value::key
const char * key
Definition: object.h:43
FLAG_REFL_SPELL
#define FLAG_REFL_SPELL
Definition: define.h:275
Floor.t
t
Definition: Floor.py:62
object::slaying
sstring slaying
Definition: object.h:327
find_archetype_by_object_name
archetype * find_archetype_by_object_name(const char *name)
Definition: arch.cpp:53
object::name
sstring name
Definition: object.h:319
bigchest.check
check
Definition: bigchest.py:10
artifact::chance
uint16_t chance
Definition: artifact.h:16
living::maxsp
int16_t maxsp
Definition: living.h:43
change_attr_value
void change_attr_value(living *stats, int attr, int8_t value)
Definition: living.cpp:264
object::last_sp
int32_t last_sp
Definition: object.h:368
sstring
const typedef char * sstring
Definition: sstring.h:2
give.op
op
Definition: give.py:33
Animations
Definition: face.h:25
object::gen_sp_armour
int8_t gen_sp_armour
Definition: object.h:373
ARTIFACT_TRIES
#define ARTIFACT_TRIES
Definition: artifact.cpp:123
object_set_msg
void object_set_msg(object *op, const char *msg)
Definition: object.cpp:4811
artifact_get_face
uint16_t artifact_get_face(const artifact *art)
Definition: artifact.cpp:638
FLAG_REFLECTING
#define FLAG_REFLECTING
Definition: define.h:262
object::msg
sstring msg
Definition: object.h:330
object_free_key_values
void object_free_key_values(object *op)
Definition: object.cpp:954
artifactlist::total_chance
uint16_t total_chance
Definition: artifact.h:26
CLEAR_FLAG
#define CLEAR_FLAG(xyz, p)
Definition: define.h:225
living::ac
int8_t ac
Definition: living.h:38
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:229
object_give_identified_properties
void object_give_identified_properties(object *op)
Definition: item.cpp:1356
first_artifactlist
artifactlist * first_artifactlist
Definition: init.cpp:109
castle_read.key
key
Definition: castle_read.py:64
make_face_from_files.int
int
Definition: make_face_from_files.py:32
FLAG_ANIMATE
#define FLAG_ANIMATE
Definition: define.h:242
loader.h
object_remove
void object_remove(object *op)
Definition: object.cpp:1833
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:270
try_find_face
const Face * try_find_face(const char *name, const Face *error)
Definition: assets.cpp:286
object::nrof
uint32_t nrof
Definition: object.h:342
FLAG_XRAYS
#define FLAG_XRAYS
Definition: define.h:300
living::grace
int16_t grace
Definition: living.h:44
object::stats
living stats
Definition: object.h:378
artifact
Definition: artifact.h:14
object_set_value
int object_set_value(object *op, const char *key, const char *value, int add_key)
Definition: object.cpp:4499
get_attr_value
int8_t get_attr_value(const living *stats, int attr)
Definition: living.cpp:313
dump_artifacts
void dump_artifacts(void)
Definition: artifact.cpp:614
object::attacktype
uint32_t attacktype
Definition: object.h:352
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:55
generate_artifact
void generate_artifact(object *op, int difficulty)
Definition: artifact.cpp:177
find_artifactlist
artifactlist * find_artifactlist(int type)
Definition: artifact.cpp:574
object::material
uint16_t material
Definition: object.h:357
NUM_STATS
@ NUM_STATS
Definition: living.h:18
object::next
object * next
Definition: object.h:285
FOR_INV_PREPARE
#define FOR_INV_PREPARE(op_, it_)
Definition: define.h:670
artifactlist::type
uint8_t type
Definition: artifact.h:25
living::hp
int16_t hp
Definition: living.h:40
living::luck
int8_t luck
Definition: living.h:39
ring_occidental_mages.r
r
Definition: ring_occidental_mages.py:6
Animations::name
sstring name
Definition: face.h:26
llevDebug
@ llevDebug
Definition: logger.h:13
FLAG_LIFESAVE
#define FLAG_LIFESAVE
Definition: define.h:305
is_valid_types_gen.type
list type
Definition: is_valid_types_gen.py:25
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:252