164 if ((victim->
race && strstr(disease->
race, victim->
race))
165 || strstr(disease->
race, victim->
name))
189 if (disease->
env == NULL) {
192 if (disease->
value == 0) {
233 object *symptom, *victim = NULL;
235 assert(disease != NULL);
239 victim = symptom->
env;
256 assert(disease->
env != NULL);
269 int x, y, range, mflags;
271 int16_t i, j, i2, j2;
273 range = abs(disease->
magic);
286 for (i = x-range; i <= x+range; i++) {
287 for (j = y-range; j <= y+range; j++) {
322 victim =
HEAD(victim);
355 if (tmp != NULL && tmp->
level >= disease->
level)
377 if (new_disease->
skill)
405 if (new_disease->
title)
406 snprintf(buf,
sizeof(buf),
"%s %s!!", disease->
title, victim->
name);
408 snprintf(buf,
sizeof(buf),
"You infect %s with your disease, %s!", victim->
name, new_disease->
name);
419 "You suddenly feel ill.");
436 victim = disease->
env;
443 if (victim == NULL || victim == disease)
451 if (symptom == NULL) {
454 int reduce_level = 0;
467 reduce_level = tmp->
level;
492 new_symptom->
level = disease->
level - reduce_level;
494 new_symptom->
value = 0;
514 if (new_symptom->
skill)
534 scale = 1.0+symptom->
value/100.0;
538 cur_stat = (int)(scale * cur_stat);
571 assert(disease->
env != NULL);
575 if (immunity != NULL) {
593 object *victim = symptom->
env;
598 if (victim == NULL || victim->
map == NULL) {
634 for (tmp =
HEAD(victim); tmp != NULL; tmp = tmp->
more) {
638 snprintf(name,
sizeof(name),
"%s's %s", victim->
name, new_ob->
name);
641 snprintf(name,
sizeof(name),
"%s's %s", victim->
name, new_ob->
name_pl);
648 LOG(
llevError,
"BUG: move_symptom(): symptom %d (%s) without message!\n", symptom->
count, symptom->
name);
690 casting_level = caster->
level;
692 casting_level = 1000;
702 if ((casting_level >= disease->level)
717 "You cure a disease!");
720 "You no longer feel diseased.");
void check_stat_bounds(living *stats, int8_t min_stat, int8_t max_stat)
Ensures that all stats (str/dex/con/wis/cha/int) are within the passed in range of min_stat and max_s...
Spell-related defines: spellpath, subtypes, ...
uint8_t max_stat
Maximum stat value - 255 should be sufficient.
object * object_get_owner(object *op)
Returns the object which this object marks as being the owner.
void LOG(LogLevel logLevel, const char *format,...)
Logs a message to stderr, or to file.
#define FABS(x)
Decstations have trouble with fabs()...
void draw_ext_info_format(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *format,...) PRINTF_ARGS(6
void check_physically_infect(object *victim, object *hitter)
Possibly infect due to direct physical contact i.e., AT_PHYSICAL.
void fix_object(object *op)
Updates all abilities given by applied objects in the inventory of the given object.
void object_set_msg(object *op, const char *msg)
Set the message field of an object.
void object_remove(object *op)
This function removes the object op from the linked list of objects which it is currently tied to...
#define MSG_TYPE_SPELL
Spell related info.
int16_t maxgrace
Maximum grace.
object * more
Pointer to the rest of a large body of objects.
sstring add_string(const char *str)
Share a string.
int32_t value
How much money it is worth (or contains)
#define ARCH_SYMPTOM
Archetype for disease symptom.
void change_exp(object *op, int64_t exp, const char *skill_name, int flag)
Changes experience to a player/monster.
int16_t y
Position in the map for this object.
int8_t magic
Any magical bonuses to this item.
sstring add_refcount(sstring str)
Like add_string(), but the string is already a shared string.
MoveType move_block
What movement types this blocks.
#define object_was_destroyed(op, old_tag)
Checks if an object still exists.
void object_set_owner(object *op, object *owner)
Sets the owner and sets the skill and exp pointers to owner's current skill and experience objects...
static int is_susceptible_to_disease(object *victim, object *disease)
Check if victim is susceptible to disease.
Global type definitions and header inclusions.
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
Sends message to player(s).
static void do_symptoms(object *disease)
This function monitors the symptoms caused by the disease (if any), causes symptoms, and modifies existing symptoms in the case of existing diseases.
void set_attr_value(living *stats, int attr, int8_t value)
Sets Str/Dex/con/Wis/Cha/Int/Pow in stats to value, depending on what attr is (STR to POW)...
#define FLAG_UNDEAD
Monster is undead.
void free_string(sstring str)
This will reduce the refcount, and if it has reached 0, str will be freed.
int16_t level
Level of creature or object.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END
End of a bad effect.
#define FLAG_ALIVE
Object can fight (or be fought)
#define MSG_TYPE_SPELL_HEAL
Healing related spells.
int cure_disease(object *sufferer, object *caster, sstring skill)
Do the cure disease stuff, from the spell "cure disease".
float speed
Frequency of object 'moves' relative to server tick rate.
object * arch_to_object(archetype *at)
Creates and returns a new object which is a copy of the given archetype.
object * create_archetype(const char *name)
Finds which archetype matches the given name, and returns a new object containing a copy of the arche...
object * env
Pointer to the object which is the environment.
int32_t last_sp
As last_heal, but for spell points.
#define QUERY_FLAG(xyz, p)
#define MSG_TYPE_ATTRIBUTE
Changes to attributes (stats, resistances, etc)
void object_free_drop_inventory(object *ob)
Frees everything allocated by an object, removes it from the list of used objects, and puts it on the list of free objects.
#define FOR_INV_FINISH()
Finishes FOR_INV_PREPARE().
sstring msg
If this is a book/sign/magic mouth/etc.
sstring race
Human, goblin, dragon, etc.
int infect_object(object *victim, object *disease, int force)
Try to infect something with a disease.
#define P_OUT_OF_MAP
This space is outside the map.
struct Settings settings
Global settings.
static void check_infection(object *disease)
Searches around for more victims to infect.
object * object_new(void)
Grabs an object from the list of unused objects, makes sure it is initialised, and returns it...
static void remove_symptoms(object *disease)
Remove any symptoms of disease.
int op_on_battleground(object *op, int *x, int *y, archetype **trophy)
Check if the given object (usually a player) is standing on a battleground tile.
int random_roll(int min, int max, const object *op, int goodbad)
Roll a random number between min and max.
uint32_t tag_t
Object tag, unique during the whole game.
int16_t dam
How much damage this object does when hitting.
#define HEAD(op)
Returns the head part of an object.
#define FLAG_WIZ
Object has special privilegies.
static void grant_immunity(object *disease)
Grants immunity to a disease.
living stats
Str, Con, Dex, etc.
#define MAX_BUF
Used for all kinds of things.
#define MSG_TYPE_ATTACK
Attack related messages.
#define MSG_TYPE_ATTACK_DID_HIT
Player hit something else.
void object_copy(const object *src_ob, object *dest_ob)
Copy object first frees everything allocated by the second object, and then copies the contents of th...
struct mapstruct * map
Pointer to the map in which this object is present.
Skill-related defines, including subtypes.
#define FOR_MAP_FINISH()
Finishes FOR_MAP_PREPARE().
object * object_find_by_type_and_name(const object *who, int type, const char *name)
Find object in inventory by type and name.
struct archetype * other_arch
Pointer used for various things - mostly used for what this objects turns into or what this object cr...
sstring name_pl
The plural name of the object.
Object structure, the core of Crossfire.
#define FREE_AND_COPY(sv, nv)
Release the shared string if not NULL, and make it a reference to nv.
sstring name
The name of the object, obviously...
int8_t get_attr_value(const living *stats, int attr)
Gets the value of a stat.
sstring title
Of foo, etc.
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
This rolls up wall, blocks_magic, blocks_view, etc, all into one function that just returns a P_...
uint8_t type
PLAYER, BULLET, etc.
int8_t ac
Armor Class, lower AC increases probability of not getting hit.
#define FLAG_APPLIED
Object is ready for use by living.
#define FLAG_STARTEQUIP
Object was given to player at start.
int move_disease(object *disease)
Ticks the clock for disease: infect, aggravate symptoms, ...
sstring skill
Name of the skill this object uses/grants.
static object * find_symptom(object *disease)
Find a symptom for a disease in disease's env.
int16_t maxsp
Max spell points.
uint32_t attacktype
Bitmask of attacks this object does.
#define FLAG_MONSTER
Will attack players.
#define NDI_UNIQUE
Print immediately, don't buffer.
int32_t last_heal
Last healed.
#define FOR_MAP_PREPARE(map_, mx_, my_, it_)
Constructs a loop iterating over all objects of a map tile.
int32_t food
How much food in stomach.
Structure containing object statistics.
int16_t maxhp
Max hit points.
#define P_IS_ALIVE
Something alive is on this space.
object * object_insert_in_ob(object *op, object *where)
This function inserts the object op in the linked list inside the object environment.
object * object_insert_in_map_at(object *op, mapstruct *m, object *originator, int flag, int x, int y)
Same as object_insert_in_map() except it handle separate coordinates and do a clean job preparing mul...
int8_t wc
Weapon Class, lower WC increases probability of hitting.
tag_t count
Unique object number for this object.
int hit_player(object *op, int dam, object *hitter, uint32_t type, int full_hit)
Object is attacked by something.
int16_t last_grace
As last_sp, except for grace.
void move_symptom(object *symptom)
Make the symptom do the nasty things it does.
#define FOR_INV_PREPARE(op_, it_)
Constructs a loop iterating over the inventory of an object.
#define MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START
Start of a bad effect to the player.
int32_t last_eat
How long since we last ate.
#define FLAG_FREED
Object is in the list of free objects.