| 93 | } |
| 94 | |
| 95 | void |
| 96 | new_were(struct monst *mon) |
| 97 | { |
| 98 | int pm; |
| 99 | |
| 100 | /* neither hero nor werecreature can change from human form to |
| 101 | critter form if hero has Protection_from_shape_changers extrinsic; |
| 102 | if already in critter form, always change to human form for that */ |
| 103 | if (Protection_from_shape_changers && is_human(mon->data)) |
| 104 | return; |
| 105 | |
| 106 | pm = counter_were(monsndx(mon->data)); |
| 107 | if (pm < LOW_PM) { |
| 108 | impossible("unknown lycanthrope %s.", |
| 109 | mon->data->pmnames[NEUTRAL]); |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | if (canseemon(mon) && !Hallucination) |
| 114 | pline("%s changes into a %s.", Monnam(mon), |
| 115 | is_human(&mons[pm]) ? "human" |
| 116 | /* pmname()+4: skip past "were" prefix */ |
| 117 | : pmname(&mons[pm], Mgender(mon)) + 4); |
| 118 | |
| 119 | set_mon_data(mon, &mons[pm]); |
| 120 | if (helpless(mon)) { |
| 121 | /* transformation wakens and/or revitalizes */ |
| 122 | mon->msleeping = 0; |
| 123 | mon->mfrozen = 0; /* not asleep or paralyzed */ |
| 124 | mon->mcanmove = 1; |
| 125 | } |
| 126 | /* regenerate by 1/4 of the lost hit points */ |
| 127 | healmon(mon, (mon->mhpmax - mon->mhp) / 4, 0); |
| 128 | newsym(mon->mx, mon->my); |
| 129 | mon_break_armor(mon, FALSE); |
| 130 | possibly_unwield(mon, FALSE); |
| 131 | |
| 132 | /* vision capability isn't changing so we don't call set_apparxy() to |
| 133 | update mon's idea of where hero is; peaceful check is redundant */ |
| 134 | if (svc.context.mon_moving && !mon->mpeaceful |
| 135 | && onscary(mon->mux, mon->muy, mon) |
| 136 | && monnear(mon, mon->mux, mon->muy)) |
| 137 | monflee(mon, rn1(9, 2), TRUE, TRUE); /* 2..10 turns */ |
| 138 | } |
| 139 | |
| 140 | /* were-creature (even you) summons a horde */ |
| 141 | int |
no test coverage detected