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

Function dosacrifice

src/pray.c:1853–1896  ·  view source on GitHub ↗

the #offer command - sacrifice something to the gods */

Source from the content-addressed store, hash-verified

1851
1852/* the #offer command - sacrifice something to the gods */
1853int
1854dosacrifice(void)
1855{
1856 struct obj *otmp;
1857 boolean highaltar;
1858 aligntyp altaralign = a_align(u.ux, u.uy);
1859
1860 if (!on_altar() || u.uswallow) {
1861 You("are not %s an altar.",
1862 (Levitation || Flying) ? "over" : "on");
1863 return ECMD_OK;
1864 } else if (Confusion || Stunned) {
1865 You("are too impaired to perform the rite.");
1866 return ECMD_OK;
1867 }
1868 highaltar = (levl[u.ux][u.uy].altarmask & AM_SANCTUM);
1869
1870 otmp = floorfood("sacrifice", 1);
1871 if (!otmp)
1872 return ECMD_OK;
1873
1874 if (otmp->otyp == AMULET_OF_YENDOR) {
1875 if (!highaltar) {
1876 offer_too_soon(altaralign);
1877 return ECMD_TIME;
1878 } else {
1879 offer_real_amulet(otmp, altaralign);
1880 /*NOTREACHED*/
1881 }
1882 } /* real Amulet */
1883
1884 if (otmp->otyp == FAKE_AMULET_OF_YENDOR) {
1885 offer_fake_amulet(otmp, highaltar, altaralign);
1886 return ECMD_TIME;
1887 } /* fake Amulet */
1888
1889 if (otmp->otyp == CORPSE) {
1890 offer_corpse(otmp, highaltar, altaralign);
1891 return ECMD_TIME;
1892 }
1893
1894 pline1(nothing_happens);
1895 return ECMD_TIME;
1896}
1897
1898staticfn int
1899eval_offering(struct obj *otmp, aligntyp altaralign)

Callers

nothing calls this directly

Calls 6

YouFunction · 0.85
floorfoodFunction · 0.85
offer_too_soonFunction · 0.85
offer_real_amuletFunction · 0.85
offer_fake_amuletFunction · 0.85
offer_corpseFunction · 0.85

Tested by

no test coverage detected