* Check to see if obj (which has just hit hard something at speed, e.g. * thrown or dropped from height) is going to break, but don't actually * break it. Return 0 if the object isn't going to break, 1 if it is. */
| 2579 | * break it. Return 0 if the object isn't going to break, 1 if it is. |
| 2580 | */ |
| 2581 | boolean |
| 2582 | breaktest(struct obj *obj) |
| 2583 | { |
| 2584 | int nonbreakchance = 1; /* chance for non-artifacts to resist */ |
| 2585 | |
| 2586 | /* this may need to be changed if actual glass armor gets added someday; |
| 2587 | for now, it affects crystal plate mail and helm of brilliance; |
| 2588 | either of them will have to be cracked 4 times before breaking */ |
| 2589 | if (obj->oclass == ARMOR_CLASS && objects[obj->otyp].oc_material == GLASS) |
| 2590 | nonbreakchance = 90; |
| 2591 | |
| 2592 | if (obj_resists(obj, nonbreakchance, 99)) |
| 2593 | return FALSE; |
| 2594 | if (objects[obj->otyp].oc_material == GLASS && !obj->oartifact |
| 2595 | && obj->oclass != GEM_CLASS) |
| 2596 | return TRUE; |
| 2597 | switch (obj->oclass == POTION_CLASS ? POT_WATER : obj->otyp) { |
| 2598 | case EXPENSIVE_CAMERA: |
| 2599 | case POT_WATER: /* really, all potions */ |
| 2600 | case EGG: |
| 2601 | case CREAM_PIE: |
| 2602 | case MELON: |
| 2603 | case ACID_VENOM: |
| 2604 | case BLINDING_VENOM: |
| 2605 | return TRUE; |
| 2606 | default: |
| 2607 | return FALSE; |
| 2608 | } |
| 2609 | } |
| 2610 | |
| 2611 | staticfn void |
| 2612 | breakmsg(struct obj *obj, boolean in_view) |
no test coverage detected