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

Function hmon_hitmon_misc_obj

src/uhitm.c:1118–1383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1116}
1117
1118staticfn void
1119hmon_hitmon_misc_obj(
1120 struct _hitmon_data *hmd,
1121 struct monst *mon,
1122 struct obj *obj) /* obj is not NULL */
1123{
1124 switch (obj->otyp) {
1125 case BOULDER: /* 1d20 */
1126 case HEAVY_IRON_BALL: /* 1d25 */
1127 case IRON_CHAIN: /* 1d4+1 */
1128 hmd->dmg = dmgval(obj, mon);
1129 break;
1130 case MIRROR:
1131 if (breaktest(obj)) {
1132 You("break %s. That's bad luck!", ysimple_name(obj));
1133 change_luck(-2);
1134 useup(obj);
1135 obj = (struct obj *) 0;
1136 hmd->unarmed = FALSE; /* avoid obj==0 confusion */
1137 hmd->get_dmg_bonus = FALSE;
1138 hmd->hittxt = TRUE;
1139 }
1140 hmd->dmg = 1;
1141 break;
1142 case EXPENSIVE_CAMERA:
1143 You("succeed in destroying %s. Congratulations!",
1144 ysimple_name(obj));
1145 release_camera_demon(obj, u.ux, u.uy);
1146 useup(obj);
1147 hmd->doreturn = TRUE;
1148 hmd->retval = TRUE;
1149 return;
1150 /*return TRUE;*/
1151 case CORPSE: /* fixed by polder@cs.vu.nl */
1152 if (touch_petrifies(&mons[obj->corpsenm])) {
1153 hmd->dmg = 1;
1154 hmd->hittxt = TRUE;
1155 You("hit %s with %s.", mon_nam(mon),
1156 corpse_xname(obj, (const char *) 0,
1157 obj->dknown ? CXN_PFX_THE
1158 : CXN_ARTICLE));
1159 observe_object(obj);
1160 if (!munstone(mon, TRUE))
1161 minstapetrify(mon, TRUE);
1162 if (resists_ston(mon))
1163 break;
1164 /* note: hp may be <= 0 even if munstoned==TRUE */
1165 hmd->doreturn = TRUE;
1166 hmd->retval = !DEADMONSTER(mon);
1167 return;
1168 /*return (boolean) !DEADMONSTER(mon);*/
1169#if 0
1170 } else if (touch_petrifies(mdat)) {
1171 ; /* maybe turn the corpse into a statue? */
1172#endif
1173 }
1174 hmd->dmg = (ismnum(obj->corpsenm) ? mons[obj->corpsenm].msize
1175 : 0) + 1;

Callers 1

hmon_hitmon_do_hitFunction · 0.85

Calls 15

dmgvalFunction · 0.85
breaktestFunction · 0.85
YouFunction · 0.85
ysimple_nameFunction · 0.85
change_luckFunction · 0.85
useupFunction · 0.85
release_camera_demonFunction · 0.85
mon_namFunction · 0.85
corpse_xnameFunction · 0.85
observe_objectFunction · 0.85
munstoneFunction · 0.85
minstapetrifyFunction · 0.85

Tested by

no test coverage detected