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

Function weffects

src/zap.c:3430–3476  ·  view source on GitHub ↗

called for various wand and spell effects - M. Stephenson */

Source from the content-addressed store, hash-verified

3428
3429/* called for various wand and spell effects - M. Stephenson */
3430void
3431weffects(struct obj *obj)
3432{
3433 int otyp = obj->otyp;
3434 boolean disclose = FALSE, was_unkn = !objects[otyp].oc_name_known;
3435
3436 exercise(A_WIS, TRUE);
3437 if (u.usteed && (objects[otyp].oc_dir != NODIR) && !u.dx && !u.dy
3438 && (u.dz > 0) && zap_steed(obj)) {
3439 disclose = TRUE;
3440 } else if (objects[otyp].oc_dir == IMMEDIATE) {
3441 zapsetup(); /* reset obj_zapped */
3442 if (u.uswallow) {
3443 (void) bhitm(u.ustuck, obj);
3444 /* [how about `bhitpile(u.ustuck->minvent)' effect?] */
3445 } else if (u.dz) {
3446 disclose = zap_updown(obj);
3447 } else {
3448 (void) bhit(u.dx, u.dy, rn1(8, 6), ZAPPED_WAND, bhitm, bhito,
3449 &obj);
3450 }
3451 zapwrapup(); /* give feedback for obj_zapped */
3452
3453 } else if (objects[otyp].oc_dir == NODIR) {
3454 zapnodir(obj);
3455
3456 } else {
3457 /* neither immediate nor directionless */
3458
3459 if (otyp == WAN_DIGGING || otyp == SPE_DIG)
3460 zap_dig();
3461 else if (otyp >= SPE_MAGIC_MISSILE && otyp <= SPE_FINGER_OF_DEATH)
3462 ubuzz(BZ_U_SPELL(BZ_OFS_SPE(otyp)), u.ulevel / 2 + 1);
3463 else if (otyp >= WAN_MAGIC_MISSILE && otyp <= WAN_LIGHTNING)
3464 ubuzz(BZ_U_WAND(BZ_OFS_WAN(otyp)),
3465 (otyp == WAN_MAGIC_MISSILE) ? 2 : 6);
3466 else
3467 impossible("weffects: unexpected spell or wand");
3468 disclose = TRUE;
3469 }
3470 if (disclose) {
3471 learnwand(obj);
3472 if (was_unkn)
3473 more_experienced(0, 10);
3474 }
3475 return;
3476}
3477
3478/* augment damage for a spell based on the hero's intelligence (and level) */
3479int

Callers 2

dozapFunction · 0.85
spelleffectsFunction · 0.85

Calls 13

exerciseFunction · 0.85
zap_steedFunction · 0.85
zapsetupFunction · 0.85
bhitmFunction · 0.85
zap_updownFunction · 0.85
bhitFunction · 0.85
zapwrapupFunction · 0.85
zapnodirFunction · 0.85
zap_digFunction · 0.85
ubuzzFunction · 0.85
learnwandFunction · 0.85
more_experiencedFunction · 0.85

Tested by

no test coverage detected