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

Function lava_damage

src/trap.c:4575–4615  ·  view source on GitHub ↗

obj has been thrown or dropped into lava; damage is worse than mere fire */

Source from the content-addressed store, hash-verified

4573
4574/* obj has been thrown or dropped into lava; damage is worse than mere fire */
4575boolean
4576lava_damage(struct obj *obj, coordxy x, coordxy y)
4577{
4578 int otyp = obj->otyp, ocls = obj->oclass;
4579
4580 /* the Amulet, invocation items, and Rider corpses are never destroyed
4581 (let Book of the Dead fall through to fire_damage() to get feedback) */
4582 if (obj_resists(obj, 0, 0) && otyp != SPE_BOOK_OF_THE_DEAD)
4583 return FALSE;
4584 /* destroy liquid (venom), wax, veggy, flesh, paper (except for scrolls
4585 and books--let fire damage deal with them), cloth, leather, wood, bone
4586 unless it's inherently or explicitly fireproof or contains something;
4587 note: potions are glass so fall through to fire_damage() and boil */
4588 if (objects[otyp].oc_material < DRAGON_HIDE
4589 && ocls != SCROLL_CLASS && ocls != SPBOOK_CLASS
4590 && objects[otyp].oc_oprop != FIRE_RES
4591 && otyp != WAN_FIRE && otyp != FIRE_HORN
4592 /* assumes oerodeproof isn't overloaded for some other purpose on
4593 non-eroding items */
4594 && !obj->oerodeproof
4595 /* fire_damage() knows how to deal with containers and contents */
4596 && !Has_contents(obj)) {
4597 if (cansee(x, y)) {
4598 /* this feedback is pretty clunky and can become very verbose
4599 when former contents of a burned container get here via
4600 flooreffects() */
4601 if (obj == gt.thrownobj || obj == gk.kickedobj)
4602 pline("%s %s up!", is_plural(obj) ? "They" : "It",
4603 otense(obj, "burn"));
4604 else
4605 You_see("%s hit lava and burn up!", doname(obj));
4606 }
4607 if (carried(obj)) { /* shouldn't happen */
4608 remove_worn_item(obj, TRUE);
4609 useupall(obj);
4610 } else
4611 delobj(obj);
4612 return TRUE;
4613 }
4614 return fire_damage(obj, TRUE, x, y);
4615}
4616
4617void
4618acid_damage(struct obj *obj)

Callers 1

flooreffectsFunction · 0.85

Calls 9

obj_resistsFunction · 0.85
otenseFunction · 0.85
You_seeFunction · 0.85
donameFunction · 0.85
remove_worn_itemFunction · 0.85
useupallFunction · 0.85
delobjFunction · 0.85
fire_damageFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected