… | |
… | |
193 | } |
193 | } |
194 | else |
194 | else |
195 | { |
195 | { |
196 | // drop everything to the ground, if possible |
196 | // drop everything to the ground, if possible |
197 | op->insert_at (originator); |
197 | op->insert_at (originator); |
|
|
198 | op->destroy_inv (true); // be explicit about dropping |
198 | op->destroy (); |
199 | op->destroy (true); |
199 | } |
200 | } |
200 | |
201 | |
201 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
202 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
202 | if (env) |
203 | if (env) |
203 | { |
204 | { |
… | |
… | |
891 | /* Disassemble missile */ |
892 | /* Disassemble missile */ |
892 | if (op->inv) |
893 | if (op->inv) |
893 | { |
894 | { |
894 | container = op; |
895 | container = op; |
895 | hitter = op->inv; |
896 | hitter = op->inv; |
896 | hitter->remove (); |
897 | container->insert_at (hitter, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
897 | insert_ob_in_map (hitter, container->map, hitter, INS_NO_MERGE | INS_NO_WALK_ON); |
|
|
898 | /* Note that we now have an empty THROWN_OBJ on the map. Code that |
898 | /* Note that we now have an empty THROWN_OBJ on the map. Code that |
899 | * might be called until this THROWN_OBJ is either reassembled or |
899 | * might be called until this THROWN_OBJ is either reassembled or |
900 | * removed at the end of this function must be able to deal with empty |
900 | * removed at the end of this function must be able to deal with empty |
901 | * THROWN_OBJs. */ |
901 | * THROWN_OBJs. */ |
902 | } |
902 | } |
… | |
… | |
916 | * other places as well!) |
916 | * other places as well!) |
917 | */ |
917 | */ |
918 | if (hitter->destroyed () || hitter->env != NULL) |
918 | if (hitter->destroyed () || hitter->env != NULL) |
919 | { |
919 | { |
920 | if (container) |
920 | if (container) |
921 | { |
|
|
922 | container->remove (); |
|
|
923 | container->destroy (); |
921 | container->destroy (true); |
924 | } |
|
|
925 | |
922 | |
926 | return 0; |
923 | return 0; |
927 | } |
924 | } |
928 | |
925 | |
929 | /* Missile hit victim */ |
926 | /* Missile hit victim */ |
… | |
… | |
938 | hitter = fix_stopped_arrow (hitter); |
935 | hitter = fix_stopped_arrow (hitter); |
939 | if (!hitter) |
936 | if (!hitter) |
940 | return 0; |
937 | return 0; |
941 | } |
938 | } |
942 | else |
939 | else |
943 | container->destroy (); |
940 | container->destroy (true); |
944 | |
941 | |
945 | /* Try to stick arrow into victim */ |
942 | /* Try to stick arrow into victim */ |
946 | if (!victim->destroyed () && stick_arrow (hitter, victim)) |
943 | if (!victim->destroyed () && stick_arrow (hitter, victim)) |
947 | return 0; |
944 | return 0; |
948 | |
945 | |
… | |
… | |
992 | } |
989 | } |
993 | else if (!GET_ANIM_ID (op)) |
990 | else if (!GET_ANIM_ID (op)) |
994 | { |
991 | { |
995 | /* Object has been called - no animations, so remove it */ |
992 | /* Object has been called - no animations, so remove it */ |
996 | if (op->stats.hp < 0) |
993 | if (op->stats.hp < 0) |
997 | op->destroy (); |
994 | op->destroy (true); |
998 | |
995 | |
999 | return; /* no animations, so nothing more to do */ |
996 | return; /* no animations, so nothing more to do */ |
1000 | } |
997 | } |
1001 | |
998 | |
1002 | perc = NUM_ANIMATIONS (op) - ((int) NUM_ANIMATIONS (op) * op->stats.hp) / op->stats.maxhp; |
999 | perc = NUM_ANIMATIONS (op) - ((int) NUM_ANIMATIONS (op) * op->stats.hp) / op->stats.maxhp; |
… | |
… | |
1011 | |
1008 | |
1012 | if (perc == NUM_ANIMATIONS (op) - 1) |
1009 | if (perc == NUM_ANIMATIONS (op) - 1) |
1013 | { /* Reached the last animation */ |
1010 | { /* Reached the last animation */ |
1014 | if (op->face == blank_face) |
1011 | if (op->face == blank_face) |
1015 | /* If the last face is blank, remove the ob */ |
1012 | /* If the last face is blank, remove the ob */ |
1016 | op->destroy (); |
1013 | op->destroy (true); |
1017 | else |
1014 | else |
1018 | { /* The last face was not blank, leave an image */ |
1015 | { /* The last face was not blank, leave an image */ |
1019 | CLEAR_FLAG (op, FLAG_BLOCKSVIEW); |
1016 | CLEAR_FLAG (op, FLAG_BLOCKSVIEW); |
1020 | update_all_los (op->map, op->x, op->y); |
1017 | update_all_los (op->map, op->x, op->y); |
1021 | op->move_block = 0; |
1018 | op->move_block = 0; |
… | |
… | |
1412 | return maxdam; |
1409 | return maxdam; |
1413 | } |
1410 | } |
1414 | |
1411 | |
1415 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1412 | if (QUERY_FLAG (op, FLAG_FRIENDLY) && op->type != PLAYER) |
1416 | { |
1413 | { |
|
|
1414 | op->destroy_inv (true); // be explicit about dropping |
1417 | op->destroy (); |
1415 | op->destroy (true); |
1418 | return maxdam; |
1416 | return maxdam; |
1419 | } |
1417 | } |
1420 | |
1418 | |
1421 | /* Now lets start dealing with experience we get for killing something */ |
1419 | /* Now lets start dealing with experience we get for killing something */ |
1422 | |
1420 | |
… | |
… | |
1596 | } |
1594 | } |
1597 | |
1595 | |
1598 | remove_friendly_object (op); |
1596 | remove_friendly_object (op); |
1599 | } |
1597 | } |
1600 | |
1598 | |
|
|
1599 | op->destroy_inv (true); // be explicit about dropping |
1601 | op->destroy (); |
1600 | op->destroy (true); |
1602 | } |
1601 | } |
1603 | else |
1602 | else |
1604 | /* Player has been killed! */ |
1603 | /* Player has been killed! */ |
1605 | op->contr->killer = owner->type == PLAYER ? owner : hitter; |
1604 | op->contr->killer = owner->type == PLAYER ? owner : hitter; |
1606 | |
1605 | |
… | |
… | |
1892 | /* See if the creature has been killed */ |
1891 | /* See if the creature has been killed */ |
1893 | rtn_kill = kill_object (op, maxdam, hitter, type); |
1892 | rtn_kill = kill_object (op, maxdam, hitter, type); |
1894 | if (rtn_kill != -1) |
1893 | if (rtn_kill != -1) |
1895 | return rtn_kill; |
1894 | return rtn_kill; |
1896 | |
1895 | |
1897 | |
|
|
1898 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1896 | /* Used to be ghosthit removal - we now use the ONE_HIT flag. Note |
1899 | * that before if the player was immune to ghosthit, the monster |
1897 | * that before if the player was immune to ghosthit, the monster |
1900 | * remained - that is no longer the case. |
1898 | * remained - that is no longer the case. |
1901 | */ |
1899 | */ |
1902 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
1900 | if (QUERY_FLAG (hitter, FLAG_ONE_HIT)) |
|
|
1901 | { |
|
|
1902 | hitter->destroy_inv (true); // be explicit about dropping |
1903 | hitter->destroy (); |
1903 | hitter->destroy (true); |
1904 | |
1904 | } |
1905 | /* Lets handle creatures that are splitting now */ |
1905 | /* Lets handle creatures that are splitting now */ |
1906 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1906 | else if (type & AT_PHYSICAL && !QUERY_FLAG (op, FLAG_FREED) && QUERY_FLAG (op, FLAG_SPLITTING)) |
1907 | { |
1907 | { |
1908 | int i; |
1908 | int i; |
1909 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
1909 | int friendly = QUERY_FLAG (op, FLAG_FRIENDLY); |
… | |
… | |
1938 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
1938 | SET_FLAG (tmp, FLAG_UNAGGRESSIVE); |
1939 | |
1939 | |
1940 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
1940 | j = find_first_free_spot (tmp, op->map, op->x, op->y); |
1941 | |
1941 | |
1942 | if (j == -1) /* No spot to put this monster */ |
1942 | if (j == -1) /* No spot to put this monster */ |
1943 | tmp->destroy (); |
1943 | tmp->destroy (true); |
1944 | else |
1944 | else |
1945 | { |
1945 | { |
1946 | tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; |
1946 | tmp->x = op->x + freearr_x[j], tmp->y = op->y + freearr_y[j]; |
1947 | insert_ob_in_map (tmp, op->map, NULL, 0); |
1947 | insert_ob_in_map (tmp, op->map, NULL, 0); |
1948 | } |
1948 | } |
1949 | } |
1949 | } |
1950 | |
1950 | |
1951 | op->destroy (); |
1951 | op->destroy (true); |
1952 | } |
1952 | } |
1953 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
1953 | else if (type & AT_DRAIN && hitter->type == GRIMREAPER && hitter->value++ > 10) |
|
|
1954 | { |
|
|
1955 | hitter->destroy_inv (true); // be explicit about dropping |
1954 | hitter->destroy (); |
1956 | hitter->destroy (true); |
|
|
1957 | } |
1955 | |
1958 | |
1956 | return maxdam; |
1959 | return maxdam; |
1957 | } |
1960 | } |
1958 | |
1961 | |
1959 | void |
1962 | void |