1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_attack_c = |
3 | * static char *rcsid_attack_c = |
4 | * "$Id: attack.C,v 1.12 2006/09/12 19:20:08 root Exp $"; |
4 | * "$Id: attack.C,v 1.13 2006/09/14 00:14:51 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
177 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
177 | if (type & (AT_FIRE | AT_ELECTRICITY) && op->other_arch && QUERY_FLAG (op, FLAG_IS_LIGHTABLE)) |
178 | { |
178 | { |
179 | const char *arch = op->other_arch->name; |
179 | const char *arch = op->other_arch->name; |
180 | |
180 | |
181 | op = decrease_ob_nr (op, 1); |
181 | op = decrease_ob_nr (op, 1); |
|
|
182 | |
182 | if (op) |
183 | if (op) |
183 | fix_stopped_item (op, m, originator); |
184 | fix_stopped_item (op, m, originator); |
|
|
185 | |
184 | if ((op = get_archetype (arch)) != NULL) |
186 | if ((op = get_archetype (arch)) != NULL) |
185 | { |
187 | { |
186 | if (env) |
188 | if (env) |
187 | { |
189 | { |
188 | op->x = env->x, op->y = env->y; |
190 | op->x = env->x, op->y = env->y; |
… | |
… | |
194 | { |
196 | { |
195 | op->x = x, op->y = y; |
197 | op->x = x, op->y = y; |
196 | insert_ob_in_map (op, m, originator, 0); |
198 | insert_ob_in_map (op, m, originator, 0); |
197 | } |
199 | } |
198 | } |
200 | } |
|
|
201 | |
199 | return; |
202 | return; |
200 | } |
203 | } |
|
|
204 | |
201 | if (type & AT_CANCELLATION) |
205 | if (type & AT_CANCELLATION) |
202 | { /* Cancellation. */ |
206 | { /* Cancellation. */ |
203 | cancellation (op); |
207 | cancellation (op); |
204 | fix_stopped_item (op, m, originator); |
208 | fix_stopped_item (op, m, originator); |
205 | return; |
209 | return; |
206 | } |
210 | } |
|
|
211 | |
207 | if (op->nrof > 1) |
212 | if (op->nrof > 1) |
208 | { |
213 | { |
209 | op = decrease_ob_nr (op, rndm (0, op->nrof - 1)); |
214 | op = decrease_ob_nr (op, rndm (0, op->nrof - 1)); |
|
|
215 | |
210 | if (op) |
216 | if (op) |
211 | fix_stopped_item (op, m, originator); |
217 | fix_stopped_item (op, m, originator); |
212 | } |
218 | } |
213 | else |
219 | else |
214 | { |
220 | { |
215 | if (op->env) |
221 | if (op->env) |
216 | { |
222 | { |
217 | object *tmp = is_player_inv (op->env); |
223 | object *tmp = is_player_inv (op->env); |
218 | |
224 | |
219 | if (tmp) |
225 | if (tmp) |
220 | { |
|
|
221 | esrv_del_item (tmp->contr, op->count); |
226 | esrv_del_item (tmp->contr, op->count); |
222 | } |
|
|
223 | } |
227 | } |
|
|
228 | |
224 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
229 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
225 | remove_ob (op); |
230 | remove_ob (op); |
|
|
231 | |
226 | free_object (op); |
232 | free_object (op); |
227 | } |
233 | } |
|
|
234 | |
228 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
235 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
229 | { |
|
|
230 | if (env) |
236 | if (env) |
231 | { |
237 | { |
232 | op = get_archetype ("burnout"); |
238 | op = get_archetype ("burnout"); |
233 | op->x = env->x, op->y = env->y; |
239 | op->x = env->x, op->y = env->y; |
234 | insert_ob_in_ob (op, env); |
240 | insert_ob_in_ob (op, env); |
235 | } |
241 | } |
236 | else |
242 | else |
237 | { |
|
|
238 | replace_insert_ob_in_map ("burnout", originator); |
243 | replace_insert_ob_in_map ("burnout", originator); |
239 | } |
244 | |
240 | } |
|
|
241 | return; |
245 | return; |
242 | } |
246 | } |
243 | /* The value of 50 is arbitrary. */ |
247 | /* The value of 50 is arbitrary. */ |
244 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) |
248 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && (RANDOM () & 2)) |
245 | { |
249 | { |