Note: I had to choose one of three possible kinds of "type" when writing * this function: a wand type (like in zap.c), an adtyp, or an object type. * Wand types get complex because they must be converted to adtyps for * determining such things as fire resistance. Adtyps get complex in that * they don't supply enough information--was it a player or a monster that * did it, and with a wand, sp
| 196 | * that Half_physical_damage only affects the damage applied to the hero. |
| 197 | */ |
| 198 | void |
| 199 | explode( |
| 200 | coordxy x, coordxy y, /* explosion's location; |
| 201 | * adjacent spots are also affected */ |
| 202 | int type, /* same as in zap.c; -(wand typ) for some WAND_CLASS */ |
| 203 | int dam, /* damage amount */ |
| 204 | char olet, /* object class or BURNING_OIL or MON_EXPLODE */ |
| 205 | int expltype) /* explosion type: controls color of explosion glyphs */ |
| 206 | { |
| 207 | int i, j, k, damu = dam; |
| 208 | boolean starting = 1; |
| 209 | boolean visible, any_shield; |
| 210 | int uhurt = 0; /* 0=unhurt, 1=items damaged, 2=you and items damaged */ |
| 211 | const char *str = (const char *) 0; |
| 212 | struct monst *mtmp, *mdef = 0; |
| 213 | uchar adtyp; |
| 214 | int explmask[3][3]; /* 0=normal explosion, 1=do shieldeff, 2=do nothing */ |
| 215 | coordxy xx, yy; |
| 216 | boolean shopdamage = FALSE, generic = FALSE, |
| 217 | do_hallu = FALSE, inside_engulfer, grabbed, grabbing; |
| 218 | coord grabxy; |
| 219 | char hallu_buf[BUFSZ], killr_buf[BUFSZ]; |
| 220 | short exploding_wand_typ = 0; |
| 221 | boolean you_exploding = (olet == MON_EXPLODE && type >= 0); |
| 222 | boolean didmsg = FALSE; |
| 223 | |
| 224 | if (olet == WAND_CLASS) { /* retributive strike */ |
| 225 | /* 'type' is passed as (wand's object type * -1); save |
| 226 | object type and convert 'type' itself to zap-type */ |
| 227 | if (type < 0) { |
| 228 | type = -type; |
| 229 | exploding_wand_typ = (short) type; |
| 230 | /* most attack wands produce specific explosions; |
| 231 | other types produce a generic magical explosion */ |
| 232 | if (objects[type].oc_dir == RAY |
| 233 | && type != WAN_DIGGING && type != WAN_SLEEP) { |
| 234 | type -= WAN_MAGIC_MISSILE; |
| 235 | if (type < 0 || type > 9) { |
| 236 | impossible("explode: wand has bad zap type (%d).", type); |
| 237 | type = 0; |
| 238 | } |
| 239 | } else |
| 240 | type = 0; |
| 241 | } |
| 242 | switch (Role_switch) { |
| 243 | case PM_CLERIC: |
| 244 | case PM_MONK: |
| 245 | case PM_WIZARD: |
| 246 | damu /= 5; |
| 247 | break; |
| 248 | case PM_HEALER: |
| 249 | case PM_KNIGHT: |
| 250 | damu /= 2; |
| 251 | break; |
| 252 | default: |
| 253 | break; |
| 254 | } |
| 255 | } else if (olet == BURNING_OIL) { |
no test coverage detected