MCPcopy Create free account
hub / github.com/NetHack/NetHack / offer_different_alignment_altar

Function offer_different_alignment_altar

src/pray.c:1630–1695  ·  view source on GitHub ↗

possibly convert an altar's alignment or the hero's alignment */

Source from the content-addressed store, hash-verified

1628
1629/* possibly convert an altar's alignment or the hero's alignment */
1630staticfn void
1631offer_different_alignment_altar(
1632 struct obj *otmp,
1633 aligntyp altaralign)
1634{
1635 /* Is this a conversion ? */
1636 /* An unaligned altar in Gehennom will always elicit rejection. */
1637 if (ugod_is_angry() || (altaralign == A_NONE && Inhell)) {
1638 if (u.ualignbase[A_CURRENT] == u.ualignbase[A_ORIGINAL]
1639 && altaralign != A_NONE) {
1640 You("have a strong feeling that %s is angry...", u_gname());
1641 consume_offering(otmp);
1642 pline("%s accepts your allegiance.", a_gname());
1643
1644 uchangealign(altaralign, A_CG_CONVERT);
1645 /* Beware, Conversion is costly */
1646 change_luck(-3);
1647 u.ublesscnt += 300;
1648 } else {
1649 u.ugangr += 3;
1650 adjalign(-5);
1651 pline("%s rejects your sacrifice!", a_gname());
1652 godvoice(altaralign, "Suffer, infidel!");
1653 change_luck(-5);
1654 (void) adjattrib(A_WIS, -2, TRUE);
1655 if (!Inhell)
1656 angrygods(u.ualign.type);
1657 }
1658 } else {
1659 consume_offering(otmp);
1660 You("sense a conflict between %s and %s.", u_gname(), a_gname());
1661 if (rn2(8 + u.ulevel) > 5) {
1662 struct monst *pri;
1663 boolean shrine;
1664
1665 You_feel("the power of %s increase.", u_gname());
1666 exercise(A_WIS, TRUE);
1667 change_luck(1);
1668 shrine = on_shrine();
1669 levl[u.ux][u.uy].altarmask = Align2amask(u.ualign.type);
1670 if (shrine)
1671 levl[u.ux][u.uy].altarmask |= AM_SHRINE;
1672 newsym(u.ux, u.uy); /* in case Invisible to self */
1673 if (!Blind)
1674 pline_The("altar glows %s.",
1675 hcolor((u.ualign.type == A_LAWFUL) ? NH_WHITE
1676 : u.ualign.type ? NH_BLACK
1677 : (const char *) "gray"));
1678
1679 if (rnl(u.ulevel) > 6 && u.ualign.record > 0
1680 && rnd(u.ualign.record) > (3 * ALIGNLIM) / 4)
1681 summon_minion(altaralign, TRUE);
1682 /* anger priest; test handles bones files */
1683 if ((pri = findpriest(temple_occupied(u.urooms)))
1684 && !p_coaligned(pri))
1685 angry_priest();
1686 } else {
1687 pline("Unluckily, you feel the power of %s decrease.", u_gname());

Callers 1

offer_corpseFunction · 0.85

Calls 15

YouFunction · 0.85
u_gnameFunction · 0.85
consume_offeringFunction · 0.85
a_gnameFunction · 0.85
uchangealignFunction · 0.85
change_luckFunction · 0.85
adjalignFunction · 0.85
godvoiceFunction · 0.85
adjattribFunction · 0.85
angrygodsFunction · 0.85
rn2Function · 0.85
You_feelFunction · 0.85

Tested by

no test coverage detected