Revive the corpse via a timeout. */ ARGSUSED*/
| 2248 | /* Revive the corpse via a timeout. */ |
| 2249 | /*ARGSUSED*/ |
| 2250 | void |
| 2251 | revive_mon(anything *arg, long timeout UNUSED) |
| 2252 | { |
| 2253 | struct obj *body = arg->a_obj; |
| 2254 | struct permonst *mptr = &mons[body->corpsenm]; |
| 2255 | struct monst *mtmp; |
| 2256 | coordxy x, y; |
| 2257 | |
| 2258 | /* corpse will revive somewhere else if there is a monster in the way; |
| 2259 | Riders get a chance to try to bump the obstacle out of their way */ |
| 2260 | if (is_displacer(mptr) && body->where == OBJ_FLOOR |
| 2261 | && get_obj_location(body, &x, &y, 0) && (mtmp = m_at(x, y)) != 0 && |
| 2262 | svl.level.flags.stasis_until < svm.moves) { |
| 2263 | boolean notice_it = canseemon(mtmp); /* before rloc() */ |
| 2264 | char *monname = Monnam(mtmp); |
| 2265 | |
| 2266 | if (rloc(mtmp, RLOC_NOMSG)) { |
| 2267 | if (notice_it && !canseemon(mtmp)) |
| 2268 | pline("%s vanishes.", monname); |
| 2269 | else if (!notice_it && canseemon(mtmp)) |
| 2270 | pline("%s appears.", Monnam(mtmp)); /* not pre-rloc monname */ |
| 2271 | else if (notice_it && dist2(mtmp->mx, mtmp->my, x, y) > 2) |
| 2272 | pline("%s teleports.", monname); /* saw it and still see it */ |
| 2273 | } |
| 2274 | } |
| 2275 | |
| 2276 | /* if we succeed, the corpse is gone */ |
| 2277 | if (!revive_corpse(body)) { |
| 2278 | long when; |
| 2279 | int action; |
| 2280 | |
| 2281 | if (is_rider(mptr) && rn2(99)) { /* Rider usually tries again */ |
| 2282 | action = REVIVE_MON; |
| 2283 | when = rider_revival_time(body, TRUE); |
| 2284 | } else { /* rot this corpse away */ |
| 2285 | if (!obj_has_timer(body, ROT_CORPSE)) |
| 2286 | You_feel("%sless hassled.", is_rider(mptr) ? "much " : ""); |
| 2287 | action = ROT_CORPSE; |
| 2288 | when = (long) d(5, 50) - (svm.moves - body->age); |
| 2289 | if (when < 1L) |
| 2290 | when = 1L; |
| 2291 | } |
| 2292 | if (!obj_has_timer(body, action)) |
| 2293 | (void) start_timer(when, TIMER_OBJECT, action, arg); |
| 2294 | } |
| 2295 | } |
| 2296 | |
| 2297 | /* Timeout callback. Revive the corpse as a zombie. */ |
| 2298 | void |
no test coverage detected