Looting will fall through to force
If you have autounlock on, and don't have unlocking tool, but are wielding a weapon usable for forcing the lock.
This commit is contained in:
@@ -778,6 +778,8 @@ monsters should growl even if you can't hear it
|
|||||||
give a sound effect message when thrown item lands in water or lava
|
give a sound effect message when thrown item lands in water or lava
|
||||||
don't show rusting of items that land in water
|
don't show rusting of items that land in water
|
||||||
the water used on the Plane of Water stops thrown or kicked items
|
the water used on the Plane of Water stops thrown or kicked items
|
||||||
|
looting will do #force if you could do it and the container is locked
|
||||||
|
and you didn't have a tool to unlock it
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
@@ -1178,6 +1178,7 @@ extern void reset_pick(void);
|
|||||||
extern void maybe_reset_pick(struct obj *);
|
extern void maybe_reset_pick(struct obj *);
|
||||||
extern struct obj *autokey(boolean);
|
extern struct obj *autokey(boolean);
|
||||||
extern int pick_lock(struct obj *, xchar, xchar, struct obj *);
|
extern int pick_lock(struct obj *, xchar, xchar, struct obj *);
|
||||||
|
extern boolean u_have_forceable_weapon(void);
|
||||||
extern int doforce(void);
|
extern int doforce(void);
|
||||||
extern boolean boxlock(struct obj *, struct obj *);
|
extern boolean boxlock(struct obj *, struct obj *);
|
||||||
extern boolean doorlock(struct obj *, int, int);
|
extern boolean doorlock(struct obj *, int, int);
|
||||||
|
|||||||
21
src/lock.c
21
src/lock.c
@@ -602,6 +602,20 @@ pick_lock(struct obj *pick,
|
|||||||
return PICKLOCK_DID_SOMETHING;
|
return PICKLOCK_DID_SOMETHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* is hero wielding a weapon that can #force? */
|
||||||
|
boolean
|
||||||
|
u_have_forceable_weapon(void)
|
||||||
|
{
|
||||||
|
if (!uwep /* proper type test */
|
||||||
|
|| ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep))
|
||||||
|
? (objects[uwep->otyp].oc_skill < P_DAGGER
|
||||||
|
|| objects[uwep->otyp].oc_skill == P_FLAIL
|
||||||
|
|| objects[uwep->otyp].oc_skill > P_LANCE)
|
||||||
|
: uwep->oclass != ROCK_CLASS))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|
||||||
/* the #force command - try to force a chest with your weapon */
|
/* the #force command - try to force a chest with your weapon */
|
||||||
@@ -616,12 +630,7 @@ doforce(void)
|
|||||||
You_cant("force anything from inside here.");
|
You_cant("force anything from inside here.");
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
}
|
}
|
||||||
if (!uwep /* proper type test */
|
if (!u_have_forceable_weapon()) {
|
||||||
|| ((uwep->oclass == WEAPON_CLASS || is_weptool(uwep))
|
|
||||||
? (objects[uwep->otyp].oc_skill < P_DAGGER
|
|
||||||
|| objects[uwep->otyp].oc_skill == P_FLAIL
|
|
||||||
|| objects[uwep->otyp].oc_skill > P_LANCE)
|
|
||||||
: uwep->oclass != ROCK_CLASS)) {
|
|
||||||
You_cant("force anything %s weapon.",
|
You_cant("force anything %s weapon.",
|
||||||
!uwep ? "when not wielding a"
|
!uwep ? "when not wielding a"
|
||||||
: (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))
|
: (uwep->oclass != WEAPON_CLASS && !is_weptool(uwep))
|
||||||
|
|||||||
12
src/pickup.c
12
src/pickup.c
@@ -1877,9 +1877,15 @@ do_loot_cont(struct obj **cobjp,
|
|||||||
pline("Hmmm, %s turns out to be locked.", the(xname(cobj)));
|
pline("Hmmm, %s turns out to be locked.", the(xname(cobj)));
|
||||||
cobj->lknown = 1;
|
cobj->lknown = 1;
|
||||||
|
|
||||||
if (flags.autounlock && (unlocktool = autokey(TRUE)) != 0) {
|
if (flags.autounlock) {
|
||||||
/* pass ox and oy to avoid direction prompt */
|
if ((unlocktool = autokey(TRUE)) != 0) {
|
||||||
return (pick_lock(unlocktool, cobj->ox, cobj->oy, cobj) != 0);
|
/* pass ox and oy to avoid direction prompt */
|
||||||
|
return (pick_lock(unlocktool, cobj->ox, cobj->oy, cobj) != 0);
|
||||||
|
} else if (ccount == 1 && u_have_forceable_weapon()) {
|
||||||
|
/* single container, and we could #force it open... */
|
||||||
|
cmdq_add_ec(doforce); /* doforce asks for confirmation */
|
||||||
|
g.abort_looting = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ECMD_OK;
|
return ECMD_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user