remove curse vs saddle

Prayer reward can already uncurse a cursed saddle because hero is
stuck on it.  Allow scroll/spell of remove curse to do so too.

The original riding implementation in slash'em operated with the
saddle in hero's inventory rather than in the steed's, so it would
have handled this without any extra effort.  Presumeably that was
overlooked when incorporating riding into nethack changed it to
have saddle be part of the steed's inventory instead of hero's.
This commit is contained in:
PatR
2021-04-14 12:51:20 -07:00
parent 519f00e3c4
commit cf62687630
5 changed files with 32 additions and 10 deletions

View File

@@ -454,6 +454,7 @@ if a branch has only one level (Fort Ludios), prevent creation of any level
wishing could attempt to place one)
opening/unlocking magic zapped at monster holding the hero will release hold
(zap at engulfer already expels hero); zapping at self has same effect
when riding, allow scroll of remove curse to affect to affect steed's saddle
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository

View File

@@ -1214,12 +1214,13 @@ bottlename(void)
/* handle item dipped into water potion or steed saddle splashed by same */
static boolean
H2Opotion_dip(struct obj *potion, struct obj *targobj,
boolean useeit,
const char *objphrase) /* "Your widget glows" or "Steed's saddle
glows" */
H2Opotion_dip(struct obj *potion, /* water */
struct obj *targobj, /* item being dipped into the water */
boolean useeit, /* will hero see the glow/aura? */
const char *objphrase) /* "Your widget glows" or
* "Steed's saddle glows" */
{
void (*func)(OBJ_P) = 0;
void (*func)(struct obj *) = 0;
const char *glowcolor = 0;
#define COST_alter (-2)
#define COST_none (-1)

View File

@@ -935,7 +935,7 @@ display_stinking_cloud_positions(int state)
/* scroll effects; return 1 if we use up the scroll and possibly make it
become discovered, 0 if caller should take care of those side-effects */
int
seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll-like spell */
seffects(struct obj *sobj) /* sobj - scroll or fake spellbook for spell */
{
int cval, otyp = sobj->otyp;
boolean confused = (Confusion != 0), sblessed = sobj->blessed,
@@ -1300,9 +1300,26 @@ seffects(struct obj* sobj) /* sobj - scroll, or fake spellbook object for scroll
known not to be, make the scroll known; it's
trivial to identify anyway by comparing inventory
before and after */
if (obj->bknown && otyp == SCR_REMOVE_CURSE) {
if (obj->bknown && otyp == SCR_REMOVE_CURSE)
learnscrolltyp(SCR_REMOVE_CURSE);
}
}
}
}
/* if riding, treat steed's saddle as if part of hero's invent */
if (u.usteed && (obj = which_armor(u.usteed, W_SADDLE)) != 0) {
if (confused) {
blessorcurse(obj, 2);
obj->bknown = 0; /* skip set_bknown() */
} else if (obj->cursed) {
uncurse(obj);
/* like rndcurse(sit.c), effect on regular inventory
doesn't show things glowing but saddle does */
if (!Blind) {
pline("%s %s.", Yobjnam2(obj, "glow"),
hcolor("amber"));
obj->bknown = Hallucination ? 0 : 1;
} else {
obj->bknown = 0; /* skip set_bknown() */
}
}
}

View File

@@ -394,7 +394,9 @@ rndcurse(void)
if (!Blind) {
pline("%s %s.", Yobjnam2(otmp, "glow"),
hcolor(otmp->cursed ? NH_BLACK : (const char *) "brown"));
otmp->bknown = 1; /* ok to bypass set_bknown() here */
otmp->bknown = Hallucination ? 0 : 1; /* bypass set_bknown() */
} else {
otmp->bknown = 0; /* bypass set_bknown() */
}
}
}

View File

@@ -58,7 +58,8 @@ use_saddle(struct obj* otmp)
}
/* Is this a valid monster? */
if (mtmp->misc_worn_check & W_SADDLE || which_armor(mtmp, W_SADDLE)) {
if ((mtmp->misc_worn_check & W_SADDLE) != 0L
|| which_armor(mtmp, W_SADDLE)) {
pline("%s doesn't need another one.", Monnam(mtmp));
return 1;
}