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

Function pot_acid_damage

src/trap.c:4656–4707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4654}
4655
4656staticfn void
4657pot_acid_damage(
4658 struct obj *obj,
4659 boolean in_invent,
4660 boolean described)
4661{
4662 char *bufp;
4663 boolean one, exploded;
4664
4665 one = (obj->quan == 1L);
4666 exploded = FALSE;
4667
4668 if (Blind && !in_invent)
4669 obj->dknown = 0;
4670 if (ga.acid_ctx.ctx_valid)
4671 exploded = ((obj->dknown ? ga.acid_ctx.dkn_boom
4672 : ga.acid_ctx.unk_boom) > 0);
4673 if (described) {
4674 /* just gave "The grease washes off your potion of acid."
4675 or "...your <color> potion." (or just "...your potion.");
4676 don't re-describe potion here; if we used "It explodes!"
4677 then "it" might be misconstrued as applying to "grease" */
4678 pline_The("potion%s %s!",
4679 plur(obj->quan), otense(obj, "explode"));
4680 } else {
4681 /* First message is
4682 * "a [potion|<color> potion|potion of acid] explodes"
4683 * depending on obj->dknown (potion has been seen) and
4684 * objects[POT_ACID].oc_name_known (fully discovered),
4685 * or "some {plural version} explode" when relevant.
4686 * Second and subsequent messages for same chain and
4687 * matching dknown status are
4688 * "another [potion|<color> &c] explodes" or plural
4689 * variant.
4690 */
4691 bufp = simpleonames(obj);
4692 pline("%s%s %s!", /* "A potion explodes!" */
4693 !exploded ? (one ? "A " : "Some ")
4694 : (one ? "Another " : "More "),
4695 bufp, vtense(bufp, "explode"));
4696 }
4697 if (ga.acid_ctx.ctx_valid) {
4698 if (obj->dknown)
4699 ga.acid_ctx.dkn_boom++;
4700 else
4701 ga.acid_ctx.unk_boom++;
4702 }
4703 setnotworn(obj);
4704 delobj(obj);
4705 if (in_invent)
4706 update_inventory();
4707}
4708
4709/* Get an object wet and damage it appropriately.
4710 Returns an erosion return value (ER_*). */

Callers 1

water_damageFunction · 0.85

Calls 8

pline_TheFunction · 0.85
otenseFunction · 0.85
simpleonamesFunction · 0.85
vtenseFunction · 0.85
setnotwornFunction · 0.85
delobjFunction · 0.85
update_inventoryFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected