determine whether an item confers Protection */
| 695 | |
| 696 | /* determine whether an item confers Protection */ |
| 697 | boolean |
| 698 | protects(struct obj *otmp, boolean being_worn) |
| 699 | { |
| 700 | const struct artifact *arti; |
| 701 | |
| 702 | if (being_worn && objects[otmp->otyp].oc_oprop == PROTECTION) |
| 703 | return TRUE; |
| 704 | arti = get_artifact(otmp); |
| 705 | if (arti == &artilist[ART_NONARTIFACT]) |
| 706 | return FALSE; |
| 707 | return (boolean) ((arti->cspfx & SPFX_PROTECT) != 0 |
| 708 | || (being_worn && (arti->spfx & SPFX_PROTECT) != 0)); |
| 709 | } |
| 710 | |
| 711 | /* |
| 712 | * a potential artifact has just been worn/wielded/picked-up or |
no test coverage detected