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 */
40 /* update innate intrinsics (mainly Drain_resistance) */
41 set_uasmon(); /* new_were() doesn't do this */
50 return (PM_HUMAN_WEREWOLF
);
51 case PM_HUMAN_WEREWOLF
:
54 return (PM_HUMAN_WEREJACKAL
);
55 case PM_HUMAN_WEREJACKAL
:
56 return (PM_WEREJACKAL
);
58 return (PM_HUMAN_WERERAT
);
59 case PM_HUMAN_WERERAT
:
66 /* convert monsters similar to werecritters into appropriate werebeast */
95 register struct monst
*mon
;
99 pm
= counter_were(monsndx(mon
->data
));
101 impossible("unknown lycanthrope %s.", mon
->data
->mname
);
105 if (canseemon(mon
) && !Hallucination
)
106 pline("%s changes into a %s.", Monnam(mon
),
107 is_human(&mons
[pm
]) ? "human" : mons
[pm
].mname
+ 4);
109 set_mon_data(mon
, &mons
[pm
], 0);
110 if (mon
->msleeping
|| !mon
->mcanmove
) {
111 /* transformation wakens and/or revitalizes */
113 mon
->mfrozen
= 0; /* not asleep or paralyzed */
116 /* regenerate by 1/4 of the lost hit points */
117 mon
->mhp
+= (mon
->mhpmax
- mon
->mhp
) / 4;
118 newsym(mon
->mx
, mon
->my
);
119 mon_break_armor(mon
, FALSE
);
120 possibly_unwield(mon
, FALSE
);
123 /* were-creature (even you) summons a horde */
124 int were_summon(ptr
, yours
, visible
, genbuf
)
125 struct permonst
*ptr
;
127 int *visible
; /* number of visible helpers created */
130 int i
, typ
, pm
= monsndx(ptr
);
135 if (Protection_from_shape_changers
&& !yours
)
137 for (i
= rnd(5); i
> 0; i
--) {
140 case PM_HUMAN_WERERAT
:
142 rn2(3) ? PM_SEWER_RAT
: rn2(3) ? PM_GIANT_RAT
: PM_RABID_RAT
;
144 Strcpy(genbuf
, "rat");
147 case PM_HUMAN_WEREJACKAL
:
150 Strcpy(genbuf
, "jackal");
153 case PM_HUMAN_WEREWOLF
:
154 typ
= rn2(5) ? PM_WOLF
: PM_WINTER_WOLF
;
156 Strcpy(genbuf
, "wolf");
161 mtmp
= makemon(&mons
[typ
], u
.ux
, u
.uy
, NO_MM_FLAGS
);
168 (void) tamedog(mtmp
, (struct obj
*) 0);
177 boolean controllable_poly
= Polymorph_control
&& !(Stunned
|| Unaware
);
179 if (Unchanging
|| (u
.umonnum
== u
.ulycn
))
181 if (controllable_poly
) {
182 /* `+4' => skip "were" prefix to get name of beast */
183 Sprintf(qbuf
, "Do you want to change into %s?",
184 an(mons
[u
.ulycn
].mname
+ 4));
188 (void) polymon(u
.ulycn
);
195 boolean controllable_poly
= Polymorph_control
&& !(Stunned
|| Unaware
);
198 You_feel("purified.");
199 set_ulycn(NON_PM
); /* cure lycanthropy */
201 if (!Unchanging
&& is_were(youmonst
.data
)
202 && (!controllable_poly
|| yn("Remain in beast form?") == 'n'))
206 /* lycanthropy is being caught or cured, but no shape change is involved */
212 /* add or remove lycanthrope's innate intrinsics (Drain_resistance) */