Go to the documentation of this file.
79 static void free_artifact(
artifact *at) {
83 free_artifact(at->
next);
112 for (; al != NULL; al = nextal) {
115 free_artifact(al->
items);
131 #define ARTIFACT_TRIES 2
145 if (!
list ||
list->total_chance == 0) {
149 int chance_of_invalid_item = 0;
153 chance_of_invalid_item +=
check->chance;
172 (*numerator) = art->
chance * (
list->total_chance + chance_of_invalid_item);
173 (*denominator) =
list->total_chance *
list->total_chance;
201 for (art = al->
items; art != NULL; art = art->
next) {
207 if (art == NULL || roll >= 0) {
208 LOG(
llevError,
"Got null entry and non zero roll in generate_artifact, type %d\n",
op->type);
211 if (!strcmp(art->
item->
name,
"NONE"))
217 if (difficulty < art->difficulty)
221 #ifdef TREASURE_VERBOSE
241 snprintf(new_name,
sizeof(new_name),
"of %s",
artifact->name);
261 int neg, success = 0;
268 #ifdef TREASURE_VERBOSE
271 if (*
tmp->name ==
'!') {
280 if (
op->name && (!strcmp(
name,
op->name) || (
op->arch && !strcmp(
name,
op->arch->name))))
301 const char* dot =
name + strlen(
name) - 1;
302 while (dot >
name && (isdigit(*dot) || (*dot ==
'x')))
320 #define KEY_FACE_SUFFIX "face_suffix"
321 #define KEY_ANIMATION_SUFFIX "animation_suffix"
335 #ifdef TREASURE_VERBOSE
353 if (change->
animation != NULL &&
op->arch != NULL) {
358 snprintf(
buf,
sizeof(
buf),
"%s_%s",
op->animation->name,
key);
426 if (change->
nrof != 0 && change->
nrof != 1) {
427 LOG(
llevDebug,
"archetype %s has nrof set to %d, which will be ignored\n",
478 if (change->
level < 0)
493 else if (
op->stats.dam) {
495 if (
tmp ==
op->stats.dam) {
508 op->weight = (
op->weight*(change->
weight))/100;
520 op->gen_sp_armour = (
signed char)(((
int)
op->gen_sp_armour*((
int)change->
gen_sp_armour))/(
int)100);
528 if (
op->materialname)
602 for (at =
list->items; at != NULL; at = at->
next) {
624 for (art = al->
items; art != NULL; art = art->
next) {
627 fprintf(
logfile,
"\tAllowed combinations:");
653 for (allowed = art->
allowed; allowed != NULL; allowed = allowed->
next) {
654 if (strcmp(
arch->name, allowed->
name + 1) == 0) {
658 if (allowed == NULL &&
arch->clone.face != NULL) {
659 return arch->clone.face->number;
671 return arch->clone.face->number;
676 while (
arch != NULL) {
678 return arch->clone.face->number;
sstring add_refcount(sstring str)
artifactlist * get_empty_artifactlist(void)
sstring add_string(const char *str)
void object_remove(object *op)
artifact * get_empty_artifact(void)
void object_free_key_values(object *op)
void give_artifact_abilities(object *op, const object *artifact)
#define FLAG_CLIENT_ANIM_RANDOM
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
archetype * get_next_archetype(archetype *current)
object * object_new(void)
EXTERN artifactlist * first_artifactlist
struct artifactstruct * items
const artifact * find_artifact(const object *op, const char *name)
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
const char * object_get_value(const object *op, const char *const key)
void free_string(sstring str)
artifactlist * find_artifactlist(int type)
void object_copy(const object *src_ob, object *dest_ob)
struct artifactstruct * next
void fatal(enum fatal_error err)
sstring find_string(const char *str)
void generate_artifact(object *op, int difficulty)
struct artifactliststruct * next
struct linked_char * next
struct archt * other_arch
int object_set_value(object *op, const char *key, const char *value, int add_key)
const typedef char * sstring
void object_give_identified_properties(object *op)
const Animations * animation
void free_charlinks(linked_char *lc)
size_t strlcpy(char *dst, const char *src, size_t size)
void add_abilities(object *op, const object *change)
Animations * try_find_animation(const char *name)
void dump_artifacts(void)
void object_set_msg(object *op, const char *msg)
archetype * find_archetype_by_object_name(const char *name)
void LOG(LogLevel logLevel, const char *format,...)
#define CLEAR_FLAG(xyz, p)
object * object_insert_in_ob(object *op, object *where)
uint16_t artifact_get_face(const artifact *art)
void object_update_speed(object *op)
object * arch_to_object(archetype *at)
int8_t get_attr_value(const living *stats, int attr)
void object_free_drop_inventory(object *ob)
void free_all_artifacts(void)
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
#define KEY_ANIMATION_SUFFIX
void set_abs_magic(object *op, int magic)
int legal_artifact_combination(const object *op, const artifact *art)
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
int16_t resist[NROFATTACKS]
void change_attr_value(living *stats, int attr, int8_t value)
#define FOR_INV_PREPARE(op_, it_)
int is_identified(const object *op)