The "do we or do we not give the intrinsic" logic from givit(), extracted * into its own function. Depends on the monster's level and the type of * intrinsic it is trying to give you. */
| 958 | * intrinsic it is trying to give you. |
| 959 | */ |
| 960 | boolean |
| 961 | should_givit(int type, struct permonst *ptr) |
| 962 | { |
| 963 | int chance; |
| 964 | |
| 965 | /* some intrinsics are easier to get than others */ |
| 966 | switch (type) { |
| 967 | case POISON_RES: |
| 968 | if ((ptr == &mons[PM_KILLER_BEE] || ptr == &mons[PM_SCORPION]) |
| 969 | && !rn2(4)) |
| 970 | chance = 1; |
| 971 | else |
| 972 | chance = 15; |
| 973 | break; |
| 974 | case TELEPORT: |
| 975 | chance = 10; |
| 976 | break; |
| 977 | case TELEPORT_CONTROL: |
| 978 | chance = 12; |
| 979 | break; |
| 980 | case TELEPAT: |
| 981 | chance = 1; |
| 982 | break; |
| 983 | default: |
| 984 | chance = 15; |
| 985 | break; |
| 986 | } |
| 987 | |
| 988 | return (ptr->mlevel > rn2(chance)); |
| 989 | } |
| 990 | |
| 991 | staticfn boolean |
| 992 | temp_givit(int type, struct permonst *ptr) |