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

Function explum

src/uhitm.c:4890–4928  ·  view source on GitHub ↗

Hero, as a monster which is capable of an exploding attack mattk, is * exploding at a target monster mdef, or just exploding at nothing (e.g. with * forcefight) if mdef is null. */

Source from the content-addressed store, hash-verified

4888 * forcefight) if mdef is null.
4889 */
4890int
4891explum(struct monst *mdef, struct attack *mattk)
4892{
4893 int tmp = d((int) mattk->damn, (int) mattk->damd);
4894
4895 switch (mattk->adtyp) {
4896 case AD_BLND:
4897 if (mdef && !resists_blnd(mdef)) {
4898 pline("%s is blinded by your flash of light!", Monnam(mdef));
4899 mdef->mblinded = min((int) mdef->mblinded + tmp, 127);
4900 mdef->mcansee = 0;
4901 }
4902 break;
4903 case AD_HALU:
4904 if (mdef && haseyes(mdef->data) && mdef->mcansee) {
4905 pline("%s is affected by your flash of light!", Monnam(mdef));
4906 mdef->mconf = 1;
4907 }
4908 break;
4909 case AD_COLD:
4910 case AD_FIRE:
4911 case AD_ELEC:
4912 /* See comment in mon_explodes() and in zap.c for an explanation
4913 of this math. Here, the player is causing the explosion, so it
4914 should be in the +20 to +29 range instead of negative. */
4915 explode(u.ux, u.uy, (mattk->adtyp - 1) + 20, tmp, MON_EXPLODE,
4916 adtyp_to_expltype(mattk->adtyp));
4917 if (mdef && DEADMONSTER(mdef)) {
4918 /* Other monsters may have died too, but return this if the actual
4919 target died. */
4920 return M_ATTK_DEF_DIED;
4921 }
4922 break;
4923 default:
4924 break;
4925 }
4926 wake_nearto(u.ux, u.uy, 7 * 7); /* same radius as exploding monster */
4927 return M_ATTK_HIT;
4928}
4929
4930staticfn void
4931start_engulf(struct monst *mdef)

Callers 2

hmonasFunction · 0.85
domove_fight_emptyFunction · 0.85

Calls 7

dFunction · 0.85
resists_blndFunction · 0.85
MonnamFunction · 0.85
explodeFunction · 0.85
adtyp_to_expltypeFunction · 0.85
wake_neartoFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected