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

Function inventory_resistance_check

src/zap.c:5709–5718  ·  view source on GitHub ↗

Rolls to see whether an object in inventory resists damage from the given damage type, due to an equipped item protecting it. Use u_adtyp_resistance_obj to discover whether objects are protected in general (e.g. for enlightenment) and this function to actually do the roll to see whether a specific object is protected. This function doesn't check for other reasons why an object migh

Source from the content-addressed store, hash-verified

5707 be protected; you will usually need to do an obj_resists() call
5708 too. */
5709boolean
5710inventory_resistance_check(int dmgtyp)
5711{
5712 int prob = u_adtyp_resistance_obj(dmgtyp);
5713
5714 if (!prob)
5715 return FALSE;
5716
5717 return rn2(100) < prob;
5718}
5719
5720/* for enlightenment; currently only useful in wizard mode; cf from_what() */
5721char *

Callers 4

erode_objFunction · 0.85
acid_damageFunction · 0.85
zhituFunction · 0.85
maybe_destroy_itemFunction · 0.85

Calls 2

u_adtyp_resistance_objFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected