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,2012 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 |
… | |
… | |
130 | #include <sproto.h> |
131 | #include <sproto.h> |
131 | #include <spells.h> |
132 | #include <spells.h> |
132 | #include <sounds.h> |
133 | #include <sounds.h> |
133 | #include <skills.h> |
134 | #include <skills.h> |
134 | |
135 | |
135 | /* IMPLEMENTATION NOTES |
136 | /* IMPLEMENTATION NOTES |
136 | |
137 | |
137 | 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 |
138 | inventory. They themselves do nothing, except modify Symptoms, or |
139 | inventory. They themselves do nothing, except modify Symptoms, or |
139 | 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: |
140 | these are their own object. */ |
141 | these are their own object. */ |
141 | |
142 | |
142 | /* grants immunity to plagues we've seen before. */ |
143 | /* grants immunity to plagues we've seen before. */ |
143 | static int |
144 | static int |
… | |
… | |
380 | |
381 | |
381 | int |
382 | int |
382 | move_disease (object *disease) |
383 | move_disease (object *disease) |
383 | { |
384 | { |
384 | /* 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. |
385 | * If outside, we decrement 'value' until we're gone. |
386 | * If outside, we decrement 'value' until we're gone. |
386 | */ |
387 | */ |
387 | |
388 | |
388 | if (!disease->env) |
389 | if (!disease->env) |
389 | { /* we're outside of someone */ |
390 | { /* we're outside of someone */ |
390 | if (disease->stats.maxhp > 0) |
391 | if (disease->stats.maxhp > 0) |
… | |
… | |
439 | /* don't infect inanimate objects */ |
440 | /* don't infect inanimate objects */ |
440 | if (!victim->flag [FLAG_MONSTER] && !(victim->type == PLAYER)) |
441 | if (!victim->flag [FLAG_MONSTER] && !(victim->type == PLAYER)) |
441 | return 0; |
442 | return 0; |
442 | |
443 | |
443 | /* check and see if victim can catch disease: diseases |
444 | /* check and see if victim can catch disease: diseases |
444 | * are specific |
445 | * are specific |
445 | */ |
446 | */ |
446 | if (!is_susceptible_to_disease (victim, disease)) |
447 | if (!is_susceptible_to_disease (victim, disease)) |
447 | return 0; |
448 | return 0; |
448 | |
449 | |
449 | /* roll the dice on infection before doing the inventory check! */ |
450 | /* roll the dice on infection before doing the inventory check! */ |
… | |
… | |
494 | if (new_disease->owner && new_disease->owner->type == PLAYER) |
495 | if (new_disease->owner && new_disease->owner->type == PLAYER) |
495 | { |
496 | { |
496 | const char *buf; |
497 | const char *buf; |
497 | |
498 | |
498 | /* 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 |
499 | * This messages is printed in the form MESSAGE victim |
500 | * This messages is printed in the form MESSAGE victim |
500 | */ |
501 | */ |
501 | if (new_disease->title) |
502 | if (new_disease->title) |
502 | buf = format ("%s %s!!", &disease->title, &victim->name); |
503 | buf = format ("%s %s!!", &disease->title, &victim->name); |
503 | else |
504 | else |
504 | 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); |
… | |
… | |
525 | { /* outside a monster/player, die immediately */ |
526 | { /* outside a monster/player, die immediately */ |
526 | symptom->destroy (); |
527 | symptom->destroy (); |
527 | return 0; |
528 | return 0; |
528 | } |
529 | } |
529 | |
530 | |
530 | /* create the symptom "other arch" object and drop it here |
531 | /* create the symptom "other arch" object and drop it here |
531 | * under every part of the monster |
532 | * under every part of the monster |
532 | * The victim may well have died. |
533 | * The victim may well have died. |
533 | */ |
534 | */ |
534 | if (victim->map) |
535 | if (victim->map) |
535 | { |
536 | { |
536 | victim->play_sound (symptom->sound); |
537 | victim->play_sound (symptom->sound); |
537 | |
538 | |
… | |
… | |
622 | |
623 | |
623 | return 1; |
624 | return 1; |
624 | } |
625 | } |
625 | |
626 | |
626 | #if 0 // unused, but seems interesting |
627 | #if 0 // unused, but seems interesting |
627 | /* reduces disease progression: reduce_symptoms |
628 | /* reduces disease progression: reduce_symptoms |
628 | * return true if we actually reduce a disease. |
629 | * return true if we actually reduce a disease. |
629 | */ |
630 | */ |
630 | static int |
631 | static int |
631 | reduce_symptoms (object *sufferer, int reduction) |
632 | reduce_symptoms (object *sufferer, int reduction) |
632 | { |
633 | { |