… | |
… | |
157 | { |
157 | { |
158 | walk->level = disease->level; |
158 | walk->level = disease->level; |
159 | return 1; /* just update the existing immunity. */ |
159 | return 1; /* just update the existing immunity. */ |
160 | } |
160 | } |
161 | |
161 | |
162 | immunity = get_archetype ("immunity"); |
162 | immunity = get_archetype (shstr_immunity); |
163 | |
163 | |
164 | immunity->name = disease->name; |
164 | immunity->name = disease->name; |
165 | immunity->level = disease->level; |
165 | immunity->level = disease->level; |
166 | immunity->move_block = 0; |
166 | immunity->move_block = 0; |
167 | |
167 | |
… | |
… | |
292 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
292 | for (tmp = victim->head_ ()->inv; tmp; tmp = tmp->below) |
293 | if (tmp->type == SIGN) /* possibly an immunity, or diseased */ |
293 | if (tmp->type == SIGN) /* possibly an immunity, or diseased */ |
294 | if (tmp->name == disease->name && tmp->level >= disease->level) |
294 | if (tmp->name == disease->name && tmp->level >= disease->level) |
295 | return 0; /* Immune! */ |
295 | return 0; /* Immune! */ |
296 | |
296 | |
297 | object *new_symptom = get_archetype ("symptom"); |
297 | object *new_symptom = get_archetype (shstr_symptom); |
298 | |
298 | |
299 | /* Something special done with dam. We want diseases to be more |
299 | /* Something special done with dam. We want diseases to be more |
300 | * random in what they'll kill, so we'll make the damage they |
300 | * random in what they'll kill, so we'll make the damage they |
301 | * do random, note, this has a weird effect with progressive diseases. |
301 | * do random, note, this has a weird effect with progressive diseases. |
302 | */ |
302 | */ |
… | |
… | |
514 | /* make the symptom do the nasty things it does */ |
514 | /* make the symptom do the nasty things it does */ |
515 | int |
515 | int |
516 | move_symptom (object *symptom) |
516 | move_symptom (object *symptom) |
517 | { |
517 | { |
518 | object *victim = symptom->env; |
518 | object *victim = symptom->env; |
519 | object *new_ob; |
|
|
520 | int sp_reduce; |
|
|
521 | |
519 | |
522 | if (!victim || !victim->map) |
520 | if (!victim || !victim->map) |
523 | { /* outside a monster/player, die immediately */ |
521 | { /* outside a monster/player, die immediately */ |
524 | symptom->destroy (); |
522 | symptom->destroy (); |
525 | return 0; |
523 | return 0; |
526 | } |
524 | } |
527 | |
|
|
528 | if (symptom->stats.dam > 0) |
|
|
529 | hit_player (victim, symptom->stats.dam, symptom, symptom->attacktype, 1); |
|
|
530 | else |
|
|
531 | hit_player (victim, max (1, -victim->stats.maxhp * symptom->stats.dam / 100), symptom, symptom->attacktype, 1); |
|
|
532 | |
|
|
533 | if (symptom->stats.maxsp > 0) |
|
|
534 | sp_reduce = symptom->stats.maxsp; |
|
|
535 | else |
|
|
536 | sp_reduce = max (1, victim->stats.maxsp * symptom->stats.maxsp / 100); |
|
|
537 | |
|
|
538 | victim->stats.sp = max (0, victim->stats.sp - sp_reduce); |
|
|
539 | |
525 | |
540 | /* create the symptom "other arch" object and drop it here |
526 | /* create the symptom "other arch" object and drop it here |
541 | * under every part of the monster |
527 | * under every part of the monster |
542 | * The victim may well have died. |
528 | * The victim may well have died. |
543 | */ |
529 | */ |
… | |
… | |
546 | victim->play_sound (symptom->sound); |
532 | victim->play_sound (symptom->sound); |
547 | |
533 | |
548 | if (symptom->other_arch) |
534 | if (symptom->other_arch) |
549 | for (object *tmp = victim->head_ (); tmp; tmp = tmp->more) |
535 | for (object *tmp = victim->head_ (); tmp; tmp = tmp->more) |
550 | { |
536 | { |
551 | new_ob = arch_to_object (symptom->other_arch); |
537 | object *new_ob = symptom->other_arch->instance (); |
552 | new_ob->x = tmp->x; |
538 | new_ob->x = tmp->x; |
553 | new_ob->y = tmp->y; |
539 | new_ob->y = tmp->y; |
554 | new_ob->map = victim->map; |
540 | new_ob->map = victim->map; |
555 | insert_ob_in_map (new_ob, victim->map, victim, 0); |
541 | insert_ob_in_map (new_ob, victim->map, victim, 0); |
556 | } |
542 | } |
557 | } |
543 | } |
|
|
544 | |
|
|
545 | int damage = |
|
|
546 | symptom->stats.dam > 0 |
|
|
547 | ? symptom->stats.dam |
|
|
548 | : max (1, victim->stats.maxhp * -symptom->stats.dam / 100); |
|
|
549 | |
|
|
550 | hit_player (victim, damage, symptom, symptom->attacktype, 1); |
|
|
551 | |
|
|
552 | int sp_reduce = |
|
|
553 | symptom->stats.maxsp > 0 |
|
|
554 | ? symptom->stats.maxsp |
|
|
555 | : max (1, victim->stats.maxsp * -symptom->stats.maxsp / 100); |
|
|
556 | |
|
|
557 | victim->stats.sp = max (0, victim->stats.sp - sp_reduce); |
558 | |
558 | |
559 | new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg); |
559 | new_draw_info (NDI_UNIQUE | NDI_RED, 0, victim, symptom->msg); |
560 | |
560 | |
561 | return 1; |
561 | return 1; |
562 | } |
562 | } |