1 /* NetHack 3.6 were.c $NHDT-Date: 1432512763 2015/05/25 00:12:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
9 register struct monst *mon;
11 if (!is_were(mon->data))
14 if (is_human(mon->data)) {
15 if (!Protection_from_shape_changers
16 && !rn2(night() ? (flags.moonphase == FULL_MOON ? 3 : 30)
17 : (flags.moonphase == FULL_MOON ? 10 : 50))) {
18 new_were(mon); /* change into animal form */
19 if (!Deaf && !canseemon(mon)) {
22 switch (monsndx(mon->data)) {
34 You_hear("a %s howling at the moon.", howler);
37 } else if (!rn2(30) || Protection_from_shape_changers) {
38 new_were(mon); /* change back into human form */
48 return (PM_HUMAN_WEREWOLF);
49 case PM_HUMAN_WEREWOLF:
52 return (PM_HUMAN_WEREJACKAL);
53 case PM_HUMAN_WEREJACKAL:
54 return (PM_WEREJACKAL);
56 return (PM_HUMAN_WERERAT);
57 case PM_HUMAN_WERERAT:
64 /* convert monsters similar to werecritters into appropriate werebeast */
93 register struct monst *mon;
97 pm = counter_were(monsndx(mon->data));
99 impossible("unknown lycanthrope %s.", mon->data->mname);
103 if (canseemon(mon) && !Hallucination)
104 pline("%s changes into a %s.", Monnam(mon),
105 is_human(&mons[pm]) ? "human" : mons[pm].mname + 4);
107 set_mon_data(mon, &mons[pm], 0);
108 if (mon->msleeping || !mon->mcanmove) {
109 /* transformation wakens and/or revitalizes */
111 mon->mfrozen = 0; /* not asleep or paralyzed */
114 /* regenerate by 1/4 of the lost hit points */
115 mon->mhp += (mon->mhpmax - mon->mhp) / 4;
116 newsym(mon->mx, mon->my);
117 mon_break_armor(mon, FALSE);
118 possibly_unwield(mon, FALSE);
121 int were_summon(ptr, yours, visible,
122 genbuf) /* were-creature (even you) summons a horde */
123 register struct permonst *ptr;
124 register boolean yours;
125 int *visible; /* number of visible helpers created */
128 register int i, typ, pm = monsndx(ptr);
129 register struct monst *mtmp;
133 if (Protection_from_shape_changers && !yours)
135 for (i = rnd(5); i > 0; i--) {
138 case PM_HUMAN_WERERAT:
140 rn2(3) ? PM_SEWER_RAT : rn2(3) ? PM_GIANT_RAT : PM_RABID_RAT;
142 Strcpy(genbuf, "rat");
145 case PM_HUMAN_WEREJACKAL:
148 Strcpy(genbuf, "jackal");
151 case PM_HUMAN_WEREWOLF:
152 typ = rn2(5) ? PM_WOLF : PM_WINTER_WOLF;
154 Strcpy(genbuf, "wolf");
159 mtmp = makemon(&mons[typ], u.ux, u.uy, NO_MM_FLAGS);
166 (void) tamedog(mtmp, (struct obj *) 0);
175 boolean controllable_poly = Polymorph_control && !(Stunned || Unaware);
177 if (Unchanging || (u.umonnum == u.ulycn))
179 if (controllable_poly) {
180 /* `+4' => skip "were" prefix to get name of beast */
181 Sprintf(qbuf, "Do you want to change into %s?",
182 an(mons[u.ulycn].mname + 4));
186 (void) polymon(u.ulycn);
193 boolean controllable_poly = Polymorph_control && !(Stunned || Unaware);
196 You_feel("purified.");
197 u.ulycn = NON_PM; /* cure lycanthropy */
199 if (!Unchanging && is_were(youmonst.data)
200 && (!controllable_poly || yn("Remain in beast form?") == 'n'))