… | |
… | |
86 | break; |
86 | break; |
87 | } |
87 | } |
88 | else |
88 | else |
89 | mt = name_to_material (op->materialname); |
89 | mt = name_to_material (op->materialname); |
90 | |
90 | |
91 | if (mt == NULL) |
91 | if (!mt) |
92 | return TRUE; |
92 | return TRUE; |
93 | |
93 | |
94 | roll = rndm (1, 20); |
94 | roll = rndm (1, 20); |
95 | |
95 | |
96 | /* the attacktypes have no meaning for object saves |
96 | /* the attacktypes have no meaning for object saves |
… | |
… | |
613 | if (hitter->owner != NULL) |
613 | if (hitter->owner != NULL) |
614 | sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2); |
614 | sprintf (buf, "%s's %s%s you.", &hitter->owner->name, &hitter->name, buf2); |
615 | else |
615 | else |
616 | { |
616 | { |
617 | sprintf (buf, "%s%s you.", &hitter->name, buf2); |
617 | sprintf (buf, "%s%s you.", &hitter->name, buf2); |
|
|
618 | |
618 | if (dam != 0) |
619 | if (dam != 0) |
619 | { |
620 | { |
620 | if (dam < 10) |
621 | if (dam < 10) |
621 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT1, 0, 0); |
622 | op->contr->play_sound (sound_find ("player_is_hit1")); |
622 | else if (dam < 20) |
623 | else if (dam < 20) |
623 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT2, 0, 0); |
624 | op->contr->play_sound (sound_find ("player_is_hit2")); |
624 | else |
625 | else |
625 | play_sound_player_only (op->contr, SOUND_PLAYER_IS_HIT3, 0, 0); |
626 | op->contr->play_sound (sound_find ("player_is_hit3")); |
626 | } |
627 | } |
627 | } |
628 | } |
|
|
629 | |
628 | new_draw_info (NDI_BLACK, 0, op, buf); |
630 | new_draw_info (NDI_BLACK, 0, op, buf); |
629 | } /* end of player hitting player */ |
631 | } /* end of player hitting player */ |
630 | |
632 | |
631 | if (hitter->type == PLAYER) |
633 | if (hitter->type == PLAYER) |
632 | { |
634 | { |
633 | sprintf (buf, "You %s.", buf1); |
635 | sprintf (buf, "You %s.", buf1); |
|
|
636 | |
634 | if (dam != 0) |
637 | if (dam != 0) |
635 | { |
638 | { |
636 | if (dam < 10) |
639 | if (dam < 10) |
637 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS1, 0, 0); |
640 | op->play_sound (sound_find ("player_hits1")); |
638 | else if (dam < 20) |
641 | else if (dam < 20) |
639 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS2, 0, 0); |
642 | op->play_sound (sound_find ("player_hits2")); |
640 | else |
643 | else |
641 | play_sound_player_only (hitter->contr, SOUND_PLAYER_HITS3, 0, 0); |
644 | op->play_sound (sound_find ("player_hits3")); |
642 | } |
645 | } |
|
|
646 | |
643 | new_draw_info (NDI_BLACK, 0, hitter, buf); |
647 | new_draw_info (NDI_BLACK, 0, hitter, buf); |
644 | } |
648 | } |
645 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
649 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
646 | { |
650 | { |
647 | /* look for stacked spells and start reducing the message chances */ |
651 | /* look for stacked spells and start reducing the message chances */ |
… | |
… | |
656 | if (next) |
660 | if (next) |
657 | while (next) |
661 | while (next) |
658 | { |
662 | { |
659 | if (next->type == SPELL_EFFECT && (next->subtype == SP_EXPLOSION || next->subtype == SP_BULLET || next->subtype == SP_CONE)) |
663 | if (next->type == SPELL_EFFECT && (next->subtype == SP_EXPLOSION || next->subtype == SP_BULLET || next->subtype == SP_CONE)) |
660 | i *= 3; |
664 | i *= 3; |
|
|
665 | |
661 | tmp = next; |
666 | tmp = next; |
662 | next = tmp->above; |
667 | next = tmp->above; |
663 | } |
668 | } |
664 | |
669 | |
665 | if (i < 0) |
670 | if (i < 0) |
… | |
… | |
670 | } |
675 | } |
671 | else if (rndm (0, 5) != 0) |
676 | else if (rndm (0, 5) != 0) |
672 | return; |
677 | return; |
673 | |
678 | |
674 | sprintf (buf, "Your %s%s %s.", &hitter->name, buf2, &op->name); |
679 | sprintf (buf, "Your %s%s %s.", &hitter->name, buf2, &op->name); |
675 | play_sound_map (op->map, op->x, op->y, SOUND_PLAYER_HITS4); |
680 | op->play_sound (sound_find ("player_hits4")); |
676 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
681 | new_draw_info (NDI_BLACK, 0, hitter->owner, buf); |
677 | } |
682 | } |
678 | } |
683 | } |
679 | |
684 | |
680 | |
685 | |
… | |
… | |
1289 | object *god = find_god (determine_god (owner)); |
1294 | object *god = find_god (determine_god (owner)); |
1290 | int div = 1; |
1295 | int div = 1; |
1291 | |
1296 | |
1292 | /* if undead are not an enemy of your god, you turn them |
1297 | /* if undead are not an enemy of your god, you turn them |
1293 | * at half strength */ |
1298 | * at half strength */ |
1294 | if (!god || !god->slaying || strstr (god->slaying, undead_name) == NULL) |
1299 | if (!god || !god->slaying || strstr (god->slaying, shstr_undead) == NULL) |
1295 | div = 2; |
1300 | div = 2; |
1296 | |
1301 | |
1297 | /* Give a bonus if you resist turn undead */ |
1302 | /* Give a bonus if you resist turn undead */ |
1298 | if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100))) |
1303 | if (op->level * div < (turn_bonus[owner->stats.Wis] + owner->level + (op->resist[ATNR_TURN_UNDEAD] / 100))) |
1299 | scare_creature (op, owner); |
1304 | scare_creature (op, owner); |
… | |
… | |
1474 | else |
1479 | else |
1475 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1480 | new_draw_info_format (NDI_BLACK, 0, owner, "You killed %s.", query_name (op)); |
1476 | |
1481 | |
1477 | /* Only play sounds for melee kills */ |
1482 | /* Only play sounds for melee kills */ |
1478 | if (hitter->type == PLAYER) |
1483 | if (hitter->type == PLAYER) |
1479 | play_sound_map (owner->map, owner->x, owner->y, SOUND_PLAYER_KILLS); |
1484 | owner->play_sound (sound_find ("player_kills")); |
1480 | } |
1485 | } |
1481 | |
1486 | |
1482 | /* If a player kills another player, not on |
1487 | /* If a player kills another player, not on |
1483 | * battleground, the "killer" looses 1 luck. Since this is |
1488 | * battleground, the "killer" looses 1 luck. Since this is |
1484 | * not reversible, it's actually quite a pain IMHO. -AV |
1489 | * not reversible, it's actually quite a pain IMHO. -AV |
… | |
… | |
1620 | { |
1625 | { |
1621 | object *owner1 = op->owner; |
1626 | object *owner1 = op->owner; |
1622 | |
1627 | |
1623 | if (owner1 && owner1->type == PLAYER) |
1628 | if (owner1 && owner1->type == PLAYER) |
1624 | { |
1629 | { |
1625 | play_sound_player_only (owner1->contr, SOUND_PET_IS_KILLED, 0, 0); |
1630 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1626 | /* Maybe we should include the owner that killed this, maybe not */ |
1631 | /* Maybe we should include the owner that killed this, maybe not */ |
1627 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1632 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1628 | } |
1633 | } |
1629 | |
1634 | |
1630 | remove_friendly_object (op); |
1635 | remove_friendly_object (op); |
… | |
… | |
1808 | if ((!hitter->slaying || |
1813 | if ((!hitter->slaying || |
1809 | (!(op->race && strstr (hitter->slaying, op->race)) && |
1814 | (!(op->race && strstr (hitter->slaying, op->race)) && |
1810 | !(op->name && strstr (hitter->slaying, op->name)))) && |
1815 | !(op->name && strstr (hitter->slaying, op->name)))) && |
1811 | (!QUERY_FLAG (op, FLAG_UNDEAD) || |
1816 | (!QUERY_FLAG (op, FLAG_UNDEAD) || |
1812 | (hitter->title != NULL |
1817 | (hitter->title != NULL |
1813 | && (god = find_god (determine_god (hitter))) != NULL && god->race != NULL && strstr (god->race, undead_name) != NULL))) |
1818 | && (god = find_god (determine_god (hitter))) != NULL && god->race != NULL && strstr (god->race, shstr_undead) != NULL))) |
1814 | return 0; |
1819 | return 0; |
1815 | } |
1820 | } |
1816 | |
1821 | |
1817 | maxattacktype = type; /* initialise this to something */ |
1822 | maxattacktype = type; /* initialise this to something */ |
1818 | for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum) |
1823 | for (attacknum = 0; attacknum < NROFATTACKS; attacknum++, attacktype = 1 << attacknum) |
… | |
… | |
2035 | tmp->stats.Dex = MAX (-(dam / 6 + 1), -10); |
2040 | tmp->stats.Dex = MAX (-(dam / 6 + 1), -10); |
2036 | tmp->stats.Int = MAX (-dam / 7, -10); |
2041 | tmp->stats.Int = MAX (-dam / 7, -10); |
2037 | SET_FLAG (tmp, FLAG_APPLIED); |
2042 | SET_FLAG (tmp, FLAG_APPLIED); |
2038 | op->update_stats (); |
2043 | op->update_stats (); |
2039 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
2044 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
|
|
2045 | op->play_sound (tmp->sound); |
2040 | } |
2046 | } |
2041 | |
2047 | |
2042 | if (hitter->type == PLAYER) |
2048 | if (hitter->type == PLAYER) |
2043 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2049 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2044 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
2050 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
… | |
… | |
2192 | ** field of the deathstriking object */ |
2198 | ** field of the deathstriking object */ |
2193 | |
2199 | |
2194 | int atk_lev, def_lev, kill_lev; |
2200 | int atk_lev, def_lev, kill_lev; |
2195 | |
2201 | |
2196 | if (hitter->slaying) |
2202 | if (hitter->slaying) |
2197 | if (!((QUERY_FLAG (op, FLAG_UNDEAD) && strstr (hitter->slaying, undead_name)) || (op->race && strstr (hitter->slaying, op->race)))) |
2203 | if (!((QUERY_FLAG (op, FLAG_UNDEAD) && strstr (hitter->slaying, shstr_undead)) || (op->race && strstr (hitter->slaying, op->race)))) |
2198 | return; |
2204 | return; |
2199 | |
2205 | |
2200 | def_lev = op->level; |
2206 | def_lev = op->level; |
2201 | if (def_lev < 1) |
2207 | if (def_lev < 1) |
2202 | { |
2208 | { |