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

Function drag_down

src/ball.c:985–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985void
986drag_down(void)
987{
988 boolean forward;
989 uchar dragchance = 3;
990
991 /*
992 * Assume that the ball falls forward if:
993 *
994 * a) the character is wielding it, or
995 * b) the character has both hands available to hold it (i.e. is
996 * not wielding any weapon), or
997 * c) (perhaps) it falls forward out of his non-weapon hand
998 */
999 forward = carried(uball) && (uwep == uball || !uwep || !rn2(3));
1000
1001 if (carried(uball) && !welded(uball))
1002 You("lose your grip on the iron ball.");
1003
1004 cls(); /* previous level is still displayed although you
1005 went down the stairs. Avoids bug C343-20 */
1006
1007 if (forward) {
1008 if (rn2(6)) {
1009 pline_The("iron ball drags you downstairs!");
1010 losehp(Maybe_Half_Phys(rnd(6)),
1011 "dragged downstairs by an iron ball", NO_KILLER_PREFIX);
1012 litter();
1013 }
1014 } else {
1015 if (rn2(2)) {
1016 Soundeffect(se_iron_ball_hits_you, 25);
1017 pline_The("iron ball smacks into you!");
1018 losehp(Maybe_Half_Phys(rnd(20)), "iron ball collision",
1019 KILLED_BY_AN);
1020 exercise(A_STR, FALSE);
1021 dragchance -= 2;
1022 }
1023 if ((int) dragchance >= rnd(6)) {
1024 pline_The("iron ball drags you downstairs!");
1025 losehp(Maybe_Half_Phys(rnd(3)),
1026 "dragged downstairs by an iron ball", NO_KILLER_PREFIX);
1027 exercise(A_STR, FALSE);
1028 litter();
1029 }
1030 }
1031}
1032
1033void
1034bc_sanity_check(void)

Callers 1

goto_levelFunction · 0.85

Calls 9

rn2Function · 0.85
weldedFunction · 0.85
YouFunction · 0.85
clsFunction · 0.85
pline_TheFunction · 0.85
losehpFunction · 0.85
rndFunction · 0.85
litterFunction · 0.85
exerciseFunction · 0.85

Tested by

no test coverage detected