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

Function dig_up_grave

src/dig.c:1026–1089  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1024}
1025
1026staticfn void
1027dig_up_grave(coord *cc)
1028{
1029 struct obj *otmp;
1030 int what_happens;
1031 coordxy dig_x, dig_y;
1032
1033 if (!cc) {
1034 dig_x = u.ux;
1035 dig_y = u.uy;
1036 } else {
1037 dig_x = cc->x;
1038 dig_y = cc->y;
1039 if (!isok(dig_x, dig_y))
1040 return;
1041 }
1042
1043 /* Grave-robbing is frowned upon... */
1044 exercise(A_WIS, FALSE);
1045 if (Role_if(PM_ARCHEOLOGIST)) {
1046 adjalign(-sgn(u.ualign.type) * 3);
1047 You_feel("like a despicable grave-robber!");
1048 } else if (Role_if(PM_SAMURAI)) {
1049 adjalign(-sgn(u.ualign.type));
1050 You("disturb the honorable dead!");
1051 } else if (u.ualign.type == A_LAWFUL) {
1052 if (u.ualign.record > -10)
1053 adjalign(-1);
1054 You("have violated the sanctity of this grave!");
1055 }
1056
1057 /* -1: force default case for empty grave */
1058 what_happens = levl[dig_x][dig_y].emptygrave ? -1 : rn2(5);
1059 switch (what_happens) {
1060 case 0:
1061 case 1:
1062 You("unearth a corpse.");
1063 if ((otmp = mk_tt_object(CORPSE, dig_x, dig_y)) != 0)
1064 otmp->age -= (TAINT_AGE + 1); /* this is an *OLD* corpse */
1065 break;
1066 case 2:
1067 if (!Blind)
1068 pline("%s!", Hallucination ? "Dude! The living dead"
1069 : "The grave's owner is very upset");
1070 (void) makemon(mkclass(S_ZOMBIE, 0), dig_x, dig_y, MM_NOMSG);
1071 break;
1072 case 3:
1073 if (!Blind)
1074 pline("%s!", Hallucination ? "I want my mummy"
1075 : "You've disturbed a tomb");
1076 (void) makemon(mkclass(S_MUMMY, 0), dig_x, dig_y, MM_NOMSG);
1077 break;
1078 default:
1079 /* No corpse */
1080 pline_The("grave is unoccupied. Strange...");
1081 break;
1082 }
1083 levl[dig_x][dig_y].typ = ROOM;

Callers 1

digholeFunction · 0.85

Calls 14

isokFunction · 0.85
exerciseFunction · 0.85
adjalignFunction · 0.85
sgnFunction · 0.85
You_feelFunction · 0.85
YouFunction · 0.85
rn2Function · 0.85
mk_tt_objectFunction · 0.85
makemonFunction · 0.85
mkclassFunction · 0.85
pline_TheFunction · 0.85
del_engr_atFunction · 0.85

Tested by

no test coverage detected