1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-04-09 10:00:45 +01:00

Add a belt slot (first pass)

Adds a welt slot: armor worn with put on

# Conflicts:
#	include/obj.h
This commit is contained in:
ChrisANG 2024-11-17 09:06:30 -05:00
parent cb2aaf1bd9
commit c97dbc00cc
22 changed files with 177 additions and 45 deletions

View file

@ -514,12 +514,12 @@ E NEARDATA struct obj *invent,
#ifdef TOURIST
*uarmu, /* under-wear, so to speak */
#endif
*uskin, *uamul, *uleft, *uright, *ublindf,
*uskin, *uamul, *ubelt, *uleft, *uright, *ublindf,
*uwep, *uswapwep, *uquiver;
/* Needs to update, so it's redefined each time whenever it's used */
#define ARMOR_SLOTS { uarm, uarmc, uarmf, uarmh, uarmg, uarms, uarmu }
#define WORN_SLOTS { uarm, uarmc, uarmf, uarmh, uarmg, uarms, uarmu, uamul, uleft, uright, ublindf, uwep, uswapwep, uquiver }
#define WORN_SLOTS { uarm, uarmc, uarmf, uarmh, uarmg, uarms, uarmu, uamul, ubelt, uleft, uright, ublindf, uwep, uswapwep, uquiver }
E NEARDATA struct obj *urope; /* defined only when entangled */
E NEARDATA struct obj *uchain; /* defined only when punished */

View file

@ -630,6 +630,8 @@ E int NDECL(Shirt_on);
E int NDECL(Shirt_off);
E void NDECL(Amulet_off);
E void NDECL(Amulet_on);
E void NDECL(Belt_off);
E void NDECL(Belt_on);
E void FDECL(Ring_on, (struct obj *));
E void FDECL(Ring_off, (struct obj *));
E void FDECL(Ring_gone, (struct obj *));

View file

@ -853,6 +853,7 @@
#define can_wear_amulet(ptr) (has_head(ptr) || (ptr->mflagsb&MB_CAN_AMULET))
#define can_wear_blindf(ptr) (has_head(ptr))
#define can_wear_boots(ptr) ((humanoid(ptr) || humanoid_feet(ptr)) && !nofeet(ptr) && !nolimbs(ptr))
#define can_wear_belt(ptr) (!naoid(ptr))
#define shirt_match(ptr,obj) ((obj->otyp != BODYGLOVE && upper_body_match(ptr,obj)) || \
full_body_match(ptr,obj))
#define upper_body_match(ptr,obj) (((ptr->mflagsb&MB_HUMANOID) && (obj->bodytypeflag&MB_HUMANOID)) || \

View file

@ -317,6 +317,7 @@ struct obj {
//define W_SADDLE 0x00100000L /* KMH -- For riding monsters */
//define W_BALL 0x00200000L /* Punishment ball */
//define W_CHAIN 0x00400000L /* Punishment chain */
//define W_BELT 0x04000000L /* Belt */
long o_e_trait;
long oward;
/*Records the warding sign of spellbooks. */
@ -1071,6 +1072,8 @@ struct obj {
objects[otmp->otyp].oc_armcat == ARM_SHIRT)
#define is_suit(otmp) (otmp->oclass == ARMOR_CLASS && \
objects[otmp->otyp].oc_armcat == ARM_SUIT)
#define is_belt(otmp) (otmp->oclass == ARMOR_CLASS && \
objects[otmp->otyp].oc_armcat == ARM_BELT)
#define is_harmonium_armor(otmp) is_harmonium_otyp((otmp)->otyp)
@ -1480,7 +1483,7 @@ struct obj {
#define higher_depth(armdepth, depth) (armdepth == depth || (\
(depth&(W_ARMC|W_GLYPH)) ? FALSE :\
(depth&(W_ARMS|W_WEP|W_QUIVER|W_SWAPWEP|W_AMUL|W_SADDLE|W_CHAIN)) ? (armdepth == W_ARMC) :\
(depth&(W_ARMS|W_WEP|W_QUIVER|W_SWAPWEP|W_AMUL|W_BELT|W_SADDLE|W_CHAIN)) ? (armdepth == W_ARMC) :\
(depth&(W_ARMH|W_ARMG|W_ARMF|W_ARM|W_RINGL|W_RINGR|W_TOOL)) ? (armdepth != W_ARMU) :\
(depth&(W_ARMU|W_SKIN|W_UPGRADE)) ? TRUE :\
FALSE))

View file

