… | |
… | |
1008 | int mflags; |
1008 | int mflags; |
1009 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1009 | sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; |
1010 | maptile *m; |
1010 | maptile *m; |
1011 | |
1011 | |
1012 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
1012 | mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); |
|
|
1013 | |
|
|
1014 | // when creating a bomb below ourself it should always work, even |
|
|
1015 | // when movement is blocked (somehow we got here, somehow we are here, |
|
|
1016 | // so we should also be able to make a bomb here). (originally added |
|
|
1017 | // to fix create bomb traps in doors, which cast with dir=0). |
|
|
1018 | if (dir) |
|
|
1019 | { |
1013 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1020 | if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) |
1014 | { |
1021 | { |
1015 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1022 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1016 | return 0; |
1023 | return 0; |
|
|
1024 | } |
1017 | } |
1025 | } |
1018 | |
1026 | |
1019 | tmp = arch_to_object (spell->other_arch); |
1027 | tmp = arch_to_object (spell->other_arch); |
1020 | |
1028 | |
1021 | /* level dependencies for bomb */ |
1029 | /* level dependencies for bomb */ |
… | |
… | |
1250 | |
1258 | |
1251 | object *tmp = get_archetype (FORCE_NAME); |
1259 | object *tmp = get_archetype (FORCE_NAME); |
1252 | tmp->speed = 0.01; |
1260 | tmp->speed = 0.01; |
1253 | tmp->stats.food = time; |
1261 | tmp->stats.food = time; |
1254 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
1262 | SET_FLAG (tmp, FLAG_IS_USED_UP); |
1255 | tmp->glow_radius = radius; |
|
|
1256 | if (tmp->glow_radius > MAX_LIGHT_RADII) |
|
|
1257 | tmp->glow_radius = MAX_LIGHT_RADII; |
1263 | tmp->glow_radius = min (MAX_LIGHT_RADIUS, radius); |
1258 | |
|
|
1259 | tmp = insert_ob_in_ob (tmp, op); |
1264 | tmp = insert_ob_in_ob (tmp, op); |
1260 | |
1265 | |
1261 | if (tmp->glow_radius > op->glow_radius) |
1266 | if (tmp->glow_radius > op->glow_radius) |
1262 | op->glow_radius = tmp->glow_radius; |
1267 | op->glow_radius = tmp->glow_radius; |
1263 | |
1268 | |
… | |
… | |
1890 | int dam, mflags; |
1895 | int dam, mflags; |
1891 | maptile *m; |
1896 | maptile *m; |
1892 | |
1897 | |
1893 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1898 | dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); |
1894 | |
1899 | |
1895 | if (!dir) |
1900 | if (dir) |
1896 | { |
|
|
1897 | new_draw_info (NDI_UNIQUE, 0, op, "In what direction?"); |
|
|
1898 | return 0; |
|
|
1899 | } |
1901 | { |
1900 | |
|
|
1901 | x = op->x + freearr_x[dir]; |
1902 | x = op->x + freearr_x[dir]; |
1902 | y = op->y + freearr_y[dir]; |
1903 | y = op->y + freearr_y[dir]; |
1903 | m = op->map; |
1904 | m = op->map; |
1904 | |
1905 | |
1905 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1906 | mflags = get_map_flags (m, &m, x, y, &x, &y); |
1906 | |
1907 | |
1907 | if (mflags & P_OUT_OF_MAP) |
1908 | if (mflags & P_OUT_OF_MAP) |
1908 | { |
1909 | { |
1909 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); |
1910 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); |
1910 | return 0; |
1911 | return 0; |
1911 | } |
1912 | } |
1912 | |
1913 | |
1913 | if (mflags & P_IS_ALIVE && spell->attacktype) |
1914 | if (mflags & P_IS_ALIVE && spell->attacktype) |
1914 | { |
1915 | { |
1915 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
1916 | for (target = GET_MAP_OB (m, x, y); target; target = target->above) |
1916 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
1917 | if (QUERY_FLAG (target, FLAG_MONSTER)) |
1917 | { |
1918 | { |
1918 | /* oky doky. got a target monster. Lets make a blinding attack */ |
1919 | /* oky doky. got a target monster. Lets make a blinding attack */ |
1919 | if (target->head) |
1920 | if (target->head) |
1920 | target = target->head; |
1921 | target = target->head; |
1921 | |
1922 | |
1922 | hit_player (target, dam, op, spell->attacktype, 1); |
1923 | hit_player (target, dam, op, spell->attacktype, 1); |
1923 | return 1; /* one success only! */ |
1924 | return 1; /* one success only! */ |
|
|
1925 | } |
1924 | } |
1926 | } |
1925 | } |
|
|
1926 | |
1927 | |
1927 | /* no live target, perhaps a wall is in the way? */ |
1928 | /* no live target, perhaps a wall is in the way? */ |
1928 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) |
1929 | if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y))) |
1929 | { |
1930 | { |
1930 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1931 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1931 | return 0; |
1932 | return 0; |
|
|
1933 | } |
1932 | } |
1934 | } |
1933 | |
1935 | |
1934 | /* ok, looks groovy to just insert a new light on the map */ |
1936 | /* ok, looks groovy to just insert a new light on the map */ |
1935 | tmp = arch_to_object (spell->other_arch); |
1937 | tmp = arch_to_object (spell->other_arch); |
1936 | if (!tmp) |
1938 | if (!tmp) |
1937 | { |
1939 | { |
1938 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1940 | LOG (llevError, "Error: spell arch for cast_light() missing.\n"); |
1939 | return 0; |
1941 | return 0; |
1940 | } |
1942 | } |
|
|
1943 | |
1941 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
1944 | tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); |
|
|
1945 | |
1942 | if (tmp->glow_radius) |
1946 | if (tmp->glow_radius) |
1943 | { |
|
|
1944 | tmp->glow_radius = spell->range + SP_level_range_adjust (caster, spell); |
1947 | tmp->glow_radius = min (MAX_LIGHT_RADIUS, spell->range + SP_level_range_adjust (caster, spell)); |
1945 | if (tmp->glow_radius > MAX_LIGHT_RADII) |
|
|
1946 | tmp->glow_radius = MAX_LIGHT_RADII; |
|
|
1947 | } |
|
|
1948 | |
1948 | |
|
|
1949 | if (dir) |
1949 | m->insert (tmp, x, y, op); |
1950 | m->insert (tmp, x, y, op); |
|
|
1951 | else |
|
|
1952 | caster->outer_env ()->insert (tmp); |
|
|
1953 | |
1950 | return 1; |
1954 | return 1; |
1951 | } |
1955 | } |
1952 | |
1956 | |
1953 | /* cast_cause_disease: this spell looks along <dir> from the |
1957 | /* cast_cause_disease: this spell looks along <dir> from the |
1954 | * player and infects someone. |
1958 | * player and infects someone. |