Crossfire Server, Trunk
|
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) |
void | artifact_compute_chance_for_item (const object *op, const artifact *art, int *numerator, int *denominator) |
uint16_t | 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) |
artifactlist * | find_artifactlist (int type) |
void | generate_artifact (object *op, int difficulty) |
artifact * | get_empty_artifact (void) |
artifactlist * | get_empty_artifactlist (void) |
void | give_artifact_abilities (object *op, const object *artifact) |
int | legal_artifact_combination (const object *op, const artifact *art) |
#define ARTIFACT_TRIES 2 |
Give 1 re-roll attempt per artifact
Definition at line 131 of file artifact.c.
#define KEY_ANIMATION_SUFFIX "animation_suffix" |
Definition at line 321 of file artifact.c.
#define KEY_FACE_SUFFIX "face_suffix" |
Definition at line 320 of file artifact.c.
Apply artifact properties to an object.
op | object to apply changes to. |
change | changes to apply, with fields handled as described in the artifacts file. |
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 329 of file artifact.c.
References liv::ac, add_refcount(), animate::anim, obj::anim_speed, obj::animation, arch_to_object(), obj::attacktype, blank_face, buf, change_attr_value(), CLEAR_FLAG, compute_face_name(), liv::dam, liv::exp, obj::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_REFLECTING, 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, make_face_from_files::int, commongive::inv, obj::inv, is_identified(), obj::item_power, _key_value::key, castle_read::key, KEY_ANIMATION_SUFFIX, KEY_FACE_SUFFIX, obj::key_values, obj::last_sp, obj::level, llevDebug, LOG(), liv::luck, obj::material, obj::materialname, MAX_BUF, liv::maxhp, liv::maxsp, obj::move_type, obj::msg, Face::name, animations_struct::name, obj::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(), give::op, obj::other_arch, obj::path_attuned, obj::path_denied, obj::path_repelled, POTION, QUERY_FLAG, obj::race, obj::resist, ROD, set_abs_magic(), SET_FLAG, obj::slaying, liv::sp, sstring, obj::stats, Ice::tmp, try_find_animation(), try_find_face(), _key_value::value, obj::value, liv::wc, and obj::weight.
Referenced by artifact_describe(), and give_artifact_abilities().
void artifact_compute_chance_for_item | ( | const object * | op, |
const artifact * | art, | ||
int * | numerator, | ||
int * | denominator | ||
) |
Compute the chance for a specified item to become the specified artifact. This does not take into account the 10% chance of an item being made an artifact.
op | item to consider. |
art | artifact to compute the chance of. |
numerator | chance in denominator for the artifact to be generated. |
denominator | denominator, will never be 0. |
Definition at line 141 of file artifact.c.
References artifactstruct::chance, reputation_trigger_connect::check(), find_artifactlist(), legal_artifact_combination(), guildoracle::list, and give::op.
Referenced by ArtifactWrapper::displayName().
uint16_t 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 642 of file artifact.c.
References artifactstruct::allowed, artifactstruct::allowed_size, archininventory::arch, blank_face, obj::face, find_archetype_by_object_name(), get_next_archetype(), artifactstruct::item, linked_char::name, linked_char::next, Face::number, try_find_archetype(), and obj::type.
Referenced by ArtifactWrapper::displayIcon(), and START_TEST().
|
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 299 of file artifact.c.
References buf, give::name, strlcpy(), and castle_read::suffix.
Referenced by add_abilities().
void dump_artifacts | ( | void | ) |
For debugging purposes. Dumps all tables.
Definition at line 616 of file artifact.c.
References artifactstruct::allowed, artifactstruct::chance, artifactstruct::difficulty, first_artifactlist, artifactstruct::item, artifactliststruct::items, logfile, obj::name, artifactstruct::next, artifactliststruct::next, give::next, artifactliststruct::total_chance, and artifactliststruct::type.
Referenced by init_beforeplay().
Searches and returns a specific artifact compatible with an object, NULL if not found.
op | item to search the artifact for. |
name | artifact name. |
Definition at line 590 of file artifact.c.
References find_artifactlist(), find_string(), artifactstruct::item, legal_artifact_combination(), guildoracle::list, give::name, obj::name, artifactstruct::next, give::op, and sstring.
Referenced by add_one_item(), save_object_in_sb(), and while().
artifactlist* find_artifactlist | ( | int | type | ) |
Finds the artifact list for a certain item type.
type | item type to get the artifacts of. |
Definition at line 575 of file artifact.c.
References first_artifactlist, artifactliststruct::next, is_valid_types_gen::type, and artifactliststruct::type.
Referenced by artifact_compute_chance_for_item(), artifact_msg(), cast_create_missile(), command_create(), ArtifactWrapper::displayName(), find_artifact(), generate_artifact(), ArtifactLoader::load(), locate_recipe_artifact(), and AssetWithArtifacts< archetype >::updateArtifacts().
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.
op | object to attempt to transform. |
difficulty | limit for artifact difficulty. |
Definition at line 187 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, give::op, RANDOM, and artifactliststruct::total_chance.
Referenced by alchemy_failure_effect(), fix_generated_item(), generate_monster_arch(), generate_monster_inv(), and START_TEST().
artifact* get_empty_artifact | ( | void | ) |
Allocate and return the pointer to an empty artifact structure.
Definition at line 56 of file artifact.c.
References fatal(), OUT_OF_MEMORY, and Floor::t.
Referenced by ArtifactLoader::load().
artifactlist* get_empty_artifactlist | ( | void | ) |
Allocate and return the pointer to an empty artifactlist structure.
Definition at line 37 of file artifact.c.
References fatal(), artifactliststruct::items, artifactliststruct::next, OUT_OF_MEMORY, and artifactliststruct::total_chance.
Referenced by ArtifactLoader::load().
Fixes the given object, giving it the abilities and titles it should have due to the second artifact-template.
op | object to give properties to. |
artifact | what properties to apply. |
Definition at line 238 of file artifact.c.
References add_abilities(), add_refcount(), add_string(), free_string(), MAX_BUF, and give::op.
Referenced by add_one_item(), ArtifactPanel::artifactChanged(), cast_create_missile(), command_create(), generate_artifact(), make_item_from_recipe(), recipe_get_face(), save_object_in_sb(), and while().
Checks if op can be combined with art.
op | object to test. |
art | artifact to test. |
Definition at line 260 of file artifact.c.
References artifactstruct::allowed, llevDebug, LOG(), give::name, give::op, and Ice::tmp.
Referenced by artifact_compute_chance_for_item(), command_create(), ArtifactPanel::computeMadeViaAlchemy(), find_artifact(), generate_artifact(), locate_recipe_artifact(), and AssetWithArtifacts< archetype >::updateArtifacts().