Split sacrificing same race into separete function
This commit is contained in:
160
src/pray.c
160
src/pray.c
@@ -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,6 +1656,89 @@ offer_different_alignment_altar(
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sacrifice_your_race(
|
||||
struct obj *otmp,
|
||||
boolean highaltar,
|
||||
aligntyp altaralign)
|
||||
{
|
||||
int pm;
|
||||
|
||||
if (is_demon(gy.youmonst.data)) {
|
||||
You("find the idea very satisfying.");
|
||||
exercise(A_WIS, TRUE);
|
||||
} else if (u.ualign.type != A_CHAOTIC) {
|
||||
pline("You'll regret this infamous offense!");
|
||||
exercise(A_WIS, FALSE);
|
||||
}
|
||||
|
||||
if (highaltar
|
||||
&& (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) {
|
||||
desecrate_high_altar(altaralign);
|
||||
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);
|
||||
levl[u.ux][u.uy].altarmask = AM_CHAOTIC;
|
||||
newsym(u.ux, u.uy); /* in case Invisible to self */
|
||||
angry_priest();
|
||||
} else {
|
||||
struct monst *dmon;
|
||||
const char *demonless_msg;
|
||||
|
||||
/* Human sacrifice on a chaotic or unaligned altar */
|
||||
/* is equivalent to demon summoning */
|
||||
if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) {
|
||||
pline(
|
||||
"The blood floods the altar, which vanishes in %s cloud!",
|
||||
an(hcolor(NH_BLACK)));
|
||||
levl[u.ux][u.uy].typ = ROOM;
|
||||
levl[u.ux][u.uy].altarmask = 0;
|
||||
newsym(u.ux, u.uy);
|
||||
angry_priest();
|
||||
demonless_msg = "cloud dissipates";
|
||||
} else {
|
||||
/* either you're chaotic or altar is Moloch's or both */
|
||||
pline_The("blood covers the altar!");
|
||||
change_luck(altaralign == A_NONE ? -2 : 2);
|
||||
demonless_msg = "blood coagulates";
|
||||
}
|
||||
if ((pm = dlord(altaralign)) != NON_PM
|
||||
&& (dmon = makemon(&mons[pm], u.ux, u.uy, MM_NOMSG))
|
||||
!= 0) {
|
||||
char dbuf[BUFSZ];
|
||||
|
||||
Strcpy(dbuf, a_monnam(dmon));
|
||||
if (!strcmpi(dbuf, "it"))
|
||||
Strcpy(dbuf, "something dreadful");
|
||||
else
|
||||
dmon->mstrategy &= ~STRAT_APPEARMSG;
|
||||
You("have summoned %s!", dbuf);
|
||||
if (sgn(u.ualign.type) == sgn(dmon->data->maligntyp))
|
||||
dmon->mpeaceful = TRUE;
|
||||
You("are terrified, and unable to move.");
|
||||
nomul(-3);
|
||||
gm.multi_reason = "being terrified of a demon";
|
||||
gn.nomovemsg = 0;
|
||||
} else
|
||||
pline_The("%s.", demonless_msg);
|
||||
}
|
||||
|
||||
if (u.ualign.type != A_CHAOTIC) {
|
||||
adjalign(-5);
|
||||
u.ugangr += 3;
|
||||
(void) adjattrib(A_WIS, -1, TRUE);
|
||||
if (!Inhell)
|
||||
angrygods(u.ualign.type);
|
||||
change_luck(-5);
|
||||
} else
|
||||
adjalign(5);
|
||||
if (carried(otmp))
|
||||
useup(otmp);
|
||||
else
|
||||
useupf(otmp, 1L);
|
||||
}
|
||||
|
||||
static int
|
||||
bestow_artifact(void)
|
||||
{
|
||||
@@ -1710,7 +1794,7 @@ int
|
||||
dosacrifice(void)
|
||||
{
|
||||
register struct obj *otmp;
|
||||
int value = 0, pm;
|
||||
int value = 0;
|
||||
boolean highaltar;
|
||||
aligntyp altaralign = a_align(u.ux, u.uy);
|
||||
|
||||
@@ -1761,79 +1845,7 @@ dosacrifice(void)
|
||||
/* 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);
|
||||
} else if (u.ualign.type != A_CHAOTIC) {
|
||||
pline("You'll regret this infamous offense!");
|
||||
exercise(A_WIS, FALSE);
|
||||
}
|
||||
|
||||
if (highaltar
|
||||
&& (altaralign != A_CHAOTIC || u.ualign.type != A_CHAOTIC)) {
|
||||
desecrate_high_altar(altaralign);
|
||||
return ECMD_TIME;
|
||||
} else if (altaralign != A_CHAOTIC && altaralign != A_NONE) {
|
||||
/* curse the lawful/neutral altar */
|
||||
pline_The("altar is stained with %s blood.", gu.urace.adj);
|
||||
levl[u.ux][u.uy].altarmask = AM_CHAOTIC;
|
||||
newsym(u.ux, u.uy); /* in case Invisible to self */
|
||||
angry_priest();
|
||||
} else {
|
||||
struct monst *dmon;
|
||||
const char *demonless_msg;
|
||||
|
||||
/* Human sacrifice on a chaotic or unaligned altar */
|
||||
/* is equivalent to demon summoning */
|
||||
if (altaralign == A_CHAOTIC && u.ualign.type != A_CHAOTIC) {
|
||||
pline(
|
||||
"The blood floods the altar, which vanishes in %s cloud!",
|
||||
an(hcolor(NH_BLACK)));
|
||||
levl[u.ux][u.uy].typ = ROOM;
|
||||
levl[u.ux][u.uy].altarmask = 0;
|
||||
newsym(u.ux, u.uy);
|
||||
angry_priest();
|
||||
demonless_msg = "cloud dissipates";
|
||||
} else {
|
||||
/* either you're chaotic or altar is Moloch's or both */
|
||||
pline_The("blood covers the altar!");
|
||||
change_luck(altaralign == A_NONE ? -2 : 2);
|
||||
demonless_msg = "blood coagulates";
|
||||
}
|
||||
if ((pm = dlord(altaralign)) != NON_PM
|
||||
&& (dmon = makemon(&mons[pm], u.ux, u.uy, MM_NOMSG))
|
||||
!= 0) {
|
||||
char dbuf[BUFSZ];
|
||||
|
||||
Strcpy(dbuf, a_monnam(dmon));
|
||||
if (!strcmpi(dbuf, "it"))
|
||||
Strcpy(dbuf, "something dreadful");
|
||||
else
|
||||
dmon->mstrategy &= ~STRAT_APPEARMSG;
|
||||
You("have summoned %s!", dbuf);
|
||||
if (sgn(u.ualign.type) == sgn(dmon->data->maligntyp))
|
||||
dmon->mpeaceful = TRUE;
|
||||
You("are terrified, and unable to move.");
|
||||
nomul(-3);
|
||||
gm.multi_reason = "being terrified of a demon";
|
||||
gn.nomovemsg = 0;
|
||||
} else
|
||||
pline_The("%s.", demonless_msg);
|
||||
}
|
||||
|
||||
if (u.ualign.type != A_CHAOTIC) {
|
||||
adjalign(-5);
|
||||
u.ugangr += 3;
|
||||
(void) adjattrib(A_WIS, -1, TRUE);
|
||||
if (!Inhell)
|
||||
angrygods(u.ualign.type);
|
||||
change_luck(-5);
|
||||
} else
|
||||
adjalign(5);
|
||||
if (carried(otmp))
|
||||
useup(otmp);
|
||||
else
|
||||
useupf(otmp, 1L);
|
||||
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