* Let's destroy the drawbridge located at x,y */
| 885 | * Let's destroy the drawbridge located at x,y |
| 886 | */ |
| 887 | void |
| 888 | destroy_drawbridge(coordxy x, coordxy y) |
| 889 | { |
| 890 | struct rm *lev1, *lev2; |
| 891 | struct trap *t; |
| 892 | struct obj *otmp; |
| 893 | coordxy x2, y2; |
| 894 | int i; |
| 895 | boolean e_inview; |
| 896 | struct entity *etmp1 = &(go.occupants[0]), *etmp2 = &(go.occupants[1]); |
| 897 | |
| 898 | lev1 = &levl[x][y]; |
| 899 | if (!IS_DRAWBRIDGE(lev1->typ)) |
| 900 | return; |
| 901 | x2 = x; |
| 902 | y2 = y; |
| 903 | get_wall_for_db(&x2, &y2); |
| 904 | lev2 = &levl[x2][y2]; |
| 905 | if ((lev1->drawbridgemask & DB_UNDER) == DB_MOAT |
| 906 | || (lev1->drawbridgemask & DB_UNDER) == DB_LAVA) { |
| 907 | struct obj *otmp2; |
| 908 | boolean lava = (lev1->drawbridgemask & DB_UNDER) == DB_LAVA; |
| 909 | |
| 910 | Soundeffect(se_loud_splash, 100); /* Deaf-aware */ |
| 911 | if (lev1->typ == DRAWBRIDGE_UP) { |
| 912 | if (cansee(x2, y2) || u_at(x2, y2)) |
| 913 | pline_The("portcullis of the drawbridge falls into the %s!", |
| 914 | lava ? hliquid("lava") : "moat"); |
| 915 | else |
| 916 | You_hear("a loud *SPLASH*!"); /* Deaf-aware */ |
| 917 | } else { |
| 918 | if (cansee(x, y) || u_at(x, y)) |
| 919 | pline_The("drawbridge collapses into the %s!", |
| 920 | lava ? hliquid("lava") : "moat"); |
| 921 | else |
| 922 | You_hear("a loud *SPLASH*!"); /* Deaf-aware */ |
| 923 | } |
| 924 | lev1->typ = lava ? LAVAPOOL : MOAT; |
| 925 | lev1->drawbridgemask = 0; |
| 926 | if ((otmp2 = sobj_at(BOULDER, x, y)) != 0) { |
| 927 | obj_extract_self(otmp2); |
| 928 | (void) flooreffects(otmp2, x, y, "fall"); |
| 929 | } |
| 930 | } else { |
| 931 | /* no moat beneath */ |
| 932 | Soundeffect(se_loud_crash, 100); /* Deaf-aware */ |
| 933 | if (cansee(x, y) || u_at(x, y)) |
| 934 | pline_The("drawbridge disintegrates!"); |
| 935 | else |
| 936 | You_hear("a loud *CRASH*!"); /* Deaf-aware */ |
| 937 | lev1->typ = ((lev1->drawbridgemask & DB_ICE) ? ICE : ROOM); |
| 938 | lev1->icedpool = ((lev1->drawbridgemask & DB_ICE) ? ICED_MOAT : 0); |
| 939 | } |
| 940 | wake_nearto(x, y, 500); |
| 941 | lev2->typ = DOOR; |
| 942 | lev2->doormask = D_NODOOR; |
| 943 | if ((t = t_at(x, y)) != 0) |
| 944 | deltrap(t); |
no test coverage detected