Split sacrificing same race into separete function
This commit is contained in:
+117
-105
@@ -25,6 +25,7 @@ static void desecrate_high_altar(aligntyp);
|
||||
static void offer_real_amulet(struct obj *, aligntyp); /* NORETURN */
|
||||
static void offer_fake_amulet(struct obj *, boolean, aligntyp);
|
||||
static void offer_different_alignment_altar(struct obj *, aligntyp);
|
||||
static void sacrifice_your_race(struct obj *, boolean, aligntyp);
|
||||
static int bestow_artifact(void);
|
||||
static boolean pray_revive(void);
|
||||
static boolean water_prayer(boolean);
|
||||
@@ -1655,112 +1656,14 @@ offer_different_alignment_altar(
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
bestow_artifact(void)
|
||||
static void
|
||||
sacrifice_your_race(
|
||||
struct obj *otmp,
|
||||
boolean highaltar,
|
||||
aligntyp altaralign)
|
||||
{
|
||||
int nartifacts = nartifact_exist();
|
||||
int pm;
|
||||
|
||||
/* you were already in pretty good standing */
|
||||
/* The player can gain an artifact */
|
||||
/* The chance goes down as the number of artifacts goes up */
|
||||
if (u.ulevel > 2 && u.uluck >= 0
|
||||
&& !rn2(10 + (2 * u.ugifts * nartifacts))) {
|
||||
struct obj *otmp;
|
||||
otmp = mk_artifact((struct obj *) 0, a_align(u.ux, u.uy));
|
||||
if (otmp) {
|
||||
char buf[BUFSZ];
|
||||
|
||||
artifact_origin(otmp, ONAME_GIFT | ONAME_KNOW_ARTI);
|
||||
if (otmp->spe < 0)
|
||||
otmp->spe = 0;
|
||||
if (otmp->cursed)
|
||||
uncurse(otmp);
|
||||
otmp->oerodeproof = TRUE;
|
||||
Strcpy(buf, (Hallucination ? "a doodad"
|
||||
: Blind ? "an object"
|
||||
: ansimpleoname(otmp)));
|
||||
if (!Blind)
|
||||
Sprintf(eos(buf), " named %s",
|
||||
bare_artifactname(otmp));
|
||||
at_your_feet(upstart(buf));
|
||||
dropy(otmp);
|
||||
godvoice(u.ualign.type, "Use my gift wisely!");
|
||||
u.ugifts++;
|
||||
u.ublesscnt = rnz(300 + (50 * nartifacts));
|
||||
exercise(A_WIS, TRUE);
|
||||
livelog_printf (LL_DIVINEGIFT | LL_ARTIFACT,
|
||||
"was bestowed with %s by %s",
|
||||
artiname(otmp->oartifact),
|
||||
align_gname(u.ualign.type));
|
||||
/* make sure we can use this weapon */
|
||||
unrestrict_weapon_skill(weapon_type(otmp));
|
||||
if (!Hallucination && !Blind) {
|
||||
otmp->dknown = 1;
|
||||
makeknown(otmp->otyp);
|
||||
discover_artifact(otmp->oartifact);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* the #offer command - sacrifice something to the gods */
|
||||
int
|
||||
dosacrifice(void)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
int value = 0, pm;
|
||||
boolean highaltar;
|
||||
aligntyp altaralign = a_align(u.ux, u.uy);
|
||||
|
||||
if (!on_altar() || u.uswallow) {
|
||||
You("are not standing on an altar.");
|
||||
return ECMD_OK;
|
||||
}
|
||||
highaltar = (levl[u.ux][u.uy].altarmask & AM_SANCTUM);
|
||||
|
||||
otmp = floorfood("sacrifice", 1);
|
||||
if (!otmp)
|
||||
return ECMD_OK;
|
||||
/*
|
||||
* Was based on nutritional value and aging behavior (< 50 moves).
|
||||
* Sacrificing a food ration got you max luck instantly, making the
|
||||
* gods as easy to please as an angry dog!
|
||||
*
|
||||
* Now only accepts corpses, based on the game's evaluation of their
|
||||
* toughness. Human and pet sacrifice, as well as sacrificing unicorns
|
||||
* of your alignment, is strongly discouraged.
|
||||
*/
|
||||
#define MAXVALUE 24 /* Highest corpse value (besides Wiz) */
|
||||
|
||||
if (otmp->otyp == CORPSE) {
|
||||
register struct permonst *ptr = &mons[otmp->corpsenm];
|
||||
struct monst *mtmp;
|
||||
|
||||
/* KMH, conduct */
|
||||
if (!u.uconduct.gnostic++)
|
||||
livelog_printf(LL_CONDUCT,
|
||||
"rejected atheism by offering %s on an altar of %s",
|
||||
corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
|
||||
a_gname());
|
||||
|
||||
/* you're handling this corpse, even if it was killed upon the altar
|
||||
*/
|
||||
feel_cockatrice(otmp, TRUE);
|
||||
if (rider_corpse_revival(otmp, FALSE))
|
||||
return ECMD_TIME;
|
||||
|
||||
if (otmp->corpsenm == PM_ACID_BLOB
|
||||
|| (gm.moves <= peek_at_iced_corpse_age(otmp) + 50)) {
|
||||
value = mons[otmp->corpsenm].difficulty + 1;
|
||||
if (otmp->oeaten)
|
||||
value = eaten_stat(value, otmp);
|
||||
}
|
||||
|
||||
/* same race or former pet results apply even if the corpse is
|
||||
too old (value==0) */
|
||||
if (your_race(ptr)) {
|
||||
if (is_demon(gy.youmonst.data)) {
|
||||
You("find the idea very satisfying.");
|
||||
exercise(A_WIS, TRUE);
|
||||
@@ -1772,7 +1675,7 @@ dosacrifice(void)
|
||||
if (highaltar
|
||||
&& (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) {
|
||||
desecrate_high_altar(altaralign);
|
||||
return ECMD_TIME;
|
||||
return;
|
||||
} else if (altaralign != A_CHAOTIC && altaralign != A_NONE) {
|
||||
/* curse the lawful/neutral altar */
|
||||
pline_The("altar is stained with %s blood.", gu.urace.adj);
|
||||
@@ -1834,6 +1737,115 @@ dosacrifice(void)
|
||||
useup(otmp);
|
||||
else
|
||||
useupf(otmp, 1L);
|
||||
}
|
||||
|
||||
static int
|
||||
bestow_artifact(void)
|
||||
{
|
||||
int nartifacts = nartifact_exist();
|
||||
|
||||
/* you were already in pretty good standing */
|
||||
/* The player can gain an artifact */
|
||||
/* The chance goes down as the number of artifacts goes up */
|
||||
if (u.ulevel > 2 && u.uluck >= 0
|
||||
&& !rn2(10 + (2 * u.ugifts * nartifacts))) {
|
||||
struct obj *otmp;
|
||||
otmp = mk_artifact((struct obj *) 0, a_align(u.ux, u.uy));
|
||||
if (otmp) {
|
||||
char buf[BUFSZ];
|
||||
|
||||
artifact_origin(otmp, ONAME_GIFT | ONAME_KNOW_ARTI);
|
||||
if (otmp->spe < 0)
|
||||
otmp->spe = 0;
|
||||
if (otmp->cursed)
|
||||
uncurse(otmp);
|
||||
otmp->oerodeproof = TRUE;
|
||||
Strcpy(buf, (Hallucination ? "a doodad"
|
||||
: Blind ? "an object"
|
||||
: ansimpleoname(otmp)));
|
||||
if (!Blind)
|
||||
Sprintf(eos(buf), " named %s",
|
||||
bare_artifactname(otmp));
|
||||
at_your_feet(upstart(buf));
|
||||
dropy(otmp);
|
||||
godvoice(u.ualign.type, "Use my gift wisely!");
|
||||
u.ugifts++;
|
||||
u.ublesscnt = rnz(300 + (50 * nartifacts));
|
||||
exercise(A_WIS, TRUE);
|
||||
livelog_printf (LL_DIVINEGIFT | LL_ARTIFACT,
|
||||
"was bestowed with %s by %s",
|
||||
artiname(otmp->oartifact),
|
||||
align_gname(u.ualign.type));
|
||||
/* make sure we can use this weapon */
|
||||
unrestrict_weapon_skill(weapon_type(otmp));
|
||||
if (!Hallucination && !Blind) {
|
||||
otmp->dknown = 1;
|
||||
makeknown(otmp->otyp);
|
||||
discover_artifact(otmp->oartifact);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* the #offer command - sacrifice something to the gods */
|
||||
int
|
||||
dosacrifice(void)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
int value = 0;
|
||||
boolean highaltar;
|
||||
aligntyp altaralign = a_align(u.ux, u.uy);
|
||||
|
||||
if (!on_altar() || u.uswallow) {
|
||||
You("are not standing on an altar.");
|
||||
return ECMD_OK;
|
||||
}
|
||||
highaltar = (levl[u.ux][u.uy].altarmask & AM_SANCTUM);
|
||||
|
||||
otmp = floorfood("sacrifice", 1);
|
||||
if (!otmp)
|
||||
return ECMD_OK;
|
||||
/*
|
||||
* Was based on nutritional value and aging behavior (< 50 moves).
|
||||
* Sacrificing a food ration got you max luck instantly, making the
|
||||
* gods as easy to please as an angry dog!
|
||||
*
|
||||
* Now only accepts corpses, based on the game's evaluation of their
|
||||
* toughness. Human and pet sacrifice, as well as sacrificing unicorns
|
||||
* of your alignment, is strongly discouraged.
|
||||
*/
|
||||
#define MAXVALUE 24 /* Highest corpse value (besides Wiz) */
|
||||
|
||||
if (otmp->otyp == CORPSE) {
|
||||
register struct permonst *ptr = &mons[otmp->corpsenm];
|
||||
struct monst *mtmp;
|
||||
|
||||
/* KMH, conduct */
|
||||
if (!u.uconduct.gnostic++)
|
||||
livelog_printf(LL_CONDUCT,
|
||||
"rejected atheism by offering %s on an altar of %s",
|
||||
corpse_xname(otmp, (const char *) 0, CXN_ARTICLE),
|
||||
a_gname());
|
||||
|
||||
/* you're handling this corpse, even if it was killed upon the altar
|
||||
*/
|
||||
feel_cockatrice(otmp, TRUE);
|
||||
if (rider_corpse_revival(otmp, FALSE))
|
||||
return ECMD_TIME;
|
||||
|
||||
if (otmp->corpsenm == PM_ACID_BLOB
|
||||
|| (gm.moves <= peek_at_iced_corpse_age(otmp) + 50)) {
|
||||
value = mons[otmp->corpsenm].difficulty + 1;
|
||||
if (otmp->oeaten)
|
||||
value = eaten_stat(value, otmp);
|
||||
}
|
||||
|
||||
/* same race or former pet results apply even if the corpse is
|
||||
too old (value==0) */
|
||||
if (your_race(ptr)) {
|
||||
sacrifice_your_race(otmp, highaltar, altaralign);
|
||||
return ECMD_TIME;
|
||||
} else if (has_omonst(otmp)
|
||||
&& (mtmp = get_mtraits(otmp, FALSE)) != 0
|
||||
|
||||
Reference in New Issue
Block a user