monster might spin a web */
| 1266 | |
| 1267 | /* monster might spin a web */ |
| 1268 | staticfn void |
| 1269 | maybe_spin_web(struct monst *mtmp) |
| 1270 | { |
| 1271 | if (webmaker(mtmp->data) |
| 1272 | && !helpless(mtmp) && !mtmp->mspec_used |
| 1273 | && !t_at(mtmp->mx, mtmp->my) && soko_allow_web(mtmp)) { |
| 1274 | struct trap *trap; |
| 1275 | int prob = ((((mtmp->data == &mons[PM_GIANT_SPIDER]) ? 15 : 5) |
| 1276 | * (count_webbing_walls(mtmp->mx, mtmp->my) + 1)) |
| 1277 | - (3 * count_traps(WEB))); |
| 1278 | |
| 1279 | if (rn2(1000) < prob |
| 1280 | && (trap = maketrap(mtmp->mx, mtmp->my, WEB)) != 0) { |
| 1281 | mtmp->mspec_used = d(4, 4); /* 4..16 */ |
| 1282 | if (cansee(mtmp->mx, mtmp->my)) { |
| 1283 | char mbuf[BUFSZ]; |
| 1284 | |
| 1285 | Strcpy(mbuf, canspotmon(mtmp) ? y_monnam(mtmp) : something); |
| 1286 | pline_mon(mtmp, "%s spins a web.", upstart(mbuf)); |
| 1287 | trap->tseen = 1; |
| 1288 | } |
| 1289 | if (*in_rooms(mtmp->mx, mtmp->my, SHOPBASE)) |
| 1290 | add_damage(mtmp->mx, mtmp->my, 0L); |
| 1291 | } |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | /* monster avoids a location nx, ny, if hero kicked that location */ |
| 1296 | boolean |
no test coverage detected