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

Function kick_door

src/dokick.c:909–970  ·  view source on GitHub ↗

kick a door */

Source from the content-addressed store, hash-verified

907
908/* kick a door */
909staticfn void
910kick_door(coordxy x, coordxy y, int avrg_attrib)
911{
912 boolean doorbuster;
913
914 if (gm.maploc->doormask == D_ISOPEN || gm.maploc->doormask == D_BROKEN
915 || gm.maploc->doormask == D_NODOOR) {
916 kick_dumb(x, y);
917 return; /* uses a turn */
918 }
919
920 /* not enough leverage to kick open doors while levitating */
921 if (Levitation) {
922 kick_ouch(x, y, "");
923 return;
924 }
925
926 exercise(A_DEX, TRUE);
927 doorbuster = Upolyd && is_giant(gy.youmonst.data);
928 /* door is known to be CLOSED or LOCKED */
929 if (doorbuster
930 || (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX)))) {
931 boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
932
933 /* break the door */
934 if (gm.maploc->doormask & D_TRAPPED) {
935 if (flags.verbose)
936 You("kick the door.");
937 exercise(A_STR, FALSE);
938 gm.maploc->doormask = D_NODOOR;
939 b_trapped("door", FOOT);
940 } else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) {
941 Soundeffect(se_kick_door_it_shatters, 50);
942 pline("As you kick the door, it shatters to pieces!");
943 exercise(A_STR, TRUE);
944 gm.maploc->doormask = D_NODOOR;
945 } else {
946 Soundeffect(se_kick_door_it_crashes_open, 50);
947 pline("As you kick the door, it crashes open!");
948 exercise(A_STR, TRUE);
949 gm.maploc->doormask = D_BROKEN;
950 }
951 feel_newsym(x, y); /* we know we broke it */
952 recalc_block_point(x, y); /* vision */
953 if (shopdoor) {
954 add_damage(x, y, SHOP_DOOR_COST);
955 pay_for_damage("break", FALSE);
956 }
957 if (in_town(x, y))
958 (void) get_iter_mons(watchman_thief_arrest);
959 } else {
960 if (Blind)
961 feel_location(x, y); /* we know we hit it */
962 exercise(A_STR, TRUE);
963 /* note: this used to be unconditional "WHAMMM!!!" but that has a
964 fairly strong connotation of noise that a deaf hero shouldn't
965 hear; we've kept the extra 'm's and one of the extra '!'s */
966 pline("%s!!", (Deaf || !rn2(3)) ? "Thwack" : "Whammm");

Callers 1

dokickFunction · 0.85

Calls 15

kick_dumbFunction · 0.85
kick_ouchFunction · 0.85
exerciseFunction · 0.85
rnlFunction · 0.85
in_roomsFunction · 0.85
YouFunction · 0.85
b_trappedFunction · 0.85
rn2Function · 0.85
feel_newsymFunction · 0.85
recalc_block_pointFunction · 0.85
add_damageFunction · 0.85
pay_for_damageFunction · 0.85

Tested by

no test coverage detected