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