ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/disease.C
(Generate patch)

Comparing deliantra/server/server/disease.C (file contents):
Revision 1.68 by root, Sun May 1 16:58:17 2011 UTC vs.
Revision 1.73 by root, Sun Jan 29 02:47:05 2017 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the Affero GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 20 * <http://www.gnu.org/licenses/>.
21 * 21 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 23 */
24 24
25/* This file contains all the code implementing diseases, 25/* This file contains all the code implementing diseases,
26 * except for odds and ends in attack.c and in 26 * except for odds and ends in attack.c and in
27 * living.c 27 * living.c
28 */ 28 */
29 29
30/* 30/*
31 31
36other_arch Creation object created and dropped when symptom moved. 36other_arch Creation object created and dropped when symptom moved.
37title Message When the "disease" "infects" something, it will 37title Message When the "disease" "infects" something, it will
38 print "title victim!!!" to the player who owns 38 print "title victim!!!" to the player who owns
39 the "disease". 39 the "disease".
40wc+ Infectiousness How well the plague spreads person-to-person 40wc+ Infectiousness How well the plague spreads person-to-person
41magic+ Range range of infection 41magic+ Range range of infection
42Stats* Disability What stats are reduced by the disease (str con...) 42Stats* Disability What stats are reduced by the disease (str con...)
43maxhp+ Persistence How long the disease can last OUTSIDE the host. 43maxhp+ Persistence How long the disease can last OUTSIDE the host.
44value TimeLeft Counter for persistence 44value TimeLeft Counter for persistence
45dam^ Damage How much damage it does (%?). 45dam^ Damage How much damage it does (%?).
46maxgrace+ Duration How long before the disease is naturally cured. 46maxgrace+ Duration How long before the disease is naturally cured.
47food DurCount Counter for Duration 47food DurCount Counter for Duration
48 48
49speed Speed How often the disease moves. 49speed Speed How often the disease moves.
50last_sp^ Lethargy Percentage of max speed. 10 = 10% speed. 50last_sp^ Lethargy Percentage of max speed. 10 = 10% speed.
51 51
52maxsp^ Mana deplete Saps mana. 52maxsp^ Mana deplete Saps mana.
53ac^ Progressiveness How the diseases increases in severity. 53ac^ Progressiveness How the diseases increases in severity.
54last_eat*^ Deplete food saps food if negative 54last_eat*^ Deplete food saps food if negative
55last_heal GrantImmunity If nonzero, disease does NOT grant immunity 55last_heal GrantImmunity If nonzero, disease does NOT grant immunity
56 when it runs out 56 when it runs out
57 57
58exp experience experience awarded when plague cured 58exp experience experience awarded when plague cured
59hp*^ ReduceRegen reduces regeneration of disease-bearer 59hp*^ ReduceRegen reduces regeneration of disease-bearer
60sp*^ ReduceSpRegen reduces spellpoint regeneration 60sp*^ ReduceSpRegen reduces spellpoint regeneration
61 61
62name Name Name of the plague 62name Name Name of the plague
63msg message What the plague says when it strikes. 63msg message What the plague says when it strikes.
64race those affected species/race the plague strikes (* = everything) 64race those affected species/race the plague strikes (* = everything)
65level Plague Level General description of the plague's deadliness 65level Plague Level General description of the plague's deadliness
66armour Attenuation reduction in wc per generation of disease. 66armour Attenuation reduction in wc per generation of disease.
67 This builds in a self-limiting factor. 67 This builds in a self-limiting factor.
68
69 68
70Explanations: 69Explanations:
71* means this # should be negative to cause adverse effect. 70* means this # should be negative to cause adverse effect.
72+ means that this effect is modulated in spells by ldur 71+ means that this effect is modulated in spells by ldur
73^ means that this effect is modulated in spells by ldam 72^ means that this effect is modulated in spells by ldam
131#include <sproto.h> 130#include <sproto.h>
132#include <spells.h> 131#include <spells.h>
133#include <sounds.h> 132#include <sounds.h>
134#include <skills.h> 133#include <skills.h>
135 134
136/* IMPLEMENTATION NOTES 135/* IMPLEMENTATION NOTES
137 136
138 Diseases may be contageous. They are objects which exist in a player's 137 Diseases may be contageous. They are objects which exist in a player's
139inventory. They themselves do nothing, except modify Symptoms, or 138inventory. They themselves do nothing, except modify Symptoms, or
140spread to other live objects. Symptoms are what actually damage the player: 139spread to other live objects. Symptoms are what actually damage the player:
141these are their own object. */ 140these are their own object. */
142 141
143/* grants immunity to plagues we've seen before. */ 142/* grants immunity to plagues we've seen before. */
144static int 143static int
381 380
382int 381int
383move_disease (object *disease) 382move_disease (object *disease)
384{ 383{
385 /* First task is to determine if the disease is inside or outside of someone. 384 /* First task is to determine if the disease is inside or outside of someone.
386 * If outside, we decrement 'value' until we're gone. 385 * If outside, we decrement 'value' until we're gone.
387 */ 386 */
388 387
389 if (!disease->env) 388 if (!disease->env)
390 { /* we're outside of someone */ 389 { /* we're outside of someone */
391 if (disease->stats.maxhp > 0) 390 if (disease->stats.maxhp > 0)
440 /* don't infect inanimate objects */ 439 /* don't infect inanimate objects */
441 if (!victim->flag [FLAG_MONSTER] && !(victim->type == PLAYER)) 440 if (!victim->flag [FLAG_MONSTER] && !(victim->type == PLAYER))
442 return 0; 441 return 0;
443 442
444 /* check and see if victim can catch disease: diseases 443 /* check and see if victim can catch disease: diseases
445 * are specific 444 * are specific
446 */ 445 */
447 if (!is_susceptible_to_disease (victim, disease)) 446 if (!is_susceptible_to_disease (victim, disease))
448 return 0; 447 return 0;
449 448
450 /* roll the dice on infection before doing the inventory check! */ 449 /* roll the dice on infection before doing the inventory check! */
487 new_disease->set_owner (disease->owner); 486 new_disease->set_owner (disease->owner);
488 else if (object *pl = disease->in_player ()) 487 else if (object *pl = disease->in_player ())
489 /* for diseases which are passed by hitting, set owner and skill */ 488 /* for diseases which are passed by hitting, set owner and skill */
490 new_disease->set_owner (pl); 489 new_disease->set_owner (pl);
491 490
491 if (INVOKE_OBJECT (INFECT, victim, ARG_OBJECT (disease), ARG_OBJECT (new_disease)))
492 return 1;
493
492 if (new_disease->owner && new_disease->owner->type == PLAYER) 494 if (new_disease->owner && new_disease->owner->type == PLAYER)
493 { 495 {
494 const char *buf; 496 const char *buf;
495 497
496 /* if the disease has a title, it has a special infection message 498 /* if the disease has a title, it has a special infection message
497 * This messages is printed in the form MESSAGE victim 499 * This messages is printed in the form MESSAGE victim
498 */ 500 */
499 if (new_disease->title) 501 if (new_disease->title)
500 buf = format ("%s %s!!", &disease->title, &victim->name); 502 buf = format ("%s %s!!", &disease->title, &victim->name);
501 else 503 else
502 buf = format ("You infect %s with your disease, %s!", &victim->name, &new_disease->name); 504 buf = format ("You infect %s with your disease, %s!", &victim->name, &new_disease->name);
523 { /* outside a monster/player, die immediately */ 525 { /* outside a monster/player, die immediately */
524 symptom->destroy (); 526 symptom->destroy ();
525 return 0; 527 return 0;
526 } 528 }
527 529
528 /* create the symptom "other arch" object and drop it here 530 /* create the symptom "other arch" object and drop it here
529 * under every part of the monster 531 * under every part of the monster
530 * The victim may well have died. 532 * The victim may well have died.
531 */ 533 */
532 if (victim->map) 534 if (victim->map)
533 { 535 {
534 victim->play_sound (symptom->sound); 536 victim->play_sound (symptom->sound);
535 537
620 622
621 return 1; 623 return 1;
622} 624}
623 625
624#if 0 // unused, but seems interesting 626#if 0 // unused, but seems interesting
625/* reduces disease progression: reduce_symptoms 627/* reduces disease progression: reduce_symptoms
626 * return true if we actually reduce a disease. 628 * return true if we actually reduce a disease.
627 */ 629 */
628static int 630static int
629reduce_symptoms (object *sufferer, int reduction) 631reduce_symptoms (object *sufferer, int reduction)
630{ 632{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines