Wands of wishing start at (0:1) and can recharge only one charge

Part 2 of implementing wish spreading. This reduces the average
number of wishes at the Castle from 6 to 3.
This commit is contained in:
Alex Smith
2025-05-30 01:23:43 +01:00
parent 3fd30c4ec8
commit 615edb1c76
2 changed files with 18 additions and 4 deletions

View File

@@ -1111,7 +1111,7 @@ mksobj_init(struct obj **obj, boolean artif)
break; break;
case WAND_CLASS: case WAND_CLASS:
if (otmp->otyp == WAN_WISHING) if (otmp->otyp == WAN_WISHING)
otmp->spe = rnd(3); otmp->spe = 1;
else else
otmp->spe = rn1(5, otmp->spe = rn1(5,
(objects[otmp->otyp].oc_dir == NODIR) ? 11 : 4); (objects[otmp->otyp].oc_dir == NODIR) ? 11 : 4);

View File

@@ -16,6 +16,7 @@ staticfn int read_ok(struct obj *);
staticfn void stripspe(struct obj *); staticfn void stripspe(struct obj *);
staticfn void p_glow1(struct obj *); staticfn void p_glow1(struct obj *);
staticfn void p_glow2(struct obj *, const char *); staticfn void p_glow2(struct obj *, const char *);
staticfn void p_glow3(struct obj *, const char *);
staticfn void forget(int); staticfn void forget(int);
staticfn int maybe_tame(struct monst *, struct obj *); staticfn int maybe_tame(struct monst *, struct obj *);
staticfn boolean can_center_cloud(coordxy, coordxy); staticfn boolean can_center_cloud(coordxy, coordxy);
@@ -674,6 +675,14 @@ p_glow2(struct obj *otmp, const char *color)
Blind ? "" : " ", Blind ? "" : hcolor(color)); Blind ? "" : " ", Blind ? "" : hcolor(color));
} }
staticfn void
p_glow3(struct obj *otmp, const char *color)
{
pline("%s feebly%s%s for a moment.",
Yobjnam2(otmp, Blind ? "vibrate" : "glow"),
Blind ? "" : " ", Blind ? "" : hcolor(color));
}
/* getobj callback for object to charge */ /* getobj callback for object to charge */
int int
charge_ok(struct obj *obj) charge_ok(struct obj *obj)
@@ -726,7 +735,7 @@ recharge(struct obj *obj, int curse_bless)
if (obj->oclass == WAND_CLASS) { if (obj->oclass == WAND_CLASS) {
int lim = (obj->otyp == WAN_WISHING) int lim = (obj->otyp == WAN_WISHING)
? 3 ? 1
: (objects[obj->otyp].oc_dir != NODIR) ? 8 : 15; : (objects[obj->otyp].oc_dir != NODIR) ? 8 : 15;
/* undo any prior cancellation, even when is_cursed */ /* undo any prior cancellation, even when is_cursed */
@@ -760,7 +769,7 @@ recharge(struct obj *obj, int curse_bless)
if (is_cursed) { if (is_cursed) {
stripspe(obj); stripspe(obj);
} else { } else {
n = (lim == 3) ? 3 : rn1(5, lim + 1 - 5); n = (lim == 1) ? 1 : rn1(5, lim + 1 - 5);
if (!is_blessed) if (!is_blessed)
n = rnd(n); n = rnd(n);
@@ -769,10 +778,15 @@ recharge(struct obj *obj, int curse_bless)
else else
obj->spe++; obj->spe++;
if (obj->otyp == WAN_WISHING && obj->spe > 3) { if (obj->otyp == WAN_WISHING && obj->spe > 3) {
/* wands can't give more than three wishes; this code is
currently unreachable but left in case the rules for
wands of wishing change in future */
wand_explode(obj, 1); wand_explode(obj, 1);
return; return;
} }
if (obj->spe >= lim) if (lim == 1)
p_glow3(obj, NH_BLUE);
else if (obj->spe >= lim)
p_glow2(obj, NH_BLUE); p_glow2(obj, NH_BLUE);
else else
p_glow1(obj); p_glow1(obj);