MCPcopy Index your code
hub / github.com/NetHack/NetHack / maybe_wail

Function maybe_wail

src/hack.c:4210–4243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4208}
4209
4210staticfn void
4211maybe_wail(void)
4212{
4213 static short powers[] = { TELEPORT, SEE_INVIS, POISON_RES, COLD_RES,
4214 SHOCK_RES, FIRE_RES, SLEEP_RES, DISINT_RES,
4215 TELEPORT_CONTROL, STEALTH, FAST, INVIS };
4216
4217 if (svm.moves <= gw.wailmsg + 50)
4218 return;
4219
4220 gw.wailmsg = svm.moves;
4221 if (Role_if(PM_WIZARD) || Race_if(PM_ELF) || Role_if(PM_VALKYRIE)) {
4222 const char *who;
4223 int i, powercnt;
4224
4225 who = (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE)) ? gu.urole.name.m
4226 : "Elf";
4227 if (u.uhp == 1) {
4228 pline("%s is about to die.", who);
4229 } else {
4230 for (i = 0, powercnt = 0; i < SIZE(powers); ++i)
4231 if (u.uprops[powers[i]].intrinsic & INTRINSIC)
4232 ++powercnt;
4233
4234 pline((powercnt >= 4) ? "%s, all your powers will be lost..."
4235 : "%s, your life force is running out.",
4236 who);
4237 }
4238 } else {
4239 Soundeffect(se_wailing_of_the_banshee, 75);
4240 You_hear(u.uhp == 1 ? "the wailing of the Banshee..."
4241 : "the howling of the CwnAnnwn...");
4242 }
4243}
4244
4245/* show a message how much damage you received */
4246void

Callers 1

losehpFunction · 0.85

Calls 2

You_hearFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected