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

Function zap_map

src/zap.c:3627–3801  ·  view source on GitHub ↗

zap_map() occurs before hitting monsters or objects and handles wands or spells that don't dish out 'elemental' damage */

Source from the content-addressed store, hash-verified

3625/* zap_map() occurs before hitting monsters or objects and handles wands or
3626 spells that don't dish out 'elemental' damage */
3627staticfn void
3628zap_map(
3629 coordxy x, coordxy y,
3630 struct obj *obj) /* zapped wand, or book for cast spell */
3631{
3632 struct trap *ttmp = t_at(x, y);
3633 coordxy dbx = x, dby = y; /* might be changed by drawbridge handling */
3634 boolean learn_it = FALSE;
3635
3636 /*
3637 * We handle drawbridge for lateral zaps; zap_updown() handles up/down.
3638 * Engravings only get hit by down zaps and we handle that here.
3639 */
3640
3641 /* cancellation */
3642 maybe_explode_trap(ttmp, obj, &learn_it);
3643 ttmp = t_at(x, y); /* refresh in case trap was altered or is gone */
3644
3645 if (u.dz > 0) { /* zapping down */
3646 char ebuf[BUFSZ], pristinebuf[BUFSZ], *etxt;
3647 struct engr *e = engr_at(x, y);
3648
3649 /* subset of engraving effects; none sets `disclose' */
3650 if (e && e->engr_type != HEADSTONE) {
3651 switch (obj->otyp) {
3652 case WAN_POLYMORPH:
3653 case SPE_POLYMORPH:
3654 del_engr(e);
3655 etxt = random_engraving(ebuf, pristinebuf);
3656 make_engr_at(x, y, etxt, pristinebuf, svm.moves, 0);
3657 break;
3658 case WAN_CANCELLATION:
3659 case SPE_CANCELLATION:
3660 case WAN_MAKE_INVISIBLE:
3661 del_engr(e);
3662 break;
3663 case WAN_TELEPORTATION:
3664 case SPE_TELEPORT_AWAY:
3665 rloc_engr(e);
3666 break;
3667 case SPE_STONE_TO_FLESH:
3668 if (e->engr_type == ENGRAVE) {
3669 /* only affects things in stone */
3670 pline_The(Hallucination
3671 ? "floor runs like butter!"
3672 : "edges on the floor get smoother.");
3673 wipe_engr_at(x, y, d(2, 4), TRUE);
3674 }
3675 break;
3676 case WAN_STRIKING:
3677 case SPE_FORCE_BOLT:
3678 wipe_engr_at(x, y, d(2, 4), TRUE);
3679 break;
3680 default:
3681 break;
3682 }
3683 }
3684

Callers 2

zap_updownFunction · 0.85
bhitFunction · 0.85

Calls 15

t_atFunction · 0.85
maybe_explode_trapFunction · 0.85
engr_atFunction · 0.85
del_engrFunction · 0.85
random_engravingFunction · 0.85
make_engr_atFunction · 0.85
rloc_engrFunction · 0.85
pline_TheFunction · 0.85
wipe_engr_atFunction · 0.85
dFunction · 0.85
find_drawbridgeFunction · 0.85
is_db_wallFunction · 0.85

Tested by

no test coverage detected