… | |
… | |
678 | } |
678 | } |
679 | |
679 | |
680 | if (!dir) |
680 | if (!dir) |
681 | dir = find_free_spot (at, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1); |
681 | dir = find_free_spot (at, op->map, op->x, op->y, 1, SIZEOFFREE1 + 1); |
682 | |
682 | |
683 | if (dir < 0 || ob_blocked (at, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) |
683 | if (dir < 0 || at->blocked (op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) |
684 | { |
684 | { |
685 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
685 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
686 | return 0; |
686 | return 0; |
687 | } |
687 | } |
688 | |
688 | |
… | |
… | |
695 | } |
695 | } |
696 | |
696 | |
697 | if (op->type == PLAYER) |
697 | if (op->type == PLAYER) |
698 | { |
698 | { |
699 | tmp->type = GOLEM; |
699 | tmp->type = GOLEM; |
700 | tmp->set_owner (op); |
|
|
701 | op->contr->golem = tmp; |
700 | op->contr->golem = tmp; |
702 | /* give the player control of the golem */ |
701 | /* give the player control of the golem */ |
703 | set_spell_skill (op, caster, spob, tmp); |
702 | set_spell_skill (op, caster, spob, tmp); |
704 | } |
|
|
705 | else |
|
|
706 | { |
|
|
707 | if (QUERY_FLAG (op, FLAG_FRIENDLY)) |
|
|
708 | { |
|
|
709 | object *owner = op->owner; |
|
|
710 | |
|
|
711 | if (owner) |
|
|
712 | { /* For now, we transfer ownership */ |
|
|
713 | tmp->set_owner (owner); |
|
|
714 | tmp->attack_movement = PETMOVE; |
|
|
715 | add_friendly_object (tmp); |
|
|
716 | } |
|
|
717 | } |
|
|
718 | |
|
|
719 | SET_FLAG (tmp, FLAG_MONSTER); |
|
|
720 | } |
703 | } |
721 | |
704 | |
722 | /* make the speed positive. */ |
705 | /* make the speed positive. */ |
723 | tmp->speed = FABS (tmp->speed); |
706 | tmp->speed = FABS (tmp->speed); |
724 | |
707 | |
… | |
… | |
949 | ndir = dir; |
932 | ndir = dir; |
950 | |
933 | |
951 | if (!ndir) |
934 | if (!ndir) |
952 | ndir = find_free_spot (mon, op->map, op->x, op->y, 1, SIZEOFFREE); |
935 | ndir = find_free_spot (mon, op->map, op->x, op->y, 1, SIZEOFFREE); |
953 | |
936 | |
954 | if (ndir < 0 || ob_blocked (mon, op->map, op->x + freearr_x[ndir], op->y + freearr_y[ndir])) |
937 | if (ndir < 0 || mon->blocked (op->map, op->x + freearr_x[ndir], op->y + freearr_y[ndir])) |
955 | { |
938 | { |
956 | ndir = -1; |
939 | ndir = -1; |
957 | if (++tries == 5) |
940 | if (++tries == 5) |
958 | { |
941 | { |
959 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
942 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
… | |
… | |
998 | { |
981 | { |
999 | x = freearr_x[ndir]; |
982 | x = freearr_x[ndir]; |
1000 | y = freearr_y[ndir]; |
983 | y = freearr_y[ndir]; |
1001 | } |
984 | } |
1002 | |
985 | |
1003 | if (ndir < 0 || ob_blocked (summon_arch, op->map, op->x + x, op->y + y)) |
986 | if (ndir < 0 || summon_arch->blocked (op->map, op->x + x, op->y + y)) |
1004 | { |
987 | { |
1005 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
988 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
1006 | if (nrof > 1) |
989 | if (nrof > 1) |
1007 | new_draw_info (NDI_UNIQUE, 0, op, "No more pets for this casting."); |
990 | new_draw_info (NDI_UNIQUE, 0, op, "No more pets for this casting."); |
1008 | |
991 | |