version 1.44 | | version 1.45 |
---|
| | |
/* | | /* |
* static char *rcsid_pets_c = | | * static char *rcsid_pets_c = |
* "$Id: pets.c,v 1.44 2006/06/08 04:30:17 qal21 Exp $"; | | * "$Id: pets.c,v 1.45 2006/08/12 11:31:54 gros Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
if(is_golem) CLEAR_FLAG(tmp, FLAG_MONSTER); | | if(is_golem) CLEAR_FLAG(tmp, FLAG_MONSTER); |
} else { | | } else if(QUERY_FLAG(op, FLAG_FRIENDLY)) { |
if(QUERY_FLAG(op, FLAG_FRIENDLY)) { | | |
object *owner = get_owner(op); | | object *owner = get_owner(op); |
if(owner != NULL) {/* For now, we transfer ownership */ | | if(owner != NULL) {/* For now, we transfer ownership */ |
set_owner(tmp,owner); | | set_owner(tmp,owner); |
| | |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
} | | } |
} | | } |
} | | |
if(op->type!=PLAYER || !is_golem) { | | if(op->type!=PLAYER || !is_golem) { |
tmp->attack_movement = PETMOVE; | | tmp->attack_movement = PETMOVE; |
tmp->speed_left = -1; | | tmp->speed_left = -1; |
| | |
tmp->enemy = op->enemy; | | tmp->enemy = op->enemy; |
} else | | } else |
tmp->type = GOLEM; | | tmp->type = GOLEM; |
| | |
} | | } |
if(head == NULL) | | if(head == NULL) |
head = tmp; | | head = tmp; |
| | |
} | | } |
head->direction = dir; | | head->direction = dir; |
| | |
| | if ((head->type != GOLEM)&&(op->type!= PLAYER)) { |
| | /* It isn't a golem, and the caster wasn't a player; that's probably |
| | * a monster generated from a trap, thus we should give it treasures |
| | * and equipment - gros, 12th August 2006 |
| | */ |
| | if (head && head->randomitems) { |
| | object *htmp; |
| | create_treasure(head->randomitems, head, GT_APPLY | GT_STARTEQUIP, |
| | 6, 0); |
| | for (htmp=head->inv; htmp; htmp=htmp->below) |
| | if (!htmp->nrof) SET_FLAG(htmp, FLAG_NO_DROP); |
| | } |
| | } |
| | |
/* need to change some monster attr to prevent problems/crashing */ | | /* need to change some monster attr to prevent problems/crashing */ |
head->last_heal=0; | | head->last_heal=0; |
head->last_eat=0; | | head->last_eat=0; |