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.37 by root, Thu Aug 23 18:55:02 2007 UTC vs.
Revision 1.42 by root, Tue Aug 28 19:30:12 2007 UTC

144is_susceptible_to_disease (object *victim, object *disease) 144is_susceptible_to_disease (object *victim, object *disease)
145{ 145{
146 if (!QUERY_FLAG (victim, FLAG_ALIVE)) 146 if (!QUERY_FLAG (victim, FLAG_ALIVE))
147 return 0; 147 return 0;
148 148
149 if (victim->flag [FLAG_WIZ])
150 return 0;
151
149 if (strstr (disease->race, "*") && !QUERY_FLAG (victim, FLAG_UNDEAD)) 152 if (strstr (disease->race, "*") && !QUERY_FLAG (victim, FLAG_UNDEAD))
150 return 1; 153 return 1;
151 154
152 if ((disease->race == shstr_undead) && QUERY_FLAG (victim, FLAG_UNDEAD)) 155 if ((disease->race == shstr_undead) && QUERY_FLAG (victim, FLAG_UNDEAD))
153 return 1; 156 return 1;
208 * Modified by MSW 2003-03-28 do try to find all the symptom the 211 * Modified by MSW 2003-03-28 do try to find all the symptom the
209 * player may have - I think through some odd interactoins with 212 * player may have - I think through some odd interactoins with
210 * disease level and player level and whatnot, a player could get 213 * disease level and player level and whatnot, a player could get
211 * more than one symtpom to a disease. 214 * more than one symtpom to a disease.
212 */ 215 */
213
214int 216int
215remove_symptoms (object *disease) 217remove_symptoms (object *disease)
216{ 218{
217 object *symptom, *victim = NULL; 219 object *symptom, *victim = NULL;
218 220
244 246
245/* searches around for more victims to infect */ 247/* searches around for more victims to infect */
246int 248int
247check_infection (object *disease) 249check_infection (object *disease)
248{ 250{
249 int x, y, range, mflags; 251 int x, y;
250 maptile *map, *map2; 252 maptile *map, *map2;
251 object *tmp; 253 object *tmp;
252 254
253 range = abs (disease->magic); 255 int range = abs (disease->magic);
254 256
255 if (disease->env) 257 if (disease->env)
256 { 258 {
257 x = disease->env->x; 259 x = disease->env->x;
258 y = disease->env->y; 260 y = disease->env->y;
270 272
271 for (int i = x - range; i <= x + range; i++) 273 for (int i = x - range; i <= x + range; i++)
272 for (int j = y - range; j <= y + range; j++) 274 for (int j = y - range; j <= y + range; j++)
273 { 275 {
274 sint16 i2, j2; 276 sint16 i2, j2;
275 mflags = get_map_flags (map, &map2, i, j, &i2, &j2); 277 int mflags = get_map_flags (map, &map2, i, j, &i2, &j2);
276 278
277 if (!(mflags & P_OUT_OF_MAP) && (mflags & P_IS_ALIVE)) 279 if (!(mflags & P_OUT_OF_MAP) && (mflags & P_IS_ALIVE))
278 for (tmp = GET_MAP_OB (map2, i2, j2); tmp; tmp = tmp->above) 280 for (tmp = GET_MAP_OB (map2, i2, j2); tmp; tmp = tmp->above)
279 infect_object (tmp, disease, 0); 281 infect_object (tmp, disease, 0);
280 } 282 }
553 555
554 /* create the symptom "other arch" object and drop it here 556 /* create the symptom "other arch" object and drop it here
555 * under every part of the monster 557 * under every part of the monster
556 * The victim may well have died. 558 * The victim may well have died.
557 */ 559 */
558 if (symptom->other_arch && victim->map) 560 if (victim->map)
561 {
562 victim->play_sound (symptom->sound);
563
564 if (symptom->other_arch)
559 for (object *tmp = victim->head_ (); tmp; tmp = tmp->more) 565 for (object *tmp = victim->head_ (); tmp; tmp = tmp->more)
560 { 566 {
561 new_ob = arch_to_object (symptom->other_arch); 567 new_ob = arch_to_object (symptom->other_arch);
562 new_ob->x = tmp->x; 568 new_ob->x = tmp->x;
563 new_ob->y = tmp->y; 569 new_ob->y = tmp->y;
564 new_ob->map = victim->map; 570 new_ob->map = victim->map;
565 insert_ob_in_map (new_ob, victim->map, victim, 0); 571 insert_ob_in_map (new_ob, victim->map, victim, 0);
572 }
566 } 573 }
567 574
568 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg); 575 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg);
569 576
570 return 1; 577 return 1;
571} 578}
594 return 0; 601 return 0;
595} 602}
596 603
597/* do the cure disease stuff, from the spell "cure disease" */ 604/* do the cure disease stuff, from the spell "cure disease" */
598int 605int
599cure_disease (object *sufferer, object *caster) 606cure_disease (object *sufferer, object *caster, object *spell)
600{ 607{
601 object *disease, *next; 608 object *disease, *next;
602 int casting_level;
603 int cure = 0; 609 int cure = 0;
604 610
605 if (caster)
606 casting_level = caster->level;
607 else
608 casting_level = 1000; /* if null caster, CURE all. */ 611 int casting_level = caster ? caster->level : 1000; /* if null caster, CURE all. */
609 612
610 for (disease = sufferer->inv; disease; disease = next) 613 for (disease = sufferer->inv; disease; disease = next)
611 { 614 {
612 next = disease->below; 615 next = disease->below;
613 616
621 if ((casting_level >= disease->level) || (!(random_roll (0, (disease->level - casting_level - 1), caster, PREFER_LOW)))) 624 if ((casting_level >= disease->level) || (!(random_roll (0, (disease->level - casting_level - 1), caster, PREFER_LOW))))
622 { 625 {
623 remove_symptoms (disease); 626 remove_symptoms (disease);
624 cure = 1; 627 cure = 1;
625 628
626 if (caster) 629 if (caster && spell)
627 change_exp (caster, disease->stats.exp, caster->chosen_skill ? caster->chosen_skill->skill : (const char *) 0, 0); 630 change_exp (caster, disease->stats.exp, spell->skill, SK_EXP_SKILL_ONLY);
628 631
629 disease->destroy (); 632 disease->destroy ();
630 } 633 }
631 } 634 }
632 } 635 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines