split offering fake amulet into separate function
This commit is contained in:
57
src/pray.c
57
src/pray.c
@@ -23,6 +23,7 @@ static void consume_offering(struct obj *);
|
||||
static void offer_too_soon(aligntyp);
|
||||
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 int bestow_artifact(void);
|
||||
static boolean pray_revive(void);
|
||||
@@ -1548,6 +1549,39 @@ offer_real_amulet(struct obj *otmp, aligntyp altaralign)
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
static void
|
||||
offer_fake_amulet(
|
||||
struct obj *otmp,
|
||||
boolean highaltar,
|
||||
aligntyp altaralign)
|
||||
{
|
||||
if (!highaltar && !otmp->known) {
|
||||
offer_too_soon(altaralign);
|
||||
return;
|
||||
}
|
||||
Soundeffect(se_thunderclap, 100);
|
||||
You_hear("a nearby thunderclap.");
|
||||
if (!otmp->known) {
|
||||
You("realize you have made a %s.",
|
||||
Hallucination ? "boo-boo" : "mistake");
|
||||
otmp->known = TRUE;
|
||||
change_luck(-1);
|
||||
} else {
|
||||
/* don't you dare try to fool the gods */
|
||||
if (Deaf)
|
||||
pline("Oh, no."); /* didn't hear thunderclap */
|
||||
change_luck(-3);
|
||||
adjalign(-1);
|
||||
u.ugangr += 3;
|
||||
/* value = -3; */
|
||||
if (altaralign != u.ualign.type && highaltar) {
|
||||
desecrate_high_altar(altaralign);
|
||||
} else { /* value < 0 */
|
||||
gods_upset(altaralign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* possibly convert an altar's alignment or the hero's alignment */
|
||||
static void
|
||||
offer_different_alignment_altar(
|
||||
@@ -1864,27 +1898,8 @@ dosacrifice(void)
|
||||
} /* real Amulet */
|
||||
|
||||
if (otmp->otyp == FAKE_AMULET_OF_YENDOR) {
|
||||
if (!highaltar && !otmp->known) {
|
||||
offer_too_soon(altaralign);
|
||||
return ECMD_TIME;
|
||||
}
|
||||
Soundeffect(se_thunderclap, 100);
|
||||
You_hear("a nearby thunderclap.");
|
||||
if (!otmp->known) {
|
||||
You("realize you have made a %s.",
|
||||
Hallucination ? "boo-boo" : "mistake");
|
||||
otmp->known = TRUE;
|
||||
change_luck(-1);
|
||||
return ECMD_TIME;
|
||||
} else {
|
||||
/* don't you dare try to fool the gods */
|
||||
if (Deaf)
|
||||
pline("Oh, no."); /* didn't hear thunderclap */
|
||||
change_luck(-3);
|
||||
adjalign(-1);
|
||||
u.ugangr += 3;
|
||||
value = -3;
|
||||
}
|
||||
offer_fake_amulet(otmp, highaltar, altaralign);
|
||||
return ECMD_TIME;
|
||||
} /* fake Amulet */
|
||||
|
||||
if (value == 0) {
|
||||
|
||||
Reference in New Issue
Block a user