* drop_ball() * * The punished hero drops or throws her iron ball. If the hero is * blind, we must reset the order and glyph. Check for side effects. * This routine expects the ball to be already placed. * * Should not be called while swallowed. */
| 879 | * Should not be called while swallowed. |
| 880 | */ |
| 881 | void |
| 882 | drop_ball(coordxy x, coordxy y) |
| 883 | { |
| 884 | if (Blind) { |
| 885 | /* get the order */ |
| 886 | u.bc_order = bc_order(); |
| 887 | /* pick up glyph */ |
| 888 | u.bglyph = (u.bc_order) ? u.cglyph : levl[x][y].glyph; |
| 889 | } |
| 890 | |
| 891 | if (x != u.ux || y != u.uy) { |
| 892 | static const char pullmsg[] = "The ball pulls you out of the "; |
| 893 | struct trap *t; |
| 894 | long side; |
| 895 | |
| 896 | if (u.utrap |
| 897 | && u.utraptype != TT_INFLOOR && u.utraptype != TT_BURIEDBALL) { |
| 898 | switch (u.utraptype) { |
| 899 | case TT_PIT: |
| 900 | pline("%s%s!", pullmsg, "pit"); |
| 901 | break; |
| 902 | case TT_WEB: |
| 903 | pline("%s%s!", pullmsg, "web"); |
| 904 | Soundeffect(se_destroy_web, 30); |
| 905 | pline_The("web is destroyed!"); |
| 906 | deltrap(t_at(u.ux, u.uy)); |
| 907 | break; |
| 908 | case TT_LAVA: |
| 909 | pline("%s%s!", pullmsg, hliquid("lava")); |
| 910 | break; |
| 911 | case TT_BEARTRAP: |
| 912 | side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE; |
| 913 | pline("%s%s!", pullmsg, "bear trap"); |
| 914 | set_wounded_legs(side, rn1(1000, 500)); |
| 915 | if (!u.usteed) { |
| 916 | Your("%s %s is severely damaged.", |
| 917 | (side == LEFT_SIDE) ? "left" : "right", |
| 918 | body_part(LEG)); |
| 919 | losehp(Maybe_Half_Phys(2), |
| 920 | "leg damage from being pulled out of a bear trap", |
| 921 | KILLED_BY); |
| 922 | } |
| 923 | break; |
| 924 | } |
| 925 | reset_utrap(TRUE); |
| 926 | fill_pit(u.ux, u.uy); |
| 927 | } |
| 928 | |
| 929 | u.ux0 = u.ux; |
| 930 | u.uy0 = u.uy; |
| 931 | if (!Levitation && !MON_AT(x, y) && !u.utrap |
| 932 | && (is_pool(x, y) |
| 933 | || ((t = t_at(x, y)) |
| 934 | && (is_pit(t->ttyp) |
| 935 | || is_hole(t->ttyp))))) { |
| 936 | u.ux = x; |
| 937 | u.uy = y; |
| 938 | } else { |
no test coverage detected