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.27 by root, Sun Jul 1 05:00:19 2007 UTC vs.
Revision 1.37 by root, Thu Aug 23 18:55:02 2007 UTC

44dam^ Damage How much damage it does (%?). 44dam^ Damage How much damage it does (%?).
45maxgrace+ Duration How long before the disease is naturally cured. 45maxgrace+ Duration How long before the disease is naturally cured.
46food DurCount Counter for Duration 46food DurCount Counter for Duration
47 47
48speed Speed How often the disease moves. 48speed Speed How often the disease moves.
49last_sp^ Lethargy Percentage of max speed--10 = 10% speed. 49last_sp^ Lethargy Percentage of max speed. 10 = 10% speed.
50 50
51maxsp^ Mana deplete Saps mana. 51maxsp^ Mana deplete Saps mana.
52ac^ Progressiveness How the diseases increases in severity. 52ac^ Progressiveness How the diseases increases in severity.
53last_eat*^ Deplete food saps food if negative 53last_eat*^ Deplete food saps food if negative
54last_heal GrantImmunity If nonzero, disease does NOT grant immunity 54last_heal GrantImmunity If nonzero, disease does NOT grant immunity
147 return 0; 147 return 0;
148 148
149 if (strstr (disease->race, "*") && !QUERY_FLAG (victim, FLAG_UNDEAD)) 149 if (strstr (disease->race, "*") && !QUERY_FLAG (victim, FLAG_UNDEAD))
150 return 1; 150 return 1;
151 151
152 if ((disease->race == undead_name) && QUERY_FLAG (victim, FLAG_UNDEAD)) 152 if ((disease->race == shstr_undead) && QUERY_FLAG (victim, FLAG_UNDEAD))
153 return 1; 153 return 1;
154 154
155 if ((victim->race && strstr (disease->race, victim->race)) || strstr (disease->race, victim->name)) 155 if ((victim->race && strstr (disease->race, victim->race)) || strstr (disease->race, victim->name))
156 return 1; 156 return 1;
157 157
163{ 163{
164 /* first task is to determine if the disease is inside or outside of someone. 164 /* first task is to determine if the disease is inside or outside of someone.
165 * If outside, we decrement 'value' until we're gone. 165 * If outside, we decrement 'value' until we're gone.
166 */ 166 */
167 167
168 if (disease->env == NULL) 168 if (!disease->env)
169 { /* we're outside of someone */ 169 { /* we're outside of someone */
170 if (disease->stats.maxhp > 0) 170 if (disease->stats.maxhp > 0)
171 disease->value--; 171 disease->value--;
172 172
173 if (disease->value == 0) 173 if (!disease->value)
174 { 174 {
175 disease->destroy (); 175 disease->destroy ();
176 return 1; 176 return 1;
177 } 177 }
178 } 178 }
179 else 179 else
180 { 180 {
181 /* if we're inside a person, have the disease run its course */ 181 /* if we're inside a person, have the disease run its course */
182 /* negative foods denote "perpetual" diseases. */ 182 /* negative/zero food denotes "perpetual" diseases. */
183 if (disease->stats.food > 0) 183 if (disease->stats.food > 0)
184 { 184 {
185 disease->stats.food--; 185 disease->stats.food--;
186 186
187 if (disease->stats.food == 0) 187 if (!disease->stats.food)
188 { 188 {
189 remove_symptoms (disease); /* remove the symptoms of this disease */ 189 remove_symptoms (disease); /* remove the symptoms of this disease */
190 grant_immunity (disease); 190 grant_immunity (disease);
191 disease->destroy (); 191 disease->destroy ();
192 return 1; 192 return 1;
224 symptom->destroy (); 224 symptom->destroy ();
225 } 225 }
226 226
227 if (victim) 227 if (victim)
228 victim->update_stats (); 228 victim->update_stats ();
229
229 return 0; 230 return 0;
230} 231}
231 232
232/* argument is a disease */ 233/* argument is a disease */
233object * 234object *
234find_symptom (object *disease) 235find_symptom (object *disease)
235{ 236{
236 object *walk;
237
238 /* check the inventory for symptoms */ 237 /* check the inventory for symptoms */
239 for (walk = disease->env->inv; walk; walk = walk->below) 238 for (object *walk = disease->env->inv; walk; walk = walk->below)
240 if (walk->name == disease->name && walk->type == SYMPTOM) 239 if (walk->name == disease->name && walk->type == SYMPTOM)
241 return walk; 240 return walk;
241
242 return NULL; 242 return NULL;
243} 243}
244 244
245/* searches around for more victims to infect */ 245/* searches around for more victims to infect */
246int 246int
279 infect_object (tmp, disease, 0); 279 infect_object (tmp, disease, 0);
280 } 280 }
281 281
282 return 1; 282 return 1;
283} 283}
284
285 284
286/* check to see if an object is infectable: 285/* check to see if an object is infectable:
287 * objects with immunity aren't infectable. 286 * objects with immunity aren't infectable.
288 * objects already infected aren't infectable. 287 * objects already infected aren't infectable.
289 * dead objects aren't infectable. 288 * dead objects aren't infectable.
308 /* roll the dice on infection before doing the inventory check! */ 307 /* roll the dice on infection before doing the inventory check! */
309 if (!force && (random_roll (0, 126, victim, PREFER_HIGH) >= disease->stats.wc)) 308 if (!force && (random_roll (0, 126, victim, PREFER_HIGH) >= disease->stats.wc))
310 return 0; 309 return 0;
311 310
312 /* do an immunity check */ 311 /* do an immunity check */
313 if (victim->head)
314 tmp = victim->head->inv;
315 else
316 tmp = victim->inv;
317 312
318 /* There used to (IMO) be a flaw in the below - it used to be the case 313 /* There used to (IMO) be a flaw in the below - it used to be the case
319 * that if level check was done for both immunity and disease. This could 314 * that if level check was done for both immunity and disease. This could
320 * result in a person with multiple afflictions of the same disease 315 * result in a person with multiple afflictions of the same disease
321 * (eg, level 1 cold, level 2 cold, level 3 cold, etc), as long as 316 * (eg, level 1 cold, level 2 cold, level 3 cold, etc), as long as
322 * they were cast in that same order. Instead, change it so that 317 * they were cast in that same order. Instead, change it so that
323 * if you diseased, you can't get diseased more. 318 * if you diseased, you can't get diseased more.
324 */ 319 */
325 320
326 for ( /* tmp initialised in if, above */ ; tmp; tmp = tmp->below) 321 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below)
327 {
328 if (tmp->type == SIGN && tmp->name == disease->name && tmp->level >= disease->level) 322 if (tmp->type == SIGN && tmp->name == disease->name && tmp->level >= disease->level)
329 return 0; /* Immune! */ 323 return 0; /* Immune! */
330 else if (tmp->type == DISEASE && tmp->name == disease->name) 324 else if (tmp->type == DISEASE && tmp->name == disease->name)
331 return 0; /* already diseased */ 325 return 0; /* already diseased */
332 }
333 326
334 /* If we've gotten this far, go ahead and infect the victim. */ 327 /* If we've gotten this far, go ahead and infect the victim. */
328
335 new_disease = disease->clone (); 329 new_disease = disease->clone ();
330
336 new_disease->stats.food = disease->stats.maxgrace; 331 new_disease->stats.food = disease->stats.maxgrace;
337 new_disease->value = disease->stats.maxhp; 332 new_disease->value = disease->stats.maxhp;
338 new_disease->stats.wc -= disease->last_grace; /* self-limiting factor */ 333 new_disease->stats.wc -= disease->last_grace; /* self-limiting factor */
339 334
340 /* Unfortunately, set_owner does the wrong thing to the skills pointers
341 * resulting in exp going into the owners *current* chosen skill.
342 */
343
344 if (disease->owner)
345 {
346 new_disease->set_owner (disease->owner);
347
348 /* Only need to update skill if different */
349 if (new_disease->skill != disease->skill)
350 new_disease->skill = disease->skill;
351 }
352 else
353 { /* for diseases which are passed by hitting, set owner and praying skill */
354 if (disease->env && disease->env->type == PLAYER)
355 {
356 object *player = disease->env;
357
358 new_disease->set_owner (player);
359
360 /* the skill pointer for these diseases should already be set up -
361 * hardcoding in 'praying' is not the right approach.
362 */
363 }
364 }
365
366 insert_ob_in_ob (new_disease, victim->head_ ());
367 /* This appears to be a horrible case of overloading 'NO_PASS' 335 /* This appears to be a horrible case of overloading 'NO_PASS'
368 * for meaning in the diseases. 336 * for meaning in the diseases.
369 */ 337 */
370 new_disease->move_block = 0; 338 new_disease->move_block = 0;
339
340 // insert before setting the owner
341 victim->head_ ()->insert (new_disease);
342
343 if (disease->owner)
344 new_disease->set_owner (disease->owner);
345 else if (object *pl = disease->in_player ())
346 /* for diseases which are passed by hitting, set owner and skill */
347 new_disease->set_owner (pl);
348
371 if (new_disease->owner && new_disease->owner->type == PLAYER) 349 if (new_disease->owner && new_disease->owner->type == PLAYER)
372 { 350 {
373 char buf[128]; 351 const char *buf;
374 352
375 /* if the disease has a title, it has a special infection message 353 /* if the disease has a title, it has a special infection message
376 * This messages is printed in the form MESSAGE victim 354 * This messages is printed in the form MESSAGE victim
377 */ 355 */
378 if (new_disease->title) 356 if (new_disease->title)
379 sprintf (buf, "%s %s!!", &disease->title, &victim->name); 357 buf = format ("%s %s!!", &disease->title, &victim->name);
380 else 358 else
381 sprintf (buf, "You infect %s with your disease, %s!", &victim->name, &new_disease->name); 359 buf = format ("You infect %s with your disease, %s!", &victim->name, &new_disease->name);
382 360
383 if (victim->type == PLAYER) 361 if (victim->type == PLAYER)
384 new_draw_info (NDI_UNIQUE | NDI_RED, 0, new_disease->owner, buf); 362 new_draw_info (NDI_UNIQUE | NDI_RED, 0, new_disease->owner, buf);
385 else 363 else
386 new_draw_info (0, 4, new_disease->owner, buf); 364 new_draw_info (0, 4, new_disease->owner, buf);
387 } 365 }
366
388 if (victim->type == PLAYER) 367 if (victim->type == PLAYER)
389 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, "You suddenly feel ill."); 368 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, "You suddenly feel ill.");
390 369
391 return 1; 370 return 1;
392
393} 371}
394
395
396 372
397/* this function monitors the symptoms caused by the disease (if any), 373/* this function monitors the symptoms caused by the disease (if any),
398causes symptoms, and modifies existing symptoms in the case of 374causes symptoms, and modifies existing symptoms in the case of
399existing diseases. */ 375existing diseases. */
400
401int 376int
402do_symptoms (object *disease) 377do_symptoms (object *disease)
403{ 378{
404 object *symptom; 379 object *symptom;
405 object *victim; 380 object *victim;
406 object *tmp; 381 object *tmp;
407 382
408 victim = disease->env; 383 victim = disease->env;
384
385 if (!victim)
386 return 0; /* no-one to inflict symptoms on */
409 387
410 /* This is a quick hack - for whatever reason, disease->env will point 388 /* This is a quick hack - for whatever reason, disease->env will point
411 * back to disease, causing endless loops. Why this happens really needs 389 * back to disease, causing endless loops. Why this happens really needs
412 * to be found, but this should at least prevent the infinite loops. 390 * to be found, but this should at least prevent the infinite loops.
413 */ 391 */
414 392 //TODO: should no longer be the case, monitor, and remove
415 if (victim == NULL || victim == disease) 393 if (victim == disease)
416 return 0; /* no-one to inflict symptoms on */ 394 {
395 LOG (llevError | logBacktrace, "%s: disease->env points to itself", disease->debug_desc ());
396 return 0;
397 }
417 398
418 symptom = find_symptom (disease); 399 symptom = find_symptom (disease);
419 if (symptom == NULL) 400 if (!symptom)
420 { 401 {
421 /* no symptom? need to generate one! */ 402 /* no symptom? need to generate one! */
422 object *new_symptom;
423 403
424 /* first check and see if the carrier of the disease is immune. If so, no symptoms! */ 404 /* first check and see if the carrier of the disease is immune. If so, no symptoms! */
425 if (!is_susceptible_to_disease (victim, disease)) 405 if (!is_susceptible_to_disease (victim, disease))
426 return 0; 406 return 0;
427 407
428 /* check for an actual immunity */ 408 /* check for an actual immunity */
429 /* do an immunity check */ 409 /* do an immunity check */
430 if (victim->head) 410 for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below)
431 tmp = victim->head->inv;
432 else
433 tmp = victim->inv;
434
435 for ( /* tmp initialised in if, above */ ; tmp; tmp = tmp->below)
436 {
437 if (tmp->type == SIGN) /* possibly an immunity, or diseased */ 411 if (tmp->type == SIGN) /* possibly an immunity, or diseased */
438 if (tmp->name == disease->name && tmp->level >= disease->level) 412 if (tmp->name == disease->name && tmp->level >= disease->level)
439 return 0; /*Immune! */ 413 return 0; /* Immune! */
440 }
441 414
442 new_symptom = get_archetype ("symptom"); 415 object *new_symptom = get_archetype ("symptom");
443 416
444 /* Something special done with dam. We want diseases to be more 417 /* Something special done with dam. We want diseases to be more
445 * random in what they'll kill, so we'll make the damage they 418 * random in what they'll kill, so we'll make the damage they
446 * do random, note, this has a weird effect with progressive diseases. 419 * do random, note, this has a weird effect with progressive diseases.
447 */ 420 */
448 if (disease->stats.dam != 0) 421 if (disease->stats.dam)
449 { 422 {
450 int dam = disease->stats.dam; 423 int dam = disease->stats.dam;
451 424
452 /* reduce the damage, on average, 50%, and making things random. */ 425 /* reduce the damage, on average, 50%, and making things random. */
453 426
454 dam = random_roll (1, abs (dam), victim, PREFER_LOW); 427 dam = random_roll (1, abs (dam), victim, PREFER_LOW);
455 if (disease->stats.dam < 0) 428 if (disease->stats.dam < 0)
456 dam = -dam; 429 dam = -dam;
430
457 new_symptom->stats.dam = dam; 431 new_symptom->stats.dam = dam;
458 } 432 }
459 433
460
461 new_symptom->stats.maxsp = disease->stats.maxsp; 434 new_symptom->stats.maxsp = disease->stats.maxsp;
462 new_symptom->stats.food = new_symptom->stats.maxgrace; 435 new_symptom->stats.food = new_symptom->stats.maxgrace;
463 436
464 new_symptom->name = new_symptom->name_pl = disease->name; 437 new_symptom->name = new_symptom->name_pl = disease->name;
465 438
466 new_symptom->level = disease->level; 439 new_symptom->level = disease->level;
467 new_symptom->speed = disease->speed; 440 new_symptom->speed = disease->speed;
468 new_symptom->value = 0; 441 new_symptom->value = 0;
469 442
470 for (int i = 0; i < NUM_STATS; ++i) 443 for (int i = 0; i < NUM_STATS; ++i)
471 new_symptom->stats.stat (i) = disease->stats.stat (i); 444 new_symptom->stats.stat (i) = disease->stats.stat (i);
472 445
473 new_symptom->stats.sp = disease->stats.sp; 446 new_symptom->stats.sp = disease->stats.sp;
474 new_symptom->stats.food = disease->last_eat; 447 new_symptom->stats.food = disease->last_eat;
475 new_symptom->stats.maxsp = disease->stats.maxsp; 448 new_symptom->stats.maxsp = disease->stats.maxsp;
476 new_symptom->last_sp = disease->last_sp; 449 new_symptom->last_sp = disease->last_sp;
477 new_symptom->stats.exp = 0; 450 new_symptom->stats.exp = 0;
478 new_symptom->stats.hp = disease->stats.hp; 451 new_symptom->stats.hp = disease->stats.hp;
479 new_symptom->msg = disease->msg; 452 new_symptom->msg = disease->msg;
480 new_symptom->attacktype = disease->attacktype; 453 new_symptom->attacktype = disease->attacktype;
481 new_symptom->other_arch = disease->other_arch; 454 new_symptom->other_arch = disease->other_arch;
455 new_symptom->skill = disease->skill;
482 456
457 new_symptom->move_block = 0;
458
459 victim->head_ ()->insert (new_symptom);
460
461 // set owner last, as insert clears owner
483 new_symptom->set_owner (disease->owner); 462 new_symptom->set_owner (disease->owner);
484 463
485 if (new_symptom->skill != disease->skill)
486 new_symptom->skill = disease->skill;
487
488 new_symptom->move_block = 0;
489 insert_ob_in_ob (new_symptom, victim);
490 return 1; 464 return 1;
491 } 465 }
492 466
493 /* now deal with progressing diseases: we increase the debility 467 /* now deal with progressing diseases: we increase the debility
494 * caused by the symptoms. 468 * caused by the symptoms.
495 */ 469 */
496 if (disease->stats.ac != 0) 470 if (disease->stats.ac)
497 { 471 {
498 symptom->value += disease->stats.ac; 472 symptom->value = clamp (symptom->value + disease->stats.ac, 0, 100*100);
499 473
500 float scale = 1.f + symptom->value / 100.f; 474 float scale = 1.f + symptom->value / 100.f;
501 475
502 /* now rescale all the debilities */ 476 /* now rescale all the debilities */
503 for (int i = 0; i < NUM_STATS; ++i) 477 for (int i = 0; i < NUM_STATS; ++i)
504 symptom->stats.stat (i) = scale * disease->stats.stat (i); 478 symptom->stats.stat (i) = clamp (int (scale * disease->stats.stat (i)), -128, 127);
505 479
506 symptom->stats.dam = scale * disease->stats.dam; 480 symptom->stats.dam = clamp (scale * disease->stats.dam , -1024, 1024);
507 symptom->stats.sp = scale * disease->stats.sp;
508 symptom->stats.food = scale * disease->last_eat; 481 symptom->stats.food = clamp (scale * disease->last_eat , -1024, 1024);
509 symptom->stats.maxsp = scale * disease->stats.maxsp; 482 symptom->stats.maxsp = clamp (scale * disease->stats.maxsp, -1024, 1024);
510 symptom->last_sp = scale * disease->last_sp; 483 symptom->stats.sp = clamp (scale * disease->stats.sp , -1024, 1024);
484 symptom->stats.hp = clamp (scale * disease->stats.hp , -1024, 1024);
511 symptom->stats.exp = 0; 485 symptom->stats.exp = 0;
512 symptom->stats.hp = scale * disease->stats.hp; 486 symptom->last_sp = disease->last_sp ? clamp (disease->last_sp / scale, 1, 1024) : 0;
513
514 symptom->msg = disease->msg; 487 symptom->msg = disease->msg;
515 symptom->attacktype = disease->attacktype; 488 symptom->attacktype = disease->attacktype;
516 symptom->other_arch = disease->other_arch; 489 symptom->other_arch = disease->other_arch;
517 } 490 }
518 491
519 SET_FLAG (symptom, FLAG_APPLIED); 492 SET_FLAG (symptom, FLAG_APPLIED);
520 victim->update_stats (); 493 victim->update_stats ();
521 494
530 object *walk; 503 object *walk;
531 504
532 /* Don't give immunity to this disease if last_heal is set. */ 505 /* Don't give immunity to this disease if last_heal is set. */
533 if (disease->last_heal) 506 if (disease->last_heal)
534 return 0; 507 return 0;
508
535 /* first, search for an immunity of the same name */ 509 /* first, search for an immunity of the same name */
536 for (walk = disease->env->inv; walk; walk = walk->below) 510 for (walk = disease->env->inv; walk; walk = walk->below)
537 {
538 if (walk->type == 98 && disease->name == walk->name) 511 if (walk->type == 98 && disease->name == walk->name)
539 { 512 {
540 walk->level = disease->level; 513 walk->level = disease->level;
541 return 1; /* just update the existing immunity. */ 514 return 1; /* just update the existing immunity. */
542 } 515 }
543 } 516
544 immunity = get_archetype ("immunity"); 517 immunity = get_archetype ("immunity");
518
545 immunity->name = disease->name; 519 immunity->name = disease->name;
546 immunity->level = disease->level; 520 immunity->level = disease->level;
547 immunity->move_block = 0; 521 immunity->move_block = 0;
522
548 insert_ob_in_ob (immunity, disease->env); 523 insert_ob_in_ob (immunity, disease->env);
524
549 return 1; 525 return 1;
550
551} 526}
552
553 527
554/* make the symptom do the nasty things it does */ 528/* make the symptom do the nasty things it does */
555
556int 529int
557move_symptom (object *symptom) 530move_symptom (object *symptom)
558{ 531{
559 object *victim = symptom->env; 532 object *victim = symptom->env;
560 object *new_ob; 533 object *new_ob;
561 int sp_reduce; 534 int sp_reduce;
562 535
563 if (victim == NULL || victim->map == NULL) 536 if (!victim || !victim->map)
564 { /* outside a monster/player, die immediately */ 537 { /* outside a monster/player, die immediately */
565 symptom->destroy (); 538 symptom->destroy ();
566 return 0; 539 return 0;
567 } 540 }
568 541
569 if (symptom->stats.dam > 0) 542 if (symptom->stats.dam > 0)
570 hit_player (victim, symptom->stats.dam, symptom, symptom->attacktype, 1); 543 hit_player (victim, symptom->stats.dam, symptom, symptom->attacktype, 1);
571 else 544 else
572 hit_player (victim, (int) MAX (1, -victim->stats.maxhp * symptom->stats.dam / 100.0), symptom, symptom->attacktype, 1); 545 hit_player (victim, max (1, -victim->stats.maxhp * symptom->stats.dam / 100.0), symptom, symptom->attacktype, 1);
573 546
574 if (symptom->stats.maxsp > 0) 547 if (symptom->stats.maxsp > 0)
575 sp_reduce = symptom->stats.maxsp; 548 sp_reduce = symptom->stats.maxsp;
576 else 549 else
577 sp_reduce = (int) MAX (1, victim->stats.maxsp * symptom->stats.maxsp / 100.0); 550 sp_reduce = max (1, victim->stats.maxsp * symptom->stats.maxsp / 100.0);
551
578 victim->stats.sp = MAX (0, victim->stats.sp - sp_reduce); 552 victim->stats.sp = max (0, victim->stats.sp - sp_reduce);
579 553
580 /* create the symptom "other arch" object and drop it here 554 /* create the symptom "other arch" object and drop it here
581 * under every part of the monster 555 * under every part of the monster
582 * The victim may well have died. 556 * The victim may well have died.
583 */ 557 */
584
585 if (victim->map == NULL)
586 return 0;
587 if (symptom->other_arch) 558 if (symptom->other_arch && victim->map)
588 { 559 for (object *tmp = victim->head_ (); tmp; tmp = tmp->more)
589 object *tmp;
590
591 tmp = victim;
592 if (tmp->head != NULL)
593 tmp = tmp->head;
594 for ( /*tmp initialised above */ ; tmp != NULL; tmp = tmp->more)
595 { 560 {
596 new_ob = arch_to_object (symptom->other_arch); 561 new_ob = arch_to_object (symptom->other_arch);
597 new_ob->x = tmp->x; 562 new_ob->x = tmp->x;
598 new_ob->y = tmp->y; 563 new_ob->y = tmp->y;
599 new_ob->map = victim->map; 564 new_ob->map = victim->map;
600 insert_ob_in_map (new_ob, victim->map, victim, 0); 565 insert_ob_in_map (new_ob, victim->map, victim, 0);
601 } 566 }
602 } 567
603 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg); 568 new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg);
604 569
605 return 1; 570 return 1;
606} 571}
607 572
679} 644}
680 645
681/* reduces disease progression: reduce_symptoms 646/* reduces disease progression: reduce_symptoms
682 * return true if we actually reduce a disease. 647 * return true if we actually reduce a disease.
683 */ 648 */
684
685int 649int
686reduce_symptoms (object *sufferer, int reduction) 650reduce_symptoms (object *sufferer, int reduction)
687{ 651{
688 object *walk; 652 object *walk;
689 int success = 0; 653 int success = 0;
693 if (walk->type == SYMPTOM) 657 if (walk->type == SYMPTOM)
694 { 658 {
695 if (walk->value > 0) 659 if (walk->value > 0)
696 { 660 {
697 success = 1; 661 success = 1;
698 walk->value = MAX (0, walk->value - 2 * reduction); 662 walk->value = max (0, walk->value - 2 * reduction);
699 /* give the disease time to modify this symptom, 663 /* give the disease time to modify this symptom,
700 * and reduce its severity. */ 664 * and reduce its severity. */
701 walk->speed_left = 0; 665 walk->speed_left = 0;
702 } 666 }
703 } 667 }
704 } 668 }
669
705 if (success) 670 if (success)
706 new_draw_info (NDI_UNIQUE, 0, sufferer, "Your illness seems less severe."); 671 new_draw_info (NDI_UNIQUE, 0, sufferer, "Your illness seems less severe.");
672
707 return success; 673 return success;
708} 674}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines