Skip to content

Commit f6a544a

Browse files
committed
Give two more uses to dipping in potion of restore ability
It was already possible to dip an eroded object in restore ability to remove the erosion. This commit adds two more things it can do: - Increasing an item's negative enchantment or charge, to a maximum of 0, provided it wasn't eroded and got that fixed instead. - Restoring the ink in a spellbook to maximum freshness. (I don't see any additional potential for abuse here; in the case where you refresh spell knowledge 4 times and want even more from the same book, you are probably far into the game and are likely to have either found a duplicate spellbook, have a magic marker, or are doing large-scale farming.) This commit also restructures the code around restore ability dipping; in particular, enshrining a principle that cursed restore ability dips will just do nothing (not even use up the potion) and fall into the "Interesting..." case, similar to how cursed restore ability has no effect when quaffed.
1 parent ffc7af8 commit f6a544a

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

doc/xnh-changelog-10.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ changes:
2424

2525
- The Ides of March (March 15th) is recognized as one of the in-game holidays,
2626
and slime molds will generate as "Caesar salads" on that day.
27+
- Items with negative enchantment or charges can be dipped in a noncursed potion
28+
of restore ability to raise their enchantment, to 0 if the potion is blessed
29+
or by 1 point if not. If the item is eroded, that will be fixed first and a
30+
second potion will be required to address any negative enchantment.
31+
- Spellbooks can be dipped in a noncursed potion of restore ability to fully
32+
refresh the ink on their pages.
2733

2834
### Interface changes
2935

src/potion.c

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,14 +3020,52 @@ potion_dip(struct obj *obj, struct obj *potion)
30203020
return ECMD_TIME;
30213021
}
30223022

3023-
/* removing erosion from items */
3024-
if (potion->otyp == POT_RESTORE_ABILITY && !potion->cursed
3025-
&& erosion_matters(obj) && (obj->oeroded || obj->oeroded2)) {
3026-
obj->oeroded = obj->oeroded2 = 0;
3027-
pline("%s as good as new!", Yobjnam2(obj, Blind ? "feel" : "look"));
3028-
if (potion->dknown)
3023+
/* Restore ability has many uses.
3024+
* Like with quaffing it, it generally doesn't have any negative effects
3025+
* if cursed; it just won't do anything.
3026+
* If it could do multiple things to an item (rusty -1 weapon for instance),
3027+
* it will only fix the first case. */
3028+
if (potion->otyp == POT_RESTORE_ABILITY && !potion->cursed) {
3029+
boolean did_something = FALSE;
3030+
boolean learn_it = FALSE;
3031+
3032+
/* removing erosion from items */
3033+
if (erosion_matters(obj) && (obj->oeroded || obj->oeroded2)) {
3034+
obj->oeroded = obj->oeroded2 = 0;
3035+
pline("%s as good as new!", Yobjnam2(obj, Blind ? "feel" : "look"));
3036+
learn_it = TRUE;
3037+
did_something = TRUE;
3038+
}
3039+
/* undoing a negative enchantment */
3040+
else if (spe_means_plus(obj) && obj->spe < 0) {
3041+
obj->spe = (potion->blessed ? 0 : obj->spe + 1);
3042+
pline("%s %smore effective.",
3043+
Yobjnam2(obj, Blind ? "feel" : "look"),
3044+
obj->spe < 0 ? "a little " : "");
3045+
if (obj->known)
3046+
learn_it = TRUE;
3047+
else
3048+
trycall(potion);
3049+
did_something = TRUE;
3050+
}
3051+
/* refreshing a faded spellbook */
3052+
else if (obj->oclass == SPBOOK_CLASS
3053+
&& obj->otyp != SPE_BOOK_OF_THE_DEAD
3054+
&& obj->otyp != SPE_BLANK_PAPER && obj->otyp != SPE_NOVEL
3055+
&& obj->spestudied > 0) {
3056+
obj->spestudied = 0;
3057+
if (Blind)
3058+
pline("The pages of %s feel crisper.", yname(obj));
3059+
else
3060+
pline("The ink in %s becomes sharp and fresh again!",
3061+
yname(obj));
3062+
learn_it = TRUE;
3063+
did_something = TRUE;
3064+
}
3065+
if (learn_it && potion->dknown)
30293066
makeknown(POT_RESTORE_ABILITY);
3030-
useup(potion);
3067+
if (did_something)
3068+
useup(potion);
30313069
return ECMD_TIME;
30323070
}
30333071

0 commit comments

Comments
 (0)