prevent wizard mode user from specifying invalid vampshifter shape when using monpolycontrol to assign a new form to a vampshifter */
| 5025 | /* prevent wizard mode user from specifying invalid vampshifter shape |
| 5026 | when using monpolycontrol to assign a new form to a vampshifter */ |
| 5027 | boolean |
| 5028 | validvamp(struct monst *mon, int *mndx_p, int monclass) |
| 5029 | { |
| 5030 | /* simplify caller's usage */ |
| 5031 | if (!is_vampshifter(mon)) |
| 5032 | return validspecmon(mon, *mndx_p); |
| 5033 | |
| 5034 | if (mon->cham == PM_VLAD_THE_IMPALER && mon_has_special(mon)) { |
| 5035 | /* Vlad with Candelabrum; override choice, then accept it */ |
| 5036 | *mndx_p = PM_VLAD_THE_IMPALER; |
| 5037 | return TRUE; |
| 5038 | } |
| 5039 | if (ismnum(*mndx_p) && is_shapeshifter(&mons[*mndx_p])) { |
| 5040 | /* player picked some type of shapeshifter; use mon's self |
| 5041 | (vampire or chameleon) */ |
| 5042 | *mndx_p = mon->cham; |
| 5043 | return TRUE; |
| 5044 | } |
| 5045 | /* basic vampires can't become wolves; any can become fog or bat |
| 5046 | (we don't enforce upper-case only for rogue level here) */ |
| 5047 | if (*mndx_p == PM_WOLF) |
| 5048 | return (boolean) (mon->cham != PM_VAMPIRE); |
| 5049 | if (*mndx_p == PM_FOG_CLOUD || *mndx_p == PM_VAMPIRE_BAT) |
| 5050 | return TRUE; |
| 5051 | |
| 5052 | /* if we get here, specific type was no good; try by class */ |
| 5053 | switch (monclass) { |
| 5054 | case S_VAMPIRE: |
| 5055 | *mndx_p = mon->cham; |
| 5056 | break; |
| 5057 | case S_BAT: |
| 5058 | *mndx_p = PM_VAMPIRE_BAT; |
| 5059 | break; |
| 5060 | case S_VORTEX: |
| 5061 | *mndx_p = PM_FOG_CLOUD; |
| 5062 | break; |
| 5063 | case S_DOG: |
| 5064 | if (mon->cham != PM_VAMPIRE) { |
| 5065 | *mndx_p = PM_WOLF; |
| 5066 | break; |
| 5067 | } |
| 5068 | FALLTHROUGH; |
| 5069 | /*FALLTHRU*/ |
| 5070 | default: |
| 5071 | *mndx_p = NON_PM; |
| 5072 | break; |
| 5073 | } |
| 5074 | return (boolean) (*mndx_p != NON_PM); |
| 5075 | } |
| 5076 | |
| 5077 | staticfn int |
| 5078 | wiz_force_cham_form(struct monst *mon) |
no test coverage detected