… | |
… | |
1264 | */ |
1264 | */ |
1265 | int |
1265 | int |
1266 | check_pick (object *op) |
1266 | check_pick (object *op) |
1267 | { |
1267 | { |
1268 | object *tmp, *next; |
1268 | object *tmp, *next; |
1269 | tag_t next_tag = 0, op_tag; |
|
|
1270 | int stop = 0; |
1269 | int stop = 0; |
1271 | int j, k, wvratio; |
1270 | int j, k, wvratio; |
1272 | char putstring[128], tmpstr[16]; |
1271 | char putstring[128], tmpstr[16]; |
1273 | |
1272 | |
1274 | |
|
|
1275 | /* if you're flying, you cna't pick up anything */ |
1273 | /* if you're flying, you cna't pick up anything */ |
1276 | if (op->move_type & MOVE_FLYING) |
1274 | if (op->move_type & MOVE_FLYING) |
1277 | return 1; |
1275 | return 1; |
1278 | |
1276 | |
1279 | op_tag = op->count; |
|
|
1280 | |
|
|
1281 | next = op->below; |
1277 | next = op->below; |
1282 | if (next) |
|
|
1283 | next_tag = next->count; |
|
|
1284 | |
1278 | |
1285 | /* loop while there are items on the floor that are not marked as |
1279 | /* loop while there are items on the floor that are not marked as |
1286 | * destroyed */ |
1280 | * destroyed */ |
1287 | while (next && !was_destroyed (next, next_tag)) |
1281 | while (next && !next->destroyed ()) |
1288 | { |
1282 | { |
1289 | tmp = next; |
1283 | tmp = next; |
1290 | next = tmp->below; |
1284 | next = tmp->below; |
1291 | if (next) |
|
|
1292 | next_tag = next->count; |
|
|
1293 | |
1285 | |
1294 | if (was_destroyed (op, op_tag)) |
1286 | if (op->destroyed ()) |
1295 | return 0; |
1287 | return 0; |
1296 | |
1288 | |
1297 | if (!can_pick (op, tmp)) |
1289 | if (!can_pick (op, tmp)) |
1298 | continue; |
1290 | continue; |
1299 | |
1291 | |
… | |
… | |
1840 | */ |
1832 | */ |
1841 | int |
1833 | int |
1842 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1834 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1843 | { |
1835 | { |
1844 | object *left, *bow; |
1836 | object *left, *bow; |
1845 | tag_t left_tag, tag; |
|
|
1846 | int bowspeed, mflags; |
1837 | int bowspeed, mflags; |
1847 | mapstruct *m; |
1838 | mapstruct *m; |
1848 | |
1839 | |
1849 | if (!dir) |
1840 | if (!dir) |
1850 | { |
1841 | { |
… | |
… | |
1912 | free_object (arrow); |
1903 | free_object (arrow); |
1913 | return 0; |
1904 | return 0; |
1914 | } |
1905 | } |
1915 | |
1906 | |
1916 | left = arrow; /* these are arrows left to the player */ |
1907 | left = arrow; /* these are arrows left to the player */ |
1917 | left_tag = left->count; |
|
|
1918 | arrow = get_split_ob (arrow, 1); |
1908 | arrow = get_split_ob (arrow, 1); |
1919 | if (arrow == NULL) |
1909 | if (arrow == NULL) |
1920 | { |
1910 | { |
1921 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1911 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1922 | return 0; |
1912 | return 0; |
… | |
… | |
1965 | arrow->level = op->chosen_skill ? op->chosen_skill->level : op->level; |
1955 | arrow->level = op->chosen_skill ? op->chosen_skill->level : op->level; |
1966 | } |
1956 | } |
1967 | else |
1957 | else |
1968 | { |
1958 | { |
1969 | arrow->stats.wc = op->stats.wc - bow->magic - arrow->magic - arrow->stats.wc + wc_mod; |
1959 | arrow->stats.wc = op->stats.wc - bow->magic - arrow->magic - arrow->stats.wc + wc_mod; |
1970 | |
|
|
1971 | arrow->level = op->level; |
1960 | arrow->level = op->level; |
1972 | } |
1961 | } |
|
|
1962 | |
1973 | if (arrow->attacktype == AT_PHYSICAL) |
1963 | if (arrow->attacktype == AT_PHYSICAL) |
1974 | arrow->attacktype |= bow->attacktype; |
1964 | arrow->attacktype |= bow->attacktype; |
|
|
1965 | |
1975 | if (bow->slaying != NULL) |
1966 | if (bow->slaying != NULL) |
1976 | arrow->slaying = bow->slaying; |
1967 | arrow->slaying = bow->slaying; |
1977 | |
1968 | |
1978 | arrow->map = m; |
1969 | arrow->map = m; |
1979 | arrow->move_type = MOVE_FLY_LOW; |
1970 | arrow->move_type = MOVE_FLY_LOW; |
1980 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1971 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1981 | |
1972 | |
1982 | play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW); |
1973 | play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW); |
1983 | tag = arrow->count; |
|
|
1984 | insert_ob_in_map (arrow, m, op, 0); |
1974 | insert_ob_in_map (arrow, m, op, 0); |
1985 | |
1975 | |
1986 | if (!was_destroyed (arrow, tag)) |
1976 | if (!arrow->destroyed ()) |
1987 | move_arrow (arrow); |
1977 | move_arrow (arrow); |
1988 | |
1978 | |
1989 | if (op->type == PLAYER) |
1979 | if (op->type == PLAYER) |
1990 | { |
1980 | { |
1991 | if (was_destroyed (left, left_tag)) |
1981 | if (left->destroyed ()) |
1992 | esrv_del_item (op->contr, left_tag); |
1982 | esrv_del_item (op->contr, left->count); |
1993 | else |
1983 | else |
1994 | esrv_send_item (op, left); |
1984 | esrv_send_item (op, left); |
1995 | } |
1985 | } |
|
|
1986 | |
1996 | return 1; |
1987 | return 1; |
1997 | } |
1988 | } |
1998 | |
1989 | |
1999 | /* Special fire code for players - this takes into |
1990 | /* Special fire code for players - this takes into |
2000 | * account the special fire modes players can have |
1991 | * account the special fire modes players can have |