… | |
… | |
77 | did_make_save_item (object *op, int type, object *originator) |
77 | did_make_save_item (object *op, int type, object *originator) |
78 | { |
78 | { |
79 | int i, roll, saves = 0, attacks = 0, number; |
79 | int i, roll, saves = 0, attacks = 0, number; |
80 | materialtype_t *mt; |
80 | materialtype_t *mt; |
81 | |
81 | |
82 | if (op->materialname == NULL) |
82 | if (!op->materialname) |
83 | { |
83 | { |
84 | for (mt = materialt; mt != NULL && mt->next != NULL; mt = mt->next) |
84 | for (mt = materialt; mt && mt->next; mt = mt->next) |
85 | if (op->materials & mt->material) |
85 | if (op->materials & mt->material) |
86 | break; |
86 | break; |
87 | } |
87 | } |
88 | else |
88 | else |
89 | mt = name_to_material (op->materialname); |
89 | mt = name_to_material (op->materialname); |
… | |
… | |
104 | if (type != AT_MAGIC) |
104 | if (type != AT_MAGIC) |
105 | type &= ~(AT_CONFUSION | AT_DRAIN | AT_GHOSTHIT | AT_POISON | AT_SLOW | |
105 | type &= ~(AT_CONFUSION | AT_DRAIN | AT_GHOSTHIT | AT_POISON | AT_SLOW | |
106 | AT_PARALYZE | AT_TURN_UNDEAD | AT_FEAR | AT_DEPLETE | AT_DEATH | |
106 | AT_PARALYZE | AT_TURN_UNDEAD | AT_FEAR | AT_DEPLETE | AT_DEATH | |
107 | AT_COUNTERSPELL | AT_HOLYWORD | AT_BLIND | AT_LIFE_STEALING | AT_MAGIC); |
107 | AT_COUNTERSPELL | AT_HOLYWORD | AT_BLIND | AT_LIFE_STEALING | AT_MAGIC); |
108 | |
108 | |
109 | if (type == 0) |
109 | if (type == 0) return TRUE; |
110 | return TRUE; |
110 | |
111 | if (roll == 20) |
111 | if (roll == 20) return TRUE; |
112 | return TRUE; |
112 | if (roll == 1) return FALSE; |
113 | if (roll == 1) |
|
|
114 | return FALSE; |
|
|
115 | |
113 | |
116 | for (number = 0; number < NROFATTACKS; number++) |
114 | for (number = 0; number < NROFATTACKS; number++) |
117 | { |
115 | { |
118 | i = 1 << number; |
116 | i = 1 << number; |
|
|
117 | |
119 | if (!(i & type)) |
118 | if (!(i & type)) |
120 | continue; |
119 | continue; |
|
|
120 | |
121 | attacks++; |
121 | attacks++; |
122 | if (op->resist[number] == 100) |
122 | if (op->resist[number] == 100) |
123 | saves++; |
123 | saves++; |
124 | else if (roll >= mt->save[number] - op->magic - op->resist[number] / 100) |
124 | else if (roll >= mt->save[number] - op->magic - op->resist[number] / 100) |
125 | saves++; |
125 | saves++; |
… | |
… | |
148 | object *env = op->env; |
148 | object *env = op->env; |
149 | int x = op->x, y = op->y; |
149 | int x = op->x, y = op->y; |
150 | maptile *m = op->map; |
150 | maptile *m = op->map; |
151 | |
151 | |
152 | op = stop_item (op); |
152 | op = stop_item (op); |
153 | if (op == NULL) |
153 | if (!op) |
154 | return; |
154 | return; |
155 | |
155 | |
156 | /* Hacked the following so that type LIGHTER will work. |
156 | /* Hacked the following so that type LIGHTER will work. |
157 | * Also, objects which are potenital "lights" that are hit by |
157 | * Also, objects which are potential "lights" that are hit by |
158 | * flame/elect attacks will be set to glow. "lights" are any |
158 | * flame/elect attacks will be set to glow. "lights" are any |
159 | * object with +/- glow_radius and an "other_arch" to change to. |
159 | * object with +/- glow_radius and an "other_arch" to change to. |
160 | * (and please note that we cant fail our save and reach this |
160 | * (and please note that we cant fail our save and reach this |
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. |
… | |
… | |
169 | fix_stopped_item (op, m, originator); |
169 | fix_stopped_item (op, m, originator); |
170 | |
170 | |
171 | if ((op = archetype::get (arch))) |
171 | if ((op = archetype::get (arch))) |
172 | { |
172 | { |
173 | if (env) |
173 | if (env) |
174 | { |
|
|
175 | op->x = env->x, op->y = env->y; //???? wtf |
|
|
176 | env->insert (op); |
174 | env->insert (op); |
177 | } |
|
|
178 | else |
175 | else |
179 | { |
|
|
180 | op->x = x, op->y = y; |
|
|
181 | insert_ob_in_map (op, m, originator, 0); |
176 | m->insert (op, x, y, originator); |
182 | } |
|
|
183 | } |
177 | } |
184 | |
178 | |
185 | return; |
179 | return; |
186 | } |
180 | } |
187 | |
181 | |
… | |
… | |
196 | { |
190 | { |
197 | if (op->decrease (rndm (0, op->nrof - 1))) |
191 | if (op->decrease (rndm (0, op->nrof - 1))) |
198 | fix_stopped_item (op, m, originator); |
192 | fix_stopped_item (op, m, originator); |
199 | } |
193 | } |
200 | else |
194 | else |
|
|
195 | { |
|
|
196 | // drop everything to the ground, if possible |
|
|
197 | op->insert_at (originator); |
201 | op->destroy (); |
198 | op->drop_and_destroy (); |
|
|
199 | } |
202 | |
200 | |
203 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
201 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
204 | if (env) |
202 | if (env) |
205 | { |
203 | { |
206 | op = archetype::get (shstr_burnout); |
204 | op = archetype::get (shstr_burnout); |
… | |
… | |
212 | |
210 | |
213 | return; |
211 | return; |
214 | } |
212 | } |
215 | |
213 | |
216 | /* The value of 50 is arbitrary. */ |
214 | /* The value of 50 is arbitrary. */ |
217 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) |
215 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && rndm (2)) |
218 | { |
216 | { |
219 | object *tmp; |
|
|
220 | archetype *at = archetype::find (shstr_icecube); |
217 | archetype *at = archetype::find (shstr_icecube); |
221 | |
218 | |
222 | if (at == NULL) |
219 | if (at == NULL) |
223 | return; |
220 | return; |
224 | |
221 | |
225 | op = stop_item (op); |
222 | op = stop_item (op); |
226 | if (op == NULL) |
223 | if (op == NULL) |
227 | return; |
224 | return; |
228 | |
225 | |
229 | if ((tmp = present_arch (at, op->map, op->x, op->y)) == NULL) |
226 | object *tmp = present_arch (at, op->map, op->x, op->y); |
|
|
227 | if (!tmp) |
230 | { |
228 | { |
231 | tmp = arch_to_object (at); |
229 | tmp = arch_to_object (at); |
232 | tmp->x = op->x, tmp->y = op->y; |
230 | tmp->x = op->x, tmp->y = op->y; |
233 | /* This was in the old (pre new movement code) - |
231 | /* This was in the old (pre new movement code) - |
234 | * icecubes have slow_move set to 1 - don't want |
232 | * icecubes have slow_move set to 1 - don't want |
… | |
… | |
237 | tmp->move_slow_penalty = 0; |
235 | tmp->move_slow_penalty = 0; |
238 | tmp->move_slow = 0; |
236 | tmp->move_slow = 0; |
239 | insert_ob_in_map (tmp, op->map, originator, 0); |
237 | insert_ob_in_map (tmp, op->map, originator, 0); |
240 | } |
238 | } |
241 | |
239 | |
242 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
240 | tmp->insert (op); |
243 | op->remove (); |
|
|
244 | |
|
|
245 | insert_ob_in_ob (op, tmp); |
|
|
246 | return; |
241 | return; |
247 | } |
242 | } |
248 | } |
243 | } |
249 | |
244 | |
250 | /* Object op is hitting the map. |
245 | /* Object op is hitting the map. |
… | |
… | |
785 | * for help. */ |
780 | * for help. */ |
786 | if (op->type != PLAYER && !can_see_enemy (op, hitter) && !op->owner && rndm (0, op->stats.Int)) |
781 | if (op->type != PLAYER && !can_see_enemy (op, hitter) && !op->owner && rndm (0, op->stats.Int)) |
787 | npc_call_help (op); |
782 | npc_call_help (op); |
788 | |
783 | |
789 | /* if you were hidden and hit by a creature, you are discovered */ |
784 | /* if you were hidden and hit by a creature, you are discovered */ |
790 | if (op->hide && QUERY_FLAG (hitter, FLAG_ALIVE)) |
785 | if (op->flag [FLAG_HIDDEN] && hitter->flag [FLAG_ALIVE]) |
791 | { |
786 | { |
792 | make_visible (op); |
787 | make_visible (op); |
793 | |
788 | |
794 | if (op->type == PLAYER) |
789 | if (op->type == PLAYER) |
795 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!"); |
790 | new_draw_info (NDI_UNIQUE, 0, op, "You were hit by a wild attack. " "You are no longer hidden!"); |
… | |
… | |
896 | /* Disassemble missile */ |
891 | /* Disassemble missile */ |
897 | if (op->inv) |
892 | if (op->inv) |
898 | { |
893 | { |
899 | container = op; |
894 | container = op; |
900 | hitter = op->inv; |
895 | hitter = op->inv; |
901 | hitter->remove (); |
|
|
902 | insert_ob_in_map (hitter, container->map, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
896 | hitter->insert_at (container, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
903 | /* Note that we now have an empty THROWN_OBJ on the map. Code that |
897 | /* Note that we now have an empty THROWN_OBJ on the map. Code that |
904 | * might be called until this THROWN_OBJ is either reassembled or |
898 | * might be called until this THROWN_OBJ is either reassembled or |
905 | * removed at the end of this function must be able to deal with empty |
899 | * removed at the end of this function must be able to deal with empty |
906 | * THROWN_OBJs. */ |
900 | * THROWN_OBJs. */ |
907 | } |
901 | } |
… | |
… | |
921 | * other places as well!) |
915 | * other places as well!) |
922 | */ |
916 | */ |
923 | if (hitter->destroyed () || hitter->env != NULL) |
917 | if (hitter->destroyed () || hitter->env != NULL) |
924 | { |
918 | { |
925 | if (container) |
919 | if (container) |
926 | { |
|
|
927 | container->remove (); |
|
|
928 | container->destroy (); |
920 | container->destroy (); |
929 | } |
|
|
930 | |
921 | |
931 | return 0; |
922 | return 0; |
932 | } |
923 | } |
933 | |
924 | |
934 | /* Missile hit victim */ |
925 | /* Missile hit victim */ |
… | |
… | |
958 | * can fly over but not otherwise move over. What is the correct |
949 | * can fly over but not otherwise move over. What is the correct |
959 | * way to handle those otherwise? |
950 | * way to handle those otherwise? |
960 | */ |
951 | */ |
961 | if (victim->x != hitter->x || victim->y != hitter->y) |
952 | if (victim->x != hitter->x || victim->y != hitter->y) |
962 | { |
953 | { |
|
|
954 | if (victim->destroyed ()) |
|
|
955 | hitter->destroy (); |
|
|
956 | else |
|
|
957 | { |
963 | hitter->remove (); |
958 | hitter->remove (); |
964 | hitter->x = victim->x; |
959 | hitter->x = victim->x; |
965 | hitter->y = victim->y; |
960 | hitter->y = victim->y; |
966 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
961 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
|
|
962 | } |
967 | } |
963 | } |
968 | else |
964 | else |
969 | /* Else leave arrow where it is */ |
965 | /* Else leave arrow where it is */ |
970 | merge_ob (hitter, NULL); |
966 | merge_ob (hitter, NULL); |
971 | |
967 | |
… | |
… | |
1386 | */ |
1382 | */ |
1387 | int |
1383 | int |
1388 | kill_object (object *op, int dam, object *hitter, int type) |
1384 | kill_object (object *op, int dam, object *hitter, int type) |
1389 | { |
1385 | { |
1390 | char buf[MAX_BUF]; |
1386 | char buf[MAX_BUF]; |
1391 | const char *skill; |
1387 | shstr skill; |
1392 | int maxdam = 0; |
1388 | int maxdam = 0; |
1393 | int battleg = 0; /* true if op standing on battleground */ |
1389 | int battleg = 0; /* true if op standing on battleground */ |
1394 | int pk = 0; /* true if op and what controls hitter are both players */ |
1390 | int pk = 0; /* true if op and what controls hitter are both players */ |
1395 | object *owner = 0; |
1391 | object *owner = 0; |
1396 | object *skop = 0; |
1392 | object *skop = 0; |
… | |
… | |
1417 | return maxdam; |
1413 | return maxdam; |
1418 | } |
1414 | } |
1419 | |
1415 | |
1420 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1416 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1421 | { |
1417 | { |
1422 | op->destroy (); |
1418 | op->drop_and_destroy (); |
1423 | return maxdam; |
1419 | return maxdam; |
1424 | } |
1420 | } |
1425 | |
1421 | |
1426 | /* Now lets start dealing with experience we get for killing something */ |
1422 | /* Now lets start dealing with experience we get for killing something */ |
1427 | |
1423 | |
1428 | owner = hitter->owner; |
1424 | owner = hitter->outer_owner (); |
1429 | if (!owner) |
1425 | if (!owner) |
1430 | owner = hitter; |
1426 | owner = hitter; |
1431 | |
1427 | |
1432 | /* is the victim (op) standing on battleground? */ |
1428 | /* is the victim (op) standing on battleground? */ |
1433 | if (op_on_battleground (op, NULL, NULL)) |
1429 | if (op_on_battleground (op, NULL, NULL)) |
… | |
… | |
1485 | |
1481 | |
1486 | /* This code below deals with finding the appropriate skill |
1482 | /* This code below deals with finding the appropriate skill |
1487 | * to credit exp to. This is a bit problematic - we should |
1483 | * to credit exp to. This is a bit problematic - we should |
1488 | * probably never really have to look at current_weapon->skill |
1484 | * probably never really have to look at current_weapon->skill |
1489 | */ |
1485 | */ |
1490 | skill = 0; |
|
|
1491 | |
|
|
1492 | if (hitter->skill && hitter->type != PLAYER) |
1486 | if (hitter->skill && hitter->type != PLAYER) |
1493 | skill = hitter->skill; |
1487 | skill = hitter->skill; |
1494 | else if (owner->chosen_skill) |
1488 | else if (owner->chosen_skill) |
1495 | { |
1489 | { |
1496 | skop = owner->chosen_skill; |
1490 | skop = owner->chosen_skill; |
1497 | skill = skop->skill; |
1491 | skill = skop->skill; |
1498 | } |
1492 | } |
1499 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) |
1493 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON) && owner->current_weapon) |
1500 | skill = owner->current_weapon->skill; |
1494 | skill = owner->current_weapon->skill; |
1501 | else |
1495 | else |
|
|
1496 | { |
1502 | LOG (llevError, "kill_object - unable to find skill that killed monster\n"); |
1497 | LOG (llevError, "BUG: kill_object - unable to find skill that killed monster\n" |
|
|
1498 | "op: %s\n" "hitter: %s\n" "owner: %s\n", |
|
|
1499 | owner->debug_desc (), hitter->debug_desc (), op->debug_desc ()); |
|
|
1500 | skill = 0; |
|
|
1501 | } |
1503 | |
1502 | |
1504 | /* We have the skill we want to credit to - now find the object this goes |
1503 | /* We have the skill we want to credit to - now find the object this goes |
1505 | * to. Make sure skop is an actual skill, and not a skill tool! |
1504 | * to. Make sure skop is an actual skill, and not a skill tool! |
1506 | */ |
1505 | */ |
1507 | if ((!skop || skop->type != SKILL) && skill) |
1506 | skop = owner->contr->find_skill (skill); |
1508 | { |
|
|
1509 | int i; |
|
|
1510 | |
|
|
1511 | for (i = 0; i < NUM_SKILLS; i++) |
|
|
1512 | if (owner->contr->last_skill_ob[i] && !strcmp (owner->contr->last_skill_ob[i]->skill, skill)) |
|
|
1513 | { |
|
|
1514 | skop = owner->contr->last_skill_ob[i]; |
|
|
1515 | break; |
|
|
1516 | } |
|
|
1517 | } |
|
|
1518 | } /* Was it a player that hit somethign */ |
1507 | } /* Was it a player that hit somethign */ |
1519 | else |
1508 | else |
1520 | skill = 0; |
1509 | skill = 0; |
1521 | |
1510 | |
1522 | /* Pet (or spell) killed something. */ |
|
|
1523 | if (owner != hitter) |
|
|
1524 | sprintf (buf, "%s killed %s with %s%s%s.", &owner->name, |
|
|
1525 | query_name (op), query_name (hitter), battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
|
|
1526 | else |
|
|
1527 | sprintf (buf, "%s killed %s%s%s%s.", &hitter->name, &op->name, |
|
|
1528 | (QUERY_FLAG (hitter, FLAG_MONSTER)) || hitter->type == PLAYER ? |
|
|
1529 | " in hand to hand combat" : "", battleg ? " (duel)" : "", pk ? " (pk)" : ""); |
|
|
1530 | |
|
|
1531 | /* These may have been set in the player code section above */ |
1511 | /* These may have been set in the player code section above */ |
1532 | if (!skop) |
1512 | if (!skop) |
1533 | skop = hitter->chosen_skill; |
1513 | skop = hitter->chosen_skill; |
1534 | |
1514 | |
1535 | if (!skill && skop) |
1515 | if (!skill && skop) |
1536 | skill = skop->skill; |
1516 | skill = skop->skill; |
1537 | |
|
|
1538 | new_draw_info (NDI_ALL, op->type == PLAYER ? 1 : 10, NULL, buf); |
|
|
1539 | |
1517 | |
1540 | /* If you didn't kill yourself, and your not the wizard */ |
1518 | /* If you didn't kill yourself, and your not the wizard */ |
1541 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1519 | if (owner != op && !QUERY_FLAG (op, FLAG_WIZ)) |
1542 | { |
1520 | { |
1543 | int exp; |
1521 | int exp; |
… | |
… | |
1615 | |
1593 | |
1616 | if (owner1 && owner1->type == PLAYER) |
1594 | if (owner1 && owner1->type == PLAYER) |
1617 | { |
1595 | { |
1618 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1596 | owner1->contr->play_sound (sound_find ("pet_is_killed")); |
1619 | /* Maybe we should include the owner that killed this, maybe not */ |
1597 | /* Maybe we should include the owner that killed this, maybe not */ |
1620 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, is killed by %s.", &op->name, &hitter->name); |
1598 | new_draw_info_format (NDI_UNIQUE, 0, owner1, "Your pet, the %s, was killed by %s.", &op->name, &hitter->name); |
1621 | } |
1599 | } |
1622 | |
1600 | |
1623 | remove_friendly_object (op); |
1601 | remove_friendly_object (op); |
1624 | } |
1602 | } |
1625 | |
1603 | |
1626 | op->destroy (); |
1604 | op->drop_and_destroy (); |
1627 | } |
1605 | } |
1628 | else |
1606 | else |
1629 | /* Player has been killed! */ |
1607 | /* Player has been killed! */ |
1630 | op->contr->killer = owner->type == PLAYER ? owner : hitter; |
1608 | op->contr->killer = owner->type == PLAYER ? owner : hitter; |
1631 | |
1609 | |
… | |
… | |
1917 | /* See if the creature has been killed */ |
1895 | /* See if the creature has been killed */ |
1918 | rtn_kill = kill_object (op, maxdam, hitter, type); |
1896 | rtn_kill = kill_object (op, maxdam, hitter, type); |
1919 | if (rtn_kill != -1) |
1897 | if (rtn_kill != -1) |
1920 | return rtn_kill; |
1898 | return rtn_kill; |
1921 | |
1899 | |
1922 | |
|
|
1923 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1900 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1924 | * that before if the player was immune to ghosthit, the monster |
1901 | * that before if the player was immune to ghosthit, the monster |
1925 | * remained - that is no longer the case. |
1902 | * remained - that is no longer the case. |
1926 | */ |
1903 | */ |
1927 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1904 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1928 | hitter->destroy (); |
1905 | hitter->drop_and_destroy (); |
1929 | |
|
|
1930 | /* Lets handle creatures that are splitting now */ |
1906 | /* Lets handle creatures that are splitting now */ |
1931 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1907 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1932 | { |
1908 | { |
1933 | int i; |
1909 | int i; |
1934 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
1910 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
… | |
… | |
1974 | } |
1950 | } |
1975 | |
1951 | |
1976 | op->destroy (); |
1952 | op->destroy (); |
1977 | } |
1953 | } |
1978 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
1954 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
1979 | hitter->destroy (); |
1955 | hitter->drop_and_destroy (); |
1980 | |
1956 | |
1981 | return maxdam; |
1957 | return maxdam; |
1982 | } |
1958 | } |
1983 | |
1959 | |
1984 | void |
1960 | void |
… | |
… | |
2187 | return; |
2163 | return; |
2188 | |
2164 | |
2189 | def_lev = op->level; |
2165 | def_lev = op->level; |
2190 | if (def_lev < 1) |
2166 | if (def_lev < 1) |
2191 | { |
2167 | { |
2192 | LOG (llevError, "BUG: arch %s, name %s with level < 1\n", &op->arch->archname, &op->name); |
2168 | LOG (llevError, "BUG: arch %s with level < 1 (%s)\n", &op->arch->archname, op->debug_desc ()); |
2193 | def_lev = 1; |
2169 | def_lev = 1; |
2194 | } |
2170 | } |
2195 | |
2171 | |
2196 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2172 | atk_lev = (hitter->chosen_skill ? hitter->chosen_skill->level : hitter->level) / 2; |
2197 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
2173 | /* LOG(llevDebug,"Deathstrike - attack level %d, defender level %d\n", |
… | |
… | |
2290 | { |
2266 | { |
2291 | /* target is unseen */ |
2267 | /* target is unseen */ |
2292 | if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) |
2268 | if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) |
2293 | adjust -= 10; |
2269 | adjust -= 10; |
2294 | /* dark map penalty for the hitter (lacks infravision if we got here). */ |
2270 | /* dark map penalty for the hitter (lacks infravision if we got here). */ |
2295 | else if (target->map && target->map->darkness > 0 && !stand_in_light (target)) |
2271 | else if (target->map && target->map->darklevel () > 0 && !stand_in_light (target)) |
2296 | adjust -= target->map->darkness; |
2272 | adjust -= target->map->darklevel (); |
2297 | } |
2273 | } |
2298 | |
2274 | |
2299 | if (QUERY_FLAG (attacker, FLAG_SCARED)) |
2275 | if (QUERY_FLAG (attacker, FLAG_SCARED)) |
2300 | adjust -= 3; |
2276 | adjust -= 3; |
2301 | |
2277 | |