Wear the best object of each type that the monster has. During creation, * the monster can put everything on at once; otherwise, wearing takes time. * This doesn't affect monster searching for objects--a monster may very well * search for objects it would not want to wear, because we don't want to * check which_armor() each round. * * We'll let monsters put on shirts and/or suits under worn
| 754 | * already worn body armor is too obviously buggy... |
| 755 | */ |
| 756 | void |
| 757 | m_dowear(struct monst *mon, boolean creation) |
| 758 | { |
| 759 | boolean can_wear_armor; |
| 760 | |
| 761 | #define RACE_EXCEPTION TRUE |
| 762 | /* Note the restrictions here are the same as in dowear in do_wear.c |
| 763 | * except for the additional restriction on intelligence. (Players |
| 764 | * are always intelligent, even if polymorphed). |
| 765 | */ |
| 766 | if (verysmall(mon->data) || nohands(mon->data) || is_animal(mon->data)) |
| 767 | return; |
| 768 | /* give mummies a chance to wear their wrappings |
| 769 | * and let skeletons wear their initial armor */ |
| 770 | if (mindless(mon->data) |
| 771 | && (!creation || (mon->data->mlet != S_MUMMY |
| 772 | && mon->data != &mons[PM_SKELETON]))) |
| 773 | return; |
| 774 | |
| 775 | m_dowear_type(mon, W_AMUL, creation, FALSE); |
| 776 | can_wear_armor = !cantweararm(mon->data); /* for suit, cloak, shirt */ |
| 777 | /* can't put on shirt if already wearing suit */ |
| 778 | if (can_wear_armor && !(mon->misc_worn_check & W_ARM)) |
| 779 | m_dowear_type(mon, W_ARMU, creation, FALSE); |
| 780 | /* WrappingAllowed() makes any size between small and huge eligible; |
| 781 | treating small as a special case allows hobbits, gnomes, and |
| 782 | kobolds to wear all cloaks; large and huge allows giants and such |
| 783 | to wear mummy wrappings but not other cloaks */ |
| 784 | if (can_wear_armor || WrappingAllowed(mon->data)) |
| 785 | m_dowear_type(mon, W_ARMC, creation, FALSE); |
| 786 | m_dowear_type(mon, W_ARMH, creation, FALSE); |
| 787 | if (!MON_WEP(mon) || !bimanual(MON_WEP(mon))) |
| 788 | m_dowear_type(mon, W_ARMS, creation, FALSE); |
| 789 | m_dowear_type(mon, W_ARMG, creation, FALSE); |
| 790 | if (!slithy(mon->data) && mon->data->mlet != S_CENTAUR) |
| 791 | m_dowear_type(mon, W_ARMF, creation, FALSE); |
| 792 | if (can_wear_armor) |
| 793 | m_dowear_type(mon, W_ARM, creation, FALSE); |
| 794 | else |
| 795 | m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION); |
| 796 | } |
| 797 | |
| 798 | staticfn void |
| 799 | m_dowear_type( |
no test coverage detected