MCPcopy Index your code
hub / github.com/NetHack/NetHack / dip_potion_explosion

Function dip_potion_explosion

src/potion.c:2416–2438  ·  view source on GitHub ↗

do dipped potion(s) explode? */

Source from the content-addressed store, hash-verified

2414
2415/* do dipped potion(s) explode? */
2416staticfn boolean
2417dip_potion_explosion(struct obj *obj, int dmg)
2418{
2419 if (obj->cursed || obj->otyp == POT_ACID
2420 || (obj->otyp == POT_OIL && obj->lamplit)
2421 || !rn2((uarmc && uarmc->otyp == ALCHEMY_SMOCK) ? 30 : 10)) {
2422 /* it would be better to use up the whole stack in advance
2423 of the message, but we can't because we need to keep it
2424 around for potionbreathe() [and we can't set obj->in_use
2425 to 'amt' because that's not implemented] */
2426 obj->in_use = 1;
2427 pline("%sThey explode!", !Deaf ? "BOOM! " : "");
2428 wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1));
2429 exercise(A_STR, FALSE);
2430 if (!breathless(gy.youmonst.data) || haseyes(gy.youmonst.data))
2431 potionbreathe(obj);
2432 useupall(obj);
2433 losehp(dmg, /* not physical damage */
2434 "alchemic blast", KILLED_BY_AN);
2435 return TRUE;
2436 }
2437 return FALSE;
2438}
2439
2440/* called by dodip() or dip_into() after obj and potion have been chosen */
2441staticfn int

Callers 1

potion_dipFunction · 0.85

Calls 7

rn2Function · 0.85
wake_neartoFunction · 0.85
exerciseFunction · 0.85
potionbreatheFunction · 0.85
useupallFunction · 0.85
losehpFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected