Is hero wearing or wielding an object with resistance to attack damage type? Returns the percentage protection that the object gives. */
| 5673 | /* Is hero wearing or wielding an object with resistance to attack |
| 5674 | damage type? Returns the percentage protection that the object gives. */ |
| 5675 | int |
| 5676 | u_adtyp_resistance_obj(int dmgtyp) |
| 5677 | { |
| 5678 | int prop = adtyp_to_prop(dmgtyp); |
| 5679 | |
| 5680 | if (!prop) |
| 5681 | return 0; |
| 5682 | |
| 5683 | /* FIXME? these percentages (99 and 90) seem too high... */ |
| 5684 | |
| 5685 | /* items that give an extrinsic resistance when worn or wielded or |
| 5686 | carried give 99% protection to your items */ |
| 5687 | if ((u.uprops[prop].extrinsic & (W_ARMOR | W_ACCESSORY | W_WEP | W_ART)) |
| 5688 | != 0L) |
| 5689 | return 99; |
| 5690 | |
| 5691 | /* worn dwarvish cloaks give 90% protection against heat and cold to |
| 5692 | carried items */ |
| 5693 | if (uarmc && uarmc->otyp == DWARVISH_CLOAK |
| 5694 | && (dmgtyp == AD_COLD || dmgtyp == AD_FIRE)) |
| 5695 | return 90; |
| 5696 | |
| 5697 | return 0; |
| 5698 | } |
| 5699 | |
| 5700 | /* Rolls to see whether an object in inventory resists damage from the |
| 5701 | given damage type, due to an equipped item protecting it. Use |
no test coverage detected