… | |
… | |
252 | for (tmp = GET_MAP_OB (m2, tx, ty); tmp; tmp = tmp->above) |
252 | for (tmp = GET_MAP_OB (m2, tx, ty); tmp; tmp = tmp->above) |
253 | { |
253 | { |
254 | if (tmp->head == op || tmp == op) |
254 | if (tmp->head == op || tmp == op) |
255 | continue; |
255 | continue; |
256 | |
256 | |
257 | if ((QUERY_FLAG (tmp, FLAG_ALIVE) && tmp->type != DOOR)) |
257 | if ((tmp->flag [FLAG_ALIVE] && tmp->type != DOOR)) |
258 | return 1; |
258 | return 1; |
259 | |
259 | |
260 | if (OB_MOVE_BLOCK (op, tmp)) |
260 | if (OB_MOVE_BLOCK (op, tmp)) |
261 | return 1; |
261 | return 1; |
262 | |
262 | |
… | |
… | |
282 | op = op->head; |
282 | op = op->head; |
283 | |
283 | |
284 | x = op->x + freearr_x[dir]; |
284 | x = op->x + freearr_x[dir]; |
285 | y = op->y + freearr_y[dir]; |
285 | y = op->y + freearr_y[dir]; |
286 | |
286 | |
287 | if (!QUERY_FLAG (op, FLAG_CAN_ROLL) |
287 | if (!op->flag [FLAG_CAN_ROLL] |
288 | || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) |
288 | || (op->weight && random_roll (0, op->weight / 50000 - 1, pusher, PREFER_LOW) |
289 | > pusher->stats.Str)) |
289 | > pusher->stats.Str)) |
290 | return 0; |
290 | return 0; |
291 | |
291 | |
292 | m = op->map; |
292 | m = op->map; |
… | |
… | |
342 | if (who->head != NULL) |
342 | if (who->head != NULL) |
343 | who = who->head; |
343 | who = who->head; |
344 | owner = who->owner; |
344 | owner = who->owner; |
345 | |
345 | |
346 | /* Wake up sleeping monsters that may be pushed */ |
346 | /* Wake up sleeping monsters that may be pushed */ |
347 | CLEAR_FLAG (who, FLAG_SLEEP); |
347 | who->clr_flag (FLAG_SLEEP); |
348 | |
348 | |
349 | /* player change place with his pets or summoned creature */ |
349 | /* player change place with his pets or summoned creature */ |
350 | /* TODO: allow multi arch pushing. Can't be very difficult */ |
350 | /* TODO: allow multi arch pushing. Can't be very difficult */ |
351 | if (who->more == NULL |
351 | if (who->more == NULL |
352 | && ((owner && owner->contr && pusher->contr && same_party (owner->contr->party, pusher->contr->party)) |
352 | && ((owner && owner->contr && pusher->contr && same_party (owner->contr->party, pusher->contr->party)) |
… | |
… | |
379 | /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |
379 | /* We want ONLY become enemy of evil, unaggressive monster. We must RUN in them */ |
380 | /* In original we have here a unaggressive check only - that was the reason why */ |
380 | /* In original we have here a unaggressive check only - that was the reason why */ |
381 | /* we so often become an enemy of friendly monsters... */ |
381 | /* we so often become an enemy of friendly monsters... */ |
382 | /* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ |
382 | /* funny: was they set to unaggressive 0 (= not so nice) they don't attack */ |
383 | if (owner != pusher && pusher->type == PLAYER && who->type != PLAYER && |
383 | if (owner != pusher && pusher->type == PLAYER && who->type != PLAYER && |
384 | !QUERY_FLAG (who, FLAG_FRIENDLY) && !QUERY_FLAG (who, FLAG_NEUTRAL)) |
384 | !who->flag [FLAG_FRIENDLY] && !who->flag [FLAG_NEUTRAL]) |
385 | { |
385 | { |
386 | if (pusher->contr->run_on) /* only when we run */ |
386 | if (pusher->contr->run_on) /* only when we run */ |
387 | { |
387 | { |
388 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You start to attack %s!!", &who->name); |
388 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You start to attack %s!!", &who->name); |
389 | CLEAR_FLAG (who, FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
389 | who->clr_flag (FLAG_UNAGGRESSIVE); /* the sucker don't like you anymore */ |
390 | who->enemy = pusher; |
390 | who->enemy = pusher; |
391 | return 1; |
391 | return 1; |
392 | } |
392 | } |
393 | else |
393 | else |
394 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s. H<You have to run if you wish to attack unnagressive NPCs.>", &who->name); |
394 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You avoid attacking %s. H<You have to run if you wish to attack unnagressive NPCs.>", &who->name); |
395 | } |
395 | } |
396 | |
396 | |
397 | /* now, let's test stand still. we NEVER can push stand_still monsters. */ |
397 | /* now, let's test stand still. we NEVER can push stand_still monsters. */ |
398 | if (QUERY_FLAG (who, FLAG_STAND_STILL)) |
398 | if (who->flag [FLAG_STAND_STILL]) |
399 | { |
399 | { |
400 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s. H<You simply can't.>", &who->name); |
400 | new_draw_info_format (NDI_UNIQUE, 0, pusher, "You can't push %s. H<You simply can't.>", &who->name); |
401 | return 0; |
401 | return 0; |
402 | } |
402 | } |
403 | |
403 | |
… | |
… | |
408 | * this pushes the other person away - its not a swap. |
408 | * this pushes the other person away - its not a swap. |
409 | */ |
409 | */ |
410 | |
410 | |
411 | str1 = (who->stats.Str > 0 ? who->stats.Str : who->level); |
411 | str1 = (who->stats.Str > 0 ? who->stats.Str : who->level); |
412 | str2 = (pusher->stats.Str > 0 ? pusher->stats.Str : pusher->level); |
412 | str2 = (pusher->stats.Str > 0 ? pusher->stats.Str : pusher->level); |
413 | if (QUERY_FLAG (who, FLAG_WIZ) || |
413 | if (who->flag [FLAG_WIZ] || |
414 | random_roll (str1, str1 * 5 / 2, who, PREFER_HIGH) >= |
414 | random_roll (str1, str1 * 5 / 2, who, PREFER_HIGH) >= |
415 | random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !who->move (dir)) |
415 | random_roll (str2, str2 * 5 / 2, pusher, PREFER_HIGH) || !who->move (dir)) |
416 | { |
416 | { |
417 | if (who->type == PLAYER) |
417 | if (who->type == PLAYER) |
418 | new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name); |
418 | new_draw_info_format (NDI_UNIQUE, 0, who, "%s tried to push you.", &pusher->name); |