version 1.26 | | version 1.27 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.26 2000/11/07 00:43:30 peterm Exp $"; | | * "$Id: spell_util.c,v 1.27 2000/11/15 02:57:10 peterm Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
} | | } |
| | |
| | |
| | void forklightning(object *op, object *tmp) { |
| | int new_dir=1; /* direction or -1 for left, +1 for right 0 if no new bolt */ |
| | int t_dir; /* stores temporary dir calculation */ |
| | |
| | /* pick a fork direction. tmp->stats.Con is the left bias |
| | i.e., the chance in 100 of forking LEFT |
| | Should start out at 50, down to 25 for one already going left |
| | down to 0 for one going 90 degrees left off original path*/ |
| | |
| | if(RANDOM()%100 < tmp->stats.Con) /* fork left */ |
| | new_dir = -1; |
| | |
| | /* check the new dir for a wall and in the map*/ |
| | t_dir = absdir(tmp->direction + new_dir); |
| | if(wall(tmp->map,tmp->x + freearr_x[t_dir],tmp->y + freearr_y[t_dir]) |
| | || out_of_map(tmp->map,tmp->x + freearr_x[t_dir],tmp->y + freearr_y[t_dir])) |
| | new_dir = 0; |
| | |
| | if(new_dir) { /* OK, we made a fork */ |
| | object *new_bolt = get_object(); |
| | copy_object(tmp,new_bolt); |
| | |
| | /* reduce chances of subsequent forking */ |
| | new_bolt->stats.Dex -= 10; |
| | tmp->stats.Dex -= 10; /* less forks from main bolt too */ |
| | new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ |
| | new_bolt->speed_left = -0.1; |
| | new_bolt->direction = t_dir; |
| | new_bolt->stats.hp++; |
| | new_bolt->x+=DIRX(new_bolt); |
| | new_bolt->y+=DIRY(new_bolt); |
| | new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */ |
| | new_bolt->stats.dam++; |
| | tmp->stats.dam /= 2; /* reduce father bolt damage */ |
| | tmp->stats.dam++; |
| | new_bolt = insert_ob_in_map(new_bolt,op->map,op); |
| | update_turn_face(new_bolt); |
| | } |
| | } |
| | |
| | |
int reflwall(mapstruct *m,int x,int y) { | | int reflwall(mapstruct *m,int x,int y) { |
object *op; | | object *op; |
if(out_of_map(m,x,y)) return 0; | | if(out_of_map(m,x,y)) return 0; |
| | |
tmp->stats.hp++; | | tmp->stats.hp++; |
tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); | | tmp->x+=DIRX(tmp),tmp->y+=DIRY(tmp); |
tmp = insert_ob_in_map(tmp,op->map,op); | | tmp = insert_ob_in_map(tmp,op->map,op); |
| | |
| | /* New forking code. Possibly create forks of this object |
| | going off in other directions. */ |
| | |
| | if(RANDOM()%100< tmp->stats.Dex) { /* stats.Dex % of forking */ |
| | forklightning(op,tmp); |
| | } |
if (tmp) { | | if (tmp) { |
if ( ! tmp->stats.food) { | | if ( ! tmp->stats.food) { |
tmp->stats.food = 1; | | tmp->stats.food = 1; |