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

Function offer_corpse

src/pray.c:1958–2120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1956}
1957
1958staticfn void
1959offer_corpse(struct obj *otmp, boolean highaltar, aligntyp altaralign)
1960{
1961 int value;
1962 struct permonst *ptr;
1963 struct monst *mtmp;
1964
1965 /*
1966 * Was based on nutritional value and aging behavior (< 50 moves).
1967 * Sacrificing a food ration got you max luck instantly, making the
1968 * gods as easy to please as an angry dog!
1969 *
1970 * Now only accepts corpses, based on the game's evaluation of their
1971 * toughness. Human and pet sacrifice, as well as sacrificing unicorns
1972 * of your alignment, is strongly discouraged.
1973 */
1974#define MAXVALUE 24 /* Highest corpse value (besides Wiz) */
1975
1976 /* KMH, conduct */
1977 if (!u.uconduct.gnostic++)
1978 livelog_printf(LL_CONDUCT, "rejected atheism"
1979 " by offering %s on an altar of %s",
1980 corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
1981 a_gname());
1982
1983 /* you're handling this corpse, even if it was killed upon the altar
1984 */
1985 feel_cockatrice(otmp, TRUE);
1986 if (rider_corpse_revival(otmp, FALSE))
1987 return;
1988
1989 ptr = &mons[otmp->corpsenm];
1990
1991 /* same race or former pet results apply even if the corpse is
1992 too old (value==0) */
1993 if (your_race(ptr)) {
1994 sacrifice_your_race(otmp, highaltar, altaralign);
1995 return;
1996 }
1997 if (has_omonst(otmp)
1998 && (mtmp = get_mtraits(otmp, FALSE)) != 0
1999 && mtmp->mtame) {
2000 /* mtmp is a temporary pointer to a tame monster's attributes,
2001 * not a real monster */
2002 pline("So this is how you repay loyalty?");
2003 adjalign(-3);
2004 HAggravate_monster |= FROMOUTSIDE;
2005 offer_negative_valued(highaltar, altaralign);
2006 return;
2007 }
2008
2009 value = eval_offering(otmp, altaralign);
2010 if (value == 0) {
2011 /* too old; don't give undead or unicorn bonus or penalty */
2012 pline1(nothing_happens);
2013 return;
2014 }
2015 if (value < 0) {

Callers 1

dosacrificeFunction · 0.85

Calls 15

livelog_printfFunction · 0.85
corpse_xnameFunction · 0.85
a_gnameFunction · 0.85
feel_cockatriceFunction · 0.85
rider_corpse_revivalFunction · 0.85
sacrifice_your_raceFunction · 0.85
get_mtraitsFunction · 0.85
adjalignFunction · 0.85
offer_negative_valuedFunction · 0.85
eval_offeringFunction · 0.85
desecrate_altarFunction · 0.85

Tested by

no test coverage detected