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

Function do_entity

src/dbridge.c:553–759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553staticfn void
554do_entity(struct entity *etmp)
555{
556 coordxy newx, newy, oldx, oldy;
557 int at_portcullis;
558 boolean must_jump = FALSE, relocates = FALSE, e_inview;
559 struct rm *crm;
560
561 if (!etmp->edata)
562 return;
563
564 e_inview = e_canseemon(etmp);
565 oldx = etmp->ex;
566 oldy = etmp->ey;
567 at_portcullis = is_db_wall(oldx, oldy);
568 crm = &levl[oldx][oldy];
569
570 if (automiss(etmp) && e_survives_at(etmp, oldx, oldy)) {
571 if (e_inview && (at_portcullis || IS_DRAWBRIDGE(crm->typ)))
572 pline_The("%s passes through %s!",
573 at_portcullis ? "portcullis" : "drawbridge",
574 e_nam(etmp));
575 if (is_u(etmp))
576 spoteffects(FALSE);
577 return;
578 }
579 if (e_missed(etmp, FALSE)) {
580 if (at_portcullis) {
581 pline_The("portcullis misses %s!", e_nam(etmp));
582 } else {
583 debugpline1("The drawbridge misses %s!", e_nam(etmp));
584 }
585 if (e_survives_at(etmp, oldx, oldy)) {
586 return;
587 } else {
588 debugpline0("Mon can't survive here");
589 if (at_portcullis)
590 must_jump = TRUE;
591 else
592 relocates = TRUE; /* just ride drawbridge in */
593 }
594 } else {
595 if (crm->typ == DRAWBRIDGE_DOWN) {
596 if (is_u(etmp)) {
597 svk.killer.format = NO_KILLER_PREFIX;
598 Strcpy(svk.killer.name,
599 "crushed to death underneath a drawbridge");
600 }
601 pline("%s crushed underneath the drawbridge.",
602 E_phrase(etmp, "are")); /* no jump */
603 e_died(etmp,
604 XKILL_NOCORPSE | (e_inview ? XKILL_GIVEMSG : XKILL_NOMSG),
605 CRUSHING); /* no corpse */
606 return; /* Note: Beyond this point, we know we're */
607 } /* not at an opened drawbridge, since all */
608 must_jump = TRUE; /* *missable* creatures survive on the */
609 } /* square, and all the unmissed ones die. */
610 if (must_jump) {

Callers 3

close_drawbridgeFunction · 0.85
open_drawbridgeFunction · 0.85
destroy_drawbridgeFunction · 0.85

Calls 15

is_db_wallFunction · 0.85
automissFunction · 0.85
e_survives_atFunction · 0.85
pline_TheFunction · 0.85
e_namFunction · 0.85
spoteffectsFunction · 0.85
e_missedFunction · 0.85
E_phraseFunction · 0.85
e_diedFunction · 0.85
e_jumpsFunction · 0.85
You_hearFunction · 0.85
find_drawbridgeFunction · 0.85

Tested by

no test coverage detected