ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_attack.C
(Generate patch)

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.68 by elmex, Mon Oct 6 08:46:33 2008 UTC vs.
Revision 1.69 by root, Thu Dec 4 01:07:35 2008 UTC

1250 1250
1251 object *tmp = get_archetype (FORCE_NAME); 1251 object *tmp = get_archetype (FORCE_NAME);
1252 tmp->speed = 0.01; 1252 tmp->speed = 0.01;
1253 tmp->stats.food = time; 1253 tmp->stats.food = time;
1254 SET_FLAG (tmp, FLAG_IS_USED_UP); 1254 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; 1255 tmp->glow_radius = min (MAX_LIGHT_RADIUS, radius);
1258
1259 tmp = insert_ob_in_ob (tmp, op); 1256 tmp = insert_ob_in_ob (tmp, op);
1260 1257
1261 if (tmp->glow_radius > op->glow_radius) 1258 if (tmp->glow_radius > op->glow_radius)
1262 op->glow_radius = tmp->glow_radius; 1259 op->glow_radius = tmp->glow_radius;
1263 1260
1890 int dam, mflags; 1887 int dam, mflags;
1891 maptile *m; 1888 maptile *m;
1892 1889
1893 dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1890 dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1894 1891
1895 if (!dir) 1892 if (dir)
1896 {
1897 new_draw_info (NDI_UNIQUE, 0, op, "In what direction?");
1898 return 0;
1899 } 1893 {
1900
1901 x = op->x + freearr_x[dir]; 1894 x = op->x + freearr_x[dir];
1902 y = op->y + freearr_y[dir]; 1895 y = op->y + freearr_y[dir];
1903 m = op->map; 1896 m = op->map;
1904 1897
1905 mflags = get_map_flags (m, &m, x, y, &x, &y); 1898 mflags = get_map_flags (m, &m, x, y, &x, &y);
1906 1899
1907 if (mflags & P_OUT_OF_MAP) 1900 if (mflags & P_OUT_OF_MAP)
1908 { 1901 {
1909 new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there."); 1902 new_draw_info (NDI_UNIQUE, 0, op, "Nothing is there.");
1910 return 0; 1903 return 0;
1911 } 1904 }
1912 1905
1913 if (mflags & P_IS_ALIVE && spell->attacktype) 1906 if (mflags & P_IS_ALIVE && spell->attacktype)
1914 { 1907 {
1915 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)
1916 if (QUERY_FLAG (target, FLAG_MONSTER)) 1909 if (QUERY_FLAG (target, FLAG_MONSTER))
1917 { 1910 {
1918 /* oky doky. got a target monster. Lets make a blinding attack */ 1911 /* oky doky. got a target monster. Lets make a blinding attack */
1919 if (target->head) 1912 if (target->head)
1920 target = target->head; 1913 target = target->head;
1921 1914
1922 hit_player (target, dam, op, spell->attacktype, 1); 1915 hit_player (target, dam, op, spell->attacktype, 1);
1923 return 1; /* one success only! */ 1916 return 1; /* one success only! */
1917 }
1924 } 1918 }
1925 }
1926 1919
1927 /* no live target, perhaps a wall is in the way? */ 1920 /* no live target, perhaps a wall is in the way? */
1928 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)))
1929 { 1922 {
1930 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.");
1931 return 0; 1924 return 0;
1925 }
1932 } 1926 }
1933 1927
1934 /* 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 */
1935 tmp = arch_to_object (spell->other_arch); 1929 tmp = arch_to_object (spell->other_arch);
1936 if (!tmp) 1930 if (!tmp)
1937 { 1931 {
1938 LOG (llevError, "Error: spell arch for cast_light() missing.\n"); 1932 LOG (llevError, "Error: spell arch for cast_light() missing.\n");
1939 return 0; 1933 return 0;
1940 } 1934 }
1935
1941 tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell); 1936 tmp->stats.food = spell->duration + SP_level_duration_adjust (caster, spell);
1937
1942 if (tmp->glow_radius) 1938 if (tmp->glow_radius)
1943 {
1944 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));
1945 if (tmp->glow_radius > MAX_LIGHT_RADII)
1946 tmp->glow_radius = MAX_LIGHT_RADII;
1947 }
1948 1940
1941 if (dir)
1949 m->insert (tmp, x, y, op); 1942 m->insert (tmp, x, y, op);
1943 else
1944 caster->outer_env ()->insert (tmp);
1945
1950 return 1; 1946 return 1;
1951} 1947}
1952 1948
1953/* cast_cause_disease: this spell looks along <dir> from the 1949/* cast_cause_disease: this spell looks along <dir> from the
1954 * player and infects someone. 1950 * player and infects someone.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines