Crossfire Server, Trunk
R21670
|
Go to the source code of this file.
Macros | |
#define | ARTIFACT_TRIES 2 |
#define | KEY_ANIMATION_SUFFIX "animation_suffix" |
#define | KEY_FACE_SUFFIX "face_suffix" |
Functions | |
void | add_abilities (object *op, const object *change) |
unsigned | artifact_get_face (const artifact *art) |
static void | compute_face_name (char *buf, size_t size, const char *name, const char *suffix) |
void | dump_artifacts (void) |
const artifact * | find_artifact (const object *op, const char *name) |
const artifactlist * | find_artifactlist (int type) |
static artifactlist * | find_artifactlist_internal (int type) |
void | free_all_artifacts (void) |
static void | free_artifact (artifact *at) |
static void | free_artifactlist (artifactlist *al) |
static void | free_charlinks (linked_char *lc) |
void | generate_artifact (object *op, int difficulty) |
static artifact * | get_empty_artifact (void) |
static artifactlist * | get_empty_artifactlist (void) |
void | give_artifact_abilities (object *op, const object *artifact) |
void | init_artifacts (void) |
int | legal_artifact_combination (const object *op, const artifact *art) |
Variables | |
int | artifact_init |
#define ARTIFACT_TRIES 2 |
Give 1 re-roll attempt per artifact
Definition at line 146 of file artifact.c.
Referenced by generate_artifact().
#define KEY_ANIMATION_SUFFIX "animation_suffix" |
Definition at line 282 of file artifact.c.
Referenced by add_abilities().
#define KEY_FACE_SUFFIX "face_suffix" |
Definition at line 281 of file artifact.c.
Referenced by add_abilities().
Used in artifact generation. The bonuses of the first object is modified by the bonuses of the second object.
For items that do not need identifying, use their identified face/animation immediately. This should make seas of generated creatures look more interesting.
Daniel Hawkins 2018-01-07
Add query flags to perform the same treatment for identified items or artifacts that come identified. Also make sure we have op->arch. Otherwise it segfaults when we don't.
2018-01-08
Definition at line 288 of file artifact.c.
References liv::ac, add_refcount(), obj::anim_speed, obj::animation, obj::arch, arch_to_object(), obj::attacktype, blank_face, change_attr_value(), CLEAR_FLAG, compute_face_name(), liv::dam, liv::exp, obj::face, find_face(), FLAG_ALIVE, FLAG_ANIMATE, FLAG_BLIND, FLAG_CLIENT_ANIM_RANDOM, FLAG_CONFUSED, FLAG_CURSED, FLAG_DAMNED, FLAG_IDENTIFIED, FLAG_LIFESAVE, FLAG_MAKE_INVIS, FLAG_NO_SAVE, FLAG_REFL_MISSILE, FLAG_REFL_SPELL, FLAG_SEE_IN_DARK, FLAG_STAND_STILL, FLAG_STEALTH, FLAG_XRAYS, liv::food, FOR_INV_FINISH, FOR_INV_PREPARE, free_string(), obj::gen_sp_armour, get_attr_value(), liv::hp, obj::inv, is_identified(), obj::item_power, _key_value::key, KEY_ANIMATION_SUFFIX, KEY_FACE_SUFFIX, obj::key_values, obj::last_sp, obj::level, llevDebug, LOG(), liv::luck, obj::magic, obj::material, obj::materialname, MAX_BUF, liv::maxhp, liv::maxsp, obj::move_type, obj::msg, Face::name, animations_struct::name, _key_value::next, obj::nrof, NROFATTACKS, NUM_STATS, Face::number, object_copy(), object_free_drop_inventory(), object_get_value(), object_give_identified_properties(), object_insert_in_ob(), object_new(), object_remove(), object_set_msg(), object_set_value(), object_update_speed(), obj::other_arch, obj::path_attuned, obj::path_denied, obj::path_repelled, POTION, QUERY_FLAG, obj::race, RANDOM, obj::resist, ROD, set_abs_magic(), SET_FLAG, obj::slaying, snprintf, liv::sp, obj::speed, obj::stats, try_find_animation(), obj::type, _key_value::value, obj::value, liv::wc, and obj::weight.
Referenced by artifact_describe(), and give_artifact_abilities().
unsigned artifact_get_face | ( | const artifact * | art | ) |
Get a suitable face number for representing an artifact.
art | what to get the face of. |
Definition at line 723 of file artifact.c.
References artifactstruct::allowed, artifactstruct::allowed_size, blank_face, archt::clone, obj::face, find_archetype(), first_archetype, artifactstruct::item, linked_char::name, archt::name, linked_char::next, archt::next, Face::number, and obj::type.
|
static |
Compute the name of a face with a suffix, taking into account names like '.123' or '.1xx'.
buf | where to put the resulting name. |
size | length of buf. |
name | base face name. |
suffix | suffix to add to the face name. |
Definition at line 260 of file artifact.c.
References snprintf, and strlcpy().
Referenced by add_abilities().
void dump_artifacts | ( | void | ) |
For debugging purposes. Dumps all tables.
Definition at line 697 of file artifact.c.
References artifactstruct::allowed, artifactstruct::chance, artifactstruct::difficulty, first_artifactlist, artifactstruct::item, artifactliststruct::items, logfile, linked_char::name, obj::name, artifactstruct::next, artifactliststruct::next, linked_char::next, artifactliststruct::total_chance, and artifactliststruct::type.
Referenced by init_beforeplay().
Searches and returns a specific artifact, NULL if not found.
op | item to search for. |
name | artifact name. |
Definition at line 671 of file artifact.c.
References find_artifactlist_internal(), find_string(), artifactstruct::item, artifactliststruct::items, legal_artifact_combination(), obj::name, artifactstruct::next, and obj::type.
Referenced by add_one_item(), and save_object_in_sb().
const artifactlist* find_artifactlist | ( | int | type | ) |
Searches the artifact lists and returns one that has the same type of objects on it.
Definition at line 661 of file artifact.c.
References find_artifactlist_internal().
Referenced by artifact_msg(), cast_create_missile(), command_create(), generate_artifact(), locate_recipe_artifact(), and CREFormulaePanel::setItem().
|
static |
Searches the artifact lists and returns one that has the same type of objects on it, non-const version of find_artifactlist() used only during artifact loading.
Definition at line 531 of file artifact.c.
References first_artifactlist, artifactliststruct::next, and artifactliststruct::type.
Referenced by find_artifact(), find_artifactlist(), and init_artifacts().
void free_all_artifacts | ( | void | ) |
Free all artifact-related information.
Definition at line 140 of file artifact.c.
References first_artifactlist, and free_artifactlist().
Referenced by cleanup().
|
static |
Totally frees an artifact, its next items, and such.
at | artifact to free. Pointer is free()d too, so becomes invalid. |
But artifact inventory is a 'real' object, that may be created for 'old' objects. So should be destroyed through object_free_drop_inventory(). Note that it isn't on the usual item list, so some tweaking is required.
Definition at line 95 of file artifact.c.
References artifactstruct::allowed, free_charlinks(), free_string(), artifactstruct::item, obj::msg, obj::name, obj::name_pl, artifactstruct::next, obj::next, object_free_key_values(), and obj::title.
Referenced by free_artifactlist().
|
static |
Free specified list and its items.
al | list to free. Pointer is free()d too, so becomes invalid. |
Definition at line 125 of file artifact.c.
References free_artifact(), artifactliststruct::items, and artifactliststruct::next.
Referenced by free_all_artifacts().
|
static |
Frees a link structure and its next items.
lc | item to free. Pointer is free()d too, so becomes invalid. |
Definition at line 77 of file artifact.c.
References linked_char::next.
Referenced by free_artifact().
void generate_artifact | ( | object * | op, |
int | difficulty | ||
) |
Decides randomly which artifact the object should be turned into. Makes sure that the item can become that artifact (means magic, difficulty, and Allowed fields properly). Then calls give_artifact_abilities in order to actually create the artifact.
Definition at line 155 of file artifact.c.
References ARTIFACT_TRIES, artifactstruct::chance, FABS, find_artifactlist(), give_artifact_abilities(), artifactstruct::item, artifactliststruct::items, legal_artifact_combination(), llevDebug, llevError, LOG(), obj::magic, obj::name, artifactstruct::next, RANDOM, artifactliststruct::total_chance, and obj::type.
Referenced by alchemy_failure_effect(), fix_generated_item(), generate_monster_arch(), generate_monster_inv(), and START_TEST().
|
static |
Allocate and return the pointer to an empty artifact structure.
Definition at line 58 of file artifact.c.
References artifactstruct::allowed, artifactstruct::allowed_size, artifactstruct::chance, artifactstruct::difficulty, fatal(), artifactstruct::item, artifactstruct::next, and OUT_OF_MEMORY.
Referenced by init_artifacts().
|
static |
Allocate and return the pointer to an empty artifactlist structure.
Definition at line 39 of file artifact.c.
References fatal(), artifactliststruct::items, artifactliststruct::next, OUT_OF_MEMORY, and artifactliststruct::total_chance.
Referenced by init_artifacts().
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.
Definition at line 203 of file artifact.c.
References add_abilities(), add_refcount(), add_string(), obj::artifact, free_string(), MAX_BUF, obj::name, snprintf, and obj::title.
Referenced by add_one_item(), CREArtifactPanel::artifactChanged(), cast_create_missile(), command_create(), generate_artifact(), knowledge_alchemy_face(), make_item_from_recipe(), and save_object_in_sb().
void init_artifacts | ( | void | ) |
Builds up the lists of artifacts from the file in the libdir. Can be called multiple times without ill effects.
Definition at line 544 of file artifact.c.
References add_string(), artifactstruct::allowed, artifactstruct::allowed_size, obj::arch, artifact_init, artifactstruct::chance, Settings::datadir, artifactstruct::difficulty, find_artifactlist_internal(), first_artifactlist, get_empty_artifact(), get_empty_artifactlist(), HUGE_BUF, artifactstruct::item, artifactliststruct::items, llevDebug, llevError, LO_LINEMODE, load_object(), LOG(), MAP_STYLE, MAX_BUF, linked_char::name, obj::name, artifactstruct::next, artifactliststruct::next, linked_char::next, nrofallowedstr, nrofartifacts, object_reset(), settings, snprintf, artifactliststruct::total_chance, artifactliststruct::type, and obj::type.
Referenced by generate_map(), init_beforeplay(), ResourcesManager::load(), and main().
Checks if op can be combined with art.
Definition at line 221 of file artifact.c.
References artifactstruct::allowed, obj::arch, llevDebug, LOG(), linked_char::name, obj::name, archt::name, and linked_char::next.
Referenced by command_create(), CREArtifactPanel::computeMadeViaAlchemy(), find_artifact(), generate_artifact(), and locate_recipe_artifact().
int artifact_init |
1 if doing archetypes initialization
Definition at line 28 of file artifact.c.
Referenced by init_artifacts(), local_check_loaded_object(), and teardown().