Skip to content

Commit 6d14f0e

Browse files
committed
Fix: thiefstone couldn't be re-keyed
When I added extra uses for dipping objects in potions of restore ability, I included an early return for that block. This meant the thiefstone re-keying code which was left below that could never be reached with a non-cursed potion of restore ability, meaning effectively that thiefstones could no longer be re-keyed. Fix is to move the re-keying code into the general case for restore ability. While here, I slightly adjusted the undo-negative-enchantment restore ability behavior to hit poof() -> trycall() rather than directly calling trycall() itself (fixing a minor bug; the player would have been prompted to call the potion even if its dknown wasn't set). I decided to leave the thiefstone-rekeying case as something that will prompt a trycall rather than automatically identifying the potion, since it might not be obvious that it was restore ability even if the player has identified the thiefstone and can see it went from inactive to keyed. There is no longer a case that handles re-keying a thiefstone with a cursed potion of restore ability. Previously it printed a unique message and used up the potion. Now it falls into the general dipping case, meaning it results in "Interesting..." and doesn't use up the potion. Fixes #226
1 parent 01aa384 commit 6d14f0e

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

src/potion.c

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,8 +3062,6 @@ potion_dip(struct obj *obj, struct obj *potion)
30623062
obj->spe < 0 ? "a little " : "");
30633063
if (obj->known)
30643064
learn_it = TRUE;
3065-
else
3066-
trycall(potion);
30673065
did_something = TRUE;
30683066
}
30693067
/* refreshing a faded spellbook */
@@ -3080,26 +3078,18 @@ potion_dip(struct obj *obj, struct obj *potion)
30803078
learn_it = TRUE;
30813079
did_something = TRUE;
30823080
}
3083-
if (learn_it && potion->dknown)
3084-
makeknown(POT_RESTORE_ABILITY);
3085-
if (did_something)
3086-
useup(potion);
3087-
return ECMD_TIME;
3088-
}
3089-
3090-
/* resetting a cancelled thiefstone */
3091-
if (potion->otyp == POT_RESTORE_ABILITY
3092-
&& obj->otyp == THIEFSTONE && !thiefstone_ledger_valid(obj)
3093-
&& !In_endgame(&u.uz)) { /* thiefstones can't key to endgame levels */
3094-
if (potion->cursed) {
3095-
pline("%s.", Tobjnam(obj, "twitch"));
3096-
}
3097-
else {
3081+
/* resetting a cancelled thiefstone */
3082+
if (obj->otyp == THIEFSTONE && !thiefstone_ledger_valid(obj)
3083+
&& !In_endgame(&u.uz)) { /* thiefstones can't key to endgame levels */
30983084
obj->keyed_ledger = ledger_no(&u.uz);
30993085
set_keyed_loc(obj, u.ux, u.uy);
31003086
pline("%s for an instant.", Tobjnam(obj, "quiver"));
3087+
did_something = TRUE;
31013088
}
3102-
poof(potion);
3089+
if (learn_it && potion->dknown)
3090+
makeknown(POT_RESTORE_ABILITY);
3091+
if (did_something)
3092+
poof(potion); /* includes trycall if dknown */
31033093
return ECMD_TIME;
31043094
}
31053095
more_dips:

0 commit comments

Comments
 (0)