… | |
… | |
1545 | } |
1545 | } |
1546 | |
1546 | |
1547 | if (player *pl = op->contr) |
1547 | if (player *pl = op->contr) |
1548 | { |
1548 | { |
1549 | bow = pl->ranged_ob; |
1549 | bow = pl->ranged_ob; |
1550 | |
1550 | op->set_weapon (bow); |
1551 | if (op->current_weapon != pl->ranged_ob) |
|
|
1552 | { |
|
|
1553 | op->current_weapon = pl->ranged_ob; |
|
|
1554 | new_draw_info_format (NDI_UNIQUE, 0, op, "You switch to your %s.", &op->current_weapon->name); |
|
|
1555 | op->update_stats (); |
|
|
1556 | } |
|
|
1557 | } |
1551 | } |
1558 | else |
1552 | else |
1559 | { |
1553 | { |
1560 | for (bow = op->inv; bow; bow = bow->below) |
1554 | for (bow = op->inv; bow; bow = bow->below) |
1561 | /* Don't check for applied - monsters don't apply bows - in that way, they |
1555 | /* Don't check for applied - monsters don't apply bows - in that way, they |
… | |
… | |
1736 | else if (op->contr->bowtype == bow_spreadshot) |
1730 | else if (op->contr->bowtype == bow_spreadshot) |
1737 | { |
1731 | { |
1738 | ret |= fire_bow (op, op, NULL, dir, 0, op->x, op->y); |
1732 | ret |= fire_bow (op, op, NULL, dir, 0, op->x, op->y); |
1739 | ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y); |
1733 | ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y); |
1740 | ret |= fire_bow (op, op, NULL, absdir (dir + 1), -5, op->x, op->y); |
1734 | ret |= fire_bow (op, op, NULL, absdir (dir + 1), -5, op->x, op->y); |
1741 | |
|
|
1742 | } |
1735 | } |
1743 | else |
1736 | else |
1744 | { |
1737 | { |
1745 | /* Simple case */ |
1738 | /* Simple case */ |
1746 | ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); |
1739 | ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); |
1747 | } |
1740 | } |
|
|
1741 | |
1748 | return ret; |
1742 | return ret; |
1749 | } |
1743 | } |
1750 | |
1744 | |
1751 | |
1745 | |
1752 | /* Fires a misc (wand/rod/horn) object in 'dir'. |
1746 | /* Fires a misc (wand/rod/horn) object in 'dir'. |
… | |
… | |
1767 | { |
1761 | { |
1768 | LOG (llevError, "Object %s lacks a spell\n", &item->name); |
1762 | LOG (llevError, "Object %s lacks a spell\n", &item->name); |
1769 | return; |
1763 | return; |
1770 | } |
1764 | } |
1771 | |
1765 | |
|
|
1766 | op->set_weapon (item); |
|
|
1767 | |
1772 | if (item->type == WAND) |
1768 | if (item->type == WAND) |
1773 | { |
1769 | { |
1774 | if (item->stats.food <= 0) |
1770 | if (item->stats.food <= 0) |
1775 | { |
1771 | { |
1776 | play_sound_player_only (op->contr, SOUND_WAND_POOF, 0, 0); |
1772 | play_sound_player_only (op->contr, SOUND_WAND_POOF, 0, 0); |
1777 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s goes poof.", query_base_name (item, 0)); |
1773 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s goes poof.", query_base_name (item, 0)); |
|
|
1774 | |
1778 | return; |
1775 | return; |
1779 | } |
1776 | } |
1780 | } |
1777 | } |
1781 | else if (item->type == ROD || item->type == HORN) |
1778 | else if (item->type == ROD || item->type == HORN) |
1782 | { |
1779 | { |
1783 | if (item->stats.hp < MAX (item->inv->stats.sp, item->inv->stats.grace)) |
1780 | if (item->stats.hp < MAX (item->inv->stats.sp, item->inv->stats.grace)) |
1784 | { |
1781 | { |
1785 | play_sound_player_only (op->contr, SOUND_WAND_POOF, 0, 0); |
1782 | play_sound_player_only (op->contr, SOUND_WAND_POOF, 0, 0); |
|
|
1783 | |
1786 | if (item->type == ROD) |
1784 | if (item->type == ROD) |
1787 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0)); |
1785 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s whines for a while, but nothing happens.", query_base_name (item, 0)); |
1788 | else |
1786 | else |
1789 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s needs more time to charge.", query_base_name (item, 0)); |
1787 | new_draw_info_format (NDI_UNIQUE, 0, op, "The %s needs more time to charge.", query_base_name (item, 0)); |
|
|
1788 | |
1790 | return; |
1789 | return; |
1791 | } |
1790 | } |
1792 | } |
1791 | } |
1793 | |
1792 | |
1794 | if (cast_spell (op, item, dir, item->inv, NULL)) |
1793 | if (cast_spell (op, item, dir, item->inv, NULL)) |