… | |
… | |
451 | next = tmp->above; |
451 | next = tmp->above; |
452 | if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) |
452 | if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) |
453 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
453 | hit_player (tmp, 9998, op, AT_PHYSICAL, 0); |
454 | } |
454 | } |
455 | } |
455 | } |
|
|
456 | |
456 | return 1; |
457 | return 1; |
457 | } |
458 | } |
458 | |
|
|
459 | |
459 | |
460 | void |
460 | void |
461 | execute_word_of_recall (object *op) |
461 | execute_word_of_recall (object *op) |
462 | { |
462 | { |
463 | object *wor = op; |
463 | if (object *pl = op->in_player ()) |
464 | |
464 | { |
465 | while (op != NULL && op->type != PLAYER) |
465 | if (pl->ms ().flags () & P_NO_CLERIC && !QUERY_FLAG (pl, FLAG_WIZCAST)) |
466 | op = op->env; |
|
|
467 | |
|
|
468 | if (op != NULL && op->map) |
|
|
469 | if ((get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_NO_CLERIC) && (!QUERY_FLAG (op, FLAG_WIZCAST))) |
|
|
470 | new_draw_info (NDI_UNIQUE, 0, op, "You feel something fizzle inside you."); |
466 | new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); |
471 | else |
467 | else |
|
|
468 | { |
|
|
469 | // remove first so we do not call update_stats |
|
|
470 | op->remove (); |
472 | op->enter_exit (wor); |
471 | pl->enter_exit (op); |
|
|
472 | } |
|
|
473 | } |
473 | |
474 | |
474 | wor->destroy (); |
475 | op->destroy (); |
475 | } |
476 | } |
476 | |
477 | |
477 | /* Word of recall causes the player to return 'home'. |
478 | /* Word of recall causes the player to return 'home'. |
478 | * we put a force into the player object, so that there is a |
479 | * we put a force into the player object, so that there is a |
479 | * time delay effect. |
480 | * time delay effect. |
… | |
… | |
519 | */ |
520 | */ |
520 | EXIT_PATH (dummy) = op->contr->savebed_map; |
521 | EXIT_PATH (dummy) = op->contr->savebed_map; |
521 | EXIT_X (dummy) = op->contr->bed_x; |
522 | EXIT_X (dummy) = op->contr->bed_x; |
522 | EXIT_Y (dummy) = op->contr->bed_y; |
523 | EXIT_Y (dummy) = op->contr->bed_y; |
523 | |
524 | |
524 | (void) insert_ob_in_ob (dummy, op); |
525 | op->insert (dummy); |
|
|
526 | |
525 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
527 | new_draw_info (NDI_UNIQUE, 0, op, "You feel a force starting to build up inside you."); |
|
|
528 | |
526 | return 1; |
529 | return 1; |
527 | } |
530 | } |
528 | |
531 | |
529 | /* cast_wonder |
532 | /* cast_wonder |
530 | * wonder is really just a spell that will likely cast another |
533 | * wonder is really just a spell that will likely cast another |
… | |
… | |
637 | * Code by Tchize (david.delbecq@usa.net) |
640 | * Code by Tchize (david.delbecq@usa.net) |
638 | */ |
641 | */ |
639 | int |
642 | int |
640 | cast_create_town_portal (object *op, object *caster, object *spell, int dir) |
643 | cast_create_town_portal (object *op, object *caster, object *spell, int dir) |
641 | { |
644 | { |
642 | object *dummy, *force, *old_force, *tmp; |
645 | object *dummy, *force, *old_force; |
643 | archetype *perm_portal; |
646 | archetype *perm_portal; |
644 | char portal_name[1024], portal_message[1024]; |
647 | char portal_name[1024], portal_message[1024]; |
645 | maptile *exitmap; |
648 | maptile *exitmap; |
646 | int op_level; |
649 | int op_level; |
647 | |
650 | |
… | |
… | |
719 | * If it has the good name, we destruct it. |
722 | * If it has the good name, we destruct it. |
720 | * -We destruct the force indicating that portal. |
723 | * -We destruct the force indicating that portal. |
721 | */ |
724 | */ |
722 | while ((old_force = check_inv_recursive (op, dummy))) |
725 | while ((old_force = check_inv_recursive (op, dummy))) |
723 | { |
726 | { |
724 | exitmap = maptile::load_map_sync (old_force->race, op->map); |
727 | exitmap = maptile::find_sync (old_force->race, op->map); |
725 | |
728 | |
726 | if (exitmap) |
729 | if (exitmap) |
727 | { |
730 | { |
|
|
731 | exitmap->load_sync (); |
|
|
732 | |
728 | int exitx = EXIT_X (old_force); |
733 | int exitx = EXIT_X (old_force); |
729 | int exity = EXIT_Y (old_force); |
734 | int exity = EXIT_Y (old_force); |
730 | |
735 | |
731 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
736 | for (object *tmp = present_arch (perm_portal, exitmap, exitx, exity); tmp; tmp = tmp->above) |
732 | while (tmp) |
|
|
733 | { |
737 | { |
734 | if (tmp->name == old_force->name) |
738 | if (tmp->name == old_force->name) |
735 | { |
739 | { |
736 | tmp->destroy (); |
740 | tmp->destroy (); |
737 | break; |
741 | break; |
738 | } |
742 | } |
739 | |
|
|
740 | tmp = tmp->above; |
|
|
741 | } |
743 | } |
742 | } |
744 | } |
743 | |
745 | |
744 | old_force->destroy (); |
746 | old_force->destroy (); |
745 | } |
747 | } |
… | |
… | |
755 | * 'force' is the destination of the town portal, which we got |
757 | * 'force' is the destination of the town portal, which we got |
756 | * from the players inventory above. |
758 | * from the players inventory above. |
757 | */ |
759 | */ |
758 | |
760 | |
759 | /* Ensure exit map is loaded */ |
761 | /* Ensure exit map is loaded */ |
760 | exitmap = maptile::load_map_sync (force->name); |
762 | exitmap = maptile::find_sync (force->name); |
761 | |
763 | |
762 | /* If we were unable to load (ex. random map deleted), warn player */ |
764 | /* If we were unable to load (ex. random map deleted), warn player */ |
763 | if (!exitmap) |
765 | if (!exitmap) |
764 | { |
766 | { |
765 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
767 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
766 | force->destroy (); |
768 | force->destroy (); |
767 | return 1; |
769 | return 1; |
768 | } |
770 | } |
|
|
771 | |
|
|
772 | exitmap->load_sync (); |
769 | |
773 | |
770 | op_level = caster_level (caster, spell); |
774 | op_level = caster_level (caster, spell); |
771 | if (op_level < 15) |
775 | if (op_level < 15) |
772 | snprintf (portal_message, 1024, |
776 | snprintf (portal_message, 1024, |
773 | "\nThe air moves around you and\na huge smell of ammonia\nsurounds you as you pass\nthrough %s's tiny portal\nPouah!\n", |
777 | "\nThe air moves around you and\na huge smell of ammonia\nsurounds you as you pass\nthrough %s's tiny portal\nPouah!\n", |
… | |
… | |
804 | |
808 | |
805 | /* Now we need to to create a town portal marker inside the player |
809 | /* Now we need to to create a town portal marker inside the player |
806 | * object, so on future castings, we can know that he has an active |
810 | * object, so on future castings, we can know that he has an active |
807 | * town portal. |
811 | * town portal. |
808 | */ |
812 | */ |
809 | tmp = get_archetype (spell->race); |
813 | object *tmp = get_archetype (spell->race); |
810 | if (tmp == NULL) |
814 | |
|
|
815 | if (!tmp) |
811 | { |
816 | { |
812 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
817 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
813 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
818 | LOG (llevError, "object::create failed (force) in cast_create_town_portal for %s!\n", &op->name); |
814 | return 0; |
819 | return 0; |
815 | } |
820 | } |