1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2025-08-11 07:01:37 +01:00

freehand/nohands/nolimbs rationalization and straitjacket

This commit is contained in:
ChrisANG 2017-12-15 10:28:02 -05:00
parent a0e2951a28
commit 8d7c886c16
11 changed files with 78 additions and 21 deletions

View file

@ -2958,6 +2958,8 @@ struct obj *otmp;
if (nohands(youracedata))
what = "without hands";
else if(!freehand())
what = "without free hands";
else if (Stunned)
what = "while stunned";
else if (u.uswallow)
@ -3100,9 +3102,7 @@ struct obj **optr;
mtmp = m_at(rx, ry);
ttmp = t_at(rx, ry);
if (nohands(youracedata))
what = "without hands";
else if (Stunned)
if (Stunned)
what = "while stunned";
else if (u.uswallow)
what = is_animal(u.ustuck->data) ? "while swallowed" :
@ -3170,9 +3170,7 @@ struct obj *otmp;
{
const char *what = (char *)0;
if (nohands(youracedata))
what = "without hands";
else if (Stunned)
if (Stunned)
what = "while stunned";
else if (u.uswallow)
what = is_animal(u.ustuck->data) ? "while swallowed" :
@ -3708,8 +3706,8 @@ do_break_wand(obj)
is_fragile = (!strcmp(OBJ_DESCR(objects[obj->otyp]), "balsa"));
if (nohands(youracedata)) {
You_cant("break %s without hands!", the_wand);
if (nolimbs(youracedata)) {
You_cant("break %s without limbs!", the_wand);
return 0;
} else if (obj->oartifact || ACURR(A_STR) < (is_fragile ? 5 : 10)) {
You("don't have the strength to break %s!", the_wand);

View file

@ -1242,6 +1242,17 @@ dotakeoff()
register struct obj *otmp = (struct obj *)0;
int armorpieces = 0;
/* nohands checks for shields, gloves, etc... */
if (nohands(youracedata)) {
pline("Don't even bother.");
return(0);
}
if(!freehand()){
You("have no free %s to undress yourself with!", body_part(HAND));
return(0);
}
#define MOREARM(x) if (x) { armorpieces++; otmp = x; }
MOREARM(uarmh);
MOREARM(uarms);
@ -1680,6 +1691,11 @@ dowear()
pline("Don't even bother.");
return(0);
}
if(!freehand()){
You("have no free %s to dress yourself with!", body_part(HAND));
return(0);
}
otmp = getobj(clothes, "wear");
if(!otmp) return(0);

View file

@ -1753,8 +1753,9 @@ int x, y;
int
freehand()
{
return(!uwep || !welded(uwep) ||
(!bimanual(uwep,youracedata) && (!uarms || !uarms->cursed)));
return((!uarm || uarm->otyp != STRAITJACKET || !(uarm->cursed)) &&
(!uwep || !welded(uwep) ||
(!bimanual(uwep,youracedata) && (!uarms || !uarms->cursed))));
/* if ((uwep && bimanual(uwep)) ||
(uwep && uarms))
return(0);

View file

@ -124,7 +124,7 @@ picklock() /* try to open/close a lock */
}
}
if (xlock.usedtime++ >= 50 || nohands(youracedata)) {
if (xlock.usedtime++ >= 50 || nohands(youracedata) || !freehand()) {
You("give up your attempt at %s.", lock_action());
exercise(A_DEX, TRUE); /* even if you don't succeed */
return((xlock.usedtime = 0));
@ -168,7 +168,9 @@ forcelock() /* try to force a locked chest */
if((xlock.box->ox != u.ux) || (xlock.box->oy != u.uy))
return((xlock.usedtime = 0)); /* you or it moved */
if (xlock.usedtime++ >= 50 || (!uwep && xlock.picktyp != 3) || nohands(youracedata)) {
if (xlock.usedtime++ >= 50 || (!uwep && xlock.picktyp != 3)
|| nohands(youracedata) || !freehand()
) {
You("give up your attempt to force the lock.");
if(xlock.usedtime >= 50) /* you made the effort */
exercise((xlock.picktyp) ? A_DEX : A_STR, TRUE);
@ -267,7 +269,10 @@ forcedoor() /* try to break/pry open a door */
return((xlock.usedtime = 0));
}
if (xlock.usedtime++ >= 50 || (nohands(youracedata) && !(u.sealsActive&SEAL_OTIAX))) {
if (xlock.usedtime++ >= 50
|| ((nohands(youracedata) || !freehand())
&& !(u.sealsActive&SEAL_OTIAX))
) {
You("give up your attempt at %s the door.",
(xlock.picktyp == 2 ? "melting" : xlock.picktyp == 1 ?
"prying open" : "breaking down"));
@ -331,7 +336,7 @@ pick_lock(pick) /* pick a lock with a given object */
if (xlock.usedtime && picktyp == xlock.picktyp) {
static char no_longer[] = "Unfortunately, you can no longer %s %s.";
if (nohands(youracedata)) {
if (nohands(youracedata) || !freehand()) {
const char *what = (picktyp == LOCK_PICK) ? "pick" : "key";
#ifdef TOURIST
if (picktyp == CREDIT_CARD) what = "card";
@ -356,6 +361,10 @@ pick_lock(pick) /* pick a lock with a given object */
You_cant("hold %s -- you have no hands!", doname(pick));
return(0);
}
if(!freehand()){
You_cant("hold %s -- you have no free hands!", doname(pick));
return(0);
}
if((picktyp != LOCK_PICK &&
#ifdef TOURIST
@ -771,6 +780,10 @@ int x, y;
You_cant("open anything -- you have no hands!");
return 0;
}
if(!freehand()){
You_cant("open anything -- you have no free hands!");
return(0);
}
if (u.utrap && u.utraptype == TT_PIT) {
You_cant("reach over the edge of the pit.");
@ -880,6 +893,10 @@ doclose() /* try to close a door */
You_cant("close anything -- you have no hands!");
return 0;
}
if(!freehand()){
You_cant("close anything -- you have no free hands!");
return(0);
}
if (u.utrap && u.utraptype == TT_PIT) {
You_cant("reach over the edge of the pit.");

View file

@ -1296,6 +1296,16 @@ register struct obj *otmp;
with cursed alternate weapon */
if (otmp == uswapwep && u.twoweap)
drop_uswapwep();
if (otmp == uarm && otmp->otyp == STRAITJACKET){
struct obj *o;
reset_remarm();
if(u.twoweap && uswapwep) drop_uswapwep();
if(uwep){
o = uwep;
setuwep((struct obj *)0);
dropx(o);
}
}
/* some cursed items need immediate updating */
if (carried(otmp) && confers_luck(otmp))
set_moreluck();

View file

@ -1789,7 +1789,7 @@ struct obj *instr;
return(0);
}
*/
if (welded(uwep)) {
if (welded(uwep) || !freehand()) {
You("need free hands to play music!");
return(0);
}

View file

@ -1630,8 +1630,8 @@ doloot() /* loot a container on the floor or loot saddle from mon. */
/* "Can't do that while carrying so much stuff." */
return 0;
}
if (nohands(youracedata)) {
You("have no hands!"); /* not `body_part(HAND)' */
if (nolimbs(youracedata)) {
You("have no limbs!"); /* not `body_part(HAND)' */
return 0;
}
cc.x = u.ux; cc.y = u.uy;
@ -1940,6 +1940,9 @@ dopetequip()
You_cant("do that without limbs."); /* not body_part(HAND) */
return (0);
}
if(!freehand()){
You("have no free %s to dress %s with!", body_part(HAND), mon_nam(mtmp));
}
if(otmp->oclass == AMULET_CLASS){
flag = W_AMUL;
} else if(is_shirt(otmp)){

View file

@ -377,9 +377,13 @@ register int trouble;
}
goto decurse;
case TROUBLE_UNUSEABLE_HANDS:
if (welded(uwep)) {
otmp = uwep;
goto decurse;
if(uarm && uarm->otyp == STRAITJACKET && uarm->cursed){
otmp = uarm;
goto decurse;
}
else if (welded(uwep)) {
otmp = uwep;
goto decurse;
}
if (Upolyd && nohands(youracedata)) {
if (!Unchanging) {

View file

@ -3459,7 +3459,7 @@ dountrap() /* disarm a trap */
pline("You're too strained to do that.");
return 0;
}
if ((nohands(youracedata) && !(webmaker(youracedata) || u.sealsActive&SEAL_CHUPOCLOPS || (uarm && uarm->oartifact==ART_SPIDERSILK))) || !youracedata->mmove) {
if (((nohands(youracedata) || !freehand()) && !(webmaker(youracedata) || u.sealsActive&SEAL_CHUPOCLOPS || (uarm && uarm->oartifact==ART_SPIDERSILK))) || !youracedata->mmove) {
pline("And just how do you expect to do that?");
return 0;
} else if (u.ustuck && sticks(youracedata)) {

View file

@ -263,6 +263,11 @@ dowield()
pline("Don't be ridiculous!");
return(0);
}
if (!freehand()) {
You("have no free %s to wield anything!", body_part(HAND));
return(0);
}
/* Prompt for a new weapon */
if (!(wep = getobj(wield_objs, "wield")))

View file

@ -90,6 +90,9 @@ register struct obj *pen;
if (nohands(youracedata)) {
You("need hands to be able to write!");
return 0;
} else if (!freehand()) {
You("need a free %s to be able to write!", body_part(HAND));
return 0;
} else if (Glib) {
pline("%s from your %s.",
Tobjnam(pen, "slip"), makeplural(body_part(FINGER)));