… | |
… | |
456 | |
456 | |
457 | new_symptom->move_block = 0; |
457 | new_symptom->move_block = 0; |
458 | |
458 | |
459 | victim->head_ ()->insert (new_symptom); |
459 | victim->head_ ()->insert (new_symptom); |
460 | |
460 | |
461 | // ste owner last, as insert clears owner |
461 | // set owner last, as insert clears owner |
462 | new_symptom->set_owner (disease->owner); |
462 | new_symptom->set_owner (disease->owner); |
463 | |
463 | |
464 | return 1; |
464 | return 1; |
465 | } |
465 | } |
466 | |
466 | |
… | |
… | |
523 | insert_ob_in_ob (immunity, disease->env); |
523 | insert_ob_in_ob (immunity, disease->env); |
524 | |
524 | |
525 | return 1; |
525 | return 1; |
526 | } |
526 | } |
527 | |
527 | |
528 | |
|
|
529 | /* make the symptom do the nasty things it does */ |
528 | /* make the symptom do the nasty things it does */ |
530 | |
|
|
531 | int |
529 | int |
532 | move_symptom (object *symptom) |
530 | move_symptom (object *symptom) |
533 | { |
531 | { |
534 | object *victim = symptom->env; |
532 | object *victim = symptom->env; |
535 | object *new_ob; |
533 | object *new_ob; |
536 | int sp_reduce; |
534 | int sp_reduce; |
537 | |
535 | |
538 | if (victim == NULL || victim->map == NULL) |
536 | if (!victim || !victim->map) |
539 | { /* outside a monster/player, die immediately */ |
537 | { /* outside a monster/player, die immediately */ |
540 | symptom->destroy (); |
538 | symptom->destroy (); |
541 | return 0; |
539 | return 0; |
542 | } |
540 | } |
543 | |
541 | |
544 | if (symptom->stats.dam > 0) |
542 | if (symptom->stats.dam > 0) |
545 | hit_player (victim, symptom->stats.dam, symptom, symptom->attacktype, 1); |
543 | hit_player (victim, symptom->stats.dam, symptom, symptom->attacktype, 1); |
546 | else |
544 | else |
547 | 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); |
548 | |
546 | |
549 | if (symptom->stats.maxsp > 0) |
547 | if (symptom->stats.maxsp > 0) |
550 | sp_reduce = symptom->stats.maxsp; |
548 | sp_reduce = symptom->stats.maxsp; |
551 | else |
549 | else |
552 | 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); |
553 | |
551 | |
554 | victim->stats.sp = MAX (0, victim->stats.sp - sp_reduce); |
552 | victim->stats.sp = max (0, victim->stats.sp - sp_reduce); |
555 | |
553 | |
556 | /* create the symptom "other arch" object and drop it here |
554 | /* create the symptom "other arch" object and drop it here |
557 | * under every part of the monster |
555 | * under every part of the monster |
558 | * The victim may well have died. |
556 | * The victim may well have died. |
559 | */ |
557 | */ |
560 | if (victim->map) |
|
|
561 | return 0; |
|
|
562 | |
|
|
563 | if (symptom->other_arch) |
558 | if (symptom->other_arch && victim->map) |
564 | for (object *tmp = victim->head_ (); tmp; tmp = tmp->more) |
559 | for (object *tmp = victim->head_ (); tmp; tmp = tmp->more) |
565 | { |
560 | { |
566 | new_ob = arch_to_object (symptom->other_arch); |
561 | new_ob = arch_to_object (symptom->other_arch); |
567 | new_ob->x = tmp->x; |
562 | new_ob->x = tmp->x; |
568 | new_ob->y = tmp->y; |
563 | new_ob->y = tmp->y; |