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

Function zapnodir

src/zap.c:2538–2602  ·  view source on GitHub ↗

* zapnodir - zaps a NODIR wand/spell. * Won't get here if wand has no charges (unless wresting 1 last charge). */

Source from the content-addressed store, hash-verified

2536 * Won't get here if wand has no charges (unless wresting 1 last charge).
2537 */
2538void
2539zapnodir(struct obj *obj)
2540{
2541 boolean known = FALSE;
2542
2543 switch (obj->otyp) {
2544 case WAN_LIGHT:
2545 case SPE_LIGHT:
2546 /* FIXME? wand of light becoming discovered should be contingent upon
2547 seeing at least one previously unlit spot become lit */
2548 known = (obj->dknown && !Blind);
2549 litroom(TRUE, obj);
2550 (void) lightdamage(obj, TRUE, 5);
2551 break;
2552 case WAN_SECRET_DOOR_DETECTION:
2553 case SPE_DETECT_UNSEEN:
2554 /* findit() gives sufficient feedback to discover the wand even when
2555 blinded or when it fails to find anything */
2556 known = !!obj->dknown;
2557 (void) findit();
2558 break;
2559 case WAN_STASIS: {
2560 long tmp_until = svm.moves + (long) rn1(21, 10);
2561
2562 /* no immediately obvious effect, and no message so that it isn't
2563 distinguishable from other NODIR wands that produce no message;
2564 for multiple zaps, keep the longest duration rather than latest */
2565 if (tmp_until > svl.level.flags.stasis_until)
2566 svl.level.flags.stasis_until = tmp_until;
2567 break;
2568 }
2569 case WAN_CREATE_MONSTER:
2570 /* create_critters() returns True iff hero sees a new monster appear */
2571 if (create_critters(rn2(23) ? 1 : rn1(7, 2),
2572 (struct permonst *) 0, FALSE))
2573 known = !!obj->dknown;
2574 break;
2575 case WAN_WISHING:
2576 if (Luck + rn2(5) < 0) {
2577 pline("Unfortunately, nothing happens.");
2578 known = FALSE;
2579 } else {
2580 known = !!obj->dknown;
2581 /* wand of wishing asks player what to wish for so always becomes
2582 discovered (unless it hasn't been seen) */
2583 makewish();
2584 }
2585 break;
2586 case WAN_ENLIGHTENMENT:
2587 known = !!obj->dknown;
2588 /* do_enlightenmnt_effect() always describes enlightenment */
2589 do_enlightenment_effect();
2590 break;
2591 default:
2592 break;
2593 }
2594
2595 if (known) {

Callers 2

doengrave_sfx_item_WANFunction · 0.85
weffectsFunction · 0.85

Calls 10

litroomFunction · 0.85
lightdamageFunction · 0.85
finditFunction · 0.85
create_crittersFunction · 0.85
rn2Function · 0.85
makewishFunction · 0.85
do_enlightenment_effectFunction · 0.85
more_experiencedFunction · 0.85
learnwandFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected