Blessed scroll of destroy armor asks which armor to destroy

via xNetHack with some slight modifications.
This commit is contained in:
Pasi Kallinen
2024-12-06 11:09:23 +02:00
parent 9b4f38eebe
commit e23e6ef235
4 changed files with 45 additions and 0 deletions

View File

@@ -1485,6 +1485,7 @@ digging in ice was handled inconsistently, particularly if done at the span
spot in front of closed drawbridge
angry god may remove an intrinsic
blessed scroll of taming increases tameness of already tame creatures
blessed scroll of destroy armor asks which armor to destroy
Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -732,6 +732,8 @@ extern int remarm_swapwep(void);
extern int destroy_arm(struct obj *);
extern void adj_abon(struct obj *, schar) NONNULLARG1;
extern boolean inaccessible_equipment(struct obj *, const char *, boolean);
extern int any_worn_armor_ok(struct obj *);
extern int count_worn_armor(void);
/* ### dog.c ### */

View File

@@ -3367,4 +3367,31 @@ takeoff_ok(struct obj *obj)
return equip_ok(obj, TRUE, FALSE);
}
/* getobj callback for blessed destroy armor.
suggest any worn armor, even if covered by other armor */
int
any_worn_armor_ok(struct obj *obj)
{
if (obj && (obj->owornmask & W_ARMOR))
return GETOBJ_SUGGEST;
return GETOBJ_EXCLUDE;
}
/* number of armor pieces worn by hero */
int
count_worn_armor(void)
{
int ret = 0;
if (uarm) ret++;
if (uarmc) ret++;
if (uarmh) ret++;
if (uarms) ret++;
if (uarmg) ret++;
if (uarmf) ret++;
if (uarmu) ret++;
return ret;
}
/*do_wear.c*/

View File

@@ -1279,6 +1279,21 @@ seffect_destroy_armor(struct obj **sobjp)
return;
}
if (!scursed || !otmp || !otmp->cursed) {
boolean gets_choice = (otmp && sobj && sobj->blessed
&& count_worn_armor() > 1);
if (gets_choice) {
struct obj *atmp;
if (!objects[sobj->otyp].oc_name_known)
pline("This is %s!", an(actualoname(sobj)));
gk.known = TRUE;
atmp = getobj("destroy", any_worn_armor_ok, GETOBJ_PROMPT);
/* check the return value, if user picked non-valid obj */
if (any_worn_armor_ok(atmp) == GETOBJ_SUGGEST)
otmp = atmp;
}
if (!destroy_arm(otmp)) {
strange_feeling(sobj, "Your skin itches.");
*sobjp = 0; /* useup() in strange_feeling() */