* dmgval returns an integer representing the damage bonuses * of "otmp" against the monster. */
| 213 | * of "otmp" against the monster. |
| 214 | */ |
| 215 | int |
| 216 | dmgval(struct obj *otmp, struct monst *mon) |
| 217 | { |
| 218 | int tmp = 0, otyp = otmp->otyp; |
| 219 | struct permonst *ptr = mon->data; |
| 220 | boolean Is_weapon = (otmp->oclass == WEAPON_CLASS || is_weptool(otmp)); |
| 221 | |
| 222 | if (otyp == CREAM_PIE) |
| 223 | return 0; |
| 224 | |
| 225 | if (bigmonst(ptr)) { |
| 226 | if (objects[otyp].oc_wldam) |
| 227 | tmp = rnd(objects[otyp].oc_wldam); |
| 228 | switch (otyp) { |
| 229 | case IRON_CHAIN: |
| 230 | case CROSSBOW_BOLT: |
| 231 | case MORNING_STAR: |
| 232 | case PARTISAN: |
| 233 | case RUNESWORD: |
| 234 | case ELVEN_BROADSWORD: |
| 235 | case BROADSWORD: |
| 236 | tmp++; |
| 237 | break; |
| 238 | |
| 239 | case FLAIL: |
| 240 | case RANSEUR: |
| 241 | case VOULGE: |
| 242 | tmp += rnd(4); |
| 243 | break; |
| 244 | |
| 245 | case ACID_VENOM: |
| 246 | case HALBERD: |
| 247 | case SPETUM: |
| 248 | tmp += rnd(6); |
| 249 | break; |
| 250 | |
| 251 | case BATTLE_AXE: |
| 252 | case BARDICHE: |
| 253 | case TRIDENT: |
| 254 | tmp += d(2, 4); |
| 255 | break; |
| 256 | |
| 257 | case TSURUGI: |
| 258 | case DWARVISH_MATTOCK: |
| 259 | case TWO_HANDED_SWORD: |
| 260 | tmp += d(2, 6); |
| 261 | break; |
| 262 | } |
| 263 | } else { |
| 264 | if (objects[otyp].oc_wsdam) |
| 265 | tmp = rnd(objects[otyp].oc_wsdam); |
| 266 | switch (otyp) { |
| 267 | case IRON_CHAIN: |
| 268 | case CROSSBOW_BOLT: |
| 269 | case MACE: |
| 270 | case SILVER_MACE: |
| 271 | case WAR_HAMMER: |
| 272 | case FLAIL: |
no test coverage detected