1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-05-01 12:55:11 +01:00

Gracefully fail on wishes for artifacts that have already been generated instead of handing out a useless base item.

This commit is contained in:
demogorgon22 2023-11-07 07:49:15 -05:00
parent fd5aaf2da2
commit e3c9590099
3 changed files with 16 additions and 11 deletions

View file

@ -520,6 +520,7 @@ struct obj {
#define WISH_SUCCESS 0x0000200L
#define WISH_FAILURE 0x0000400L
#define WISH_DENIED 0x0000800L
#define WISH_ARTEXISTS 0x0001000L

View file

@ -5788,6 +5788,11 @@ typfnd:
if (otmp->oartifact) {
isartifact = TRUE;
} else {
obfree(otmp, (struct obj *) 0); // Is this necessary?
otmp = &zeroobj; // Is this necessary?
*wishreturn = WISH_ARTEXISTS;
return &zeroobj;
}
}
/* if not artifact, use given name */
@ -5829,17 +5834,6 @@ typfnd:
}
}
}
/* even more wishing abuse: if we tried to create an artifact but failed (it was already generated) we may need a new otyp */
else if (isartifact && !otmp->oartifact) {
switch (otmp->otyp) {
case BEAMSWORD:
otmp = poly_obj(otmp, BROADSWORD);
break;
case UNIVERSAL_KEY:
otmp = poly_obj(otmp, SKELETON_KEY);
break;
}
}
/* set ampule type */
if(ampule != -1 && otmp->otyp == HYPOSPRAY_AMPULE){

View file

@ -5701,6 +5701,16 @@ retry:
if (++tries < 5)
goto retry;
}
if (wishreturn & WISH_ARTEXISTS)
{
/* wish was read as an artifact that has already been generated */
if (wishflags & WISH_VERBOSE)
verbalize("Such an artifact already has been created.");
else
pline("You cannot wish for an existing artifact.");
if (++tries < 5)
goto retry;
}
if (wishreturn & WISH_SUCCESS)
{
/* an allowable wish was read */