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

Function adtyp_to_prop

src/zap.c:5653–5671  ·  view source on GitHub ↗

convert attack damage AD_foo to property resistance */

Source from the content-addressed store, hash-verified

5651
5652/* convert attack damage AD_foo to property resistance */
5653staticfn int
5654adtyp_to_prop(int dmgtyp)
5655{
5656 switch (dmgtyp) {
5657 case AD_COLD:
5658 return COLD_RES;
5659 case AD_FIRE:
5660 return FIRE_RES;
5661 case AD_ELEC:
5662 return SHOCK_RES;
5663 case AD_ACID:
5664 return ACID_RES;
5665 case AD_DISN:
5666 return DISINT_RES;
5667 default:
5668 break;
5669 }
5670 return 0; /* prop_types start at 1 */
5671}
5672
5673/* Is hero wearing or wielding an object with resistance to attack
5674 damage type? Returns the percentage protection that the object gives. */

Callers 2

u_adtyp_resistance_objFunction · 0.85
item_whatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected