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

Function zhitu

src/zap.c:4400–4591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4398}
4399
4400staticfn void
4401zhitu(
4402 int type, int nd,
4403 const char *fltxt,
4404 coordxy sx, coordxy sy)
4405{
4406 int dam = 0, abstyp = zaptype(type);
4407 int orig_dam = 0;
4408
4409 switch (abstyp % 10) {
4410 case ZT_MAGIC_MISSILE:
4411 if (Antimagic) {
4412 shieldeff(sx, sy);
4413 pline_The("missiles bounce off!");
4414 monstseesu(M_SEEN_MAGR);
4415 } else {
4416 dam = d(nd, 6);
4417 exercise(A_STR, FALSE);
4418 monstunseesu(M_SEEN_MAGR);
4419 }
4420 break;
4421 case ZT_FIRE:
4422 orig_dam = d(nd, 6);
4423 if (Fire_resistance) {
4424 shieldeff(sx, sy);
4425 You("don't feel hot!");
4426 monstseesu(M_SEEN_FIRE);
4427 ugolemeffects(AD_FIRE, orig_dam);
4428 } else {
4429 dam = orig_dam;
4430 monstunseesu(M_SEEN_FIRE);
4431 }
4432 burn_away_slime();
4433 if (burnarmor(&gy.youmonst)) { /* "body hit" */
4434 if (!rn2(3))
4435 (void) destroy_items(&gy.youmonst, AD_FIRE, orig_dam);
4436 if (!rn2(3))
4437 ignite_items(gi.invent);
4438 }
4439 break;
4440 case ZT_COLD:
4441 orig_dam = d(nd, 6);
4442 if (Cold_resistance) {
4443 shieldeff(sx, sy);
4444 You("don't feel cold.");
4445 monstseesu(M_SEEN_COLD);
4446 ugolemeffects(AD_COLD, orig_dam);
4447 } else {
4448 dam = orig_dam;
4449 monstunseesu(M_SEEN_COLD);
4450 }
4451 if (!rn2(3))
4452 (void) destroy_items(&gy.youmonst, AD_COLD, orig_dam);
4453 break;
4454 case ZT_SLEEP:
4455 if (Sleep_resistance) {
4456 shieldeff(u.ux, u.uy);
4457 You("don't feel sleepy.");

Callers 2

ubreatheuFunction · 0.85
dobuzzFunction · 0.85

Calls 15

zaptypeFunction · 0.85
shieldeffFunction · 0.85
pline_TheFunction · 0.85
monstseesuFunction · 0.85
dFunction · 0.85
exerciseFunction · 0.85
monstunseesuFunction · 0.85
YouFunction · 0.85
ugolemeffectsFunction · 0.85
burn_away_slimeFunction · 0.85
burnarmorFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected