intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
| 887 | |
| 888 | /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */ |
| 889 | int |
| 890 | intrinsic_possible(int type, struct permonst *ptr) |
| 891 | { |
| 892 | int res = 0; |
| 893 | |
| 894 | #ifdef DEBUG |
| 895 | #define ifdebugresist(Msg) \ |
| 896 | do { \ |
| 897 | if (res) \ |
| 898 | debugpline0(Msg); \ |
| 899 | } while (0) |
| 900 | #else |
| 901 | #define ifdebugresist(Msg) /*empty*/ |
| 902 | #endif |
| 903 | switch (type) { |
| 904 | case FIRE_RES: |
| 905 | res = (ptr->mconveys & MR_FIRE) != 0; |
| 906 | ifdebugresist("can get fire resistance"); |
| 907 | break; |
| 908 | case SLEEP_RES: |
| 909 | res = (ptr->mconveys & MR_SLEEP) != 0; |
| 910 | ifdebugresist("can get sleep resistance"); |
| 911 | break; |
| 912 | case COLD_RES: |
| 913 | res = (ptr->mconveys & MR_COLD) != 0; |
| 914 | ifdebugresist("can get cold resistance"); |
| 915 | break; |
| 916 | case DISINT_RES: |
| 917 | res = (ptr->mconveys & MR_DISINT) != 0; |
| 918 | ifdebugresist("can get disintegration resistance"); |
| 919 | break; |
| 920 | case SHOCK_RES: /* shock (electricity) resistance */ |
| 921 | res = (ptr->mconveys & MR_ELEC) != 0; |
| 922 | ifdebugresist("can get shock resistance"); |
| 923 | break; |
| 924 | case POISON_RES: |
| 925 | res = (ptr->mconveys & MR_POISON) != 0; |
| 926 | ifdebugresist("can get poison resistance"); |
| 927 | break; |
| 928 | case ACID_RES: |
| 929 | res = (ptr->mconveys & MR_ACID) != 0; |
| 930 | ifdebugresist("can get acid resistance temporarily"); |
| 931 | break; |
| 932 | case STONE_RES: |
| 933 | res = (ptr->mconveys & MR_STONE) != 0; |
| 934 | ifdebugresist("can get stoning resistance temporarily"); |
| 935 | break; |
| 936 | case TELEPORT: |
| 937 | res = can_teleport(ptr); |
| 938 | ifdebugresist("can get teleport"); |
| 939 | break; |
| 940 | case TELEPORT_CONTROL: |
| 941 | res = control_teleport(ptr); |
| 942 | ifdebugresist("can get teleport control"); |
| 943 | break; |
| 944 | case TELEPAT: |
| 945 | res = telepathic(ptr); |
| 946 | ifdebugresist("can get telepathy"); |
no outgoing calls
no test coverage detected