This Patch is licensed under the NetHack General Public License. Created on 2015-04-11, by APic@IRCnet diff --git a/include/decl.h b/include/decl.h index 76f9533..7c5f1ac 100644 --- a/include/decl.h +++ b/include/decl.h @@ -242,7 +242,7 @@ E NEARDATA struct obj *invent, #ifdef TOURIST *uarmu, /* under-wear, so to speak */ #endif - *uskin, *uamul, *uleft, *uright, *ublindf, + *uskin, *uamull, *uamulr, *uleft, *uright, *ublindf, *uwep, *uswapwep, *uquiver; E NEARDATA struct obj *uchain; /* defined only when punished */ diff --git a/include/extern.h b/include/extern.h index 4e2314d..985df2a 100644 --- a/include/extern.h +++ b/include/extern.h @@ -372,7 +372,7 @@ E int NDECL(Shield_off); #ifdef TOURIST E int NDECL(Shirt_off); #endif -E void NDECL(Amulet_off); +E void FDECL(Amulet_off, (struct obj *)); E void FDECL(Ring_on, (struct obj *)); E void FDECL(Ring_off, (struct obj *)); E void FDECL(Ring_gone, (struct obj *)); diff --git a/include/prop.h b/include/prop.h index f2ce274..b4fd43a 100644 --- a/include/prop.h +++ b/include/prop.h @@ -100,16 +100,17 @@ struct prop { # define W_ART 0x00001000L /* Carrying artifact (not really worn) */ # define W_ARTI 0x00002000L /* Invoked artifact (not really worn) */ /* Amulets, rings, tools, and other items */ -# define W_AMUL 0x00010000L /* Amulet */ -# define W_RINGL 0x00020000L /* Left ring */ -# define W_RINGR 0x00040000L /* Right ring */ +# define W_AMULL 0x00010000L /* Left Amulet */ +# define W_AMULR 0x00020000L /* Right Amulet */ +# define W_RINGL 0x00040000L /* Left ring */ +# define W_RINGR 0x00080000L /* Right ring */ # define W_RING (W_RINGL | W_RINGR) -# define W_TOOL 0x00080000L /* Eyewear */ +# define W_TOOL 0x00100000L /* Eyewear */ #ifdef STEED -# define W_SADDLE 0x00100000L /* KMH -- For riding monsters */ +# define W_SADDLE 0x00200000L /* KMH -- For riding monsters */ #endif -# define W_BALL 0x00200000L /* Punishment ball */ -# define W_CHAIN 0x00400000L /* Punishment chain */ +# define W_BALL 0x00400000L /* Punishment ball */ +# define W_CHAIN 0x00800000L /* Punishment chain */ /*** Property is blocked by an object ***/ long blocked; /* Same assignments as extrinsic */ @@ -139,7 +140,8 @@ struct prop { #define WORN_SHIELD W_ARMS #define WORN_GLOVES W_ARMG #define WORN_BOOTS W_ARMF -#define WORN_AMUL W_AMUL +#define WORN_AMUL_L W_AMULL +#define WORN_AMUL_R W_AMULR #define WORN_BLINDF W_TOOL #ifdef TOURIST #define WORN_SHIRT W_ARMU diff --git a/src/decl.c b/src/decl.c index 4dd460e..5b92b83 100644 --- a/src/decl.c +++ b/src/decl.c @@ -154,7 +154,9 @@ NEARDATA struct obj *invent = (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, - *uarmf = (struct obj *)0, *uamul = (struct obj *)0, + *uarmf = (struct obj *)0, + *uamull = (struct obj *)0, + *uamulr = (struct obj *)0, *uright = (struct obj *)0, *uleft = (struct obj *)0, *ublindf = (struct obj *)0, diff --git a/src/do.c b/src/do.c index 858777f..a1d693d 100644 --- a/src/do.c +++ b/src/do.c @@ -413,7 +413,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_AMULL | W_AMULR | W_TOOL)){ if (*word) Norep("You cannot %s %s you are wearing.",word, something); diff --git a/src/do_wear.c b/src/do_wear.c index c197c1b..b3c2143 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -35,7 +35,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_L, WORN_AMUL_R, WORN_ARMOR, #ifdef TOURIST WORN_SHIRT, #endif @@ -51,7 +51,7 @@ STATIC_PTR int NDECL(Shield_on); #ifdef TOURIST STATIC_PTR int NDECL(Shirt_on); #endif -STATIC_DCL void NDECL(Amulet_on); +STATIC_DCL void FDECL(Amulet_on, (struct obj *)); STATIC_DCL void FDECL(Ring_off_or_gone, (struct obj *, BOOLEAN_P)); STATIC_PTR int FDECL(select_off, (struct obj *)); STATIC_DCL struct obj *NDECL(do_takeoff); @@ -575,9 +575,9 @@ Armor_gone() } STATIC_OVL void -Amulet_on() +Amulet_on(struct obj *amul) { - switch(uamul->otyp) { + switch(amul->otyp) { case AMULET_OF_ESP: case AMULET_OF_LIFE_SAVING: case AMULET_VERSUS_POISON: @@ -595,10 +595,10 @@ Amulet_on() { int orig_sex = poly_gender(); - if (Unchanging) break; - change_sex(); + if(!Unchanging) + change_sex(); /* Don't use same message as polymorph */ - if (orig_sex != poly_gender()) { + if (!Unchanging || orig_sex != poly_gender()) { makeknown(AMULET_OF_CHANGE); You("are suddenly very %s!", flags.female ? "feminine" : "masculine"); @@ -608,11 +608,11 @@ Amulet_on() changed the character's base sex */ You("don't feel like yourself."); pline_The("amulet disintegrates!"); - if (orig_sex == poly_gender() && uamul->dknown && + if (orig_sex == poly_gender() && amul->dknown && !objects[AMULET_OF_CHANGE].oc_name_known && !objects[AMULET_OF_CHANGE].oc_uname) - docall(uamul); - useup(uamul); + docall(amul); + useup(amul); break; } case AMULET_OF_STRANGULATION: @@ -629,14 +629,17 @@ Amulet_on() } void -Amulet_off() +Amulet_off(struct obj *amul) { - takeoff_mask &= ~W_AMUL; + if(amul == uamull) + takeoff_mask &= ~W_AMULL; + else + takeoff_mask &= ~W_AMULR; - switch(uamul->otyp) { + switch(amul->otyp) { case AMULET_OF_ESP: /* need to update ability before calling see_monsters() */ - setworn((struct obj *)0, W_AMUL); + setworn((struct obj *)0, amul==uamull ? W_AMULL : W_AMULR); see_monsters(); return; case AMULET_OF_LIFE_SAVING: @@ -650,7 +653,10 @@ Amulet_off() if (Underwater) { /* HMagical_breathing must be set off before calling drown() */ - setworn((struct obj *)0, W_AMUL); + if(amul == uamull) + setworn((struct obj *)0, W_AMULL); + else + setworn((struct obj *)0, W_AMULR); if (!breathless(youmonst.data) && !amphibious(youmonst.data) && !Swimming) { You("suddenly inhale an unhealthy amount of water!"); @@ -666,14 +672,20 @@ Amulet_off() } break; case AMULET_OF_RESTFUL_SLEEP: - setworn((struct obj *)0, W_AMUL); + if(amul == uamull) + setworn((struct obj *)0, W_AMULL); + else + setworn((struct obj *)0, W_AMULR); if (!ESleeping) HSleeping = 0; return; case AMULET_OF_YENDOR: break; } - setworn((struct obj *)0, W_AMUL); + if(amul == uamull) + setworn((struct obj *)0, W_AMULL); + else + setworn((struct obj *)0, W_AMULR); return; } @@ -1074,7 +1086,7 @@ dotakeoff() "dragon scales are" : "dragon scale mail is"); else pline("Not wearing any armor.%s", (iflags.cmdassist && - (uleft || uright || uamul || ublindf)) ? + (uleft || uright || uamull || uamulr || ublindf)) ? " Use 'R' command to remove accessories." : ""); return 0; } @@ -1115,7 +1127,8 @@ doremring() #define MOREACC(x) if (x) { Accessories++; otmp = x; } MOREACC(uleft); MOREACC(uright); - MOREACC(uamul); + MOREACC(uamull); + MOREACC(uamulr); MOREACC(ublindf); if(!Accessories) { @@ -1130,7 +1143,7 @@ doremring() } if (Accessories != 1) otmp = getobj(accessories, "remove"); if(!otmp) return(0); - if(!(otmp->owornmask & (W_RING | W_AMUL | W_TOOL))) { + if(!(otmp->owornmask & (W_RING | W_AMULL | W_AMULR | W_TOOL))) { You("are not wearing that."); return(0); } @@ -1149,8 +1162,8 @@ doremring() */ off_msg(otmp); Ring_off(otmp); - } else if (otmp == uamul) { - Amulet_off(); + } else if (otmp == uamull || otmp == uamulr) { + Amulet_off(otmp); off_msg(otmp); } else if (otmp == ublindf) { Blindf_off(otmp); /* does its own off_msg */ @@ -1465,8 +1478,8 @@ doputon() register struct obj *otmp; long mask = 0L; - if(uleft && uright && uamul && ublindf) { - Your("%s%s are full, and you're already wearing an amulet and %s.", + if(uleft && uright && uamull && uamulr && ublindf) { + Your("%s%s are full, and you're already wearing two amulets and %s.", humanoid(youmonst.data) ? "ring-" : "", makeplural(body_part(FINGER)), ublindf->otyp==LENSES ? "some lenses" : "a blindfold"); @@ -1474,7 +1487,7 @@ doputon() } otmp = getobj(accessories, "put on"); if(!otmp) return(0); - if(otmp->owornmask & (W_RING | W_AMUL | W_TOOL)) { + if(otmp->owornmask & (W_RING | W_AMULL | W_AMULR | W_TOOL)) { already_wearing(c_that_); return(0); } @@ -1541,19 +1554,48 @@ doputon() setworn(otmp, mask); Ring_on(otmp); } else if (otmp->oclass == AMULET_CLASS) { - if(uamul) { - already_wearing("an amulet"); - return(0); - } + if(u.umonnum == PM_ETTIN || u.umonnum == PM_ETTIN_ZOMBIE || u.umonnum == PM_ETTIN_MUMMY) { + if(uamull && uamulr) { + already_wearing("two amulets"); + return(0); + } + if(uamull) mask = WORN_AMUL_R; + else if(uamulr) mask = WORN_AMUL_L; + else do { + char qbuf[QBUFSZ]; + char answer; + + Sprintf(qbuf, "Which %s, Right or Left?", + body_part(HEAD)); + if(!(answer = yn_function(qbuf, "rl", '\0'))) + return(0); + switch(answer){ + case 'l': + case 'L': + mask = WORN_AMUL_L; + break; + case 'r': + case 'R': + mask = WORN_AMUL_R; + break; + } + } while(!mask); + } else { + if(uamull) { + already_wearing("an amulet"); + return(0); + } + mask = WORN_AMUL_L; + } if (otmp->oartifact && !touch_artifact(otmp, &youmonst)) return 1; - setworn(otmp, W_AMUL); if (otmp->otyp == AMULET_OF_CHANGE) { - Amulet_on(); + Amulet_on(otmp); /* Don't do a prinv() since the amulet is now gone */ return(1); } - Amulet_on(); + setworn(otmp, mask); + Amulet_on(otmp); } else { /* it's a blindfold, towel, or lenses */ if (ublindf) { if (ublindf->otyp == TOWEL) @@ -1736,8 +1778,11 @@ int otyp; /* reasons ring can't be removed match those checked by select_off(); limbless case has extra checks because ordinarily it's temporary */ if (nolimbs(youmonst.data) && - uamul && uamul->otyp == AMULET_OF_UNCHANGING && uamul->cursed) - return uamul; + (uamull && uamull->otyp == AMULET_OF_UNCHANGING && uamull->cursed)) + return uamull; + if (nolimbs(youmonst.data) && + (uamulr && uamulr->otyp == AMULET_OF_UNCHANGING && uamulr->cursed)) + return uamulr; if (welded(uwep) && (ring == uright || bimanual(uwep))) return uwep; if (uarmg && uarmg->cursed) return uarmg; if (ring->cursed) return ring; @@ -1750,7 +1795,8 @@ int otyp; struct obj * unchanger() { - if (uamul && uamul->otyp == AMULET_OF_UNCHANGING) return uamul; + if (uamull && uamull->otyp == AMULET_OF_UNCHANGING) return uamull; + if (uamulr && uamulr->otyp == AMULET_OF_UNCHANGING) return uamulr; return 0; } @@ -1857,7 +1903,8 @@ register struct obj *otmp; #endif 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 == uamull) takeoff_mask |= WORN_AMUL_L; + else if(otmp == uamulr) takeoff_mask |= WORN_AMUL_R; else if(otmp == ublindf) takeoff_mask |= WORN_BLINDF; else if(otmp == uwep) takeoff_mask |= W_WEP; else if(otmp == uswapwep) takeoff_mask |= W_SWAPWEP; @@ -1909,9 +1956,12 @@ do_takeoff() otmp = uarmu; if (!cursed(otmp)) (void) Shirt_off(); #endif - } else if (taking_off == WORN_AMUL) { - otmp = uamul; - if(!cursed(otmp)) Amulet_off(); + } else if (taking_off == WORN_AMUL_L) { + otmp = uamull; + if(!cursed(otmp)) Amulet_off(otmp); + } else if (taking_off == WORN_AMUL_R) { + otmp = uamulr; + if(!cursed(otmp)) Amulet_off(otmp); } else if (taking_off == LEFT_RING) { otmp = uleft; if(!cursed(otmp)) Ring_off(uleft); @@ -1987,7 +2037,9 @@ take_off() if (uarm) todelay += 2 * objects[uarm->otyp].oc_delay; if (uarmc) todelay += 2 * objects[uarmc->otyp].oc_delay + 1; #endif - } else if (taking_off == WORN_AMUL) { + } else if (taking_off == WORN_AMUL_L) { + todelay = 1; + } else if (taking_off == WORN_AMUL_R) { todelay = 1; } else if (taking_off == LEFT_RING) { todelay = 1; @@ -2030,7 +2082,7 @@ doddoremarm() You("continue %s.", disrobing); set_occupation(take_off, disrobing, 0); return 0; - } else if (!uwep && !uswapwep && !uquiver && !uamul && !ublindf && + } else if (!uwep && !uswapwep && !uquiver && !uamull && !uamulr && !ublindf && !uleft && !uright && !wearing_armor()) { You("are not wearing anything."); return 0; diff --git a/src/eat.c b/src/eat.c index 12e8d9b..0352e73 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1896,7 +1896,7 @@ doeat() /* generic "eat" command funtion (see cmd.c) */ if (!is_edible(otmp)) { You("cannot eat that!"); return 0; - } else if ((otmp->owornmask & (W_ARMOR|W_TOOL|W_AMUL + } else if ((otmp->owornmask & (W_ARMOR|W_TOOL|W_AMULL|W_AMULR #ifdef STEED |W_SADDLE #endif @@ -2149,7 +2149,8 @@ gethungry() /* as time goes by - called by moveloop() and domove() */ (uleft->spe || !objects[uleft->otyp].oc_charged)) u.uhunger--; break; - case 8: if (uamul) u.uhunger--; + case 8: if (uamull) u.uhunger--; + if (uamulr) u.uhunger--; break; case 12: if (uright && (uright->spe || !objects[uright->otyp].oc_charged)) diff --git a/src/end.c b/src/end.c index 58d47e0..de9a461 100644 --- a/src/end.c +++ b/src/end.c @@ -578,7 +578,10 @@ int how; if (how == CHOKING) You("vomit ..."); You_feel("much better!"); pline_The("medallion crumbles to dust!"); - if (uamul) useup(uamul); + if (uamull && uamull->otyp == AMULET_OF_LIFE_SAVING) + useup(uamull); + else if(uamulr && uamulr->otyp == AMULET_OF_LIFE_SAVING) + useup(uamulr); (void) adjattrib(A_CON, -1, TRUE); if(u.uhpmax <= 0) u.uhpmax = 10; /* arbitrary */ diff --git a/src/invent.c b/src/invent.c index b9a3683..10b3771 100644 --- a/src/invent.c +++ b/src/invent.c @@ -831,14 +831,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_AMULL | W_AMULR | W_TOOL)) || (otmp==uarm && uarmc) #ifdef TOURIST || (otmp==uarmu && (uarm || uarmc)) #endif )) || (putting_on(word) && - (otmp->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL))) + (otmp->owornmask & (W_ARMOR | W_RING | W_AMULL | W_AMULR | W_TOOL))) /* already worn */ #if 0 /* 3.4.1 -- include currently wielded weapon among the choices */ || (!strcmp(word, "wield") && @@ -1159,7 +1159,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_AMULL | W_AMULR | W_TOOL | #ifdef STEED W_SADDLE | #endif @@ -1281,8 +1281,8 @@ unsigned *resultflags; } else if (oc_of_sym == RING_CLASS && !uright && !uleft) { You("are not wearing rings."); return 0; - } else if (oc_of_sym == AMULET_CLASS && !uamul) { - You("are not wearing an amulet."); + } else if (oc_of_sym == AMULET_CLASS && !uamull && !uamulr) { + You("are not wearing amulets."); return 0; } else if (oc_of_sym == TOOL_CLASS && !ublindf) { You("are not wearing a blindfold."); @@ -2478,10 +2478,17 @@ doprring() int dopramulet() { - if (!uamul) - You("are not wearing an amulet."); - else - prinv((char *)0, uamul, 0L); + if (!uamull && !uamulr) + You("are not wearing any amulets."); + else { + char lets[3]; + register int ct = 0; + + if(uamull) lets[ct++] = obj_to_let(uamull); + if(uamulr) lets[ct++] = obj_to_let(uamulr); + lets[ct] = 0; + (void) display_inventory(lets, FALSE); + } return 0; } diff --git a/src/mhitu.c b/src/mhitu.c index c0711fc..8f2099a 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1078,16 +1078,19 @@ dopois: /* No such thing as mindless players... */ if (ABASE(A_INT) <= ATTRMIN(A_INT)) { int lifesaved = 0; - struct obj *wore_amulet = uamul; + struct obj *wore_amulet_l = uamull; + struct obj *wore_amulet_r = uamulr; while(1) { /* avoid looping on "die(y/n)?" */ if (lifesaved && (discover || wizard)) { - if (wore_amulet && !uamul) { + if (wore_amulet_l && !uamull) { /* used up AMULET_OF_LIFE_SAVING; still subject to dying from brainlessness */ - wore_amulet = 0; - } else { + wore_amulet_l = 0; + } else if (wore_amulet_r && !uamulr) { + wore_amulet_r = 0; + } else { /* explicitly chose not to die; arbitrarily boost intelligence */ ABASE(A_INT) = ATTRMIN(A_INT) + 2; diff --git a/src/mon.c b/src/mon.c index c769953..98b413c 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1360,7 +1360,12 @@ mlifesaver(mon) struct monst *mon; { if (!nonliving(mon->data)) { - struct obj *otmp = which_armor(mon, W_AMUL); + struct obj *otmp = which_armor(mon, W_AMULL); + + if (otmp && otmp->otyp == AMULET_OF_LIFE_SAVING) + return otmp; + + otmp = which_armor(mon, W_AMULR); if (otmp && otmp->otyp == AMULET_OF_LIFE_SAVING) return otmp; diff --git a/src/muse.c b/src/muse.c index 86044e5..e85747d 100644 --- a/src/muse.c +++ b/src/muse.c @@ -2041,8 +2041,10 @@ const char *str; if (str) pline(str, s_suffix(mon_nam(mon)), "weapon"); return TRUE; - } else if ((orefl = which_armor(mon, W_AMUL)) && - orefl->otyp == AMULET_OF_REFLECTION) { + } else if (((orefl = which_armor(mon, W_AMULL)) && + orefl->otyp == AMULET_OF_REFLECTION) || + ((orefl = which_armor(mon, W_AMULR))) && + orefl->otyp == AMULET_OF_REFLECTION) { if (str) { pline(str, s_suffix(mon_nam(mon)), "amulet"); makeknown(AMULET_OF_REFLECTION); @@ -2079,7 +2081,7 @@ const char *fmt, *str; if (fmt && str) pline(fmt, str, "weapon"); return TRUE; - } else if (EReflecting & W_AMUL) { + } else if ((EReflecting & W_AMULL) || (EReflecting & W_AMULR)) { if (fmt && str) { pline(fmt, str, "medallion"); makeknown(AMULET_OF_REFLECTION); diff --git a/src/objnam.c b/src/objnam.c index 2130432..f06537d 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -626,9 +626,15 @@ register struct obj *obj; switch(obj->oclass) { case AMULET_CLASS: - if(obj->owornmask & W_AMUL) - Strcat(bp, " (being worn)"); - break; + if(u.umonnum == PM_ETTIN || u.umonnum == PM_ETTIN_ZOMBIE || u.umonnum == PM_ETTIN_MUMMY) { + if(obj->owornmask & W_AMULR) Strcat(bp, " (on right "); + if(obj->owornmask & W_AMULL) Strcat(bp, " (on left "); + if((obj->owornmask & W_AMULL) || (obj->owornmask & W_AMULR)) { + Strcat(bp, body_part(HEAD)); + Strcat(bp, ")"); + } + } else if(obj->owornmask & W_AMULL) Strcat(bp, " (being worn)"); + break; case WEAPON_CLASS: if(ispoisoned) Strcat(prefix, "poisoned "); diff --git a/src/pickup.c b/src/pickup.c index 07be607..56c1cd0 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -365,7 +365,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_AMULL | W_AMULR | W_TOOL | W_WEP | W_SWAPWEP | W_QUIVER))) && (index(valid_menu_classes, otmp->oclass) != (char *)0)); } @@ -826,7 +826,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_AMULL|W_AMULR|W_TOOL|W_WEP|W_SWAPWEP|W_QUIVER))) continue; break; } @@ -860,7 +860,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_AMULL | W_AMULR | W_TOOL | W_WEP | W_SWAPWEP | W_QUIVER))) continue; if (!collected_type_name) { @@ -959,7 +959,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_AMULL | W_AMULR | W_TOOL | W_WEP | W_SWAPWEP | W_QUIVER))) continue; if (!counted_category) { @@ -1782,7 +1782,7 @@ register struct obj *obj; } else if (obj == current_container) { pline("That would be an interesting topological exercise."); return 0; - } else if (obj->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL)) { + } else if (obj->owornmask & (W_ARMOR | W_RING | W_AMULL | W_AMULR | W_TOOL)) { Norep("You cannot %s %s you are wearing.", Icebox ? "refrigerate" : "stash", something); return 0; diff --git a/src/polyself.c b/src/polyself.c index b051acb..9617abe 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -15,6 +15,7 @@ #ifdef OVLB STATIC_DCL void FDECL(polyman, (const char *,const char *)); STATIC_DCL void NDECL(break_armor); +STATIC_DCL void NDECL(drop_amulr); STATIC_DCL void FDECL(drop_weapon,(int)); STATIC_DCL void NDECL(uunstick); STATIC_DCL int FDECL(armor_to_dragon,(int)); @@ -76,6 +77,8 @@ const char *fmt, *arg; done(GENOCIDED); } + drop_amulr(); + if (u.twoweap && !could_twoweap(youmonst.data)) untwoweapon(); @@ -457,6 +460,7 @@ int mntmp; skinback(FALSE); break_armor(); drop_weapon(1); + drop_amulr(); if (hides_under(youmonst.data)) u.uundetected = OBJ_AT(u.ux, u.uy); else if (youmonst.data->mlet == S_EEL) @@ -706,6 +710,21 @@ int alone; } } +STATIC_OVL void +drop_amulr() +{ + struct obj *otmp; + + if(u.umonnum == PM_ETTIN || u.umonnum == PM_ETTIN_ZOMBIE || u.umonnum == PM_ETTIN_MUMMY) + return; + + if ((otmp = uamulr) != 0) { + Your("right amulet falls off."); + (void) Amulet_off(otmp); + dropx(otmp); + } +} + void rehumanize() { diff --git a/src/pray.c b/src/pray.c index 0df2855..47c4464 100644 --- a/src/pray.c +++ b/src/pray.c @@ -235,8 +235,10 @@ worst_cursed_item() } else if (uarmu && uarmu->cursed) { /* shirt */ otmp = uarmu; #endif - } else if (uamul && uamul->cursed) { /* amulet */ - otmp = uamul; + } else if (uamull && uamull->cursed) { /* left amulet */ + otmp = uamull; + } else if (uamulr && uamulr->cursed) { /* right amulet */ + otmp = uamulr; } else if (uleft && uleft->cursed) { /* left ring */ otmp = uleft; } else if (uright && uright->cursed) { /* right ring */ @@ -284,9 +286,13 @@ register int trouble; delayed_killer = 0; break; case TROUBLE_STRANGLED: - if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) { + if (uamull && uamull->otyp == AMULET_OF_STRANGULATION) { Your("amulet vanishes!"); - useup(uamul); + useup(uamull); + } + if (uamulr && uamulr->otyp == AMULET_OF_STRANGULATION) { + Your("amulet vanishes!"); + useup(uamulr); } You("can breathe again."); Strangled = 0; @@ -1269,7 +1275,8 @@ dosacrifice() return 1; } else { /* The final Test. Did you win? */ - if(uamul == otmp) Amulet_off(); + if(uamull == otmp) Amulet_off(otmp); + if(uamulr == otmp) Amulet_off(otmp); u.uevent.ascended = 1; if(carried(otmp)) useup(otmp); /* well, it's gone now */ else useupf(otmp, 1L); diff --git a/src/steal.c b/src/steal.c index 1feed77..22e3969 100644 --- a/src/steal.c +++ b/src/steal.c @@ -202,8 +202,8 @@ boolean unchain_ball; /* whether to unpunish or just unwield */ #endif /* catchall -- should never happen */ else setworn((struct obj *)0, obj->owornmask & W_ARMOR); - } else if (obj->owornmask & W_AMUL) { - Amulet_off(); + } else if ((obj->owornmask & W_AMULL) || (obj->owornmask & W_AMULR)) { + Amulet_off(obj); } else if (obj->owornmask & W_RING) { Ring_gone(obj); } else if (obj->owornmask & W_TOOL) { @@ -277,7 +277,7 @@ nothing_to_steal: #endif ) tmp += ((otmp->owornmask & - (W_ARMOR | W_RING | W_AMUL | W_TOOL)) ? 5 : 1); + (W_ARMOR | W_RING | W_AMULL | W_AMULR | W_TOOL)) ? 5 : 1); if (!tmp) goto nothing_to_steal; tmp = rn2(tmp); for(otmp = invent; otmp; otmp = otmp->nobj) @@ -287,7 +287,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_AMULL | W_AMULR | W_TOOL)) ? 5 : 1)) < 0) break; if(!otmp) { impossible("Steal fails!"); @@ -339,7 +339,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_AMULL | W_AMULR | W_TOOL))){ switch(otmp->oclass) { case TOOL_CLASS: case AMULET_CLASS: diff --git a/src/trap.c b/src/trap.c index d336276..e2a2fab 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2770,7 +2770,8 @@ boolean *lostsome; * for obvious reasons. */ if (!((obj->otyp == LOADSTONE && obj->cursed) || - obj == uamul || obj == uleft || obj == uright || + obj == uamull || obj == uamulr || + obj == uleft || obj == uright || obj == ublindf || obj == uarm || obj == uarmc || obj == uarmg || obj == uarmf || #ifdef TOURIST @@ -3964,7 +3965,8 @@ lava_effects() else if(obj == uleft) Ring_gone(obj); else if(obj == uright) Ring_gone(obj); else if(obj == ublindf) Blindf_off(obj); - else if(obj == uamul) Amulet_off(); + else if(obj == uamull) Amulet_off(obj); + else if(obj == uamulr) Amulet_off(obj); else if(obj == uwep) uwepgone(); else if (obj == uquiver) uqwepgone(); else if (obj == uswapwep) uswapwepgone(); diff --git a/src/wield.c b/src/wield.c index 0423116..86d9e8d 100644 --- a/src/wield.c +++ b/src/wield.c @@ -264,7 +264,7 @@ dowield() return (doswapweapon()); else if (wep == uquiver) 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_AMULL | W_AMULR | W_TOOL #ifdef STEED | W_SADDLE #endif @@ -367,7 +367,7 @@ dowieldquiver() pline("%s already being used as a weapon!", !is_plural(uwep) ? "That is" : "They are"); return(0); - } else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMUL | W_TOOL + } else if (newquiver->owornmask & (W_ARMOR | W_RING | W_AMULL | W_AMULR | W_TOOL #ifdef STEED | W_SADDLE #endif @@ -415,7 +415,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_AMULL|W_AMULR|W_TOOL)) { char yourbuf[BUFSZ]; You_cant("%s %s %s while wearing %s.", diff --git a/src/wizard.c b/src/wizard.c index c0f67e3..5102828 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -60,7 +60,8 @@ amulet() if (!u.uhave.amulet) return; #endif - if ((((amu = uamul) != 0 && amu->otyp == AMULET_OF_YENDOR) || + if ((((amu = uamull) != 0 && amu->otyp == AMULET_OF_YENDOR) || + ((amu = uamulr) != 0 && amu->otyp == AMULET_OF_YENDOR) || ((amu = uwep) != 0 && amu->otyp == AMULET_OF_YENDOR)) && !rn2(15)) { for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) { diff --git a/src/worn.c b/src/worn.c index 61a239c..9df1e24 100644 --- a/src/worn.c +++ b/src/worn.c @@ -26,7 +26,8 @@ const struct worn { { W_WEP, &uwep }, { W_SWAPWEP, &uswapwep }, { W_QUIVER, &uquiver }, - { W_AMUL, &uamul }, + { W_AMULL, &uamull }, + { W_AMULR, &uamulr }, { W_TOOL, &ublindf }, { W_BALL, &uball }, { W_CHAIN, &uchain }, @@ -373,7 +374,8 @@ boolean creation; (mon->data->mlet != S_MUMMY && mon->data != &mons[PM_SKELETON]))) return; - m_dowear_type(mon, W_AMUL, creation, FALSE); + m_dowear_type(mon, W_AMULL, creation, FALSE); + m_dowear_type(mon, W_AMULR, creation, FALSE); #ifdef TOURIST /* can't put on shirt if already wearing suit */ if (!cantweararm(mon->data) || (mon->misc_worn_check & W_ARM)) @@ -414,12 +416,13 @@ boolean racialexception; old = which_armor(mon, flag); if (old && old->cursed) return; - if (old && flag == W_AMUL) return; /* no such thing as better amulets */ + if (old && (flag == W_AMULL || flag == W_AMULR)) return; /* no such thing as better amulets */ best = old; for(obj = mon->minvent; obj; obj = obj->nobj) { switch(flag) { - case W_AMUL: + case W_AMULL: + case W_AMULR: if (obj->oclass != AMULET_CLASS || (obj->otyp != AMULET_OF_LIFE_SAVING && obj->otyp != AMULET_OF_REFLECTION))