amount of HP to lose from level drain (or gain from Stormbringer) */
| 983 | |
| 984 | /* amount of HP to lose from level drain (or gain from Stormbringer) */ |
| 985 | int |
| 986 | monhp_per_lvl(struct monst *mon) |
| 987 | { |
| 988 | struct permonst *ptr = mon->data; |
| 989 | int hp = rnd(8); /* default is d8 */ |
| 990 | |
| 991 | /* like newmonhp, but home elementals are ignored, riders use normal d8 */ |
| 992 | if (is_golem(ptr)) { |
| 993 | /* draining usually won't be applicable for these critters */ |
| 994 | hp = golemhp(monsndx(ptr)) / (int) ptr->mlevel; |
| 995 | } else if (ptr->mlevel > 49) { |
| 996 | /* arbitrary; such monsters won't be involved in draining anyway */ |
| 997 | hp = 4 + rnd(4); /* 5..8 */ |
| 998 | } else if (ptr->mlet == S_DRAGON && monsndx(ptr) >= PM_GRAY_DRAGON) { |
| 999 | /* adult dragons; newmonhp() uses In_endgame(&u.uz) ? 8 : 4 + rnd(4) |
| 1000 | */ |
| 1001 | hp = 4 + rn2(5); /* 4..8 */ |
| 1002 | } else if (!mon->m_lev) { |
| 1003 | /* level 0 monsters use 1d4 instead of Nd8 */ |
| 1004 | hp = rnd(4); |
| 1005 | } |
| 1006 | return hp; |
| 1007 | } |
| 1008 | |
| 1009 | /* set up a new monster's initial level and hit points; |
| 1010 | used by newcham() as well as by makemon() */ |