@ -86,6 +86,7 @@ struct objclass {
mask == W_ART ? 0 :\
mask == W_ARTI ? 0 :\
mask == W_AMUL ? UPPER_TORSO_DR :\
mask == W_BELT ? LOWER_TORSO_DR :\
mask == W_RINGL ? ARM_DR :\
mask == W_RINGR ? ARM_DR :\
mask == W_TOOL ? HEAD_DR :\
@ -174,6 +175,7 @@ struct objclass {
#define ARM_BOOTS 4
#define ARM_CLOAK 5
#define ARM_SHIRT 6
#define ARM_BELT 7
#define ARM_SUIT 0
uchar oc_oprop[8]; /* property (invis, &c.) conveyed */

View file

@ -166,7 +166,6 @@ struct prop {
# define W_RINGR 0x00040000L /* Right ring */
# define W_RING (W_RINGL | W_RINGR)
# define W_TOOL 0x00080000L /* Eyewear */
# define W_ACCESSORY (W_AMUL | W_RING| W_TOOL)
#ifdef STEED
# define W_SADDLE 0x00100000L /* KMH -- For riding monsters */
#endif
@ -175,7 +174,9 @@ struct prop {
# define W_SPIRIT 0x00800000L /* Bound spirit */
# define W_GLYPH 0x01000000L /* Active thought-glyph */
# define W_UPGRADE 0x02000000L /* Permanent upgrade */
# define W_BELT 0x04000000L /* Belt */
# define W_SKIN I_SPECIAL /* merged into skin */
# define W_ACCESSORY (W_AMUL | W_RING | W_TOOL | W_BELT)
# define W_WORN (W_ARMOR | W_ACCESSORY)
/*** Property is blocked by an object ***/
@ -209,6 +210,7 @@ struct prop {
#define WORN_GLOVES W_ARMG
#define WORN_BOOTS W_ARMF
#define WORN_AMUL W_AMUL
#define WORN_BELT W_BELT
#define WORN_BLINDF W_TOOL
#ifdef TOURIST
#define WORN_SHIRT W_ARMU

View file

@ -1317,6 +1317,7 @@ struct monst *mon;
struct obj *armg = (is_player ? uarmg : which_armor(mon, W_ARMG));
struct obj *arms = (is_player ? uarms : which_armor(mon, W_ARMS));
struct obj *armh = (is_player ? uarmh : which_armor(mon, W_ARMH));
struct obj *belt = (is_player ? ubelt : which_armor(mon, W_BELT));
struct obj *wep = (is_player ? uwep : MON_WEP(mon));
struct obj *swapwep = (is_player ? uswapwep : MON_SWEP(mon));
const struct artifact *oart = (struct artifact *) 0;

View file

@ -181,6 +181,7 @@ NEARDATA struct obj *invent = (struct obj *)0,
#ifdef TOURIST
*uarmu = (struct obj *)0, /* under-wear, so to speak */
#endif
*ubelt = (struct obj *)0,
*uskin = (struct obj *)0, /* dragon armor, if a dragon */
*uarmc = (struct obj *)0, *uarmh = (struct obj *)0,
*uarms = (struct obj *)0, *uarmg = (struct obj *)0,

View file

@ -547,7 +547,7 @@ canletgo(obj,word)
register struct obj *obj;
register const char *word;
{
if(obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)){
if(obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL | W_BELT)){
if (*word)
Norep("You cannot %s %s you are wearing.",word,
something);

View file

@ -39,7 +39,7 @@ static NEARDATA const char c_armor[] = "armor",
static NEARDATA const long takeoff_order[] = { WORN_BLINDF, W_WEP,
WORN_SHIELD, WORN_GLOVES, LEFT_RING, RIGHT_RING, WORN_CLOAK,
WORN_HELMET, WORN_AMUL, WORN_ARMOR,
WORN_HELMET, WORN_AMUL, WORN_BELT, WORN_ARMOR,
#ifdef TOURIST
WORN_SHIRT,
#endif
@ -1424,6 +1424,32 @@ register struct obj *otmp;
}
}
void
Belt_on()
{
if (!ubelt) return;
if(check_oprop(ubelt, OPROP_CURS)){
if (Blind)
pline("%s for a moment.", Tobjnam(ubelt, "vibrate"));
else
pline("%s %s for a moment.",
Tobjnam(ubelt, "glow"), hcolor(NH_BLACK));
curse(ubelt);
}
}
void
Belt_off()
{
takeoff_mask &= ~W_BELT;
if(!ubelt){
impossible("Belt_off() was called, but no belt is worn.");
return;
}
setworn((struct obj *)0, W_BELT);
}
/* called in main to set intrinsics of worn start-up items */
void
set_wear()
@ -1492,7 +1518,7 @@ cancel_don()
}
static NEARDATA const char clothes[] = {ARMOR_CLASS, 0};
static NEARDATA const char accessories[] = {RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0};
static NEARDATA const char accessories[] = {ARMOR_CLASS, RING_CLASS, AMULET_CLASS, TOOL_CLASS, FOOD_CLASS, 0};
/* the 'T' command */
int
@ -1589,6 +1615,7 @@ doremring()
MOREACC(uright);
MOREACC(uamul);
MOREACC(ublindf);
MOREACC(ubelt);
if(!Accessories) {
pline("Not wearing any accessories.%s", (iflags.cmdassist &&
@ -1603,7 +1630,7 @@ doremring()
#endif
) otmp = getobj(accessories, "remove");
if(!otmp) return MOVE_CANCELLED;
if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) {
if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL | W_BELT))) {
You("are not wearing that.");
return MOVE_CANCELLED;
}
@ -1625,6 +1652,9 @@ doremring()
} else if (otmp == uamul) {
Amulet_off();
off_msg(otmp);
} else if (otmp == ubelt) {
Belt_off();
off_msg(otmp);
} else if (otmp == ublindf) {
Blindf_off(otmp); /* does its own off_msg */
} else {
@ -1758,7 +1788,7 @@ boolean noisy;
{
int err = 0;
if (otmp->owornmask & W_ARMOR) {
if (otmp->owornmask & (W_ARMOR|W_BELT)) {
if (noisy) already_wearing(c_that_);
return 0;
}
@ -1890,6 +1920,9 @@ boolean noisy;
(uarm && !uarmc) ? c_armor : cloak_simple_name(uarmc));
}
err++;
} else if (ubelt && ubelt->cursed && !Weldproof) {
if (noisy) already_wearing("a belt");
err++;
} else if(youracedata->msize != otmp->objsize){
if (noisy)
pline_The("%s is the wrong size for you.", c_shirt);
@ -1917,6 +1950,9 @@ boolean noisy;
} else if (uarm) {
if (noisy) already_wearing("some armor");
err++;
} else if (ubelt && ubelt->cursed && !Weldproof) {
if (noisy) already_wearing("a belt");
err++;
} else if(!arm_size_fits(youracedata,otmp)){
if (noisy)
pline_The("%s is the wrong size for you.", c_armor);
@ -1927,6 +1963,11 @@ boolean noisy;
err++;
} else
*mask = W_ARM;
} else if (is_belt(otmp)) {
if (ubelt) {
if (noisy) already_wearing("a belt");
err++;
}
} else {
/* getobj can't do this after setting its allow_all flag; that
happens if you have armor for slots that are covered up or
@ -1968,6 +2009,11 @@ dowear()
if (!canwearobj(otmp,&mask,TRUE)) return MOVE_CANCELLED;
if (is_belt(otmp)){
silly_thing("wear", otmp);
return MOVE_CANCELLED;
}
if (otmp->oartifact && !touch_artifact(otmp, &youmonst, FALSE))
return MOVE_STANDARD; /* costs a turn even though it didn't get worn */
@ -2001,6 +2047,7 @@ dowear()
else if(is_gloves(otmp)) afternmv = Gloves_on;
else if(is_cloak(otmp)) afternmv = Cloak_on;
else if(is_shirt(otmp)) afternmv = Shirt_on;
// else if(is_belt(otmp)) afternmv = Belt_on;
else if(otmp == uarm) afternmv = Armor_on;
nomovemsg = "You finish your dressing maneuver.";
} else {
@ -2010,6 +2057,7 @@ dowear()
else if(is_gloves(otmp)) (void) Gloves_on();
else if(is_cloak(otmp)) (void) Cloak_on();
else if(is_shirt(otmp)) (void) Shirt_on();
// else if(is_belt(otmp)) (void) Belt_on();
else if(otmp == uarm) (void) Armor_on();
on_msg(otmp);
}
@ -2028,8 +2076,8 @@ doputon()
return MOVE_CANCELLED;
}
if(uleft && (uright || (uarmg && uarmg->oartifact == ART_CLAWS_OF_THE_REVENANCER)) && uamul && ublindf) {
Your("%s%s are full, and you're already wearing an amulet and %s.",
if(uleft && (uright || (uarmg && uarmg->oartifact == ART_CLAWS_OF_THE_REVENANCER)) && uamul && ubelt && ublindf) {
Your("%s%s are full, and you're already wearing a belt, an amulet, and %s.",
humanoid(youracedata) ? "ring-" : "",
makeplural(body_part(FINGER)),
(ublindf->otyp==LENSES || ublindf->otyp==SUNGLASSES) ? "some lenses"
@ -2039,7 +2087,7 @@ doputon()
}
otmp = getobj(accessories, "put on");
if(!otmp) return MOVE_CANCELLED;
if(otmp->owornmask & (W_RING | W_AMUL | W_TOOL)) {
if(otmp->owornmask & (W_RING | W_AMUL | W_TOOL| W_BELT)) {
already_wearing(c_that_);
return MOVE_CANCELLED;
}
@ -2119,6 +2167,19 @@ doputon()
return MOVE_STANDARD;
}
Amulet_on();
} else if (is_belt(otmp)) {
if(ubelt) {
already_wearing("a belt");
return MOVE_CANCELLED;
}
if(!can_wear_belt(youracedata)){
pline("It doesn't fit!");
return MOVE_CANCELLED;
}
if (otmp->oartifact && !touch_artifact(otmp, &youmonst, FALSE))
return MOVE_STANDARD;
setworn(otmp, W_BELT);
Belt_on();
} else { /* it's a blindfold, towel, or lenses */
if (ublindf) {
if (ublindf->otyp == TOWEL)
@ -3414,6 +3475,7 @@ register struct obj *otmp;
else if(otmp == uleft) takeoff_mask |= LEFT_RING;
else if(otmp == uright) takeoff_mask |= RIGHT_RING;
else if(otmp == uamul) takeoff_mask |= WORN_AMUL;
else if(otmp == ubelt) takeoff_mask |= WORN_BELT;
else if(otmp == ublindf) takeoff_mask |= WORN_BLINDF;
else if(otmp == uwep) takeoff_mask |= W_WEP;
else if(otmp == uswapwep) takeoff_mask |= W_SWAPWEP;
@ -3470,6 +3532,9 @@ do_takeoff()
} else if (taking_off == WORN_AMUL) {
otmp = uamul;
if(!cursed(otmp)) Amulet_off();
} else if (taking_off == WORN_BELT) {
otmp = ubelt;
if(!cursed(otmp)) Belt_off();
} else if (taking_off == LEFT_RING) {
otmp = uleft;
if(!cursed(otmp)) Ring_off(uleft);
@ -3547,6 +3612,8 @@ take_off()
#endif
} else if (taking_off == WORN_AMUL) {
todelay = 1;
} else if (taking_off == WORN_BELT) {
todelay = 1;
} else if (taking_off == LEFT_RING) {
todelay = 1;
} else if (taking_off == RIGHT_RING) {
@ -3588,7 +3655,7 @@ doddoremarm()
You("continue %s.", disrobing);
set_occupation(take_off, disrobing, 0);
return MOVE_INSTANT;
} else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf &&
} else if (!uwep && !uswapwep && !uquiver && !uamul && !ubelt && !ublindf &&
!uleft && !uright && !wearing_armor()) {
You("are not wearing anything.");
return MOVE_CANCELLED;

View file

@ -2820,7 +2820,7 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
if (!is_edible(otmp)) {
You("cannot eat that!");
return MOVE_CANCELLED;
} else if ((otmp->owornmask & (W_ARMOR|W_TOOL|W_AMUL
} else if ((otmp->owornmask & (W_ARMOR|W_TOOL|W_AMUL|W_BELT
#ifdef STEED
|W_SADDLE
#endif

View file

@ -1175,14 +1175,14 @@ register const char *let,*word;
/* ugly check: remove inappropriate things */
if ((taking_off(word) &&
(!(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))
(!(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL | W_BELT))
|| (otmp==uarm && uarmc && arm_blocks_upper_body(uarm->otyp))
#ifdef TOURIST
|| (otmp==uarmu && ((uarm && arm_blocks_upper_body(uarm->otyp)) || uarmc))
#endif
))
|| (putting_on(word) &&
(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)))
(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL)))
/* already worn */
#if 0 /* 3.4.1 -- include currently wielded weapon among the choices */
|| (!strcmp(word, "wield") &&
@ -1198,13 +1198,16 @@ register const char *let,*word;
/* Second ugly check; unlike the first it won't trigger an
* "else" in "you don't have anything else to ___".
*/
else if ((putting_on(word) &&
else if ((!strcmp(word, "put on") &&
((otmp->oclass == FOOD_CLASS && otmp->otyp != MEAT_RING) ||
(otmp->oclass == ARMOR_CLASS && !is_belt(otmp)) ||
(otmp->oclass == TOOL_CLASS &&
otyp != BLINDFOLD && otyp != MASK && otyp != R_LYEHIAN_FACEPLATE &&
otyp != TOWEL && otyp != ANDROID_VISOR && otyp != LIVING_MASK && otyp != LENSES && otyp != SUNGLASSES && otyp != SOUL_LENS) ||
(otmp->oclass == CHAIN_CLASS)
))
|| (!strcmp(word, "wear") &&
(otmp->oclass == ARMOR_CLASS && is_belt(otmp)))
|| (!strcmp(word, "wield") &&
((otmp->oclass == TOOL_CLASS && !is_weptool(otmp)) ||
(otmp->oclass == CHAIN_CLASS && otmp->otyp != CHAIN)))
@ -1635,19 +1638,21 @@ struct obj *otmp;
s1 = s2 = s3 = 0;
/* check for attempted use of accessory commands ('P','R') on armor
and for corresponding armor commands ('W','T') on accessories */
if (ocls == ARMOR_CLASS) {
if (!strcmp(word, "put on"))
s1 = "W", s2 = "wear", s3 = "";
else if (!strcmp(word, "remove"))
s1 = "T", s2 = "take", s3 = " off";
} else if ((ocls == RING_CLASS || otyp == MEAT_RING) ||
if ((ocls == RING_CLASS || otyp == MEAT_RING) ||
ocls == AMULET_CLASS ||
is_belt(otmp) ||
(is_worn_tool(otmp))) {
if (!strcmp(word, "wear"))
s1 = "P", s2 = "put", s3 = " on";
else if (!strcmp(word, "take off"))
s1 = "R", s2 = "remove", s3 = "";
}
else if (ocls == ARMOR_CLASS) {
if (!strcmp(word, "put on"))
s1 = "W", s2 = "wear", s3 = "";
else if (!strcmp(word, "remove"))
s1 = "T", s2 = "take", s3 = " off";
}
if (s1) {
what = "that";
/* quantity for armor and accessory objects is always 1,
@ -1692,7 +1697,7 @@ boolean
is_worn(otmp)
register struct obj *otmp;
{
return((boolean)(!!(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL |
return((boolean)(!!(otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL |
#ifdef STEED
W_SADDLE |
#endif
@ -2583,10 +2588,10 @@ struct obj *obj;
add_menu(win, NO_GLYPH, &any, 't', 0, ATR_NONE,
"Throw this item", MENU_UNSELECTED);
/* T: unequip worn item */
if ((obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))) {
if ((obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL | W_BELT))) {
if ((obj->owornmask & (W_ARMOR)))
any.a_void = (genericptr_t)dotakeoff;
if ((obj->owornmask & (W_RING | W_AMUL | W_TOOL)))
if ((obj->owornmask & (W_RING | W_AMUL | W_TOOL | W_BELT)))
any.a_void = (genericptr_t)doremring;
add_menu(win, NO_GLYPH, &any, 'T', 0, ATR_NONE,
"Unequip this equipment", MENU_UNSELECTED);
@ -2615,7 +2620,7 @@ struct obj *obj;
add_menu(win, NO_GLYPH, &any, 'w', 0, ATR_NONE,
"Hold this item in your hands", MENU_UNSELECTED);
/* W: Equip this item */
if (!(obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))) {
if (!(obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL | W_BELT))) {
any.a_void = (genericptr_t)dowear;
if (obj->oclass == ARMOR_CLASS)
add_menu(win, NO_GLYPH, &any, 'W', 0, ATR_NONE,
@ -3764,7 +3769,7 @@ winid *datawin;
* Expects ARM_SUIT = 0, all the way up to ARM_SHIRT = 6. */
if (!printed_type) {
const char* armorslots[] = {
"torso", "shield", "helm", "gloves", "boots", "cloak", "shirt"
"torso", "shield", "helm", "gloves", "boots", "cloak", "shirt", "belt"
};
if (obj) {
Sprintf(buf, "%s, worn in the %s slot.",
@ -6370,6 +6375,9 @@ u_clothing_discomfort()
if(uamul){
count++;
}
if(ubelt){
count++;
}
if(uleft) count++;
if(uright) count++;
if(ublindf){
@ -6395,6 +6403,7 @@ int material;
boolean marm_blocks_ub = FALSE;
boolean hasgloves = !!which_armor(mon, W_ARMG);
boolean hasshirt = !!which_armor(mon, W_ARMU);
boolean hasarm = !!which_armor(mon, W_ARMU);
curarm = which_armor(mon, W_ARMU);
if(curarm && curarm->obj_material == material)
@ -6435,6 +6444,10 @@ int material;
if(curarm && curarm->obj_material == material && !hasshirt && !marm_blocks_ub)
count++;
curarm = which_armor(mon, W_BELT);
if(curarm && curarm->obj_material == material && !hasshirt && !hasarm)
count++;
if(mon->entangled_oid && !hasshirt && !marm_blocks_ub && !which_armor(mon, W_ARMC) && entangle_material(mon, material))
count++;
@ -6458,6 +6471,7 @@ int bcu;
boolean marm_blocks_ub = FALSE;
boolean hasgloves = !!which_armor(mon, W_ARMG);
boolean hasshirt = !!which_armor(mon, W_ARMU);
boolean hasarm = !!which_armor(mon, W_ARM);
curarm = which_armor(mon, W_ARMU);
if(curarm && bcu(curarm) == bcu)
@ -6498,6 +6512,10 @@ int bcu;
if(curarm && bcu(curarm) == bcu && !hasshirt && !marm_blocks_ub)
count++;
curarm = which_armor(mon, W_BELT);
if(curarm && bcu(curarm) == bcu && !hasshirt && !hasarm)
count++;
if(mon->entangled_oid && !hasshirt && !marm_blocks_ub && !which_armor(mon, W_ARMC) && entangle_beatitude(mon, bcu))
count++;
@ -6541,6 +6559,8 @@ int material;
count++;
if(uamul && uamul->obj_material == material && !uarmu && !(uarm && arm_blocks_upper_body(uarm->otyp)))
count++;
if(ubelt && ubelt->obj_material == material && !uarmu && !uarm)
count++;
if(u.uentangled_oid && !uarmu && !uarm && !(uarm && arm_blocks_upper_body(uarm->otyp)) && entangle_material(&youmonst, material))
count++;
if(ublindf && ublindf->obj_material == material)
@ -6584,6 +6604,8 @@ int bcu;
count++;
if(uamul && bcu(uamul) == bcu && !uarmu && !(uarm && arm_blocks_upper_body(uarm->otyp)))
count++;
if(ubelt && bcu(ubelt) == bcu && !uarmu && !uarm)
count++;
if(u.uentangled_oid && !uarmu && !(uarm && arm_blocks_upper_body(uarm->otyp)) && !uarmc && entangle_beatitude(&youmonst, bcu))
count++;
if(ublindf && bcu(ublindf) == bcu)

View file

@ -7049,8 +7049,8 @@ int tary;
/* don't cast red word if target is already disrobed/disrobing */
if (spellnum == MON_RED_WORD
&& (youdef ?
(u.ufirst_know || !(uarmh || uarmc || uarm || uarmu || uarmg || uarmf || uamul || ublindf || uleft || uright))
: (!(mdef->misc_worn_check&(W_ARMOR|W_AMUL|W_TOOL)) || mdef->mdisrobe)
(u.ufirst_know || !(uarmh || uarmc || uarm || ubelt || uarmu || uarmg || uarmf || uamul || ublindf || uleft || uright))
: (!(mdef->misc_worn_check&(W_ARMOR|W_AMUL|W_BELT|W_TOOL)) || mdef->mdisrobe)
)
)
return TRUE;

View file

@ -3179,6 +3179,11 @@ const char *fmt, *str;
if(uamul && uamul->otyp == AMULET_OF_REFLECTION) makeknown(AMULET_OF_REFLECTION);
}
return TRUE;
} else if (EReflecting & W_BELT) {
if (fmt && str) {
pline(fmt, str, "belt");
}
return TRUE;
} else if (EReflecting & W_ARMG) {
if (fmt && str) {
pline(fmt, str, "gauntlets");

View file

@ -764,6 +764,8 @@ BOW(("bladed bow"), 1, MZ_LARGE, 0, 60, 75, 0, IRON, P_BOW, HI_METAL, O_TRAIT
ARMOR(names, kn, mgc, MZ_SMALL, 0, {0}, prob, delay, wt, cost, ac, dr, can, ARM_DR, ARM_GLOVES, metal, c, __VA_ARGS__)
#define BOOTS(names,kn,mgc,prob,delay,wt,cost,ac,dr,can,metal,c,...) \
ARMOR(names, kn, mgc, MZ_SMALL, 0, {0}, prob, delay, wt, cost, ac, dr, can, LEG_DR, ARM_BOOTS, metal, c, __VA_ARGS__)
#define BELT(names,kn,mgc,prob,wt,cost,ac,dr,can,metal,c,...) \
ARMOR(names, kn, mgc, MZ_SMALL, 0, {0}, prob, 1, wt, cost, ac, dr, can, LEG_DR, ARM_BELT, metal, c, __VA_ARGS__)
/* helmets */
HELM(("sedge hat", "wide conical hat"), /*Needs encyc entry*//*Needs tile*/
@ -1148,6 +1150,7 @@ BOOTS(("flying boots", "snow boots"),
#undef GLOVES
#undef BOOTS
#undef ARMOR
#undef BELT
/* rings ... */
#define RING(names,power,cost,mgc,spec,mohs,metal,color,...) OBJECT( \

View file

@ -2284,7 +2284,7 @@ weapon:
}
break;
case ARMOR_CLASS:
if (obj->owornmask & W_ARMOR)
if (obj->owornmask & (W_ARMOR|W_BELT))
Strcat(buf, (obj == uskin) ? " (embedded in your skin)" :
" (being worn)");
if (obj->lamplit)

View file

@ -378,7 +378,7 @@ is_worn_by_type(otmp)
register struct obj *otmp;
{
return((boolean)(!!(otmp->owornmask &
(W_ARMOR | W_RING | W_AMUL | W_TOOL | W_WEP | W_SWAPWEP | W_QUIVER)))
(W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL | W_WEP | W_SWAPWEP | W_QUIVER)))
&& (index(valid_menu_classes, otmp->oclass) != (char *)0));
}
@ -905,7 +905,7 @@ int how; /* type of query */
if (ccount == 1 && !do_unpaid && num_buc_types <= 1 && !(qflags & BILLED_TYPES)) {
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
if ((qflags & WORN_TYPES) &&
!(curr->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL|W_WEP|W_SWAPWEP|W_QUIVER)))
!(curr->owornmask & (W_ARMOR|W_RING|W_AMUL|W_BELT|W_TOOL|W_WEP|W_SWAPWEP|W_QUIVER)))
continue;
break;
}
@ -939,7 +939,7 @@ int how; /* type of query */
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
if (curr->oclass == *pack) {
if ((qflags & WORN_TYPES) &&
!(curr->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL |
!(curr->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL |
W_WEP | W_SWAPWEP | W_QUIVER)))
continue;
if (!collected_type_name) {
@ -1039,7 +1039,7 @@ int qflags;
for (curr = olist; curr; curr = FOLLOW(curr, qflags)) {
if (curr->oclass == *pack) {
if ((qflags & WORN_TYPES) &&
!(curr->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL |
!(curr->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL |
W_WEP | W_SWAPWEP | W_QUIVER)))
continue;
if (!counted_category) {
@ -2077,6 +2077,8 @@ dopetequip()
flag = W_ARM;
} else if(is_worn_tool(otmp)){
flag = W_TOOL;
} else if(is_belt(otmp)){
flag = W_BELT;
} else {
pline("Error: Unknown monster armor type!?");
return MOVE_CANCELLED;
@ -2204,7 +2206,7 @@ register struct obj *obj;
) {
pline("The artifact isn't interested in taking %s.", the(xname(obj)));
return 0;
} else if (obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)) {
} else if (obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL)) {
Norep("You cannot %s %s you are wearing.",
Icebox ? "refrigerate" : "stash", something);
return 0;
@ -3365,6 +3367,8 @@ struct monst *mon;
addArmorMenuOption
} else if(is_worn_tool(otmp) && !(mon->misc_worn_check&W_TOOL) && can_wear_blindf(mon->data)){
addArmorMenuOption
} else if(is_belt(otmp) && !(mon->misc_worn_check&W_BELT) && can_wear_belt(mon->data)){
addArmorMenuOption
}
}
}

View file

@ -331,6 +331,8 @@ worst_cursed_item()
#endif
} else if (uamul && uamul->cursed) { /* amulet */
otmp = uamul;
} else if (ubelt && ubelt->cursed) { /* belt */
otmp = ubelt;
} else if (uleft && uleft->cursed) { /* left ring */
otmp = uleft;
} else if (uright && uright->cursed) { /* right ring */
@ -3146,6 +3148,7 @@ int godnum;
if (uwep && not_fully_identified(uwep)) identify(uwep);
else if (uswapwep && not_fully_identified(uswapwep)) identify(uswapwep);
else if (uamul && not_fully_identified(uamul)) identify(uamul);
else if (ubelt && not_fully_identified(ubelt)) identify(ubelt);
else if (uleft && not_fully_identified(uleft)) identify(uleft);
else if (uright && not_fully_identified(uright)) identify(uright);
else if (uarmc && not_fully_identified(uarmc)) identify(uarmc);
@ -3251,6 +3254,7 @@ int godnum;
else if (uarms && wrongbuc(uarms)) otmp = uarms;
/* then cloak due to body armor */
else if (uarmc && wrongbuc(uarmc)) otmp = uarmc;
else if (ubelt && wrongbuc(ubelt)) otmp = uarmc;
else if (uarm && wrongbuc(uarm)) otmp = uarm;
else if (uarmh && wrongbuc(uarmh)) otmp = uarmh;
else if (uarmf && wrongbuc(uarmf)) otmp = uarmf;

View file

@ -208,6 +208,8 @@ boolean unchain_ball; /* whether to unpunish or just unwield */
else setworn((struct obj *)0, obj->owornmask & W_ARMOR);
} else if (obj->owornmask & W_AMUL) {
Amulet_off();
} else if (obj->owornmask & W_BELT) {
Belt_off();
} else if (obj->owornmask & W_RING) {
Ring_gone(obj);
} else if (obj->owornmask & W_TOOL) {
@ -289,7 +291,7 @@ nothing_to_steal:
#endif
)
tmp += ((otmp->owornmask &
(W_ARMOR | W_RING | W_AMUL | W_TOOL)) ? 5 : 1);
(W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL)) ? 5 : 1);
if (!tmp) goto nothing_to_steal;
tmp = rn2(tmp);
for(otmp = invent; otmp; otmp = otmp->nobj)
@ -300,7 +302,7 @@ nothing_to_steal:
#endif
)
if((tmp -= ((otmp->owornmask &
(W_ARMOR | W_RING | W_AMUL | W_TOOL)) ? 5 : 1)) < 0)
(W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL)) ? 5 : 1)) < 0)
break;
if(!otmp) {
impossible("Steal fails!");
@ -360,7 +362,7 @@ gotobj:
/* you're going to notice the theft... */
stop_occupation();
if((otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))){
if((otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL))){
switch(otmp->oclass) {
case TOOL_CLASS:
case AMULET_CLASS:

View file

@ -3617,7 +3617,7 @@ boolean *lostsome;
if (!((obj->otyp == LOADSTONE && obj->cursed) ||
obj == uamul || obj == uleft || obj == uright ||
obj == ublindf || obj == uarm || obj == uarmc ||
obj == uarmg || obj == uarmf ||
obj == uarmg || obj == ubelt || obj == uarmf ||
obj == uarmu ||
(obj->cursed && !Weldproof && (obj == uarmh || obj == uarms)) ||
welded(obj)))
@ -5371,6 +5371,7 @@ boolean initialize;
else if(obj == uright) Ring_gone(obj);
else if(obj == ublindf) Blindf_off(obj);
else if(obj == uamul) Amulet_off();
else if(obj == ubelt) Belt_off();
else if(obj == uwep) uwepgone();
else if (obj == uquiver) uqwepgone();
else if (obj == uswapwep) uswapwepgone();

View file

@ -301,7 +301,7 @@ dowield()
} else if (wep == uquiver){
if(wep->ostolen && u.sealsActive&SEAL_ANDROMALIUS) unbind(SEAL_ANDROMALIUS, TRUE);
setuqwep((struct obj *) 0);
} else if (wep->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL
} else if (wep->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL
#ifdef STEED
| W_SADDLE
#endif
@ -411,7 +411,7 @@ dowieldquiver()
pline("%s already being used as a weapon!",
!is_plural(uwep) ? "That is" : "They are");
return MOVE_CANCELLED;
} else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL
} else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMUL | W_BELT | W_TOOL
#ifdef STEED
| W_SADDLE
#endif
@ -479,7 +479,7 @@ const char *verb; /* "rub",&c */
strstri(what, "pair of ") != 0 ||
strstri(what, "s of ") != 0);
if (obj->owornmask & (W_ARMOR|W_RING|W_AMUL|W_TOOL)) {
if (obj->owornmask & (W_ARMOR|W_RING|W_AMUL|W_BELT|W_TOOL)) {
char yourbuf[BUFSZ];
You_cant("%s %s %s while wearing %s.",

View file

@ -35,6 +35,7 @@ const struct worn {
{ W_SWAPWEP, &uswapwep },
{ W_QUIVER, &uquiver },
{ W_AMUL, &uamul },
{ W_BELT, &ubelt },
{ W_TOOL, &ublindf },
{ W_BALL, &uball },
{ W_CHAIN, &uchain },
@ -1714,6 +1715,7 @@ boolean creation;
m_dowear_type(mon, W_ARMF, creation, FALSE);
m_dowear_type(mon, W_ARM, creation, FALSE);
m_dowear_type(mon, W_TOOL, creation, FALSE);
m_dowear_type(mon, W_BELT, creation, FALSE);
}
STATIC_OVL void
@ -1740,6 +1742,7 @@ boolean racialexception;
if (old && old->otyp == STATUE && (old->corpsenm == PM_PARASITIC_MIND_FLAYER || old->corpsenm == PM_PARASITIC_MASTER_MIND_FLAYER))
return;
if (old && flag == W_AMUL) return; /* no such thing as better amulets */
if (old && flag == W_BELT) return; /* no such thing as better belts */
best = old;
for(obj = mon->minvent; obj; obj = obj->nobj) {
@ -1758,6 +1761,9 @@ boolean racialexception;
continue;
best = obj;
goto outer_break; /* no such thing as better amulets */
case W_BELT:
if (!is_belt(obj) || !can_wear_belt(mon->data)) continue;
break;
case W_ARMU:
if (!is_shirt(obj) || obj->objsize != mon->data->msize || !shirt_match(mon->data,obj)) continue;
break;
@ -1891,7 +1897,7 @@ struct monst *mon;
if (mon->mfrozen) return FALSE;
do switch(rnd(7)){
do switch(rnd(8)){
case 1:
flag = W_ARM;
break;
@ -1913,6 +1919,9 @@ struct monst *mon;
case 7:
flag = W_AMUL;
break;
case 8:
flag = W_BELT;
break;
} while(tries-- && !(old = which_armor(mon, flag)));
if(!old) return FALSE;
@ -1943,7 +1952,7 @@ struct monst *mon;
if (mon->mfrozen) return FALSE;
for(i = 1; i<=7;i++){
switch(rnd(7)){
switch(rnd(8)){
case 1:
flag = W_ARM;
break;
@ -1965,6 +1974,9 @@ struct monst *mon;
case 7:
flag = W_AMUL;
break;
case 8:
flag = W_BELT;
break;
}
if(!which_armor(mon, flag)) continue;