Let's resurrect the Wizard, for some unexpected fun. */
| 712 | |
| 713 | /* Let's resurrect the Wizard, for some unexpected fun. */ |
| 714 | void |
| 715 | resurrect(void) |
| 716 | { |
| 717 | struct monst *mtmp, **mmtmp; |
| 718 | long elapsed; |
| 719 | const char *verb; |
| 720 | |
| 721 | if (!svc.context.no_of_wizards) { |
| 722 | /* make a new Wizard */ |
| 723 | verb = "kill"; |
| 724 | mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT); |
| 725 | /* affects experience; he's not coming back from a corpse |
| 726 | but is subject to repeated killing like a revived corpse */ |
| 727 | if (mtmp) |
| 728 | mtmp->mrevived = 1; |
| 729 | } else { |
| 730 | /* look for a migrating Wizard */ |
| 731 | verb = "elude"; |
| 732 | mmtmp = &gm.migrating_mons; |
| 733 | while ((mtmp = *mmtmp) != 0) { |
| 734 | if (mtmp->iswiz |
| 735 | /* if he has the Amulet, he won't bring it to you */ |
| 736 | && !mon_has_amulet(mtmp) |
| 737 | && (elapsed = svm.moves - mtmp->mlstmv) > 0L) { |
| 738 | mon_catchup_elapsed_time(mtmp, elapsed); |
| 739 | if (elapsed >= LARGEST_INT) |
| 740 | elapsed = LARGEST_INT - 1; |
| 741 | elapsed /= 50L; |
| 742 | if (mtmp->msleeping && rn2((int) elapsed + 1)) |
| 743 | mtmp->msleeping = 0; |
| 744 | if (mtmp->mfrozen == 1) /* would unfreeze on next move */ |
| 745 | mtmp->mfrozen = 0, mtmp->mcanmove = 1; |
| 746 | if (!helpless(mtmp)) { |
| 747 | *mmtmp = mtmp->nmon; |
| 748 | mon_arrive(mtmp, -1); /* -1: Wiz_arrive (dog.c) */ |
| 749 | /* mx: mon_arrive() might have sent mtmp into limbo */ |
| 750 | if (!mtmp->mx) |
| 751 | mtmp = 0; |
| 752 | /* note: there might be a second Wizard; if so, |
| 753 | he'll have to wait until the next resurrection */ |
| 754 | break; |
| 755 | } |
| 756 | } |
| 757 | mmtmp = &mtmp->nmon; |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | if (mtmp) { |
| 762 | /* FIXME: when a new wizard is created by makemon(), it gives |
| 763 | a "<mon> appears" message, delivered after he's been placed |
| 764 | on the map; however, when an existing wizard comes off |
| 765 | migrating_mons, he ends up triggering "<mon> vanishes and |
| 766 | reappears" on his first move (tactics when hero is carrying |
| 767 | the Amulet); setting STRAT_WAITMASK suppresses that but then |
| 768 | he just sits wherever he is, "meditating", contradicting the |
| 769 | threatening message below */ |
| 770 | mtmp->mstrategy &= ~STRAT_WAITMASK; |
| 771 |
no test coverage detected