Skip to content

Commit

Permalink
Fix: Players could not sacrifice the Eye of the Beholder or the Hand …
Browse files Browse the repository at this point in the history
…of Vecna (reported by Loggers_VIII). Fixes #478.
  • Loading branch information
elunna committed Oct 3, 2023
1 parent 22b9ed5 commit 7410f35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ E void NDECL(reset_faint);
E void NDECL(violated_vegetarian);
E void FDECL(newuhs, (BOOLEAN_P));
E struct obj *FDECL(floorfood, (const char *, int));
E boolean FDECL(can_sacrifice, (int));
E void NDECL(vomit);
E int FDECL(eaten_stat, (int, struct obj *));
E void FDECL(food_disappears, (struct obj *));
Expand Down
13 changes: 10 additions & 3 deletions src/eat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3212,7 +3212,6 @@ doeat()
nodelicious = TRUE;
else if (otmp->otyp == EYEBALL || otmp->otyp == SEVERED_HAND)
nodelicious = TRUE;

if (otmp->oclass == WEAPON_CLASS && otmp->opoisoned) {
pline("Ecch - that must have been poisonous!");
if (how_resistant(POISON_RES) < 100) {
Expand Down Expand Up @@ -3826,7 +3825,7 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
/* Is there some food (probably a heavy corpse) here on the ground? */
for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
if (corpsecheck
? (otmp->otyp == CORPSE
? (can_sacrifice(otmp->otyp)
&& (corpsecheck == 1 || tinnable(otmp)))
: feeding ? (otmp->oclass != COIN_CLASS && is_edible(otmp))
: otmp->oclass == FOOD_CLASS) {
Expand Down Expand Up @@ -3863,13 +3862,21 @@ int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
otmp = getobj(feeding ? allobj : offering ? offerfodder : comestibles,
verb);
if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
if (!can_sacrifice(otmp->otyp)
|| (corpsecheck == 2 && !tinnable(otmp))) {
You_cant("%s that!", verb);
return (struct obj *) 0;
}
return otmp;
}

boolean
can_sacrifice(otyp)
int otyp;
{
return (otyp == CORPSE || otyp != EYEBALL || otyp != SEVERED_HAND);
}

/* Side effects of vomiting */
/* added nomul (MRS) - it makes sense, you're too busy being sick! */
void
Expand Down
4 changes: 2 additions & 2 deletions src/invent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1701,8 +1701,8 @@ register const char *let, *word;
&& (otmp->oclass == TOOL_CLASS && otyp != KEG))
|| (!strcmp(word, "eat") && !is_edible(otmp))
|| (!strcmp(word, "sacrifice")
&& (otyp != CORPSE && otyp != AMULET_OF_YENDOR
&& otyp != FAKE_AMULET_OF_YENDOR))
&& (!can_sacrifice(otmp->otyp)
&& otyp != AMULET_OF_YENDOR && otyp != FAKE_AMULET_OF_YENDOR))
|| (!strcmp(word, "write with")
&& (otmp->oclass == TOOL_CLASS
&& otyp != MAGIC_MARKER && otyp != TOWEL)
Expand Down
3 changes: 2 additions & 1 deletion src/pray.c
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,8 @@ dosacrifice()
#define MAXVALUE 24 /* Highest corpse value (besides Wiz) */

/* sacrificing the Eye of the Beholder is a special case */
if (otmp->oartifact == ART_EYE_OF_THE_BEHOLDER) {
if (otmp->oartifact == ART_EYE_OF_THE_BEHOLDER
|| otmp->oartifact == ART_HAND_OF_VECNA) {
You("offer this abomination to %s...", a_gname());
value = MAXVALUE; /* woop */
/* KMH, conduct */
Expand Down

0 comments on commit 7410f35

Please sign in to comment.