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

Function dofiretrap

src/trap.c:4232–4314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4230}
4231
4232staticfn void
4233dofiretrap(
4234 struct obj *box) /* null for floor trap */
4235{
4236 boolean see_it = !Blind;
4237 int orig_dmg, num, alt;
4238 orig_dmg = num = d(2, 4);
4239
4240 /* Bug: for box case, the equivalent of burn_floor_objects() ought
4241 * to be done upon its contents.
4242 */
4243
4244 if ((box && !carried(box)) ? is_pool(box->ox, box->oy) : Underwater) {
4245 pline("A cascade of steamy bubbles erupts from %s!",
4246 the(box ? xname(box) : surface(u.ux, u.uy)));
4247 if (Fire_resistance)
4248 You("are uninjured.");
4249 else
4250 losehp(rnd(3), "boiling water", KILLED_BY);
4251 return;
4252 }
4253 pline("A %s %s from %s!", tower_of_flame, box ? "bursts" : "erupts",
4254 the(box ? xname(box) : surface(u.ux, u.uy)));
4255 if (Fire_resistance) {
4256 shieldeff(u.ux, u.uy);
4257 monstseesu(M_SEEN_FIRE);
4258 num = rn2(2);
4259 } else if (Upolyd) {
4260 switch (u.umonnum) {
4261 case PM_PAPER_GOLEM:
4262 alt = u.mhmax;
4263 break;
4264 case PM_STRAW_GOLEM:
4265 alt = u.mhmax / 2;
4266 break;
4267 case PM_WOOD_GOLEM:
4268 alt = u.mhmax / 4;
4269 break;
4270 case PM_LEATHER_GOLEM:
4271 alt = u.mhmax / 8;
4272 break;
4273 default:
4274 alt = 0;
4275 break;
4276 }
4277 if (alt > num)
4278 num = alt;
4279 if (u.mhmax > mons[u.umonnum].mlevel)
4280 u.mhmax -= rn2(min(u.mhmax, num + 1)), disp.botl = TRUE;
4281 if (u.mh > u.mhmax)
4282 u.mh = u.mhmax, disp.botl = TRUE;
4283 monstunseesu(M_SEEN_FIRE);
4284 } else {
4285 int uhpmin = minuhpmax(1), olduhpmax = u.uhpmax;
4286
4287 num = d(2, 4);
4288 if (u.uhpmax > uhpmin) {
4289 u.uhpmax -= rn2(min(u.uhpmax, num + 1)), disp.botl = TRUE;

Callers 3

trapeffect_fire_trapFunction · 0.85
domagictrapFunction · 0.85
chest_trapFunction · 0.85

Calls 15

dFunction · 0.85
is_poolFunction · 0.85
theFunction · 0.85
xnameFunction · 0.85
surfaceFunction · 0.85
YouFunction · 0.85
losehpFunction · 0.85
rndFunction · 0.85
shieldeffFunction · 0.85
monstseesuFunction · 0.85
rn2Function · 0.85
monstunseesuFunction · 0.85

Tested by

no test coverage detected