1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 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 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your 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, |
… | |
… | |
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 GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <assert.h> |
24 | #include <assert.h> |
25 | #include <global.h> |
25 | #include <global.h> |
26 | #include <living.h> |
26 | #include <living.h> |
… | |
… | |
689 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
689 | if (QUERY_FLAG (*target, FLAG_FREED) || QUERY_FLAG (*hitter, FLAG_FREED)) |
690 | { |
690 | { |
691 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
691 | LOG (llevError, "BUG: get_attack_mode(): freed object\n"); |
692 | return 1; |
692 | return 1; |
693 | } |
693 | } |
|
|
694 | |
694 | if ((*target)->head) |
695 | if ((*target)->head) |
695 | *target = (*target)->head; |
696 | *target = (*target)->head; |
|
|
697 | |
696 | if ((*hitter)->head) |
698 | if ((*hitter)->head) |
697 | *hitter = (*hitter)->head; |
699 | *hitter = (*hitter)->head; |
|
|
700 | |
698 | if ((*hitter)->env != NULL || (*target)->env != NULL) |
701 | if ((*hitter)->env != NULL || (*target)->env != NULL) |
699 | { |
702 | { |
700 | *simple_attack = 1; |
703 | *simple_attack = 1; |
701 | return 0; |
704 | return 0; |
702 | } |
705 | } |
|
|
706 | |
703 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
707 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
704 | || QUERY_FLAG (*hitter, FLAG_REMOVED) || (*hitter)->map == NULL || !on_same_map ((*hitter), (*target))) |
708 | || QUERY_FLAG (*hitter, FLAG_REMOVED) |
|
|
709 | || !(*hitter)->map |
|
|
710 | || !on_same_map (*hitter, *target)) |
705 | { |
711 | { |
706 | LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " "target\n", &(*hitter)->arch->archname, &(*hitter)->name); |
712 | LOG (llevError | logBacktrace, "BUG: hitter (%s) with no relation to target (%s)\n", |
|
|
713 | (*hitter)->debug_desc (), (*target)->debug_desc ()); |
707 | return 1; |
714 | return 1; |
708 | } |
715 | } |
|
|
716 | |
709 | *simple_attack = 0; |
717 | *simple_attack = 0; |
710 | return 0; |
718 | return 0; |
711 | } |
719 | } |
712 | |
720 | |
713 | static int |
721 | static int |
… | |
… | |
1958 | return maxdam; |
1966 | return maxdam; |
1959 | } |
1967 | } |
1960 | |
1968 | |
1961 | op->remove (); |
1969 | op->remove (); |
1962 | |
1970 | |
1963 | for (i = 0; i < NROFNEWOBJS (op); i++) |
1971 | for (i = 0; i < op->stats.food; i++) |
1964 | { /* This doesn't handle op->more yet */ |
1972 | { /* This doesn't handle op->more yet */ |
1965 | object *tmp = arch_to_object (op->other_arch); |
1973 | object *tmp = arch_to_object (op->other_arch); |
1966 | int j; |
1974 | int j; |
1967 | |
1975 | |
1968 | tmp->stats.hp = op->stats.hp; |
1976 | tmp->stats.hp = op->stats.hp; |