Master Key is magic key if its bless/curse state meets our criteria: not cursed for rogues or blessed for non-rogues */
| 2772 | /* Master Key is magic key if its bless/curse state meets our criteria: |
| 2773 | not cursed for rogues or blessed for non-rogues */ |
| 2774 | boolean |
| 2775 | is_magic_key(struct monst *mon, /* if null, non-rogue is assumed */ |
| 2776 | struct obj *obj) |
| 2777 | { |
| 2778 | if (is_art(obj, ART_MASTER_KEY_OF_THIEVERY)) { |
| 2779 | if ((mon == &gy.youmonst) ? Role_if(PM_ROGUE) |
| 2780 | : (mon && mon->data == &mons[PM_ROGUE])) |
| 2781 | return !obj->cursed; /* a rogue; non-cursed suffices for magic */ |
| 2782 | /* not a rogue; key must be blessed to behave as a magic one */ |
| 2783 | return obj->blessed; |
| 2784 | } |
| 2785 | return FALSE; |
| 2786 | } |
| 2787 | |
| 2788 | /* figure out whether 'mon' (usually youmonst) is carrying the magic key */ |
| 2789 | struct obj * |
no test coverage detected