1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
8 | * Crossfire TRT 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 2 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, |
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 GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|
|
21 | * |
20 | * |
22 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
23 | */ |
22 | */ |
|
|
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> |
27 | #include <material.h> |
27 | #include <material.h> |
28 | #include <skills.h> |
28 | #include <skills.h> |
… | |
… | |
161 | * function if the object doesnt contain a material that can burn. |
161 | * function if the object doesnt contain a material that can burn. |
162 | * So forget lighting magical swords on fire with this!) -b.t. |
162 | * So forget lighting magical swords on fire with this!) -b.t. |
163 | */ |
163 | */ |
164 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
164 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
165 | { |
165 | { |
166 | const char *arch = op->other_arch->name; |
166 | const char *arch = op->other_arch->archname; |
167 | |
167 | |
168 | op = decrease_ob_nr (op, 1); |
168 | op = decrease_ob_nr (op, 1); |
169 | |
169 | |
170 | if (op) |
170 | if (op) |
171 | fix_stopped_item (op, m, originator); |
171 | fix_stopped_item (op, m, originator); |
… | |
… | |
282 | return 0; |
282 | return 0; |
283 | } |
283 | } |
284 | |
284 | |
285 | if (QUERY_FLAG (op, FLAG_REMOVED) || op->env != NULL) |
285 | if (QUERY_FLAG (op, FLAG_REMOVED) || op->env != NULL) |
286 | { |
286 | { |
287 | LOG (llevError, "BUG: hit_map(): hitter (arch %s, name %s) not on a map\n", &op->arch->name, &op->name); |
287 | LOG (llevError, "BUG: hit_map(): hitter (arch %s, name %s) not on a map\n", &op->arch->archname, &op->name); |
288 | return 0; |
288 | return 0; |
289 | } |
289 | } |
290 | |
290 | |
291 | if (!op->map) |
291 | if (!op->map) |
292 | { |
292 | { |
… | |
… | |
696 | return 0; |
696 | return 0; |
697 | } |
697 | } |
698 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
698 | if (QUERY_FLAG (*target, FLAG_REMOVED) |
699 | || QUERY_FLAG (*hitter, FLAG_REMOVED) || (*hitter)->map == NULL || !on_same_map ((*hitter), (*target))) |
699 | || QUERY_FLAG (*hitter, FLAG_REMOVED) || (*hitter)->map == NULL || !on_same_map ((*hitter), (*target))) |
700 | { |
700 | { |
701 | LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " "target\n", &(*hitter)->arch->name, &(*hitter)->name); |
701 | LOG (llevError, "BUG: hitter (arch %s, name %s) with no relation to " "target\n", &(*hitter)->arch->archname, &(*hitter)->name); |
702 | return 1; |
702 | return 1; |
703 | } |
703 | } |
704 | *simple_attack = 0; |
704 | *simple_attack = 0; |
705 | return 0; |
705 | return 0; |
706 | } |
706 | } |
… | |
… | |
744 | |
744 | |
745 | /* |
745 | /* |
746 | * A little check to make it more difficult to dance forward and back |
746 | * A little check to make it more difficult to dance forward and back |
747 | * to avoid ever being hit by monsters. |
747 | * to avoid ever being hit by monsters. |
748 | */ |
748 | */ |
749 | if (!simple_attack && QUERY_FLAG (op, FLAG_MONSTER) && op->speed_left > -(FABS (op->speed)) * 0.3) |
749 | if (!simple_attack && QUERY_FLAG (op, FLAG_MONSTER) && op->speed_left > abs (op->speed) * -0.3f) |
750 | { |
750 | { |
751 | /* Decrease speed BEFORE calling process_object. Otherwise, an |
751 | /* Decrease speed BEFORE calling process_object. Otherwise, an |
752 | * infinite loop occurs, with process_object calling move_monster, |
752 | * infinite loop occurs, with process_object calling move_monster, |
753 | * which then gets here again. By decreasing the speed before |
753 | * which then gets here again. By decreasing the speed before |
754 | * we call process_object, the 'if' statement above will fail. |
754 | * we call process_object, the 'if' statement above will fail. |
755 | */ |
755 | */ |
756 | op->speed_left--; |
756 | --op->speed_left; |
757 | process_object (op); |
757 | process_object (op); |
758 | |
758 | |
759 | if (op->destroyed () || hitter->destroyed () || abort_attack (op, hitter, simple_attack)) |
759 | if (op->destroyed () || hitter->destroyed () || abort_attack (op, hitter, simple_attack)) |
760 | goto error; |
760 | goto error; |
761 | } |
761 | } |
… | |
… | |
770 | |
770 | |
771 | /* See if we hit the creature */ |
771 | /* See if we hit the creature */ |
772 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
772 | if (roll == 20 || op->stats.ac >= base_wc - roll) |
773 | { |
773 | { |
774 | int hitdam = base_dam; |
774 | int hitdam = base_dam; |
775 | |
|
|
776 | if (settings.casting_time == TRUE) |
|
|
777 | { |
|
|
778 | if (hitter->type == PLAYER && hitter->casting_time > -1) |
|
|
779 | { |
|
|
780 | hitter->casting_time = -1; |
|
|
781 | new_draw_info (NDI_UNIQUE, 0, hitter, "You attacked and lost your spell!"); |
|
|
782 | } |
|
|
783 | |
|
|
784 | if (op->casting_time > -1 && hitdam > 0) |
|
|
785 | { |
|
|
786 | op->casting_time = -1; |
|
|
787 | if (op->type == PLAYER) |
|
|
788 | { |
|
|
789 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit and lost your spell!"); |
|
|
790 | new_draw_info_format (NDI_ALL | NDI_UNIQUE, 5, NULL, "%s was hit by %s and lost a spell.", &op_name, &hitter->name); |
|
|
791 | } |
|
|
792 | } |
|
|
793 | } |
|
|
794 | |
775 | |
795 | if (!simple_attack) |
776 | if (!simple_attack) |
796 | { |
777 | { |
797 | /* If you hit something, the victim should *always* wake up. |
778 | /* If you hit something, the victim should *always* wake up. |
798 | * Before, invisible hitters could avoid doing this. |
779 | * Before, invisible hitters could avoid doing this. |
… | |
… | |
1099 | return dam; |
1080 | return dam; |
1100 | |
1081 | |
1101 | if (hitter->slaying) |
1082 | if (hitter->slaying) |
1102 | { |
1083 | { |
1103 | if ((op->race && strstr (hitter->slaying, op->race)) |
1084 | if ((op->race && strstr (hitter->slaying, op->race)) |
1104 | || (op->arch && op->arch->name && strstr (op->arch->name, hitter->slaying))) |
1085 | || (op->arch && op->arch->archname && strstr (op->arch->archname, hitter->slaying))) |
1105 | { |
1086 | { |
1106 | doesnt_slay = 0; |
1087 | doesnt_slay = 0; |
1107 | dam *= 3; |
1088 | dam *= 3; |
1108 | } |
1089 | } |
1109 | } |
1090 | } |
… | |
… | |
1273 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1254 | * exp, but the wiz would still lose exp! If drainee is a wiz, |
1274 | * nothing happens. |
1255 | * nothing happens. |
1275 | * Try to credit the owner. We try to display player -> player drain |
1256 | * Try to credit the owner. We try to display player -> player drain |
1276 | * attacks, hence all the != PLAYER checks. |
1257 | * attacks, hence all the != PLAYER checks. |
1277 | */ |
1258 | */ |
1278 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1259 | if (!op_on_battleground (hitter, NULL, NULL) && !QUERY_FLAG (op, FLAG_WIZ)) |
1279 | { |
1260 | { |
1280 | object *owner = hitter->owner; |
1261 | object *owner = hitter->owner; |
1281 | |
1262 | |
1282 | if (owner && owner != hitter) |
1263 | if (owner && owner != hitter) |
1283 | { |
1264 | { |
… | |
… | |
1433 | if (QUERY_FLAG (op, FLAG_BLOCKSVIEW)) |
1414 | if (QUERY_FLAG (op, FLAG_BLOCKSVIEW)) |
1434 | update_all_los (op->map, op->x, op->y); /* makes sure los will be recalculated */ |
1415 | update_all_los (op->map, op->x, op->y); /* makes sure los will be recalculated */ |
1435 | |
1416 | |
1436 | if (op->type == DOOR) |
1417 | if (op->type == DOOR) |
1437 | { |
1418 | { |
1438 | op->set_speed (0.1); |
1419 | op->set_speed (0.1f); |
1439 | op->speed_left = -0.05; |
1420 | op->speed_left = -0.05f; |
1440 | return maxdam; |
1421 | return maxdam; |
1441 | } |
1422 | } |
1442 | |
1423 | |
1443 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1424 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1444 | { |
1425 | { |
… | |
… | |
1562 | skill = skop->skill; |
1543 | skill = skop->skill; |
1563 | |
1544 | |
1564 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1545 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
1565 | |
1546 | |
1566 | /* If you didn't kill yourself, and your not the wizard */ |
1547 | /* If you didn't kill yourself, and your not the wizard */ |
1567 | if (owner != op && !QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1548 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1568 | { |
1549 | { |
1569 | int exp; |
1550 | int exp; |
1570 | |
1551 | |
1571 | /* Really don't give much experience for killing other players */ |
1552 | /* Really don't give much experience for killing other players */ |
1572 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
1553 | // schmorp: temporarily? reduce the amount of exp gained for pking enourmously |
… | |
… | |
1695 | } |
1676 | } |
1696 | |
1677 | |
1697 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1678 | if (hitter->type == SPELL || hitter->type == POISONING || hitter->type == DISEASE || hitter->type == RUNE) |
1698 | friendlyfire = 0; |
1679 | friendlyfire = 0; |
1699 | } |
1680 | } |
|
|
1681 | |
1700 | return friendlyfire; |
1682 | return friendlyfire; |
1701 | } |
1683 | } |
1702 | |
|
|
1703 | |
1684 | |
1704 | /* This isn't used just for players, but in fact most objects. |
1685 | /* This isn't used just for players, but in fact most objects. |
1705 | * op is the object to be hit, dam is the amount of damage, hitter |
1686 | * op is the object to be hit, dam is the amount of damage, hitter |
1706 | * is what is hitting the object, type is the attacktype, and |
1687 | * is what is hitting the object, type is the attacktype, and |
1707 | * full_hit is set if monster area does not matter. |
1688 | * full_hit is set if monster area does not matter. |
… | |
… | |
1725 | |
1706 | |
1726 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1707 | /* very simple: if our target has no_damage 1 set or is wiz, we can't hurt him */ |
1727 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1708 | if (QUERY_FLAG (op, FLAG_WIZ) || QUERY_FLAG (op, FLAG_NO_DAMAGE)) |
1728 | return 0; |
1709 | return 0; |
1729 | |
1710 | |
1730 | #ifdef PROHIBIT_PLAYERKILL |
1711 | // only allow pk for hostile players |
1731 | if (op->type == PLAYER) |
1712 | if (op->type == PLAYER) |
1732 | { |
1713 | { |
1733 | object *owner = hitter->owner; |
1714 | object *owner = hitter->owner; |
1734 | |
1715 | |
1735 | if (!owner) |
1716 | if (!owner) |
… | |
… | |
1739 | && (!op_on_battleground (op, 0, 0) |
1720 | && (!op_on_battleground (op, 0, 0) |
1740 | && (op->contr->peaceful || owner->contr->peaceful)) |
1721 | && (op->contr->peaceful || owner->contr->peaceful)) |
1741 | && op != owner) |
1722 | && op != owner) |
1742 | return 0; |
1723 | return 0; |
1743 | } |
1724 | } |
1744 | #endif |
|
|
1745 | |
1725 | |
1746 | if (body_attack) |
1726 | if (body_attack) |
1747 | { |
1727 | { |
1748 | /* slow and paralyze must hit the head. But we don't want to just |
1728 | /* slow and paralyze must hit the head. But we don't want to just |
1749 | * return - we still need to process other attacks the spell still |
1729 | * return - we still need to process other attacks the spell still |
… | |
… | |
1870 | */ |
1850 | */ |
1871 | friendlyfire = friendly_fire (op, hitter); |
1851 | friendlyfire = friendly_fire (op, hitter); |
1872 | if (friendlyfire && maxdam) |
1852 | if (friendlyfire && maxdam) |
1873 | { |
1853 | { |
1874 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1854 | maxdam = ((dam * settings.set_friendly_fire) / 100); |
1875 | #ifndef COZY_SERVER |
|
|
1876 | maxdam++; |
|
|
1877 | #endif |
|
|
1878 | |
1855 | |
1879 | #ifdef ATTACK_DEBUG |
1856 | #ifdef ATTACK_DEBUG |
1880 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1857 | LOG (llevDebug, "Friendly fire (type:%d setting: %d%) did %d damage dropped to %d\n", |
1881 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1858 | friendlyfire, settings.set_friendly_fire, dam, maxdam); |
1882 | #endif |
1859 | #endif |
1883 | } |
1860 | } |
1884 | |
1861 | |
1885 | if (!full_hit) |
1862 | if (!full_hit) |
1886 | { |
1863 | { |
1887 | archetype *at; |
|
|
1888 | int area; |
1864 | int area; |
1889 | int remainder; |
1865 | int remainder; |
1890 | |
1866 | |
1891 | area = 0; |
1867 | area = 0; |
1892 | for (at = op->arch; at != NULL; at = at->more) |
1868 | |
|
|
1869 | for (archetype *at = op->arch; at; at = (archetype *)at->more) |
1893 | area++; |
1870 | area++; |
|
|
1871 | |
1894 | assert (area > 0); |
1872 | assert (area > 0); |
1895 | |
1873 | |
1896 | /* basically: maxdam /= area; we try to "simulate" a float |
1874 | /* basically: maxdam /= area; we try to "simulate" a float |
1897 | value-effect */ |
1875 | value-effect */ |
1898 | remainder = 100 * (maxdam % area) / area; |
1876 | remainder = 100 * (maxdam % area) / area; |
… | |
… | |
2012 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
1990 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
2013 | hitter->destroy (); |
1991 | hitter->destroy (); |
2014 | |
1992 | |
2015 | return maxdam; |
1993 | return maxdam; |
2016 | } |
1994 | } |
2017 | |
|
|
2018 | |
1995 | |
2019 | void |
1996 | void |
2020 | poison_player (object *op, object *hitter, int dam) |
1997 | poison_player (object *op, object *hitter, int dam) |
2021 | { |
1998 | { |
2022 | archetype *at = archetype::find ("poisoning"); |
1999 | archetype *at = archetype::find ("poisoning"); |
… | |
… | |
2059 | tmp->stats.Int = MAX (-dam / 7, -10); |
2036 | tmp->stats.Int = MAX (-dam / 7, -10); |
2060 | SET_FLAG (tmp, FLAG_APPLIED); |
2037 | SET_FLAG (tmp, FLAG_APPLIED); |
2061 | op->update_stats (); |
2038 | op->update_stats (); |
2062 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
2039 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very ill."); |
2063 | } |
2040 | } |
|
|
2041 | |
2064 | if (hitter->type == PLAYER) |
2042 | if (hitter->type == PLAYER) |
2065 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2043 | new_draw_info_format (NDI_UNIQUE, 0, hitter, "You poison %s.", &op->name); |
2066 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
2044 | else if (hitter->owner != NULL && hitter->owner->type == PLAYER) |
2067 | new_draw_info_format (NDI_UNIQUE, 0, hitter->owner, "Your %s poisons %s.", &hitter->name, &op->name); |
2045 | new_draw_info_format (NDI_UNIQUE, 0, hitter->owner, "Your %s poisons %s.", &hitter->name, &op->name); |
2068 | } |
2046 | } |
|
|
2047 | |
2069 | tmp->speed_left = 0; |
2048 | tmp->speed_left = 0; |
2070 | } |
2049 | } |
2071 | else |
2050 | else |
2072 | tmp->stats.food++; |
2051 | tmp->stats.food++; |
2073 | } |
2052 | } |
… | |
… | |
2077 | { |
2056 | { |
2078 | archetype *at = archetype::find ("slowness"); |
2057 | archetype *at = archetype::find ("slowness"); |
2079 | object *tmp; |
2058 | object *tmp; |
2080 | |
2059 | |
2081 | if (at == NULL) |
2060 | if (at == NULL) |
2082 | { |
|
|
2083 | LOG (llevError, "Can't find slowness archetype.\n"); |
2061 | LOG (llevError, "Can't find slowness archetype.\n"); |
2084 | } |
2062 | |
2085 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2063 | if ((tmp = present_arch_in_ob (at, op)) == NULL) |
2086 | { |
2064 | { |
2087 | tmp = arch_to_object (at); |
2065 | tmp = arch_to_object (at); |
2088 | tmp = insert_ob_in_ob (tmp, op); |
2066 | tmp = insert_ob_in_ob (tmp, op); |
2089 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2067 | new_draw_info (NDI_UNIQUE, 0, op, "The world suddenly moves very fast!"); |
2090 | } |
2068 | } |
2091 | else |
2069 | else |
2092 | tmp->stats.food++; |
2070 | tmp->stats.food++; |
|
|
2071 | |
2093 | SET_FLAG (tmp, FLAG_APPLIED); |
2072 | SET_FLAG (tmp, FLAG_APPLIED); |
2094 | tmp->speed_left = 0; |
2073 | tmp->speed_left = 0; |
2095 | op->update_stats (); |
2074 | op->update_stats (); |
2096 | } |
2075 | } |
2097 | |
2076 | |
… | |
… | |
2114 | tmp->speed = 0.05; |
2093 | tmp->speed = 0.05; |
2115 | tmp->subtype = FORCE_CONFUSION; |
2094 | tmp->subtype = FORCE_CONFUSION; |
2116 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2095 | tmp->duration = 8 + MAX (1, 5 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2117 | tmp->name = "confusion"; |
2096 | tmp->name = "confusion"; |
2118 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
2097 | maxduration = MAX (2, 30 * (100 - op->resist[ATNR_CONFUSION]) / 100); |
|
|
2098 | |
2119 | if (tmp->duration > maxduration) |
2099 | if (tmp->duration > maxduration) |
2120 | tmp->duration = maxduration; |
2100 | tmp->duration = maxduration; |
2121 | |
2101 | |
2122 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2102 | if (op->type == PLAYER && !QUERY_FLAG (op, FLAG_CONFUSED)) |
2123 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
2103 | new_draw_info (NDI_UNIQUE, 0, op, "You suddenly feel very confused!"); |
|
|
2104 | |
2124 | SET_FLAG (op, FLAG_CONFUSED); |
2105 | SET_FLAG (op, FLAG_CONFUSED); |
2125 | } |
2106 | } |
2126 | |
2107 | |
2127 | void |
2108 | void |
2128 | blind_player (object *op, object *hitter, int dam) |
2109 | blind_player (object *op, object *hitter, int dam) |
… | |
… | |
2217 | return; |
2198 | return; |
2218 | |
2199 | |
2219 | def_lev = op->level; |
2200 | def_lev = op->level; |
2220 | if (def_lev < 1) |
2201 | if (def_lev < 1) |
2221 | { |
2202 | { |
2222 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->name, &op->name); |
2203 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->archname, &op->name); |
2223 | def_lev = 1; |
2204 | def_lev = 1; |
2224 | } |
2205 | } |
2225 | |
2206 | |
2226 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2207 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2227 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
2208 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
… | |
… | |
2284 | } |
2265 | } |
2285 | } |
2266 | } |
2286 | } |
2267 | } |
2287 | |
2268 | |
2288 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2269 | /* adj_attackroll() - adjustments to attacks by various conditions */ |
2289 | |
|
|
2290 | int |
2270 | int |
2291 | adj_attackroll (object *hitter, object *target) |
2271 | adj_attackroll (object *hitter, object *target) |
2292 | { |
2272 | { |
2293 | object *attacker = hitter; |
2273 | object *attacker = hitter; |
2294 | int adjust = 0; |
2274 | int adjust = 0; |
… | |
… | |
2368 | |
2348 | |
2369 | /* I broke what used to be one big if into a few nested |
2349 | /* I broke what used to be one big if into a few nested |
2370 | * ones so that figuring out the logic is at least possible. |
2350 | * ones so that figuring out the logic is at least possible. |
2371 | */ |
2351 | */ |
2372 | if (op && (op->move_type & MOVE_FLYING)) |
2352 | if (op && (op->move_type & MOVE_FLYING)) |
2373 | { |
|
|
2374 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2353 | if (op->type == ARROW || op->type == THROWN_OBJ) |
2375 | return 1; |
2354 | return 1; |
2376 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2355 | else if (op->type == SPELL_EFFECT && (op->subtype == SP_BULLET || op->subtype == SP_EXPLOSION)) |
2377 | return 1; |
2356 | return 1; |
2378 | } |
|
|
2379 | |
2357 | |
2380 | return 0; |
2358 | return 0; |
2381 | } |
2359 | } |