Crossfire Server, Trunk
|
#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"
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 object * | find_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) |
This file contains all the code implementing diseases, except for odds and ends in attack.c and in living.c
Definition in file disease.cpp.
|
static |
Searches around for more victims to infect.
disease | disease infecting. Can be either on a map or inside another object. |
Definition at line 268 of file disease.cpp.
References object::env, FOR_MAP_FINISH, FOR_MAP_PREPARE, get_map_flags(), infect_object(), object::magic, disinfect::map, object::map, P_IS_ALIVE, P_OUT_OF_MAP, Ice::tmp, diamondslots::x, object::x, diamondslots::y, and object::y.
Referenced by move_disease().
Possibly infect due to direct physical contact i.e., AT_PHYSICAL.
victim | potential victim. |
hitter | who is hitting. |
Definition at line 663 of file disease.cpp.
References DISEASE, FOR_INV_FINISH, FOR_INV_PREPARE, death_message::hitter, infect_object(), and sword_of_souls::victim.
Referenced by hit_with_one_attacktype().
Do the cure disease stuff, from the spell "cure disease".
sufferer | who is getting cured. |
caster | spell object used for curing. If NULL all diseases are removed, else only those of lower level than caster or randomly chosen. |
skill | skill to give experience to, can be NULL. |
0 | no disease was cured. |
1 | at least one disease was cured. |
Definition at line 685 of file disease.cpp.
References change_exp(), DISEASE, draw_ext_info(), draw_ext_info_format(), living::exp, FLAG_STARTEQUIP, FOR_INV_FINISH, FOR_INV_PREPARE, object::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 object::stats.
Referenced by cast_heal(), and restore_player().
|
static |
This function monitors the symptoms caused by the disease (if any), causes symptoms, and modifies existing symptoms in the case of existing diseases.
disease | disease acting. Should be in a living object. |
Definition at line 432 of file disease.cpp.
References living::ac, add_refcount(), ARCH_SYMPTOM, object::attacktype, living::Cha, check_stat_bounds(), living::Con, create_archetype(), living::dam, living::Dex, object::env, living::exp, FABS, find_symptom(), fix_object(), FLAG_APPLIED, FLAG_WIZ, living::food, FREE_AND_COPY, free_string(), get_attr_value(), HEAD, living::hp, make_face_from_files::int, living::Int, is_susceptible_to_disease(), object::last_eat, object::last_sp, object::level, Settings::max_stat, living::maxgrace, living::maxsp, object::move_block, object::msg, object::name, object::name_pl, NUM_STATS, object_find_by_type_and_name(), object_get_owner(), object_insert_in_ob(), object_set_msg(), object_set_owner(), object::other_arch, living::Pow, PREFER_LOW, QUERY_FLAG, random_roll(), set_attr_value(), SET_FLAG, settings, SIGN, object::skill, living::sp, object::speed, object::stats, living::Str, Ice::tmp, object::value, sword_of_souls::victim, and living::Wis.
Referenced by move_disease().
Find a symptom for a disease in disease's env.
disease | disease to search symptom of. Must be in another object. |
Definition at line 255 of file disease.cpp.
References object::env, object::name, object_find_by_type_and_name(), and SYMPTOM.
Referenced by do_symptoms(), and remove_symptoms().
|
static |
Grants immunity to a disease.
disease | disease to grant immunity to. Must be in another object. |
Definition at line 564 of file disease.cpp.
References add_string(), create_archetype(), object::env, object::last_heal, object::level, object::move_block, object::name, object_find_by_type_and_name(), object_insert_in_ob(), and SIGN.
Referenced by move_disease().
Try to infect something with a disease. Rules:
victim | potential victim to infect. |
disease | what could infect. |
force | don't do a random check for infection. Other checks (susceptible to disease, not immune, and so on) are still done. |
0 | victim wasn't infected. |
1 | victim was infected. |
Definition at line 317 of file disease.cpp.
References add_refcount(), buf, DISEASE, draw_ext_info(), object::env, FLAG_MONSTER, living::food, dragon_attune::force, free_string(), HEAD, is_susceptible_to_disease(), object::last_grace, object::level, object::map, living::maxgrace, living::maxhp, object::move_block, MSG_TYPE_ATTACK, MSG_TYPE_ATTACK_DID_HIT, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, object::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, object::skill, object::stats, object::title, Ice::tmp, object::type, object::value, sword_of_souls::victim, and living::wc.
Referenced by cast_cause_disease(), check_infection(), check_physically_infect(), and rune_attack().
Check if victim is susceptible to disease. Does not check for immunity.
victim | potential victim. |
disease | disease to check. |
1 | victim can be infected |
0 | victim doesn't care for the disease. |
Definition at line 153 of file disease.cpp.
References FLAG_ALIVE, FLAG_UNDEAD, FLAG_WIZ, QUERY_FLAG, object::race, undead_name, and sword_of_souls::victim.
Referenced by do_symptoms(), infect_object(), and move_disease().
int move_disease | ( | object * | disease | ) |
Ticks the clock for disease: infect, aggravate symptoms, ...
disease | disease to move. Can be removed during processing. |
1 | if disease was removed. |
0 | disease just moved. |
Definition at line 180 of file disease.cpp.
References check_infection(), do_symptoms(), object::env, FLAG_WIZ, living::food, grant_immunity(), is_susceptible_to_disease(), living::maxhp, object_free_drop_inventory(), object_remove(), QUERY_FLAG, remove_symptoms(), object::stats, and object::value.
Referenced by legacy_ob_process().
void move_symptom | ( | object * | symptom | ) |
Make the symptom do the nasty things it does.
symptom | symptom to move. |
Definition at line 592 of file disease.cpp.
References arch_to_object(), object::attacktype, object::count, living::dam, draw_ext_info(), object::env, FLAG_FREED, FREE_AND_COPY, HEAD, hit_player(), llevError, LOG(), MAX, MAX_BUF, living::maxsp, object::msg, MSG_TYPE_ATTRIBUTE, MSG_TYPE_ATTRIBUTE_BAD_EFFECT_START, give::name, object::name, object::name_pl, NDI_RED, NDI_UNIQUE, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_was_destroyed, object::other_arch, QUERY_FLAG, object::stats, CFweardisguise::tag, Ice::tmp, and sword_of_souls::victim.
Referenced by legacy_ob_process().
|
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.
disease | disease to remove. Must be in a living object. |
Definition at line 232 of file disease.cpp.
References object::env, find_symptom(), fix_object(), object_free_drop_inventory(), object_remove(), and sword_of_souls::victim.
Referenced by cure_disease(), and move_disease().