1 | /* |
1 | /* |
2 | * static char *rcsid_spell_attack_c = |
2 | * static char *rcsid_spell_attack_c = |
3 | * "$Id: spell_attack.c,v 1.1 2006/02/03 07:14:39 root Exp $"; |
3 | * "$Id: spell_attack.c,v 1.2 2006/02/21 11:00:07 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
… | |
… | |
129 | /* check the new dir for a wall and in the map*/ |
129 | /* check the new dir for a wall and in the map*/ |
130 | t_dir = absdir(tmp->direction + new_dir); |
130 | t_dir = absdir(tmp->direction + new_dir); |
131 | |
131 | |
132 | if(get_map_flags(tmp->map,&m, tmp->x + freearr_x[t_dir],tmp->y + freearr_y[t_dir], |
132 | if(get_map_flags(tmp->map,&m, tmp->x + freearr_x[t_dir],tmp->y + freearr_y[t_dir], |
133 | &sx, &sy) & P_OUT_OF_MAP) |
133 | &sx, &sy) & P_OUT_OF_MAP) |
134 | new_dir = 0; |
134 | return; |
135 | |
135 | |
136 | if (OB_TYPE_MOVE_BLOCK(tmp, GET_MAP_MOVE_BLOCK(m, sx, sy))) |
136 | if (OB_TYPE_MOVE_BLOCK(tmp, GET_MAP_MOVE_BLOCK(m, sx, sy))) |
137 | new_dir = 0; |
137 | return; |
138 | |
138 | |
139 | if(new_dir) { /* OK, we made a fork */ |
139 | /* OK, we made a fork */ |
140 | object *new_bolt = get_object(); |
140 | object *new_bolt = get_object(); |
141 | |
141 | |
142 | copy_object(tmp,new_bolt); |
142 | copy_object(tmp,new_bolt); |
143 | |
143 | |
144 | /* reduce chances of subsequent forking */ |
144 | /* reduce chances of subsequent forking */ |
145 | new_bolt->stats.Dex -= 10; |
145 | new_bolt->stats.Dex -= 10; |
146 | tmp->stats.Dex -= 10; /* less forks from main bolt too */ |
146 | tmp->stats.Dex -= 10; /* less forks from main bolt too */ |
147 | new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ |
147 | new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ |
148 | new_bolt->speed_left = -0.1; |
148 | new_bolt->speed_left = -0.1; |
149 | new_bolt->direction = t_dir; |
149 | new_bolt->direction = t_dir; |
150 | new_bolt->duration++; |
150 | new_bolt->duration++; |
151 | new_bolt->x=sx; |
151 | new_bolt->x=sx; |
152 | new_bolt->y=sy; |
152 | new_bolt->y=sy; |
153 | new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */ |
153 | new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */ |
154 | new_bolt->stats.dam++; |
154 | new_bolt->stats.dam++; |
155 | tmp->stats.dam /= 2; /* reduce father bolt damage */ |
155 | tmp->stats.dam /= 2; /* reduce father bolt damage */ |
156 | tmp->stats.dam++; |
156 | tmp->stats.dam++; |
157 | new_bolt = insert_ob_in_map(new_bolt,m,op,0); |
157 | new_bolt = insert_ob_in_map(new_bolt,m,op,0); |
158 | update_turn_face(new_bolt); |
158 | update_turn_face(new_bolt); |
159 | } |
|
|
160 | } |
159 | } |
161 | |
160 | |
162 | /* move_bolt: moves bolt 'op'. Basically, it just advances a space, |
161 | /* move_bolt: moves bolt 'op'. Basically, it just advances a space, |
163 | * and checks for various things that may stop it. |
162 | * and checks for various things that may stop it. |
164 | */ |
163 | */ |