Crossfire Server, Branch 1.12  R12190
Functions
disease.c File Reference

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

#include <global.h>
#include <object.h>
#include <living.h>
#include <sproto.h>
#include <spells.h>
#include <sounds.h>
#include <skills.h>
#include <assert.h>
Include dependency graph for disease.c:

Go to the source code of this file.

Functions

static void check_infection (object *disease)
 Searches around for more victims to infect.
void check_physically_infect (object *victim, object *hitter)
 Possibly infect due to direct physical contact i.e., AT_PHYSICAL.
int cure_disease (object *sufferer, object *caster)
 Do the cure disease stuff, from the spell "cure disease".
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.
static object * find_symptom (object *disease)
 Find a symptom for a disease in disease's env.
static void grant_immunity (object *disease)
 Grants immunity to a disease.
int infect_object (object *victim, object *disease, int force)
 Try to infect something with a disease.
static int is_susceptible_to_disease (object *victim, object *disease)
 Check if victim is susceptible to disease.
int move_disease (object *disease)
 Ticks the clock for disease: infect, aggravate symptoms, ...
void move_symptom (object *symptom)
 Make the symptom do the nasty things it does.
static void remove_symptoms (object *disease)
 Remove any symptoms of 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

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 285 of file disease.c.

References get_map_flags(), GET_MAP_OB, infect_object(), P_IS_ALIVE, and P_OUT_OF_MAP.

Referenced by move_disease().

Here is the call graph for this function:

Here is the caller graph for this function:

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 694 of file disease.c.

References DISEASE, and infect_object().

Referenced by hit_with_one_attacktype().

Here is the call graph for this function:

Here is the caller graph for this function:

int cure_disease ( object *  sufferer,
object *  caster 
)

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.
Return values:
0no disease was cured.
1at least one disease was cured.

Definition at line 715 of file disease.c.

References change_exp(), DISEASE, draw_ext_info(), draw_ext_info_format(), FLAG_STARTEQUIP, free_object(), MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_END, MSG_TYPE_SPELL, MSG_TYPE_SPELL_HEAL, NDI_UNIQUE, PREFER_LOW, QUERY_FLAG, random_roll(), remove_ob(), and remove_symptoms().

Referenced by cast_heal(), and kill_player().

Here is the call graph for this function:

Here is the caller graph for this function:

static void do_symptoms ( object *  disease) [static]

This function monitors the symptoms caused by the disease (if any), causes symptoms, and modifies existing symptoms in the case of existing diseases.

Parameters:
diseasedisease acting. Should be in a living object.

Definition at line 452 of file disease.c.

References add_refcount(), add_string(), create_archetype(), FABS, find_symptom(), fix_object(), FLAG_APPLIED, FLAG_WIZ, FREE_AND_COPY, free_string(), insert_ob_in_ob(), is_susceptible_to_disease(), PREFER_LOW, QUERY_FLAG, random_roll(), SET_FLAG, set_owner(), and SIGN.

Referenced by move_disease().

Here is the call graph for this function:

Here is the caller graph for this function:

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 267 of file disease.c.

References SYMPTOM.

Referenced by do_symptoms(), and remove_symptoms().

Here is the caller graph for this function:

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 584 of file disease.c.

References add_string(), create_archetype(), insert_ob_in_ob(), and SIGN.

Referenced by move_disease().

Here is the call graph for this function:

Here is the caller graph for this function:

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 336 of file disease.c.

References add_refcount(), copy_object(), DISEASE, draw_ext_info(), FLAG_MONSTER, free_string(), get_object(), get_owner(), insert_ob_in_ob(), is_susceptible_to_disease(), MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, NDI_RED, NDI_UNIQUE, op_on_battleground(), PLAYER, PREFER_HIGH, QUERY_FLAG, random_roll(), set_owner(), SIGN, and snprintf().

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:

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 165 of file disease.c.

References FLAG_ALIVE, FLAG_UNDEAD, FLAG_WIZ, QUERY_FLAG, and undead_name.

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

Here is the caller graph for this function:

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 192 of file disease.c.

References check_infection(), do_symptoms(), FLAG_WIZ, free_object(), grant_immunity(), is_susceptible_to_disease(), QUERY_FLAG, remove_ob(), and remove_symptoms().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

void move_symptom ( object *  symptom)

Make the symptom do the nasty things it does.

Parameters:
symptomsymptom to move.

Definition at line 615 of file disease.c.

References arch_to_object(), draw_ext_info(), FLAG_FREED, FREE_AND_COPY, free_object(), hit_player(), insert_ob_in_map(), llevError, LOG(), MAX, MAX_BUF, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, NDI_RED, NDI_UNIQUE, QUERY_FLAG, remove_ob(), and snprintf().

Referenced by legacy_ob_process().

Here is the call graph for this function:

Here is the caller graph for this function:

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 244 of file disease.c.

References find_symptom(), fix_object(), free_object(), and remove_ob().

Referenced by cure_disease(), and move_disease().

Here is the call graph for this function:

Here is the caller graph for this function: