… | |
… | |
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. |
… | |
… | |
498 | { |
499 | { |
499 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
500 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
500 | LOG (llevError, "cast_word_of_recall: get_archetype(force) failed!\n"); |
501 | LOG (llevError, "cast_word_of_recall: get_archetype(force) failed!\n"); |
501 | return 0; |
502 | return 0; |
502 | } |
503 | } |
|
|
504 | |
503 | time = spell_ob->duration - SP_level_duration_adjust (caster, spell_ob); |
505 | time = spell_ob->duration - SP_level_duration_adjust (caster, spell_ob); |
504 | if (time < 1) |
506 | if (time < 1) |
505 | time = 1; |
507 | time = 1; |
506 | |
508 | |
507 | /* value of speed really doesn't make much difference, as long as it is |
509 | /* value of speed really doesn't make much difference, as long as it is |
… | |
… | |
515 | |
517 | |
516 | /* If we could take advantage of enter_player_savebed() here, it would be |
518 | /* If we could take advantage of enter_player_savebed() here, it would be |
517 | * nice, but until the map load fails, we can't. |
519 | * nice, but until the map load fails, we can't. |
518 | */ |
520 | */ |
519 | EXIT_PATH (dummy) = op->contr->savebed_map; |
521 | EXIT_PATH (dummy) = op->contr->savebed_map; |
520 | EXIT_X (dummy) = op->contr->bed_x; |
522 | EXIT_X (dummy) = op->contr->bed_x; |
521 | EXIT_Y (dummy) = op->contr->bed_y; |
523 | EXIT_Y (dummy) = op->contr->bed_y; |
522 | |
524 | |
523 | (void) insert_ob_in_ob (dummy, op); |
525 | op->insert (dummy); |
|
|
526 | |
524 | 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 | |
525 | return 1; |
529 | return 1; |
526 | } |
530 | } |
527 | |
531 | |
528 | /* cast_wonder |
532 | /* cast_wonder |
529 | * wonder is really just a spell that will likely cast another |
533 | * wonder is really just a spell that will likely cast another |
… | |
… | |
636 | * Code by Tchize (david.delbecq@usa.net) |
640 | * Code by Tchize (david.delbecq@usa.net) |
637 | */ |
641 | */ |
638 | int |
642 | int |
639 | 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) |
640 | { |
644 | { |
641 | object *dummy, *force, *old_force, *tmp; |
645 | object *dummy, *force, *old_force; |
642 | archetype *perm_portal; |
646 | archetype *perm_portal; |
643 | char portal_name[1024], portal_message[1024]; |
647 | char portal_name[1024], portal_message[1024]; |
644 | maptile *exitmap; |
648 | maptile *exitmap; |
645 | int op_level; |
649 | int op_level; |
646 | |
650 | |
… | |
… | |
718 | * If it has the good name, we destruct it. |
722 | * If it has the good name, we destruct it. |
719 | * -We destruct the force indicating that portal. |
723 | * -We destruct the force indicating that portal. |
720 | */ |
724 | */ |
721 | while ((old_force = check_inv_recursive (op, dummy))) |
725 | while ((old_force = check_inv_recursive (op, dummy))) |
722 | { |
726 | { |
723 | exitmap = maptile::find_map (old_force->race, op->map); |
727 | exitmap = maptile::find_sync (old_force->race, op->map); |
724 | |
728 | |
725 | if (exitmap) |
729 | if (exitmap) |
726 | { |
730 | { |
|
|
731 | exitmap->load_sync (); |
|
|
732 | |
727 | int exitx = EXIT_X (old_force); |
733 | int exitx = EXIT_X (old_force); |
728 | int exity = EXIT_Y (old_force); |
734 | int exity = EXIT_Y (old_force); |
729 | |
735 | |
730 | tmp = present_arch (perm_portal, exitmap, exitx, exity); |
736 | for (object *tmp = present_arch (perm_portal, exitmap, exitx, exity); tmp; tmp = tmp->above) |
731 | while (tmp) |
|
|
732 | { |
737 | { |
733 | if (tmp->name == old_force->name) |
738 | if (tmp->name == old_force->name) |
734 | { |
739 | { |
735 | tmp->destroy (); |
740 | tmp->destroy (); |
736 | break; |
741 | break; |
737 | } |
742 | } |
738 | |
|
|
739 | tmp = tmp->above; |
|
|
740 | } |
743 | } |
741 | } |
744 | } |
742 | |
745 | |
743 | old_force->destroy (); |
746 | old_force->destroy (); |
744 | } |
747 | } |
… | |
… | |
754 | * 'force' is the destination of the town portal, which we got |
757 | * 'force' is the destination of the town portal, which we got |
755 | * from the players inventory above. |
758 | * from the players inventory above. |
756 | */ |
759 | */ |
757 | |
760 | |
758 | /* Ensure exit map is loaded */ |
761 | /* Ensure exit map is loaded */ |
759 | exitmap = maptile::find_map (force->name, 0); |
762 | exitmap = maptile::find_sync (force->name); |
760 | |
763 | |
761 | /* 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 */ |
762 | if (!exitmap) |
765 | if (!exitmap) |
763 | { |
766 | { |
764 | 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!?"); |
765 | force->destroy (); |
768 | force->destroy (); |
766 | return 1; |
769 | return 1; |
767 | } |
770 | } |
|
|
771 | |
|
|
772 | exitmap->load_sync (); |
768 | |
773 | |
769 | op_level = caster_level (caster, spell); |
774 | op_level = caster_level (caster, spell); |
770 | if (op_level < 15) |
775 | if (op_level < 15) |
771 | snprintf (portal_message, 1024, |
776 | snprintf (portal_message, 1024, |
772 | "\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", |
… | |
… | |
803 | |
808 | |
804 | /* 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 |
805 | * 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 |
806 | * town portal. |
811 | * town portal. |
807 | */ |
812 | */ |
808 | tmp = get_archetype (spell->race); |
813 | object *tmp = get_archetype (spell->race); |
809 | if (tmp == NULL) |
814 | |
|
|
815 | if (!tmp) |
810 | { |
816 | { |
811 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
817 | new_draw_info (NDI_UNIQUE, 0, op, "Oops, program error!"); |
812 | 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); |
813 | return 0; |
819 | return 0; |
814 | } |
820 | } |