Crossfire Server, Trunk
disease.c File Reference
#include "global.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "living.h"
#include "object.h"
#include "skills.h"
#include "sounds.h"
#include "spells.h"
#include "sproto.h"
+ Include dependency graph for disease.c:

Go to the source code of this file.

Functions

static void check_infection (object *disease)
 
void check_physically_infect (object *victim, object *hitter)
 
int cure_disease (object *sufferer, object *caster, sstring skill)
 
static void do_symptoms (object *disease)
 
static objectfind_symptom (object *disease)
 
static void grant_immunity (object *disease)
 
int infect_object (object *victim, object *disease, int force)
 
static int is_susceptible_to_disease (object *victim, object *disease)
 
int move_disease (object *disease)
 
void move_symptom (object *symptom)
 
static void remove_symptoms (object *disease)
 

Detailed Description

This file contains all the code implementing diseases, except for odds and ends in attack.c and in living.c

Definition in file disease.c.

Function Documentation

◆ check_infection()

static void check_infection ( object disease)
static

Searches around for more victims to infect.

Parameters
diseasedisease infecting. Can be either on a map or inside another object.

Definition at line 268 of file disease.c.

References obj::env, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_flags(), infect_object(), obj::magic, disinfect::map, obj::map, P_IS_ALIVE, P_OUT_OF_MAP, Ice::tmp, diamondslots::x, obj::x, diamondslots::y, and obj::y.

Referenced by move_disease().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_physically_infect()

void check_physically_infect ( object victim,
object hitter 
)

Possibly infect due to direct physical contact i.e., AT_PHYSICAL.

Parameters
victimpotential victim.
hitterwho is hitting.

Definition at line 663 of file disease.c.

References DISEASE, FOR_INV_FINISH, FOR_INV_PREPARE, death_message::hitter, infect_object(), and reputation::victim.

Referenced by hit_with_one_attacktype().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cure_disease()

int cure_disease ( object sufferer,
object caster,
sstring  skill 
)

Do the cure disease stuff, from the spell "cure disease".

Parameters
suffererwho is getting cured.
casterspell object used for curing. If NULL all diseases are removed, else only those of lower level than caster or randomly chosen.
skillskill to give experience to, can be NULL.
Return values
0no disease was cured.
1at least one disease was cured.

Definition at line 685 of file disease.c.

References change_exp(), DISEASE, draw_ext_info(), draw_ext_info_format(), liv::exp, FLAG_STARTEQUIP, FOR_INV_FINISH, FOR_INV_PREPARE, obj::level, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, MSG_TYPE_SPELL, MSG_TYPE_SPELL_HEAL, NDI_UNIQUE, object_free_drop_inventory(), object_remove(), PREFER_LOW, QUERY_FLAG, random_roll(), remove_symptoms(), and obj::stats.

Referenced by cast_heal(), and restore_player().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ do_symptoms()

static void do_symptoms ( object disease)
static

◆ find_symptom()

static object * find_symptom ( object disease)
static

Find a symptom for a disease in disease's env.

Parameters
diseasedisease to search symptom of. Must be in another object.
Returns
matching symptom object, NULL if none found.

Definition at line 255 of file disease.c.

References obj::env, obj::name, object_find_by_type_and_name(), and SYMPTOM.

Referenced by do_symptoms(), and remove_symptoms().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ grant_immunity()

static void grant_immunity ( object disease)
static

Grants immunity to a disease.

Parameters
diseasedisease to grant immunity to. Must be in another object.

Definition at line 564 of file disease.c.

References add_string(), create_archetype(), obj::env, obj::last_heal, obj::level, obj::move_block, obj::name, object_find_by_type_and_name(), object_insert_in_ob(), and SIGN.

Referenced by move_disease().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infect_object()

int infect_object ( object victim,
object disease,
int  force 
)

Try to infect something with a disease. Rules:

  • objects with immunity aren't infectable.
  • objects already infected aren't infectable.
  • dead objects aren't infectable.
  • undead objects are infectible only if specifically named.
Parameters
victimpotential victim to infect.
diseasewhat could infect.
forcedon't do a random check for infection. Other checks (susceptible to disease, not immune, and so on) are still done.
Return values
0victim wasn't infected.
1victim was infected.

Definition at line 317 of file disease.c.

References add_refcount(), buf, DISEASE, draw_ext_info(), obj::env, FLAG_MONSTER, liv::food, dragon_attune::force, free_string(), HEAD, is_susceptible_to_disease(), obj::last_grace, obj::level, obj::map, liv::maxgrace, liv::maxhp, obj::move_block, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, obj::name, NDI_RED, NDI_UNIQUE, object_copy(), object_find_by_type_and_name(), object_get_owner(), object_insert_in_ob(), object_new(), object_set_owner(), op_on_battleground(), PLAYER, PREFER_HIGH, QUERY_FLAG, random_roll(), SIGN, obj::skill, obj::stats, obj::title, Ice::tmp, obj::type, obj::value, reputation::victim, and liv::wc.

Referenced by cast_cause_disease(), check_infection(), check_physically_infect(), and rune_attack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_susceptible_to_disease()

static int is_susceptible_to_disease ( object victim,
object disease 
)
static

Check if victim is susceptible to disease. Does not check for immunity.

Parameters
victimpotential victim.
diseasedisease to check.
Return values
1victim can be infected
0victim doesn't care for the disease.

Definition at line 153 of file disease.c.

References FLAG_ALIVE, FLAG_UNDEAD, FLAG_WIZ, QUERY_FLAG, obj::race, undead_name, and reputation::victim.

Referenced by do_symptoms(), infect_object(), and move_disease().

+ Here is the caller graph for this function:

◆ move_disease()

int move_disease ( object disease)

Ticks the clock for disease: infect, aggravate symptoms, ...

Parameters
diseasedisease to move. Can be removed during processing.
Return values
1if disease was removed.
0disease just moved.

Definition at line 180 of file disease.c.

References check_infection(), do_symptoms(), obj::env, FLAG_WIZ, liv::food, grant_immunity(), is_susceptible_to_disease(), liv::maxhp, object_free_drop_inventory(), object_remove(), QUERY_FLAG, remove_symptoms(), obj::stats, and obj::value.

Referenced by legacy_ob_process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move_symptom()

void move_symptom ( object symptom)

◆ remove_symptoms()

static void remove_symptoms ( object disease)
static

Remove any symptoms of disease.

Modified by MSW 2003-03-28 do try to find all the symptom the player may have - I think through some odd interactoins with disease level and player level and whatnot, a player could get more than one symtpom to a disease.

Parameters
diseasedisease to remove. Must be in a living object.

Definition at line 232 of file disease.c.

References obj::env, find_symptom(), fix_object(), object_free_drop_inventory(), object_remove(), and reputation::victim.

Referenced by cure_disease(), and move_disease().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: