… | |
… | |
780 | * for help. */ |
780 | * for help. */ |
781 | 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)) |
782 | npc_call_help (op); |
782 | npc_call_help (op); |
783 | |
783 | |
784 | /* 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 */ |
785 | if (op->hide && QUERY_FLAG (hitter, FLAG_ALIVE)) |
785 | if (op->flag [FLAG_HIDDEN] && hitter->flag [FLAG_ALIVE]) |
786 | { |
786 | { |
787 | make_visible (op); |
787 | make_visible (op); |
788 | |
788 | |
789 | if (op->type == PLAYER) |
789 | if (op->type == PLAYER) |
790 | 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!"); |
… | |
… | |
891 | /* Disassemble missile */ |
891 | /* Disassemble missile */ |
892 | if (op->inv) |
892 | if (op->inv) |
893 | { |
893 | { |
894 | container = op; |
894 | container = op; |
895 | hitter = op->inv; |
895 | hitter = op->inv; |
896 | container->insert_at (hitter, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
896 | hitter->insert_at (container, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
897 | /* 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 |
898 | * might be called until this THROWN_OBJ is either reassembled or |
898 | * might be called until this THROWN_OBJ is either reassembled or |
899 | * 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 |
900 | * THROWN_OBJs. */ |
900 | * THROWN_OBJs. */ |
901 | } |
901 | } |
… | |
… | |
949 | * 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 |
950 | * way to handle those otherwise? |
950 | * way to handle those otherwise? |
951 | */ |
951 | */ |
952 | if (victim->x != hitter->x || victim->y != hitter->y) |
952 | if (victim->x != hitter->x || victim->y != hitter->y) |
953 | { |
953 | { |
|
|
954 | if (victim->destroyed ()) |
|
|
955 | hitter->destroy (); |
|
|
956 | else |
|
|
957 | { |
954 | hitter->remove (); |
958 | hitter->remove (); |
955 | hitter->x = victim->x; |
959 | hitter->x = victim->x; |
956 | hitter->y = victim->y; |
960 | hitter->y = victim->y; |
957 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
961 | insert_ob_in_map (hitter, victim->map, hitter, 0); |
|
|
962 | } |
958 | } |
963 | } |
959 | else |
964 | else |
960 | /* Else leave arrow where it is */ |
965 | /* Else leave arrow where it is */ |
961 | merge_ob (hitter, NULL); |
966 | merge_ob (hitter, NULL); |
962 | |
967 | |
… | |
… | |
1483 | else if (owner->chosen_skill) |
1488 | else if (owner->chosen_skill) |
1484 | { |
1489 | { |
1485 | skop = owner->chosen_skill; |
1490 | skop = owner->chosen_skill; |
1486 | skill = skop->skill; |
1491 | skill = skop->skill; |
1487 | } |
1492 | } |
1488 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON)) |
1493 | else if (QUERY_FLAG (owner, FLAG_READY_WEAPON) && owner->current_weapon) |
1489 | skill = owner->current_weapon->skill; |
1494 | skill = owner->current_weapon->skill; |
1490 | else |
1495 | else |
1491 | { |
1496 | { |
1492 | 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 ()); |
1493 | skill = 0; |
1500 | skill = 0; |
1494 | } |
1501 | } |
1495 | |
1502 | |
1496 | /* 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 |
1497 | * 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! |
… | |
… | |
2259 | { |
2266 | { |
2260 | /* target is unseen */ |
2267 | /* target is unseen */ |
2261 | if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) |
2268 | if (target->invisible || QUERY_FLAG (attacker, FLAG_BLIND)) |
2262 | adjust -= 10; |
2269 | adjust -= 10; |
2263 | /* 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). */ |
2264 | 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)) |
2265 | adjust -= target->map->darkness; |
2272 | adjust -= target->map->darklevel (); |
2266 | } |
2273 | } |
2267 | |
2274 | |
2268 | if (QUERY_FLAG (attacker, FLAG_SCARED)) |
2275 | if (QUERY_FLAG (attacker, FLAG_SCARED)) |
2269 | adjust -= 3; |
2276 | adjust -= 3; |
2270 | |
2277 | |