MCPcopy Create free account
hub / github.com/NetHack/NetHack / were_change

Function were_change

src/were.c:8–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include "hack.h"
7
8void
9were_change(struct monst *mon)
10{
11 if (!is_were(mon->data))
12 return;
13
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 gw.were_changes++;
20 if (!Deaf && !canseemon(mon)) {
21 const char *howler;
22
23 switch (monsndx(mon->data)) {
24 case PM_WEREWOLF:
25 howler = "wolf";
26 break;
27 case PM_WEREJACKAL:
28 howler = "jackal";
29 break;
30 default:
31 howler = (char *) 0;
32 break;
33 }
34 if (howler) {
35 Soundeffect(se_canine_howl, 50);
36 You_hear("a %s howling at the moon.", howler);
37 wake_nearto(mon->mx, mon->my, 4 * 4);
38 }
39 }
40 }
41 } else if (!rn2(30) || Protection_from_shape_changers) {
42 new_were(mon); /* change back into human form */
43 gw.were_changes++;
44 }
45}
46
47int
48counter_were(int pm)

Callers 2

mhitm_ad_cursFunction · 0.85
m_calcdistressFunction · 0.85

Calls 6

rn2Function · 0.85
nightFunction · 0.85
new_wereFunction · 0.85
canseemonFunction · 0.85
You_hearFunction · 0.85
wake_neartoFunction · 0.85

Tested by

no test coverage detected