random chance of applying erosions/grease to object */
| 193 | |
| 194 | /* random chance of applying erosions/grease to object */ |
| 195 | staticfn void |
| 196 | mkobj_erosions(struct obj *otmp) |
| 197 | { |
| 198 | if (may_generate_eroded(otmp)) { |
| 199 | /* A small fraction of non-artifact items will generate eroded or |
| 200 | * possibly erodeproof. An item that generates eroded will never be |
| 201 | * erodeproof, and vice versa. */ |
| 202 | if (!rn2(100)) { |
| 203 | otmp->oerodeproof = 1; |
| 204 | } else { |
| 205 | if (!rn2(80) && (is_flammable(otmp) || is_rustprone(otmp) |
| 206 | || is_crackable(otmp))) { |
| 207 | do { |
| 208 | otmp->oeroded++; |
| 209 | } while (otmp->oeroded < 3 && !rn2(9)); |
| 210 | } |
| 211 | if (!rn2(80) && (is_rottable(otmp) || is_corrodeable(otmp))) { |
| 212 | do { |
| 213 | otmp->oeroded2++; |
| 214 | } while (otmp->oeroded2 < 3 && !rn2(9)); |
| 215 | } |
| 216 | } |
| 217 | /* and an extremely small fraction of the time, erodable items |
| 218 | * will generate greased */ |
| 219 | if (!rn2(1000)) |
| 220 | otmp->greased = 1; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | /* make a random object of class 'let' at a specific location; |
| 225 | 'let' might be random class; place_object() will validate <x,y> */ |
no test coverage detected