… | |
… | |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * it under the terms of the GNU General Public License as published by |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * (at your option) any later version. |
11 | * option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the Affero GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * and the GNU General Public License along with this program. If not, see |
|
|
20 | * <http://www.gnu.org/licenses/>. |
20 | * |
21 | * |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
23 | */ |
23 | |
24 | |
24 | /* |
25 | /* |
… | |
… | |
599 | |
600 | |
600 | // restore original wc, dam, attacktype and slaying |
601 | // restore original wc, dam, attacktype and slaying |
601 | op->stats.wc = op->stats.sp; |
602 | op->stats.wc = op->stats.sp; |
602 | op->stats.dam = op->stats.hp; |
603 | op->stats.dam = op->stats.hp; |
603 | op->attacktype = op->stats.grace; |
604 | op->attacktype = op->stats.grace; |
|
|
605 | op->slaying = op->custom_name; |
604 | |
606 | |
605 | if (op->spellarg) |
|
|
606 | { |
|
|
607 | op->slaying = op->spellarg; |
|
|
608 | free (op->spellarg); |
|
|
609 | op->spellarg = 0; |
|
|
610 | } |
|
|
611 | else |
|
|
612 | op->slaying = 0; |
|
|
613 | |
|
|
614 | /* Reset these to zero, so that object::can_merge will work properly */ |
607 | /* Reset these to defaults, so that object::can_merge will work properly */ |
615 | op->spellarg = NULL; |
608 | op->custom_name = 0; |
616 | op->stats.sp = 0; |
609 | op->stats.sp = 0; |
617 | op->stats.hp = 0; |
610 | op->stats.hp = 0; |
618 | op->stats.grace = 0; |
611 | op->stats.grace = 0; |
619 | op->level = 0; |
612 | op->level = 0; |
620 | op->face = op->arch->face; |
613 | op->face = op->arch->face; |
621 | op->owner = NULL; /* So that stopped arrows will be saved */ |
614 | op->owner = 0; |
|
|
615 | |
622 | update_object (op, UP_OBJ_CHANGE); |
616 | update_object (op, UP_OBJ_CHANGE); |
|
|
617 | |
623 | return op; |
618 | return op; |
624 | } |
619 | } |
625 | |
620 | |
626 | /* stop_arrow() - what to do when a non-living flying object |
621 | /* stop_arrow() - what to do when a non-living flying object |
627 | * has to stop. Sept 96 - I added in thrown object code in |
622 | * has to stop. Sept 96 - I added in thrown object code in |
… | |
… | |
1235 | { |
1230 | { |
1236 | /* remove an old force with a slaying field == op->name */ |
1231 | /* remove an old force with a slaying field == op->name */ |
1237 | if (object *force = tmp->force_find (op->name)) |
1232 | if (object *force = tmp->force_find (op->name)) |
1238 | force->destroy (); |
1233 | force->destroy (); |
1239 | |
1234 | |
1240 | if (!tmp->force_find (op->slaying)) |
1235 | if (op->slaying && !tmp->force_find (op->slaying)) |
1241 | { |
1236 | { |
1242 | tmp->force_add (op->slaying, op->stats.food); |
1237 | tmp->force_add (op->slaying, op->stats.food); |
1243 | |
1238 | |
1244 | if (op->msg) |
1239 | if (op->msg) |
1245 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
1240 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, tmp, op->msg); |
… | |
… | |
1276 | op->set_speed (0); |
1271 | op->set_speed (0); |
1277 | return; |
1272 | return; |
1278 | } |
1273 | } |
1279 | else |
1274 | else |
1280 | { |
1275 | { |
1281 | // check whether the face might needs to be updated |
1276 | // check whether the face might need to be updated |
1282 | // (currently this is needed to have already switched on torches |
1277 | // (currently this is needed to have already switched on torches |
1283 | // on maps, as they just set the glow_radius in the archetype) |
1278 | // on maps, as they just set the glow_radius in the archetype) |
1284 | if (op->other_arch |
1279 | if (op->other_arch |
1285 | && ( |
1280 | && ( |
1286 | (op->flag [FLAG_ANIMATE] != op->other_arch->flag [FLAG_ANIMATE]) |
1281 | (op->flag [FLAG_ANIMATE] != op->other_arch->flag [FLAG_ANIMATE]) |
1287 | || (op->flag [FLAG_ANIMATE] |
1282 | || (op->flag [FLAG_ANIMATE] |
1288 | ? (op->animation_id != op->other_arch->animation_id) |
1283 | ? (op->animation_id != op->other_arch->animation_id) |
1289 | : (op->face != op->other_arch->face)) |
1284 | : (op->face != op->other_arch->face)) |
1290 | )) |
1285 | )) |
1291 | get_animation_from_arch (op, op->other_arch); |
1286 | get_animation_from_arch (op, op->other_arch); |
1292 | } |
1287 | } |
1293 | |
1288 | |
1294 | // lamps and torches auf maps don't use up their fuel |
1289 | // lamps and torches on maps don't use up their fuel |
1295 | if (op->is_on_map ()) |
1290 | if (op->is_on_map ()) |
1296 | return; |
1291 | return; |
1297 | |
1292 | |
1298 | if (op->stats.food > 0) |
1293 | if (op->stats.food > 0) |
1299 | { |
1294 | { |