… | |
… | |
245 | return; |
245 | return; |
246 | } |
246 | } |
247 | |
247 | |
248 | if (op->stats.food == 1) |
248 | if (op->stats.food == 1) |
249 | { |
249 | { |
250 | /* need to remove the object before fix_player is called, else fix_player |
250 | /* need to unapply the object before update_stats is called, else fix_player |
251 | * will not do anything. |
251 | * will not do anything. |
252 | */ |
252 | */ |
253 | if (op->env->type == PLAYER) |
253 | if (op->env->type == PLAYER) |
254 | { |
254 | { |
255 | CLEAR_FLAG (op, FLAG_APPLIED); |
255 | CLEAR_FLAG (op, FLAG_APPLIED); |
… | |
… | |
455 | |
455 | |
456 | if (op->stats.hp) |
456 | if (op->stats.hp) |
457 | { |
457 | { |
458 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
458 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
459 | { |
459 | { |
460 | if (op->slaying && !strcmp (op->slaying, tmp->name)) |
460 | if (op->slaying && op->slaying == tmp->name) |
461 | detected = 1; |
461 | detected = 1; |
|
|
462 | |
462 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) |
463 | if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying) |
463 | detected = 1; |
464 | detected = 1; |
464 | } |
465 | } |
465 | } |
466 | } |
|
|
467 | |
466 | if (op->slaying && !strcmp (op->slaying, tmp->name)) |
468 | if (op->slaying && op->slaying == tmp->name) |
467 | { |
|
|
468 | detected = 1; |
469 | detected = 1; |
469 | } |
|
|
470 | else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying) |
470 | else if (tmp->type == SPECIAL_KEY && tmp->slaying == op->slaying) |
471 | detected = 1; |
471 | detected = 1; |
472 | } |
472 | } |
473 | |
473 | |
474 | /* the detector sets the button if detection is found */ |
474 | /* the detector sets the button if detection is found */ |
… | |
… | |
604 | void |
604 | void |
605 | fix_stopped_item (object *op, maptile *map, object *originator) |
605 | fix_stopped_item (object *op, maptile *map, object *originator) |
606 | { |
606 | { |
607 | if (map == NULL) |
607 | if (map == NULL) |
608 | return; |
608 | return; |
|
|
609 | |
609 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
610 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
610 | insert_ob_in_map (op, map, originator, 0); |
611 | insert_ob_in_map (op, map, originator, 0); |
611 | else if (op->type == ARROW) |
612 | else if (op->type == ARROW) |
612 | merge_ob (op, NULL); /* only some arrows actually need this */ |
613 | merge_ob (op, NULL); /* only some arrows actually need this */ |
613 | } |
614 | } |
614 | |
|
|
615 | |
615 | |
616 | object * |
616 | object * |
617 | fix_stopped_arrow (object *op) |
617 | fix_stopped_arrow (object *op) |
618 | { |
618 | { |
619 | if (rndm (0, 99) < op->stats.food) |
619 | if (rndm (0, 99) < op->stats.food) |
… | |
… | |
648 | op->stats.hp = 0; |
648 | op->stats.hp = 0; |
649 | op->stats.grace = 0; |
649 | op->stats.grace = 0; |
650 | op->level = 0; |
650 | op->level = 0; |
651 | op->face = op->arch->clone.face; |
651 | op->face = op->arch->clone.face; |
652 | op->owner = NULL; /* So that stopped arrows will be saved */ |
652 | op->owner = NULL; /* So that stopped arrows will be saved */ |
653 | update_object (op, UP_OBJ_FACE); |
653 | update_object (op, UP_OBJ_CHANGE); |
654 | return op; |
654 | return op; |
655 | } |
655 | } |
656 | |
656 | |
657 | /* stop_arrow() - what to do when a non-living flying object |
657 | /* stop_arrow() - what to do when a non-living flying object |
658 | * has to stop. Sept 96 - I added in thrown object code in |
658 | * has to stop. Sept 96 - I added in thrown object code in |
… | |
… | |
765 | * as below. (Note that for living creatures there is a small |
765 | * as below. (Note that for living creatures there is a small |
766 | * chance that reflect_missile fails.) |
766 | * chance that reflect_missile fails.) |
767 | */ |
767 | */ |
768 | if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10)) |
768 | if (QUERY_FLAG (tmp, FLAG_REFL_MISSILE) && (rndm (0, 99)) < (90 - op->level / 10)) |
769 | { |
769 | { |
770 | int number = op->face->number; |
770 | int number = op->face; |
771 | |
771 | |
772 | op->direction = absdir (op->direction + 4); |
772 | op->direction = absdir (op->direction + 4); |
773 | op->state = 0; |
773 | op->state = 0; |
774 | |
774 | |
775 | if (GET_ANIM_ID (op)) |
775 | if (GET_ANIM_ID (op)) |
… | |
… | |
777 | number += 4; |
777 | number += 4; |
778 | |
778 | |
779 | if (number > GET_ANIMATION (op, 8)) |
779 | if (number > GET_ANIMATION (op, 8)) |
780 | number -= 8; |
780 | number -= 8; |
781 | |
781 | |
782 | op->face = &new_faces[number]; |
782 | op->face = number; |
783 | } |
783 | } |
784 | |
784 | |
785 | was_reflected = 1; /* skip normal movement calculations */ |
785 | was_reflected = 1; /* skip normal movement calculations */ |
786 | } |
786 | } |
787 | else |
787 | else |
… | |
… | |
1204 | return; |
1204 | return; |
1205 | } |
1205 | } |
1206 | |
1206 | |
1207 | if (op->above == NULL) |
1207 | if (op->above == NULL) |
1208 | return; |
1208 | return; |
|
|
1209 | |
1209 | for (tmp = op->above; tmp != NULL; tmp = tmp->above) |
1210 | for (tmp = op->above; tmp; tmp = tmp->above) |
1210 | { |
1211 | { |
1211 | if (strcmp (op->other_arch->name, tmp->arch->name) == 0) |
1212 | if (op->other_arch->name == tmp->arch->name) |
1212 | { |
1213 | { |
1213 | if (op->level <= 0) |
1214 | if (op->level <= 0) |
1214 | tmp->destroy (); |
1215 | tmp->destroy (); |
1215 | else |
1216 | else |
1216 | { |
1217 | { |
… | |
… | |
1307 | with a specific code as the slaying field. |
1308 | with a specific code as the slaying field. |
1308 | At that time, it writes the contents of its own message |
1309 | At that time, it writes the contents of its own message |
1309 | field to the player. The marker will decrement hp to |
1310 | field to the player. The marker will decrement hp to |
1310 | 0 and then delete itself every time it grants a mark. |
1311 | 0 and then delete itself every time it grants a mark. |
1311 | unless hp was zero to start with, in which case it is infinite.*/ |
1312 | unless hp was zero to start with, in which case it is infinite.*/ |
1312 | |
|
|
1313 | void |
1313 | void |
1314 | move_marker (object *op) |
1314 | move_marker (object *op) |
1315 | { |
1315 | { |
1316 | if (object *tmp = op->ms ().player ()) |
1316 | if (object *tmp = op->ms ().player ()) |
1317 | { |
1317 | { |
1318 | object *tmp2; |
1318 | object *tmp2; |
1319 | |
1319 | |
1320 | /* remove an old force with a slaying field == op->name */ |
1320 | /* remove an old force with a slaying field == op->name */ |
1321 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1321 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1322 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->name)) |
1322 | if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->name) |
1323 | { |
1323 | { |
1324 | tmp2->destroy (); |
1324 | tmp2->destroy (); |
1325 | break; |
1325 | break; |
1326 | } |
1326 | } |
1327 | |
1327 | |
1328 | /* cycle through his inventory to look for the MARK we want to |
1328 | /* cycle through his inventory to look for the MARK we want to |
1329 | * place |
1329 | * place |
1330 | */ |
1330 | */ |
1331 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1331 | for (tmp2 = tmp->inv; tmp2; tmp2 = tmp2->below) |
1332 | if (tmp2->type == FORCE && tmp2->slaying && !strcmp (tmp2->slaying, op->slaying)) |
1332 | if (tmp2->type == FORCE && tmp2->slaying && tmp2->slaying == op->slaying) |
1333 | break; |
1333 | break; |
1334 | |
1334 | |
1335 | /* if we didn't find our own MARK */ |
1335 | /* if we didn't find our own MARK */ |
1336 | if (tmp2 == NULL) |
1336 | if (!tmp2) |
1337 | { |
1337 | { |
1338 | object *force = get_archetype (FORCE_NAME); |
1338 | object *force = get_archetype (FORCE_NAME); |
1339 | |
1339 | |
1340 | if (op->stats.food) |
1340 | if (op->stats.food) |
1341 | { |
1341 | { |