… | |
… | |
46 | did_make_save_item (object *op, int type, object *originator) |
46 | did_make_save_item (object *op, int type, object *originator) |
47 | { |
47 | { |
48 | int i, roll, saves = 0, attacks = 0, number; |
48 | int i, roll, saves = 0, attacks = 0, number; |
49 | materialtype_t *mt = op->material; |
49 | materialtype_t *mt = op->material; |
50 | |
50 | |
|
|
51 | // destroying objects without material has many bad effects |
|
|
52 | if (mt == MATERIAL_NULL) |
|
|
53 | return 1; |
|
|
54 | |
51 | roll = rndm (1, 20); |
55 | roll = rndm (1, 20); |
52 | |
56 | |
53 | /* the attacktypes have no meaning for object saves |
57 | /* the attacktypes have no meaning for object saves |
54 | * If the type is only magic, don't adjust type - basically, if |
58 | * If the type is only magic, don't adjust type - basically, if |
55 | * pure magic is hitting an object, it should save. However, if it |
59 | * pure magic is hitting an object, it should save. However, if it |
… | |
… | |
180 | else |
184 | else |
181 | m->insert (op, x, y, originator); |
185 | m->insert (op, x, y, originator); |
182 | } |
186 | } |
183 | } |
187 | } |
184 | } |
188 | } |
|
|
189 | |
185 | return; |
190 | return; |
186 | } |
191 | } |
187 | |
192 | |
188 | if (type & AT_CANCELLATION) |
193 | if (type & AT_CANCELLATION) |
189 | { /* Cancellation. */ |
194 | { /* Cancellation. */ |
190 | cancellation (op); |
195 | cancellation (op); |
191 | fix_stopped_item (op, m, originator); |
196 | fix_stopped_item (op, m, originator); |
|
|
197 | |
192 | return; |
198 | return; |
193 | } |
|
|
194 | |
|
|
195 | if (op->nrof > 1) |
|
|
196 | { |
|
|
197 | if (op->decrease (rndm (0, op->nrof - 1))) |
|
|
198 | fix_stopped_item (op, m, originator); |
|
|
199 | } |
|
|
200 | else |
|
|
201 | { |
|
|
202 | // drop everything to the ground, if possible |
|
|
203 | op->insert_at (originator); |
|
|
204 | op->drop_and_destroy (); |
|
|
205 | } |
199 | } |
206 | |
200 | |
207 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
201 | if (type & (AT_FIRE | AT_ELECTRICITY)) |
208 | if (env) |
202 | if (env) |
209 | { |
203 | { |
… | |
… | |
212 | env->insert (op); |
206 | env->insert (op); |
213 | } |
207 | } |
214 | else |
208 | else |
215 | replace_insert_ob_in_map (shstr_burnout, originator); |
209 | replace_insert_ob_in_map (shstr_burnout, originator); |
216 | |
210 | |
|
|
211 | if (op->nrof > 1) |
|
|
212 | { |
|
|
213 | if (op->decrease (rndm (0, op->nrof - 1))) |
|
|
214 | fix_stopped_item (op, m, originator); |
|
|
215 | } |
|
|
216 | else |
|
|
217 | { |
|
|
218 | // drop everything to the ground, if possible |
|
|
219 | op->insert_at (originator); |
|
|
220 | op->drop_and_destroy (); |
|
|
221 | } |
|
|
222 | |
217 | return; |
223 | return; |
218 | } |
224 | } |
219 | |
225 | |
220 | /* The value of 50 is arbitrary. */ |
226 | /* The value of 50 is arbitrary. */ |
221 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && rndm (2)) |
227 | if (type & AT_COLD && (op->resist[ATNR_COLD] < 50) && !QUERY_FLAG (op, FLAG_NO_PICK) && rndm (2)) |
… | |
… | |
353 | * NO_PASS set, it is also immune - you can't destroy walls. Note |
359 | * NO_PASS set, it is also immune - you can't destroy walls. Note |
354 | * that weak walls have is_alive set, which prevent objects from |
360 | * that weak walls have is_alive set, which prevent objects from |
355 | * passing over/through them. We don't care what type of movement |
361 | * passing over/through them. We don't care what type of movement |
356 | * the wall blocks - if it blocks any type of movement, can't be |
362 | * the wall blocks - if it blocks any type of movement, can't be |
357 | * destroyed right now. |
363 | * destroyed right now. |
|
|
364 | * Without the material check the server completely fails to work, |
|
|
365 | * objects detsroy themselves, floors get destroyed etc. etc. |
358 | */ |
366 | */ |
359 | else if (op->stats.dam > 0 && !tmp->move_block) |
367 | else if (op->stats.dam > 0 && !tmp->move_block && tmp->material != MATERIAL_NULL) |
360 | { |
368 | { |
361 | save_throw_object (tmp, type, op); |
369 | save_throw_object (tmp, type, op); |
362 | |
370 | |
363 | if (op->destroyed ()) |
371 | if (op->destroyed ()) |
364 | break; |
372 | break; |