… | |
… | |
737 | } |
737 | } |
738 | #endif |
738 | #endif |
739 | |
739 | |
740 | hit_map (op, 0, op->attacktype, 0); |
740 | hit_map (op, 0, op->attacktype, 0); |
741 | |
741 | |
|
|
742 | if (!op->is_on_map ()) |
|
|
743 | return; |
|
|
744 | |
742 | /* Check to see if we should push anything. |
745 | /* Check to see if we should push anything. |
743 | * Spell objects with weight push whatever they encounter to some |
746 | * Spell objects with weight push whatever they encounter to some |
744 | * degree. |
747 | * degree. |
745 | */ |
748 | */ |
746 | if (op->weight) |
749 | if (op->weight) |
|
|
750 | { |
747 | check_spell_knockback (op); |
751 | check_spell_knockback (op); |
748 | |
752 | |
749 | if (op->destroyed ()) |
753 | if (!op->is_on_map ()) |
750 | return; |
754 | return; |
|
|
755 | } |
751 | |
756 | |
752 | if (op->duration-- < 0) |
757 | if (op->duration-- < 0) |
753 | { |
758 | { |
754 | op->destroy (); |
759 | op->destroy (); |
755 | return; |
760 | return; |
… | |
… | |
1245 | |
1250 | |
1246 | object *tmp = get_archetype (FORCE_NAME); |
1251 | object *tmp = get_archetype (FORCE_NAME); |
1247 | tmp->speed = 0.01; |
1252 | tmp->speed = 0.01; |
1248 | tmp->stats.food = time; |
1253 | tmp->stats.food = time; |
1249 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
1254 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
1250 | tmp->glow_radius = radius; |
|
|
1251 | if (tmp->glow_radius > MAX_LIGHT_RADII) |
|
|
1252 | tmp->glow_radius = MAX_LIGHT_RADII; |
1255 | tmp->glow_radius = min (MAX_LIGHT_RADIUS, radius); |
1253 | |
|
|
1254 | tmp = insert_ob_in_ob (tmp, op); |
1256 | tmp = insert_ob_in_ob (tmp, op); |
1255 | |
1257 | |
1256 | if (tmp->glow_radius > op->glow_radius) |
1258 | if (tmp->glow_radius > op->glow_radius) |
1257 | op->glow_radius = tmp->glow_radius; |
1259 | op->glow_radius = tmp->glow_radius; |
1258 | |
1260 | |
… | |
… | |
1885 | int dam, mflags; |
1887 | int dam, mflags; |
1886 | maptile *m; |
1888 | maptile *m; |
1887 | |
1889 | |
1888 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1890 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1889 | |
1891 | |
1890 | if (!dir) |
1892 | if (dir) |
1891 | { |
|
|
1892 | new_draw_info (NDI_UNIQUE, 0, op, "In what direction?"); |
|
|
1893 | return 0; |
|
|
1894 | } |
1893 | { |
1895 | |
|
|
1896 | x = op->x + freearr_x[dir]; |
1894 | x = op->x + freearr_x[dir]; |
1897 | y = op->y + freearr_y[dir]; |
1895 | y = op->y + freearr_y[dir]; |
1898 | m = op->map; |
1896 | m = op->map; |
1899 | |
1897 | |
1900 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1898 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1901 | |
1899 | |
1902 | if (mflags & P_OUT_OF_MAP) |
1900 | if (mflags & P_OUT_OF_MAP) |
1903 | { |
1901 | { |
1904 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); |
1902 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); |
1905 | return 0; |
1903 | return 0; |
1906 | } |
1904 | } |
1907 | |
1905 | |
1908 | if (mflags & P_IS_ALIVE && spell->attacktype) |
1906 | if (mflags & P_IS_ALIVE && spell->attacktype) |
1909 | { |
1907 | { |
1910 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
1908 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
1911 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
1909 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
1912 | { |
1910 | { |
1913 | /* oky doky. got a target monster. Lets make a blinding attack */ |
1911 | /* oky doky. got a target monster. Lets make a blinding attack */ |
1914 | if (target->head) |
1912 | if (target->head) |
1915 | target = target->head; |
1913 | target = target->head; |
1916 | |
1914 | |
1917 | hit_player (target, dam, op, spell->attacktype, 1); |
1915 | hit_player (target, dam, op, spell->attacktype, 1); |
1918 | return 1; /* one success only! */ |
1916 | return 1; /* one success only! */ |
|
|
1917 | } |
1919 | } |
1918 | } |
1920 | } |
|
|
1921 | |
1919 | |
1922 | /* no live target, perhaps a wall is in the way? */ |
1920 | /* no live target, perhaps a wall is in the way? */ |
1923 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) |
1921 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) |
1924 | { |
1922 | { |
1925 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1923 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1926 | return 0; |
1924 | return 0; |
|
|
1925 | } |
1927 | } |
1926 | } |
1928 | |
1927 | |
1929 | /* ok, looks groovy to just insert a new light on the map */ |
1928 | /* ok, looks groovy to just insert a new light on the map */ |
1930 | tmp = arch_to_object (spell->other_arch); |
1929 | tmp = arch_to_object (spell->other_arch); |
1931 | if (!tmp) |
1930 | if (!tmp) |
1932 | { |
1931 | { |
1933 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1932 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1934 | return 0; |
1933 | return 0; |
1935 | } |
1934 | } |
|
|
1935 | |
1936 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
1936 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
|
|
1937 | |
1937 | if (tmp->glow_radius) |
1938 | if (tmp->glow_radius) |
1938 | { |
|
|
1939 | tmp->glow_radius = spell->range + SP_level_range_adjust (caster, spell); |
1939 | tmp->glow_radius = min (MAX_LIGHT_RADIUS, spell->range + SP_level_range_adjust (caster, spell)); |
1940 | if (tmp->glow_radius > MAX_LIGHT_RADII) |
|
|
1941 | tmp->glow_radius = MAX_LIGHT_RADII; |
|
|
1942 | } |
|
|
1943 | |
1940 | |
|
|
1941 | if (dir) |
1944 | m->insert (tmp, x, y, op); |
1942 | m->insert (tmp, x, y, op); |
|
|
1943 | else |
|
|
1944 | caster->outer_env ()->insert (tmp); |
|
|
1945 | |
1945 | return 1; |
1946 | return 1; |
1946 | } |
1947 | } |
1947 | |
1948 | |
1948 | /* cast_cause_disease: this spell looks along <dir> from the |
1949 | /* cast_cause_disease: this spell looks along <dir> from the |
1949 | * player and infects someone. |
1950 | * player and infects someone. |