dip an object into a fountain when standing on its location */
| 391 | |
| 392 | /* dip an object into a fountain when standing on its location */ |
| 393 | void |
| 394 | dipfountain(struct obj *obj) |
| 395 | { |
| 396 | int er = ER_NOTHING; |
| 397 | boolean is_hands = (obj == &hands_obj); |
| 398 | |
| 399 | if (Levitation) { |
| 400 | floating_above("fountain"); |
| 401 | return; |
| 402 | } |
| 403 | |
| 404 | if (obj->otyp == LONG_SWORD && u.ulevel >= 5 |
| 405 | && !rn2(Role_if(PM_KNIGHT) ? 6 : 30) |
| 406 | /* once upon a time it was possible to poly N daggers into N swords */ |
| 407 | && obj->quan == 1L && !obj->oartifact |
| 408 | && !exist_artifact(LONG_SWORD, artiname(ART_EXCALIBUR))) { |
| 409 | static const char lady[] = "Lady of the Lake"; |
| 410 | |
| 411 | if (u.ualign.type != A_LAWFUL) { |
| 412 | /* Ha! Trying to cheat her. */ |
| 413 | pline("A freezing mist rises from the %s" |
| 414 | " and envelopes the sword.", |
| 415 | hliquid("water")); |
| 416 | pline_The("fountain disappears!"); |
| 417 | curse(obj); |
| 418 | if (obj->spe > -6 && !rn2(3)) |
| 419 | obj->spe--; |
| 420 | obj->oerodeproof = FALSE; |
| 421 | exercise(A_WIS, FALSE); |
| 422 | livelog_printf(LL_ARTIFACT, |
| 423 | "was denied %s! The %s has deemed %s unworthy", |
| 424 | artiname(ART_EXCALIBUR), lady, uhim()); |
| 425 | } else { |
| 426 | /* The lady of the lake acts! - Eric Backus */ |
| 427 | /* Be *REAL* nice */ |
| 428 | pline( |
| 429 | "From the murky depths, a hand reaches up to bless the sword."); |
| 430 | pline("As the hand retreats, the fountain disappears!"); |
| 431 | obj = oname(obj, artiname(ART_EXCALIBUR), |
| 432 | ONAME_VIA_DIP | ONAME_KNOW_ARTI); |
| 433 | discover_artifact(ART_EXCALIBUR); |
| 434 | bless(obj); |
| 435 | obj->oeroded = obj->oeroded2 = 0; |
| 436 | obj->oerodeproof = TRUE; |
| 437 | exercise(A_WIS, TRUE); |
| 438 | livelog_printf(LL_ARTIFACT, "was given %s by the %s", |
| 439 | artiname(ART_EXCALIBUR), lady); |
| 440 | } |
| 441 | update_inventory(); |
| 442 | set_levltyp(u.ux, u.uy, ROOM); /* updates level.flags.nfountains */ |
| 443 | levl[u.ux][u.uy].flags = 0; |
| 444 | newsym(u.ux, u.uy); |
| 445 | if (in_town(u.ux, u.uy)) |
| 446 | (void) angry_guards(FALSE); |
| 447 | return; |
| 448 | } else if (is_hands || obj == uarmg) { |
| 449 | er = wash_hands(); |
| 450 | } else { |
no test coverage detected