1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
1764 | { |
1764 | { |
1765 | identify (tmp); |
1765 | identify (tmp); |
1766 | |
1766 | |
1767 | if (op->type == PLAYER) |
1767 | if (op->type == PLAYER) |
1768 | { |
1768 | { |
1769 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have %s.", long_desc (tmp, op)); |
1769 | new_draw_info_format (NDI_UNIQUE, 0, op, "You identified: %s.", long_desc (tmp, op)); |
1770 | |
1770 | |
1771 | if (tmp->msg) |
1771 | if (tmp->msg) |
1772 | { |
1772 | { |
1773 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1773 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1774 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1774 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
… | |
… | |
1786 | * stuff on the floor. Only identify stuff on the floor if the spell |
1786 | * stuff on the floor. Only identify stuff on the floor if the spell |
1787 | * was not fully used. |
1787 | * was not fully used. |
1788 | */ |
1788 | */ |
1789 | if (num_ident) |
1789 | if (num_ident) |
1790 | { |
1790 | { |
1791 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1791 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
1792 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1792 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1793 | { |
1793 | { |
1794 | identify (tmp); |
1794 | identify (tmp); |
1795 | |
1795 | |
1796 | if (op->type == PLAYER) |
1796 | if (op->type == PLAYER) |
1797 | { |
1797 | { |
1798 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground is %s.", long_desc (tmp, op)); |
1798 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground you identified: %s.", long_desc (tmp, op)); |
1799 | |
1799 | |
1800 | if (tmp->msg) |
1800 | if (tmp->msg) |
1801 | { |
1801 | { |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1803 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1803 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
… | |
… | |
2243 | * This code was very odd - code early on would only let players use the spell, |
2243 | * This code was very odd - code early on would only let players use the spell, |
2244 | * yet the code wass full of player checks. I've presumed that the code |
2244 | * yet the code wass full of player checks. I've presumed that the code |
2245 | * that only let players use it was correct, and removed all the other |
2245 | * that only let players use it was correct, and removed all the other |
2246 | * player checks. MSW 2003-01-06 |
2246 | * player checks. MSW 2003-01-06 |
2247 | */ |
2247 | */ |
2248 | |
|
|
2249 | int |
2248 | int |
2250 | animate_weapon (object *op, object *caster, object *spell, int dir) |
2249 | animate_weapon (object *op, object *caster, object *spell, int dir) |
2251 | { |
2250 | { |
2252 | object *weapon, *tmp; |
2251 | object *weapon, *tmp; |
2253 | char buf[MAX_BUF]; |
2252 | char buf[MAX_BUF]; |
… | |
… | |
2265 | /* exit if it's not a player using this spell. */ |
2264 | /* exit if it's not a player using this spell. */ |
2266 | if (op->type != PLAYER) |
2265 | if (op->type != PLAYER) |
2267 | return 0; |
2266 | return 0; |
2268 | |
2267 | |
2269 | /* if player already has a golem, abort */ |
2268 | /* if player already has a golem, abort */ |
2270 | if (op->contr->ranges[range_golem]) |
2269 | if (object *golem = op->contr->golem) |
2271 | { |
2270 | { |
2272 | control_golem (op->contr->ranges[range_golem], dir); |
2271 | control_golem (golem, dir); |
2273 | return 0; |
2272 | return 0; |
2274 | } |
2273 | } |
2275 | |
2274 | |
2276 | /* if no direction specified, pick one */ |
2275 | /* if no direction specified, pick one */ |
2277 | if (!dir) |
2276 | if (!dir) |
… | |
… | |
2327 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2326 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2328 | tmp->stats.exp = 0; |
2327 | tmp->stats.exp = 0; |
2329 | add_friendly_object (tmp); |
2328 | add_friendly_object (tmp); |
2330 | tmp->type = GOLEM; |
2329 | tmp->type = GOLEM; |
2331 | tmp->set_owner (op); |
2330 | tmp->set_owner (op); |
|
|
2331 | op->contr->golem = tmp; |
2332 | set_spell_skill (op, caster, spell, tmp); |
2332 | set_spell_skill (op, caster, spell, tmp); |
2333 | op->contr->ranges[range_golem] = tmp; |
|
|
2334 | op->contr->shoottype = range_golem; |
|
|
2335 | |
2333 | |
2336 | /* Give the weapon to the golem now. A bit of a hack to check the |
2334 | /* Give the weapon to the golem now. A bit of a hack to check the |
2337 | * removed flag - it should only be set if get_split_object was |
2335 | * removed flag - it should only be set if get_split_object was |
2338 | * used above. |
2336 | * used above. |
2339 | */ |
2337 | */ |
2340 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2338 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2341 | weapon->remove (); |
2339 | weapon->remove (); |
|
|
2340 | |
2342 | insert_ob_in_ob (weapon, tmp); |
2341 | insert_ob_in_ob (weapon, tmp); |
2343 | esrv_send_item (op, weapon); |
2342 | esrv_send_item (op, weapon); |
2344 | /* To do everything necessary to let a golem use the weapon is a pain, |
2343 | /* To do everything necessary to let a golem use the weapon is a pain, |
2345 | * so instead, just set it as equipped (otherwise, we need to update |
2344 | * so instead, just set it as equipped (otherwise, we need to update |
2346 | * body_info, skills, etc) |
2345 | * body_info, skills, etc) |