version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.10 2000/04/25 04:53:00 cvs Exp $"; | | * "$Id: spell_util.c,v 1.11 2000/05/22 13:06:15 jec Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
Later added a ball-lightning firing routine. | | Later added a ball-lightning firing routine. |
* dir is direction, at is spell we are firing. Type is index of spell | | * dir is direction, at is spell we are firing. Type is index of spell |
* array. If magic is 1, then add magical attacktype to spell. | | * array. If magic is 1, then add magical attacktype to spell. |
* op is the owner of the spell (player who gets exp), caster is the | | * op is either the owner of the spell (player who gets exp) or the |
* casting object. | | * casting object owned by the owner. caster is the casting object. |
*/ | | */ |
| | |
int fire_arch (object *op, object *caster, int dir, archetype *at, int type, | | int fire_arch (object *op, object *caster, int dir, archetype *at, int type, |
| | |
tmp->stats.hp=SP_PARAMETERS[type].bdur+SP_level_strength_adjust(op,caster,type); | | tmp->stats.hp=SP_PARAMETERS[type].bdur+SP_level_strength_adjust(op,caster,type); |
tmp->x=x, tmp->y=y; | | tmp->x=x, tmp->y=y; |
tmp->direction=dir; | | tmp->direction=dir; |
| | if (get_owner (op) != NULL) |
| | copy_owner (tmp, op); |
| | else |
set_owner(tmp,op); | | set_owner(tmp,op); |
tmp->level = casting_level (caster, type); | | tmp->level = casting_level (caster, type); |
#ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */ | | #ifdef MULTIPLE_GODS /* needed for AT_HOLYWORD,AT_GODPOWER stuff */ |
| | |
} | | } |
| | |
int explode_object(object *op) { | | int explode_object(object *op) { |
object *tmp, *victim, *owner, *env; | | object *tmp, *victim, *env; |
| | |
if(out_of_map(op->map,op->x,op->y)) /* peterm: check for out of map obj's.*/ | | if(out_of_map(op->map,op->x,op->y)) /* peterm: check for out of map obj's.*/ |
{ | | { |
| | |
*/ | | */ |
| | |
/* op->stats.sp stores the spell which made this object here. */ | | /* op->stats.sp stores the spell which made this object here. */ |
if(op->owner) | | tmp->stats.dam += SP_level_dam_adjust(op,op,op->stats.sp); |
tmp->stats.dam += SP_level_dam_adjust(op->owner,op->owner,op->stats.sp); | | |
if(op->attacktype&AT_MAGIC) | | if(op->attacktype&AT_MAGIC) |
tmp->attacktype|=AT_MAGIC; | | tmp->attacktype|=AT_MAGIC; |
if((owner = get_owner(op)) != (object *) NULL) { | | copy_owner (tmp, op); |
set_owner(tmp,owner); | | |
if(op->chosen_skill && (op->chosen_skill != tmp->chosen_skill)){ | | |
tmp->exp_obj = op->exp_obj; | | |
tmp->chosen_skill = op->chosen_skill; | | |
} | | |
} | | |
if(op->stats.hp) | | if(op->stats.hp) |
tmp->stats.hp=op->stats.hp; | | tmp->stats.hp=op->stats.hp; |
tmp->stats.maxhp=op->count; /* Unique ID */ | | tmp->stats.maxhp=op->count; /* Unique ID */ |
| | |
{ | | { |
sint16 x,y; | | sint16 x,y; |
int di; | | int di; |
object *owner = get_owner (op); | | |
| | |
if(op->stats.hp == 0 || owner == NULL) { | | if(op->stats.hp == 0 || get_owner (op) == NULL) { |
remove_ob(op); | | remove_ob(op); |
free_object(op); | | free_object(op); |
return; | | return; |
| | |
/* for level dependence, we need to know what spell is fired. */ | | /* for level dependence, we need to know what spell is fired. */ |
/* that's stored in op->stats.sp by fire_swarm */ | | /* that's stored in op->stats.sp by fire_swarm */ |
if ( ! wall (op->map, x, y)) | | if ( ! wall (op->map, x, y)) |
fire_arch_from_position (owner, op, x, y, op->direction, op->other_arch, | | fire_arch_from_position (op, op, x, y, op->direction, op->other_arch, |
op->stats.sp, op->magic); | | op->stats.sp, op->magic); |
} | | } |
| | |
| | |
set_owner(tmp,op); /* needed so that if swarm elements kill, caster gets xp.*/ | | set_owner(tmp,op); /* needed so that if swarm elements kill, caster gets xp.*/ |
tmp->level=casting_level(caster, spell_type); /*needed later, to get level dep. right.*/ | | tmp->level=casting_level(caster, spell_type); /*needed later, to get level dep. right.*/ |
tmp->stats.sp=spell_type; /* needed later, see move_swarm_spell */ | | tmp->stats.sp=spell_type; /* needed later, see move_swarm_spell */ |
| | #ifdef MULTIPLE_GODS |
| | tmp->attacktype = swarm_type->clone.attacktype; |
| | if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) { |
| | if ( ! tailor_god_spell (tmp, op)) |
| | return; |
| | } |
| | #endif |
tmp->magic = magic; | | tmp->magic = magic; |
tmp->stats.hp=n; /* n in swarm*/ | | tmp->stats.hp=n; /* n in swarm*/ |
tmp->other_arch=swarm_type; /* the archetype of the things to be fired*/ | | tmp->other_arch=swarm_type; /* the archetype of the things to be fired*/ |