version 1.41 | | version 1.42 |
---|
| | |
/* | | /* |
* static char *rcsid_pets_c = | | * static char *rcsid_pets_c = |
* "$Id: pets.c,v 1.41 2006/01/07 18:13:50 akirschbaum Exp $"; | | * "$Id: pets.c,v 1.42 2006/05/05 08:52:02 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
| | |
if(!dir) | | if(!dir) |
dir=find_free_spot(NULL,op->map,op->x,op->y,1,9); | | dir=find_free_spot(NULL,op->map,op->x,op->y,1,SIZEOFFREE1+1); |
| | |
if ((dir==-1) || ob_blocked(&at->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { | | if ((dir==-1) || ob_blocked(&at->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { |
new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0,op,"There is something in the way."); |
| | |
{ | | { |
sint16 x,y, nrof=1, i; | | sint16 x,y, nrof=1, i; |
archetype *summon_arch; | | archetype *summon_arch; |
| | int ndir; |
| | |
if (spell_ob->other_arch) { | | if (spell_ob->other_arch) { |
summon_arch = spell_ob->other_arch; | | summon_arch = spell_ob->other_arch; |
| | |
| | |
} else if (spell_ob->race && !strcmp(spell_ob->race,"GODCULTMON")) { | | } else if (spell_ob->race && !strcmp(spell_ob->race,"GODCULTMON")) { |
object *god=find_god(determine_god(op)), *mon, *owner; | | object *god=find_god(determine_god(op)), *mon, *owner; |
int summon_level, tries, ndir; | | int summon_level, tries; |
| | |
if (!god && ((owner=get_owner(op))!=NULL)) { | | if (!god && ((owner=get_owner(op))!=NULL)) { |
god = find_god(determine_god(owner)); | | god = find_god(determine_god(owner)); |
| | |
return 0; | | return 0; |
} | | } |
| | |
if (!dir) | | for (i=1; i <= nrof; i++) { |
dir = find_free_spot(&summon_arch->clone, op->map, op->x, op->y, 1, SIZEOFFREE); | | archetype *atmp; |
| | object *prev=NULL, *head=NULL, *tmp; |
| | |
if (dir > 0) { | | if (dir) { |
x = op->x + freearr_x[dir]; | | ndir = dir; |
y = op->y + freearr_y[dir]; | | dir = absdir (dir+1); |
} else { | | } else |
x = 0; | | ndir = find_free_spot(&summon_arch->clone, op->map, op->x, op->y, 1, SIZEOFFREE); |
y = 0; | | |
| | if (ndir > 0) { |
| | x = freearr_x[ndir]; |
| | y = freearr_y[ndir]; |
} | | } |
| | |
if (dir == -1 || ob_blocked(&summon_arch->clone, op->map, x, y)){ | | if (ndir == -1 || ob_blocked(&summon_arch->clone, op->map, op->x + x, op->y + y)){ |
new_draw_info(NDI_UNIQUE, 0, op, "There is something in the way."); | | new_draw_info(NDI_UNIQUE, 0, op, "There is something in the way."); |
return 0; | | if (nrof > 1) |
} | | new_draw_info(NDI_UNIQUE, 0,op, "No more pets for this casting."); |
| | |
for (i=1; i <= nrof; i++) { | | return nrof > 1; |
archetype *atmp; | | } |
object *prev=NULL, *head=NULL, *tmp; | | |
| | |
for (atmp = summon_arch; atmp!=NULL; atmp=atmp->more) { | | for (atmp = summon_arch; atmp!=NULL; atmp=atmp->more) { |
tmp = arch_to_object(atmp); | | tmp = arch_to_object(atmp); |
| | |
prev->more = tmp; | | prev->more = tmp; |
} | | } |
prev = tmp; | | prev = tmp; |
tmp->x = op->x + freearr_x[dir] + tmp->arch->clone.x; | | tmp->x = op->x + x + tmp->arch->clone.x; |
tmp->y = op->y + freearr_y[dir] + tmp->arch->clone.y; | | tmp->y = op->y + y + tmp->arch->clone.y; |
tmp->map = op->map; | | tmp->map = op->map; |
} | | } |
head->direction = dir; | | head->direction = freedir[ndir]; |
head->stats.exp = 0; | | head->stats.exp = 0; |
head = insert_ob_in_map(head, head->map, op, 0); | | head = insert_ob_in_map(head, head->map, op, 0); |
if (head && head->randomitems) { | | if (head && head->randomitems) { |
| | |
for (tmp=head->inv; tmp; tmp=tmp->below) | | for (tmp=head->inv; tmp; tmp=tmp->below) |
if (!tmp->nrof) SET_FLAG(tmp, FLAG_NO_DROP); | | if (!tmp->nrof) SET_FLAG(tmp, FLAG_NO_DROP); |
} | | } |
dir = absdir(dir + 1); | | |
if (ob_blocked(&summon_arch->clone, op->map, op->x + freearr_x[dir], op->y + freearr_y[dir])) { | | |
if (i < nrof) { | | |
new_draw_info(NDI_UNIQUE, 0,op, "There is something in the way,"); | | |
new_draw_info(NDI_UNIQUE, 0,op, "No more pets for this casting."); | | |
return 1; | | |
} | | |
} | | |
} /* for i < nrof */ | | } /* for i < nrof */ |
return 1; | | return 1; |
} | | } |