Go to the documentation of this file.
77 for (
auto allowed : at->
allowed)
105 for (; al != NULL; al = nextal) {
107 for (
auto art : al->
items) {
123 #define ARTIFACT_TRIES 2
137 if (!
list ||
list->total_chance == 0) {
141 int chance_of_invalid_item = 0;
144 chance_of_invalid_item +=
check->chance;
162 (*numerator) = art->
chance * (
list->total_chance + chance_of_invalid_item);
163 (*denominator) =
list->total_chance *
list->total_chance;
191 for (
auto r : al->
items) {
199 if (art == NULL || roll >= 0) {
200 LOG(
llevError,
"Got null entry and non zero roll in generate_artifact, type %d\n",
op->type);
203 if (!strcmp(art->
item->
name,
"NONE"))
209 if (difficulty < art->difficulty)
213 #ifdef TREASURE_VERBOSE
233 snprintf(new_name,
sizeof(new_name),
"of %s",
artifact->name);
253 int neg, success = 0;
259 #ifdef TREASURE_VERBOSE
271 if (
op->name && (!strcmp(
name,
op->name) || (
op->arch && !strcmp(
name,
op->arch->name))))
292 const char* dot =
name + strlen(
name) - 1;
293 while (dot >
name && (isdigit(*dot) || (*dot ==
'x')))
311 #define KEY_FACE_SUFFIX "face_suffix"
312 #define KEY_ANIMATION_SUFFIX "animation_suffix"
326 #ifdef TREASURE_VERBOSE
344 if (change->
animation != NULL &&
op->arch != NULL) {
349 snprintf(
buf,
sizeof(
buf),
"%s_%s",
op->animation->name,
key);
417 if (change->
nrof != 0 && change->
nrof != 1) {
418 LOG(
llevDebug,
"archetype %s has nrof set to %d, which will be ignored\n",
477 if (change->
level < 0)
492 else if (
op->stats.dam) {
494 if (
tmp ==
op->stats.dam) {
507 op->weight = (
op->weight*(change->
weight))/100;
519 op->gen_sp_armour = (
signed char)(((
int)
op->gen_sp_armour*((
int)change->
gen_sp_armour))/(
int)100);
527 if (
op->materialname)
600 for (
const auto at :
list->items) {
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);
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;
663 return arch->clone.face->number;
668 while (
arch != NULL) {
670 return arch->clone.face->number;
static void compute_face_name(char *buf, size_t size, const char *name, const char *suffix)
void set_abs_magic(object *op, int magic)
const artifact * find_artifact(const object *op, const char *name)
#define FLAG_CLIENT_ANIM_RANDOM
void LOG(LogLevel logLevel, const char *format,...)
#define QUERY_FLAG(xyz, p)
#define FLAG_REFL_MISSILE
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
archetype * get_next_archetype(archetype *current)
std::vector< artifact * > items
void give_artifact_abilities(object *op, const object *artifact)
static void free_artifact(artifact *at)
artifactlist * get_empty_artifactlist(void)
void add_abilities(object *op, const object *change)
void object_copy(const object *src_ob, object *dest_ob)
std::vector< sstring > allowed
const char * object_get_value(const object *op, const char *const key)
object * object_insert_in_ob(object *op, object *where)
int16_t resist[NROFATTACKS]
void object_free_drop_inventory(object *ob)
sstring add_refcount(sstring str)
void free_all_artifacts(void)
sstring add_string(const char *str)
sstring find_string(const char *str)
int is_identified(const object *op)
void object_update_speed(object *op)
#define KEY_ANIMATION_SUFFIX
const Animations * animation
struct archetype * other_arch
void artifact_compute_chance_for_item(const object *op, const artifact *art, int *numerator, int *denominator)
void fatal(enum fatal_error err)
static void free_artifactlist(artifactlist *al)
size_t strlcpy(char *dst, const char *src, size_t size)
object * object_new(void)
void free_string(sstring str)
Animations * try_find_animation(const char *name)
archetype * find_archetype_by_object_name(const char *name)
void change_attr_value(living *stats, int attr, int8_t value)
const typedef char * sstring
void object_set_msg(object *op, const char *msg)
uint16_t artifact_get_face(const artifact *art)
void object_free_key_values(object *op)
#define CLEAR_FLAG(xyz, p)
object * arch_to_object(archetype *at)
void object_give_identified_properties(object *op)
artifactlist * first_artifactlist
void object_remove(object *op)
archetype * try_find_archetype(const char *name)
const Face * try_find_face(const char *name, const Face *error)
int object_set_value(object *op, const char *key, const char *value, int add_key)
int8_t get_attr_value(const living *stats, int attr)
void dump_artifacts(void)
artifact * get_empty_artifact(void)
void generate_artifact(object *op, int difficulty)
artifactlist * find_artifactlist(int type)
#define FOR_INV_PREPARE(op_, it_)
int legal_artifact_combination(const object *op, const artifact *art)