1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | * |
21 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
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 | |
|
|
30 | |
29 | |
31 | /* |
30 | /* |
32 | |
31 | |
33 | For DISEASES: |
32 | For DISEASES: |
34 | Stat Property Definition |
33 | Stat Property Definition |
… | |
… | |
636 | |
635 | |
637 | return 0; |
636 | return 0; |
638 | } |
637 | } |
639 | |
638 | |
640 | /* do the cure disease stuff, from the spell "cure disease" */ |
639 | /* do the cure disease stuff, from the spell "cure disease" */ |
641 | |
|
|
642 | int |
640 | int |
643 | cure_disease (object *sufferer, object *caster) |
641 | cure_disease (object *sufferer, object *caster) |
644 | { |
642 | { |
645 | object *disease, *next; |
643 | object *disease, *next; |
646 | int casting_level; |
644 | int casting_level; |
… | |
… | |
655 | { |
653 | { |
656 | next = disease->below; |
654 | next = disease->below; |
657 | |
655 | |
658 | if (disease->type == DISEASE) |
656 | if (disease->type == DISEASE) |
659 | { /* attempt to cure this disease */ |
657 | { /* attempt to cure this disease */ |
660 | /* If caster lvel is higher than disease level, cure chance |
658 | /* If caster level is higher than disease level, cure chance |
661 | * is automatic. If lower, then the chance is basically |
659 | * is automatic. If lower, then the chance is basically |
662 | * 1 in level_diff - if there is a 5 level difference, chance |
660 | * 1 in level_diff - if there is a 5 level difference, chance |
663 | * is 1 in 5. |
661 | * is 1 in 5. |
664 | */ |
662 | */ |
665 | if ((casting_level >= disease->level) || (!(random_roll (0, (disease->level - casting_level - 1), caster, PREFER_LOW)))) |
663 | if ((casting_level >= disease->level) || (!(random_roll (0, (disease->level - casting_level - 1), caster, PREFER_LOW)))) |
666 | { |
664 | { |
667 | |
|
|
668 | remove_symptoms (disease); |
665 | remove_symptoms (disease); |
669 | cure = 1; |
666 | cure = 1; |
670 | |
667 | |
671 | if (caster) |
668 | if (caster) |
672 | change_exp (caster, disease->stats.exp, caster->chosen_skill ? &caster->chosen_skill->skill : (const char *) 0, 0); |
669 | change_exp (caster, disease->stats.exp, caster->chosen_skill ? caster->chosen_skill->skill : (const char *) 0, 0); |
673 | |
670 | |
674 | disease->destroy (); |
671 | disease->destroy (); |
675 | } |
672 | } |
676 | } |
673 | } |
677 | } |
674 | } |
|
|
675 | |
678 | if (cure) |
676 | if (cure) |
679 | { |
677 | { |
680 | /* Only draw these messages once */ |
678 | /* Only draw these messages once */ |
681 | if (caster) |
679 | if (caster) |
682 | new_draw_info_format (NDI_UNIQUE, 0, caster, "You cure a disease!"); |
680 | new_draw_info_format (NDI_UNIQUE, 0, caster, "You cure a disease!"); |
|
|
681 | |
683 | new_draw_info (NDI_UNIQUE, 0, sufferer, "You no longer feel diseased."); |
682 | new_draw_info (NDI_UNIQUE, 0, sufferer, "You no longer feel diseased."); |
684 | } |
683 | } |
|
|
684 | |
685 | return 1; |
685 | return 1; |
686 | } |
686 | } |
687 | |
687 | |
688 | /* reduces disease progression: reduce_symptoms |
688 | /* reduces disease progression: reduce_symptoms |
689 | * return true if we actually reduce a disease. |
689 | * return true if we actually reduce a disease. |