… | |
… | |
946 | } |
946 | } |
947 | else if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
947 | else if (QUERY_FLAG (tmp, FLAG_ALIVE)) |
948 | { |
948 | { |
949 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
949 | tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
950 | tmp->stats.maxhp = tmp->stats.hp; |
950 | tmp->stats.maxhp = tmp->stats.hp; |
951 | set_owner (tmp, op); |
951 | tmp->set_owner (op); |
952 | set_spell_skill (op, caster, spell_ob, tmp); |
952 | set_spell_skill (op, caster, spell_ob, tmp); |
953 | } |
953 | } |
954 | if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) |
954 | if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) |
955 | { |
955 | { |
956 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
956 | tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); |
… | |
… | |
965 | } |
965 | } |
966 | |
966 | |
967 | /* This can't really hurt - if the object doesn't kill anything, |
967 | /* This can't really hurt - if the object doesn't kill anything, |
968 | * these fields just won't be used. |
968 | * these fields just won't be used. |
969 | */ |
969 | */ |
970 | set_owner (tmp, op); |
970 | tmp->set_owner (op); |
971 | set_spell_skill (op, caster, spell_ob, tmp); |
971 | set_spell_skill (op, caster, spell_ob, tmp); |
972 | tmp->x = x; |
972 | tmp->x = x; |
973 | tmp->y = y; |
973 | tmp->y = y; |
974 | tmp->level = caster_level (caster, spell_ob) / 2; |
974 | tmp->level = caster_level (caster, spell_ob) / 2; |
975 | |
975 | |
… | |
… | |
1742 | large->destroy (); |
1742 | large->destroy (); |
1743 | small->destroy (); |
1743 | small->destroy (); |
1744 | /* reset this so that if player standing on a big pile of stuff, |
1744 | /* reset this so that if player standing on a big pile of stuff, |
1745 | * it is redrawn properly. |
1745 | * it is redrawn properly. |
1746 | */ |
1746 | */ |
1747 | op->contr->socket.look_position = 0; |
1747 | op->contr->socket->look_position = 0; |
1748 | return 1; |
1748 | return 1; |
1749 | } |
1749 | } |
1750 | |
1750 | |
1751 | |
1751 | |
1752 | /* This function removes the cursed/damned status on equipped |
1752 | /* This function removes the cursed/damned status on equipped |
… | |
… | |
1761 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1761 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1762 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && |
1762 | if (QUERY_FLAG (tmp, FLAG_APPLIED) && |
1763 | ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || |
1763 | ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || |
1764 | (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) |
1764 | (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) |
1765 | { |
1765 | { |
1766 | |
|
|
1767 | was_one++; |
1766 | was_one++; |
1768 | if (tmp->level <= caster_level (caster, spell)) |
1767 | if (tmp->level <= caster_level (caster, spell)) |
1769 | { |
1768 | { |
1770 | success++; |
1769 | success++; |
1771 | if (QUERY_FLAG (spell, FLAG_DAMNED)) |
1770 | if (QUERY_FLAG (spell, FLAG_DAMNED)) |
… | |
… | |
1791 | new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove the curse."); |
1790 | new_draw_info (NDI_UNIQUE, 0, op, "You failed to remove the curse."); |
1792 | else |
1791 | else |
1793 | new_draw_info (NDI_UNIQUE, 0, op, "You are not using any cursed items."); |
1792 | new_draw_info (NDI_UNIQUE, 0, op, "You are not using any cursed items."); |
1794 | } |
1793 | } |
1795 | } |
1794 | } |
|
|
1795 | |
1796 | return success; |
1796 | return success; |
1797 | } |
1797 | } |
1798 | |
1798 | |
1799 | /* Identifies objects in the players inventory/on the ground */ |
1799 | /* Identifies objects in the players inventory/on the ground */ |
1800 | |
1800 | |
… | |
… | |
1807 | num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1807 | num_ident = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1808 | |
1808 | |
1809 | if (num_ident < 1) |
1809 | if (num_ident < 1) |
1810 | num_ident = 1; |
1810 | num_ident = 1; |
1811 | |
1811 | |
1812 | |
|
|
1813 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1812 | for (tmp = op->inv; tmp; tmp = tmp->below) |
1814 | { |
1813 | { |
1815 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1814 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1816 | { |
1815 | { |
1817 | identify (tmp); |
1816 | identify (tmp); |
|
|
1817 | |
1818 | if (op->type == PLAYER) |
1818 | if (op->type == PLAYER) |
1819 | { |
1819 | { |
1820 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have %s.", long_desc (tmp, op)); |
1820 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have %s.", long_desc (tmp, op)); |
|
|
1821 | |
1821 | if (tmp->msg) |
1822 | if (tmp->msg) |
1822 | { |
1823 | { |
1823 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1824 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1824 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1825 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1825 | } |
1826 | } |
1826 | } |
1827 | } |
|
|
1828 | |
1827 | num_ident--; |
1829 | num_ident--; |
1828 | success = 1; |
1830 | success = 1; |
1829 | if (!num_ident) |
1831 | if (!num_ident) |
1830 | break; |
1832 | break; |
1831 | } |
1833 | } |
1832 | } |
1834 | } |
|
|
1835 | |
1833 | /* If all the power of the spell has been used up, don't go and identify |
1836 | /* If all the power of the spell has been used up, don't go and identify |
1834 | * stuff on the floor. Only identify stuff on the floor if the spell |
1837 | * stuff on the floor. Only identify stuff on the floor if the spell |
1835 | * was not fully used. |
1838 | * was not fully used. |
1836 | */ |
1839 | */ |
1837 | if (num_ident) |
1840 | if (num_ident) |
1838 | { |
1841 | { |
1839 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1842 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1840 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1843 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1841 | { |
1844 | { |
1842 | |
|
|
1843 | identify (tmp); |
1845 | identify (tmp); |
|
|
1846 | |
1844 | if (op->type == PLAYER) |
1847 | if (op->type == PLAYER) |
1845 | { |
1848 | { |
1846 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground is %s.", long_desc (tmp, op)); |
1849 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground is %s.", long_desc (tmp, op)); |
|
|
1850 | |
1847 | if (tmp->msg) |
1851 | if (tmp->msg) |
1848 | { |
1852 | { |
1849 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1853 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1850 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1854 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1851 | } |
1855 | } |
|
|
1856 | |
1852 | esrv_send_item (op, tmp); |
1857 | esrv_send_item (op, tmp); |
1853 | } |
1858 | } |
|
|
1859 | |
1854 | num_ident--; |
1860 | num_ident--; |
1855 | success = 1; |
1861 | success = 1; |
1856 | if (!num_ident) |
1862 | if (!num_ident) |
1857 | break; |
1863 | break; |
1858 | } |
1864 | } |
1859 | } |
1865 | } |
|
|
1866 | |
1860 | if (!success) |
1867 | if (!success) |
1861 | new_draw_info (NDI_UNIQUE, 0, op, "You can't reach anything unidentified."); |
1868 | new_draw_info (NDI_UNIQUE, 0, op, "You can't reach anything unidentified."); |
1862 | else |
1869 | else |
1863 | { |
|
|
1864 | spell_effect (spell, op->x, op->y, op->map, op); |
1870 | spell_effect (spell, op->x, op->y, op->map, op); |
1865 | } |
1871 | |
1866 | return success; |
1872 | return success; |
1867 | } |
1873 | } |
1868 | |
|
|
1869 | |
1874 | |
1870 | int |
1875 | int |
1871 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1876 | cast_detection (object *op, object *caster, object *spell, object *skill) |
1872 | { |
1877 | { |
1873 | object *tmp, *last, *god, *detect; |
1878 | object *tmp, *last, *god, *detect; |
… | |
… | |
1886 | skill = caster; |
1891 | skill = caster; |
1887 | |
1892 | |
1888 | for (x = op->x - range; x <= op->x + range; x++) |
1893 | for (x = op->x - range; x <= op->x + range; x++) |
1889 | for (y = op->y - range; y <= op->y + range; y++) |
1894 | for (y = op->y - range; y <= op->y + range; y++) |
1890 | { |
1895 | { |
1891 | |
|
|
1892 | m = op->map; |
1896 | m = op->map; |
1893 | mflags = get_map_flags (m, &m, x, y, &nx, &ny); |
1897 | mflags = get_map_flags (m, &m, x, y, &nx, &ny); |
1894 | if (mflags & P_OUT_OF_MAP) |
1898 | if (mflags & P_OUT_OF_MAP) |
1895 | continue; |
1899 | continue; |
1896 | |
1900 | |
… | |
… | |
1900 | * down - that is easier than working up. |
1904 | * down - that is easier than working up. |
1901 | */ |
1905 | */ |
1902 | |
1906 | |
1903 | for (last = NULL, tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) |
1907 | for (last = NULL, tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) |
1904 | last = tmp; |
1908 | last = tmp; |
|
|
1909 | |
1905 | /* Shouldn't happen, but if there are no objects on a space, this |
1910 | /* Shouldn't happen, but if there are no objects on a space, this |
1906 | * would happen. |
1911 | * would happen. |
1907 | */ |
1912 | */ |
1908 | if (!last) |
1913 | if (!last) |
1909 | continue; |
1914 | continue; |
… | |
… | |
1911 | done_one = 0; |
1916 | done_one = 0; |
1912 | floor = 0; |
1917 | floor = 0; |
1913 | detect = NULL; |
1918 | detect = NULL; |
1914 | for (tmp = last; tmp; tmp = tmp->below) |
1919 | for (tmp = last; tmp; tmp = tmp->below) |
1915 | { |
1920 | { |
1916 | |
|
|
1917 | /* show invisible */ |
1921 | /* show invisible */ |
1918 | if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) && |
1922 | if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) && |
1919 | /* Might there be other objects that we can make visibile? */ |
1923 | /* Might there be other objects that we can make visible? */ |
1920 | (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) || |
1924 | (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) || |
1921 | (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) || |
1925 | (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) || |
1922 | tmp->type == CF_HANDLE || |
1926 | tmp->type == CF_HANDLE || |
1923 | tmp->type == TRAPDOOR || tmp->type == EXIT || tmp->type == HOLE || |
1927 | tmp->type == TRAPDOOR || tmp->type == EXIT || tmp->type == HOLE || |
1924 | tmp->type == BUTTON || tmp->type == TELEPORTER || |
1928 | tmp->type == BUTTON || tmp->type == TELEPORTER || |
… | |
… | |
1931 | { |
1935 | { |
1932 | tmp->invisible = 0; |
1936 | tmp->invisible = 0; |
1933 | done_one = 1; |
1937 | done_one = 1; |
1934 | } |
1938 | } |
1935 | } |
1939 | } |
|
|
1940 | |
1936 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1941 | if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) |
1937 | floor = 1; |
1942 | floor = 1; |
1938 | |
1943 | |
1939 | /* All detections below this point don't descend beneath the floor, |
1944 | /* All detections below this point don't descend beneath the floor, |
1940 | * so just continue on. We could be clever and look at the type of |
1945 | * so just continue on. We could be clever and look at the type of |
… | |
… | |
2374 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2379 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2375 | SET_FLAG (tmp, FLAG_FRIENDLY); |
2380 | SET_FLAG (tmp, FLAG_FRIENDLY); |
2376 | tmp->stats.exp = 0; |
2381 | tmp->stats.exp = 0; |
2377 | add_friendly_object (tmp); |
2382 | add_friendly_object (tmp); |
2378 | tmp->type = GOLEM; |
2383 | tmp->type = GOLEM; |
2379 | set_owner (tmp, op); |
2384 | tmp->set_owner (op); |
2380 | set_spell_skill (op, caster, spell, tmp); |
2385 | set_spell_skill (op, caster, spell, tmp); |
2381 | op->contr->ranges[range_golem] = tmp; |
2386 | op->contr->ranges[range_golem] = tmp; |
2382 | op->contr->shoottype = range_golem; |
2387 | op->contr->shoottype = range_golem; |
2383 | |
2388 | |
2384 | /* Give the weapon to the golem now. A bit of a hack to check the |
2389 | /* Give the weapon to the golem now. A bit of a hack to check the |
… | |
… | |
2541 | |
2546 | |
2542 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2547 | new_aura->duration = spell->duration + 10 * SP_level_duration_adjust (caster, spell); |
2543 | |
2548 | |
2544 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2549 | new_aura->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
2545 | |
2550 | |
2546 | set_owner (new_aura, op); |
2551 | new_aura->set_owner (op); |
2547 | set_spell_skill (op, caster, spell, new_aura); |
2552 | set_spell_skill (op, caster, spell, new_aura); |
2548 | new_aura->attacktype = spell->attacktype; |
2553 | new_aura->attacktype = spell->attacktype; |
2549 | |
2554 | |
2550 | new_aura->level = caster_level (caster, spell); |
2555 | new_aura->level = caster_level (caster, spell); |
2551 | if (refresh) |
2556 | if (refresh) |
… | |
… | |
2663 | |
2668 | |
2664 | if (rndm (0, atk_lev - 1) > def_lev) |
2669 | if (rndm (0, atk_lev - 1) > def_lev) |
2665 | { |
2670 | { |
2666 | /* make this sucker peaceful. */ |
2671 | /* make this sucker peaceful. */ |
2667 | |
2672 | |
2668 | change_exp (get_owner (op), victim->stats.exp, op->skill, 0); |
2673 | change_exp (op->owner, victim->stats.exp, op->skill, 0); |
2669 | victim->stats.exp = 0; |
2674 | victim->stats.exp = 0; |
2670 | #if 0 |
2675 | #if 0 |
2671 | /* No idea why these were all set to zero - if something |
2676 | /* No idea why these were all set to zero - if something |
2672 | * makes this creature agressive, he should still do damage. |
2677 | * makes this creature agressive, he should still do damage. |
2673 | */ |
2678 | */ |