version 1.19 | | version 1.20 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_effect_c = | | * static char *rcsid_spell_effect_c = |
* "$Id: spell_effect.c,v 1.19 2000/06/04 22:26:08 cvs Exp $"; | | * "$Id: spell_effect.c,v 1.20 2000/06/08 16:08:41 jec Exp $"; |
*/ | | */ |
| | |
| | |
| | |
| | |
/* Put the new creature on the map */ | | /* Put the new creature on the map */ |
op->x = x; op->y = y; | | op->x = x; op->y = y; |
insert_ob_in_map(op,map,owner); | | if ((op = insert_ob_in_map (op, map, owner)) == NULL) |
| | return; |
/* It is possible that there is something on the map that kills | | |
* the object when inserted. Unlikely, but worth checking. */ | | |
if (QUERY_FLAG(op, FLAG_FREED)) return; | | |
| | |
/*update_object(op);*/ /*I believe insert_ob_in_map already does this */ | | |
| | |
| | |
if(op->randomitems != NULL) | | if(op->randomitems != NULL) |
create_treasure(op->randomitems,op,GT_INVISIBLE,map->difficulty,0); | | create_treasure(op->randomitems,op,GT_INVISIBLE,map->difficulty,0); |
| | |
10* SP_level_strength_adjust(op,caster,spell_type); | | 10* SP_level_strength_adjust(op,caster,spell_type); |
/* More solid, since they can be torn down */ | | /* More solid, since they can be torn down */ |
tmp->stats.maxhp = tmp->stats.hp; | | tmp->stats.maxhp = tmp->stats.hp; |
#if 0 | | |
/* Don't make them friendly - ends up making them too hard hard for other | | |
* players to kill | | |
*/ | | |
/* | | |
* Now, make agressive monsters tear down the walls: | | |
*/ | | |
SET_FLAG(tmp, FLAG_FRIENDLY); | | |
add_friendly_object(tmp); | | |
#endif | | |
break; | | break; |
case SP_FIRE_WALL: | | case SP_FIRE_WALL: |
tmp=get_archetype("firebreath"); | | tmp=get_archetype("firebreath"); |
| | |
return 0; | | return 0; |
} | | } |
tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; | | tmp->x=op->x+freearr_x[dir],tmp->y=op->y+freearr_y[dir]; |
insert_ob_in_map(tmp,op->map,op); | | if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) { |
| | |
if (QUERY_FLAG(tmp, FLAG_REMOVED)) { | | |
new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall"); | | new_draw_info(NDI_UNIQUE, 0,op,"Something destroys your wall"); |
return 0; | | return 0; |
} | | } |
| | |
| | |
remove_ob(op); | | remove_ob(op); |
op->x=x,op->y=y; | | op->x=x,op->y=y; |
insert_ob_in_map(op,op->map,op); | | if ((op = insert_ob_in_map(op,op->map,op)) != NULL) |
draw(op); | | draw(op); |
return 1; | | return 1; |
} | | } |
| | |
/* Actually move the player now */ | | /* Actually move the player now */ |
remove_ob(op); | | remove_ob(op); |
op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist; | | op->x+=freearr_x[dir]*dist,op->y+=freearr_y[dir]*dist; |
insert_ob_in_map(op,op->map,op); | | if ((op = insert_ob_in_map(op,op->map,op)) == NULL) |
| | return 1; |
draw(op); | | draw(op); |
op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */ | | op->speed_left= -FABS(op->speed)*5; /* Freeze them for a short while */ |
return 1; | | return 1; |
| | |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
} else | | } else if (QUERY_FLAG (op, FLAG_FRIENDLY)) { |
if(QUERY_FLAG(op, FLAG_FRIENDLY)) { | | object *owner = get_owner(op); |
| | if (owner != NULL) { |
| | set_owner (tmp, owner); |
| | tmp->move_type = PETMOVE; |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
tmp->move_type = PETMOVE; | | } |
} else | | } |
tmp->speed_left = -1; | | tmp->speed_left = -1; |
tmp->enemy = op->enemy; | | tmp->enemy = op->enemy; |
tmp->type = 0; | | tmp->type = 0; |
| | |
prev = tmp; | | prev = tmp; |
} | | } |
head->direction = dir; | | head->direction = dir; |
insert_ob_in_map(head, op->map, op); | | head = insert_ob_in_map (head, op->map, op); |
if (!QUERY_FLAG(head, FLAG_FREED) && head->randomitems != NULL) { | | if (head != NULL && head->randomitems != NULL) { |
object *tmp; | | object *tmp; |
create_treasure(head->randomitems,head,GT_INVENTORY,6,0); | | create_treasure(head->randomitems,head,GT_INVENTORY,6,0); |
for(tmp = head->inv; tmp != NULL; tmp = tmp->below) | | for(tmp = head->inv; tmp != NULL; tmp = tmp->below) |
| | |
at = find_archetype("splint"); | | at = find_archetype("splint"); |
for(env=op;env->env!=NULL;env=env->env); | | for(env=op;env->env!=NULL;env=env->env); |
if (op->env) { | | if (op->env) { |
if (op->type==PLAYER) drop(env,op); | | if (env->map == NULL) |
| | return; |
| | if (env->type==PLAYER) drop(env,op); |
else { | | else { |
remove_ob(op); | | remove_ob(op); |
insert_ob_in_map(op, env->map, op); | | if ((op = insert_ob_in_map (op, env->map, op)) == NULL) |
| | return; |
} | | } |
} | | } |
if (env->map == NULL) | | |
return; | | |
if (at) | | if (at) |
for(i=1;i<9;i++) | | for(i=1;i<9;i++) |
fire_arch(op,op,i,at,0,0); | | fire_arch(op,op,i,at,0,0); |
| | |
int missile_plus=0; | | int missile_plus=0; |
char *missile_name; | | char *missile_name; |
object *tmp, *missile; | | object *tmp, *missile; |
| | tag_t tag; |
| | |
missile_name = "arrow"; | | missile_name = "arrow"; |
| | |
| | |
arrows +4 and selling them, even with value = 1 */ | | arrows +4 and selling them, even with value = 1 */ |
| | |
SET_FLAG(missile, FLAG_IDENTIFIED); | | SET_FLAG(missile, FLAG_IDENTIFIED); |
if (!cast_create_obj(op,caster,missile,dir) && op->type==PLAYER) { | | tag = missile->count; |
| | if ( ! cast_create_obj (op, caster, missile, dir) && op->type == PLAYER |
| | && ! was_destroyed (missile, tag)) |
| | { |
tmp= get_owner(op); | | tmp= get_owner(op); |
if (!tmp) | | if (!tmp) |
pick_up(op, missile); | | pick_up(op, missile); |
| | |
free_object(tmp); | | free_object(tmp); |
return 0; | | return 0; |
} | | } |
insert_ob_in_map(tmp,op->map,op); | | if ((tmp = insert_ob_in_map (tmp, op->map, op)) == NULL) |
| | return 1; |
if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) | | if(QUERY_FLAG(tmp, FLAG_BLOCKSVIEW)) |
update_all_los(op->map); | | update_all_los(op->map); |
if(op->type==PLAYER) | | if(op->type==PLAYER) |
| | |
int i; | | int i; |
object *tmp,*effect; | | object *tmp,*effect; |
| | |
| | if (op->type != PLAYER) |
| | return 0; |
for(i=1;i<MIN(9+SP_level_strength_adjust(op,caster,spellnum),SIZEOFFREE);i++) { | | for(i=1;i<MIN(9+SP_level_strength_adjust(op,caster,spellnum),SIZEOFFREE);i++) { |
if (out_of_map(op->map,op->x+freearr_x[i],op->y+freearr_y[i])) | | if (out_of_map(op->map,op->x+freearr_x[i],op->y+freearr_y[i])) |
continue; | | continue; |
| | |
} | | } |
set_owner(tmp,op); | | set_owner(tmp,op); |
SET_FLAG(tmp,FLAG_MONSTER); | | SET_FLAG(tmp,FLAG_MONSTER); |
if(op->type==PLAYER) | | |
tmp->stats.exp = 0; | | |
SET_FLAG(tmp,FLAG_FRIENDLY); | | SET_FLAG(tmp,FLAG_FRIENDLY); |
| | add_friendly_object (tmp); |
| | tmp->stats.exp = 0; |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
} | | } |
return 1; | | return 1; |
| | |
int i,bonus; | | int i,bonus; |
object *tmp,*effect; | | object *tmp,*effect; |
| | |
| | if (op->type != PLAYER) |
| | return 0; |
if (QUERY_FLAG(caster,FLAG_UNDEAD) || strstr(find_god(determine_god(op))->race,undead_name)!=NULL) { | | if (QUERY_FLAG(caster,FLAG_UNDEAD) || strstr(find_god(determine_god(op))->race,undead_name)!=NULL) { |
bonus = 5; | | bonus = 5; |
} else if (strstr(find_god(determine_god(op))->slaying,undead_name)!=NULL) { | | } else if (strstr(find_god(determine_god(op))->slaying,undead_name)!=NULL) { |
| | |
} | | } |
set_owner(tmp,op); | | set_owner(tmp,op); |
SET_FLAG(tmp,FLAG_MONSTER); | | SET_FLAG(tmp,FLAG_MONSTER); |
if(op->type==PLAYER) | | |
tmp->stats.exp = 0; | | |
SET_FLAG(tmp,FLAG_FRIENDLY); | | SET_FLAG(tmp,FLAG_FRIENDLY); |
| | add_friendly_object (tmp); |
| | tmp->stats.exp = 0; |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
} | | } |
return 1; | | return 1; |
| | |
} | | } |
} /* if monster level is much less than character level */ | | } /* if monster level is much less than character level */ |
| | |
insert_ob_in_map(head, op->map, op); | | head = insert_ob_in_map (head, op->map, op); |
if (!QUERY_FLAG(head, FLAG_FREED) && head->randomitems != NULL) { | | if (head != NULL && head->randomitems != NULL) { |
object *tmp; | | object *tmp; |
create_treasure(head->randomitems,head,GT_INVENTORY,6,0); | | create_treasure(head->randomitems,head,GT_INVENTORY,6,0); |
for(tmp = head->inv; tmp != NULL; tmp = tmp->below) | | for(tmp = head->inv; tmp != NULL; tmp = tmp->below) |
| | |
tmp->vulnerable|=god->vulnerable; | | tmp->vulnerable|=god->vulnerable; |
tmp->immune|=god->immune; | | tmp->immune|=god->immune; |
tmp->protected|=god->protected; | | tmp->protected|=god->protected; |
if(tmp->race) free_string(tmp->race); | | if (tmp->race) { |
if(tmp->slaying) free_string(tmp->slaying); | | free_string (tmp->race); |
| | tmp->race = NULL; |
| | } |
| | if (tmp->slaying) { |
| | free_string (tmp->slaying); |
| | tmp->slaying = NULL; |
| | } |
if(god->race) tmp->race = add_string(god->race); | | if(god->race) tmp->race = add_string(god->race); |
if(god->slaying) tmp->slaying = add_string(god->slaying); | | if(god->slaying) tmp->slaying = add_string(god->slaying); |
/* safety, we must allow a god's servants some reasonable attack */ | | /* safety, we must allow a god's servants some reasonable attack */ |
| | |
} 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); |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
} | | } |
} | | } |
| | } |
if(op->type!=PLAYER||type!=GOLEM) { | | if(op->type!=PLAYER||type!=GOLEM) { |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
tmp->speed_left = -1; | | tmp->speed_left = -1; |
| | |
&& !QUERY_FLAG(weapon,FLAG_CURSED) | | && !QUERY_FLAG(weapon,FLAG_CURSED) |
&& !QUERY_FLAG(weapon,FLAG_DAMNED)){ | | && !QUERY_FLAG(weapon,FLAG_DAMNED)){ |
object *owner = get_owner(op); | | object *owner = get_owner(op); |
if(owner != NULL) | | if(owner != NULL) { |
set_owner(tmp,owner); | | set_owner(tmp,owner); |
tmp->move_type = PETMOVE; | | tmp->move_type = PETMOVE; |
add_friendly_object(tmp); | | add_friendly_object(tmp); |
SET_FLAG(tmp, FLAG_FRIENDLY); | | SET_FLAG(tmp, FLAG_FRIENDLY); |
} | | } |
| | } |
/* otherwise, make the golem an enemy */ | | /* otherwise, make the golem an enemy */ |
SET_FLAG(tmp, FLAG_MONSTER); | | SET_FLAG(tmp, FLAG_MONSTER); |
} | | } |
| | |
} | | } |
tmp->armour = 100 - (int)((100.0-(float)tmp->armour)/(30.0-2.0*(a>14?14.0:(float)a))); | | tmp->armour = 100 - (int)((100.0-(float)tmp->armour)/(30.0-2.0*(a>14?14.0:(float)a))); |
/* If the weapon has a Slaying list, so does the golem */ | | /* If the weapon has a Slaying list, so does the golem */ |
if(tmp->slaying) free_string(tmp->slaying); | | if (tmp->slaying) { |
| | free_string (tmp->slaying); |
| | tmp->slaying = NULL; |
| | } |
if(weapon->slaying) tmp->slaying = add_string(weapon->slaying); | | if(weapon->slaying) tmp->slaying = add_string(weapon->slaying); |
| | |
/* Determine golem's speed */ | | /* Determine golem's speed */ |