MCPcopy Create free account
hub / github.com/NetHack/NetHack / explosionmask

Function explosionmask

src/explode.c:25–115  ·  view source on GitHub ↗

check if shield effects are needed for location affected by explosion */

Source from the content-addressed store, hash-verified

23
24/* check if shield effects are needed for location affected by explosion */
25staticfn int
26explosionmask(
27 struct monst *m, /* target monster (might be youmonst) */
28 uchar adtyp, /* damage type */
29 char olet) /* object class (only matters for AD_DISN) */
30{
31 int res = EXPL_NONE;
32
33 if (m == &gy.youmonst) {
34 switch (adtyp) {
35 case AD_PHYS:
36 /* leave 'res' with EXPL_NONE */
37 break;
38 case AD_MAGM:
39 if (Antimagic)
40 res = EXPL_HERO;
41 break;
42 case AD_FIRE:
43 if (Fire_resistance)
44 res = EXPL_HERO;
45 break;
46 case AD_COLD:
47 if (Cold_resistance)
48 res = EXPL_HERO;
49 break;
50 case AD_DISN:
51 if ((olet == WAND_CLASS)
52 ? (nonliving(m->data) || is_demon(m->data))
53 : Disint_resistance)
54 res = EXPL_HERO;
55 break;
56 case AD_ELEC:
57 if (Shock_resistance)
58 res = EXPL_HERO;
59 break;
60 case AD_DRST:
61 if (Poison_resistance)
62 res = EXPL_HERO;
63 break;
64 case AD_ACID:
65 if (Acid_resistance)
66 res = EXPL_HERO;
67 break;
68 default:
69 impossible("explosion type %d?", adtyp);
70 break;
71 }
72
73 } else {
74 /* 'm' is a monster */
75 switch (adtyp) {
76 case AD_PHYS:
77 break;
78 case AD_MAGM:
79 if (resists_magm(m))
80 res = EXPL_MON;
81 break;
82 case AD_FIRE:

Callers 1

explodeFunction · 0.85

Calls 2

resists_magmFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected