-/* NetHack 3.6 steal.c $NHDT-Date: 1446713643 2015/11/05 08:54:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
+/* NetHack 3.6 steal.c $NHDT-Date: 1554580626 2019/04/06 19:57:06 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.72 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
+/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
+/* JNetHack Copyright */
+/* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019 */
+/* JNetHack may be freely redistributed. See license for details. */
+
#include "hack.h"
STATIC_PTR int NDECL(stealarm);
register struct obj *otmp;
{
return ((otmp == uarmu)
+/*JP
? "shirt"
+*/
+ ? "\83V\83\83\83c"
: (otmp == uarmf)
+/*JP
? "boots"
+*/
+ ? "\8cC"
: (otmp == uarms)
+/*JP
? "shield"
+*/
+ ? "\8f\82"
: (otmp == uarmg)
+/*JP
? "gloves"
+*/
+ ? "\8f¬\8eè"
: (otmp == uarmc)
? cloak_simple_name(otmp)
: (otmp == uarmh)
register struct obj *fgold = g_at(u.ux, u.uy);
register struct obj *ygold;
register long tmp;
+#if 0 /*JP*/
struct monst *who;
const char *whose, *what;
+#endif
/* skip lesser coins on the floor */
while (fgold && fgold->otyp != GOLD_PIECE)
obj_extract_self(fgold);
add_to_minv(mtmp, fgold);
newsym(u.ux, u.uy);
+#if 0 /*JP*/
if (u.usteed) {
who = u.usteed;
whose = s_suffix(y_monnam(who));
what += 5;
pline("%s quickly snatches some gold from %s %s %s!", Monnam(mtmp),
(Levitation || Flying) ? "beneath" : "between", whose, what);
+#else /*JP:\91«\82ª\96³\82\82Ä\82à\81u\91«\8c³\81v\82Å\82æ\82µ\82Æ\82·\82é*/
+ pline("%s\82Í\91f\91\81\82\82 \82È\82½\82Ì%s\82©\82ç\8bà\82ð\82Ð\82Á\82½\82\82Á\82½\81I", Monnam(mtmp),
+ (Levitation || Flying) ? "\89º" : "\91«\8c³");
+#endif
if (!ygold || !rn2(5)) {
if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
setnotworn(ygold);
freeinv(ygold);
add_to_minv(mtmp, ygold);
+/*JP
Your("purse feels lighter.");
+*/
+ Your("\8dà\95z\82Í\8cy\82\82È\82Á\82½\81D");
if (!tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
monflee(mtmp, 0, FALSE, FALSE);
if (otmp->unpaid)
subfrombill(otmp, shop_keeper(*u.ushops));
freeinv(otmp);
+/*JP
pline("%s steals %s!", Monnam(mtmp), doname(otmp));
+*/
+ pline("%s\82Í%s\82ð\93\90\82ñ\82¾\81I", Monnam(mtmp), doname(otmp));
(void) mpickobj(mtmp, otmp); /* may free otmp */
/* Implies seduction, "you gladly hand over ..."
so we don't set mavenge bit here. */
nothing_to_steal:
/* Not even a thousand men in armor can strip a naked man. */
if (Blind)
+/*JP
pline("Somebody tries to rob you, but finds nothing to steal.");
+*/
+ pline("\92N\82©\82ª\82 \82È\82½\82©\82ç\93\90\82à\82¤\82Æ\82µ\82½\82ª\81C\93\90\82Þ\82à\82Ì\82ª\82È\82¢\82±\82Æ\82É\8bC\82ª\82Â\82¢\82½\81D");
else
+/*JP
pline("%s tries to rob you, but there is nothing to steal!",
+*/
+ pline("%s\82Í\82 \82È\82½\82©\82ç\93\90\82à\82¤\82Æ\82µ\82½\82ª\81C\93\90\82Þ\82à\82Ì\82ª\82È\82¢\82±\82Æ\82É\8bC\82ª\82Â\82¢\82½\81I",
Monnam(mtmp));
return 1; /* let her flee */
}
|| (otmp == uleft && welded(uwep) && bimanual(uwep)));
if (ostuck || can_carry(mtmp, otmp) == 0) {
+#if 0 /*JP*/
static const char *const how[] = { "steal", "snatch", "grab",
"take" };
cant_take:
(otmp->owornmask & W_ARMOR) ? "your " : "",
(otmp->owornmask & W_ARMOR) ? equipname(otmp)
: yname(otmp));
+#else
+ cant_take:
+ pline("%s\82Í%s\82ð\93\90\82à\82¤\82Æ\82µ\82½\82ª\92ú\82ß\82½\81D", Monnam(mtmp),
+ (otmp->owornmask & W_ARMOR) ? equipname(otmp)
+ : yname(otmp));
+#endif
/* the fewer items you have, the less likely the thief
is going to stick around to try again (0) instead of
running away (1) */
unmul((char *) 0);
slowly = (armordelay >= 1 || multi < 0);
if (flags.female)
+#if 0 /*JP:T*/
pline("%s charms you. You gladly %s your %s.",
!seen ? "She" : Monnam(mtmp),
curssv ? "let her take"
: was_doffing ? "continue removing"
: "start removing",
equipname(otmp));
+#else
+ pline("%s\82Í\82 \82È\82½\82ð\96£\97¹\82µ\82½\81D\82 \82È\82½\82Í\82æ\82ë\82±\82ñ\82Å%s\82ð%s\82½\81D",
+ !seen ? "\94Þ\8f\97" : Monnam(mtmp),
+ equipname(otmp),
+ curssv ? "\82Í\82¸\82µ\82Ä\82à\82ç\82Á"
+ : !slowly ? "\82Í\82¸\82µ\82Ä\8eè\93n\82µ"
+ : was_doffing ? "\82Í\82¸\82µ\91±\82¯"
+ : "\82Í\82¸\82µ\8en\82ß");
+#endif
else
+#if 0 /*JP:T*/
pline("%s seduces you and %s off your %s.",
!seen ? "She" : Adjmonnam(mtmp, "beautiful"),
curssv
: was_doffing ? "you continue taking"
: "you start taking",
equipname(otmp));
+#else
+ pline("%s\82Í\82 \82È\82½\82ð\97U\98f\82µ\82½\81D\82 \82È\82½\82Í%s\82ð%s\81D",
+ !seen ? "\94Þ\8f\97" : Adjmonnam(mtmp, "\94ü\82µ\82¢"),
+ equipname(otmp),
+ curssv
+ ? "\82Í\82¸\82µ\82Ä\82à\82ç\82Á"
+ : !slowly ? "\82Í\82¸\82µ"
+ : was_doffing ? "\82Í\82¸\82µ\91±\82¯"
+ : "\82Í\82¸\82µ\8en\82ß");
+#endif
named++;
/* the following is to set multi for later on */
nomul(-armordelay);
+/*JP
multi_reason = "taking off clothes";
+*/
+ multi_reason = "\95\9e\82ð\92E\82¢\82Å\82¢\82é\8e\9e\82É";
nomovemsg = 0;
remove_worn_item(otmp, TRUE);
otmp->cursed = curssv;
if (otmp->unpaid)
subfrombill(otmp, shop_keeper(*u.ushops));
freeinv(otmp);
+/*JP
pline("%s stole %s.", named ? "She" : Monnam(mtmp), doname(otmp));
+*/
+ pline("%s\82Í%s\82ð\93\90\82ñ\82¾\81D", named ? "\94Þ\8f\97" : Monnam(mtmp), doname(otmp));
could_petrify =
(otmp->otyp == CORPSE && touch_petrifies(&mons[otmp->corpsenm]));
(void) mpickobj(mtmp, otmp); /* may free otmp */
if (obj_sheds_light(otmp) && attacktype(mtmp->data, AT_ENGL)) {
/* this is probably a burning object that you dropped or threw */
if (u.uswallow && mtmp == u.ustuck && !Blind)
+/*JP
pline("%s out.", Tobjnam(otmp, "go"));
+*/
+ pline("%s\82Í\94ò\82Ñ\82¾\82µ\82½\81D", xname(otmp));
snuff_otmp = TRUE;
}
/* for hero owned object on shop floor, mtmp is taking possession
return freed_otmp;
}
+/* called for AD_SAMU (the Wizard and quest nemeses) */
void
stealamulet(mtmp)
struct monst *mtmp;
{
- struct obj *otmp = (struct obj *) 0;
- int real = 0, fake = 0;
-
- /* select the artifact to steal */
- if (u.uhave.amulet) {
- real = AMULET_OF_YENDOR;
- fake = FAKE_AMULET_OF_YENDOR;
- } else if (u.uhave.questart) {
+ char buf[BUFSZ];
+ struct obj *otmp = 0, *obj = 0;
+ int real = 0, fake = 0, n;
+
+ /* target every quest artifact, not just current role's;
+ if hero has more than one, choose randomly so that player
+ can't use inventory ordering to influence the theft */
+ for (n = 0, obj = invent; obj; obj = obj->nobj)
+ if (any_quest_artifact(obj))
+ ++n, otmp = obj;
+ if (n > 1) {
+ n = rnd(n);
for (otmp = invent; otmp; otmp = otmp->nobj)
- if (is_quest_artifact(otmp))
+ if (any_quest_artifact(otmp) && !--n)
break;
- if (!otmp)
- return; /* should we panic instead? */
- } else if (u.uhave.bell) {
- real = BELL_OF_OPENING;
- fake = BELL;
- } else if (u.uhave.book) {
- real = SPE_BOOK_OF_THE_DEAD;
- } else if (u.uhave.menorah) {
- real = CANDELABRUM_OF_INVOCATION;
- } else
- return; /* you have nothing of special interest */
+ }
if (!otmp) {
+ /* if we didn't find any quest arifact, find another valuable item */
+ if (u.uhave.amulet) {
+ real = AMULET_OF_YENDOR;
+ fake = FAKE_AMULET_OF_YENDOR;
+ } else if (u.uhave.bell) {
+ real = BELL_OF_OPENING;
+ fake = BELL;
+ } else if (u.uhave.book) {
+ real = SPE_BOOK_OF_THE_DEAD;
+ } else if (u.uhave.menorah) {
+ real = CANDELABRUM_OF_INVOCATION;
+ } else
+ return; /* you have nothing of special interest */
+
/* If we get here, real and fake have been set up. */
- for (otmp = invent; otmp; otmp = otmp->nobj)
- if (otmp->otyp == real || (otmp->otyp == fake && !mtmp->iswiz))
- break;
+ for (n = 0, obj = invent; obj; obj = obj->nobj)
+ if (obj->otyp == real || (obj->otyp == fake && !mtmp->iswiz))
+ ++n, otmp = obj;
+ if (n > 1) {
+ n = rnd(n);
+ for (otmp = invent; otmp; otmp = otmp->nobj)
+ if ((otmp->otyp == real
+ || (otmp->otyp == fake && !mtmp->iswiz)) && !--n)
+ break;
+ }
}
if (otmp) { /* we have something to snatch */
+ /* take off outer gear if we're targetting [hypothetical]
+ quest artifact suit, shirt, gloves, or rings */
+ if ((otmp == uarm || otmp == uarmu) && uarmc)
+ remove_worn_item(uarmc, FALSE);
+ if (otmp == uarmu && uarm)
+ remove_worn_item(uarm, FALSE);
+ if ((otmp == uarmg || ((otmp == uright || otmp == uleft) && uarmg))
+ && uwep) {
+ /* gloves are about to be unworn; unwield weapon(s) first */
+ if (u.twoweap) /* remove_worn_item(uswapwep) indirectly */
+ remove_worn_item(uswapwep, FALSE); /* clears u.twoweap */
+ remove_worn_item(uwep, FALSE);
+ }
+ if ((otmp == uright || otmp == uleft) && uarmg)
+ /* calls Gloves_off() to handle wielded cockatrice corpse */
+ remove_worn_item(uarmg, FALSE);
+
+ /* finally, steal the target item */
if (otmp->owornmask)
remove_worn_item(otmp, TRUE);
if (otmp->unpaid)
subfrombill(otmp, shop_keeper(*u.ushops));
freeinv(otmp);
- /* mpickobj wont merge otmp because none of the above things
- to steal are mergable */
- (void) mpickobj(mtmp, otmp); /* may merge and free otmp */
- pline("%s stole %s!", Monnam(mtmp), doname(otmp));
+ Strcpy(buf, doname(otmp));
+ (void) mpickobj(mtmp, otmp); /* could merge and free otmp but won't */
+/*JP
+ pline("%s steals %s!", Monnam(mtmp), buf);
+*/
+ pline("%s\82Í%s\82ð\93\90\82ñ\82¾\81I", Monnam(mtmp), buf);
if (can_teleport(mtmp->data) && !tele_restrict(mtmp))
(void) rloc(mtmp, TRUE);
}
if (cansee(mon->mx, mon->my)) {
const char *MonName = Monnam(mon);
+#if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\95s\97v*/
/* mon might be invisible; avoid "It pulls ... and absorbs it!" */
if (!strcmp(MonName, "It"))
MonName = "Something";
+#endif
+#if 0 /*JP:T*/
pline("%s pulls %s away from you and absorbs %s!", MonName,
yname(obj), (obj->quan > 1L) ? "them" : "it");
+#else
+ pline("%s\82Í%s\82ð\88ø\82Á\82Ï\82è\8d\9e\82ñ\82Å\8bz\8eû\82µ\82½\81I", MonName,
+ yname(obj));
+#endif
} else {
const char *hand_s = body_part(HAND);
if (bimanual(obj))
hand_s = makeplural(hand_s);
+#if 0 /*JP:T*/
pline("%s %s pulled from your %s!", upstart(yname(obj)),
otense(obj, "are"), hand_s);
+#else
+ pline("%s\82Í\82 \82È\82½\82Ì%s\82©\82ç\88ø\82Á\82Ï\82è\8d\9e\82Ü\82ê\82½\81I", upstart(yname(obj)),
+ hand_s);
+#endif
}
freeinv(obj);
} else {
/* not carried; presumably thrown or kicked */
if (canspotmon(mon))
+/*JP
pline("%s absorbs %s!", Monnam(mon), yname(obj));
+*/
+ pline("%s\82Í%s\82ð\8bz\8eû\82µ\82½\81I", Monnam(mon), yname(obj));
}
/* add to mon's inventory */
(void) mpickobj(mon, obj);
if (obj->owornmask) {
/* perform worn item handling if the monster is still alive */
- if (mon->mhp > 0) {
+ if (!DEADMONSTER(mon)) {
mon->misc_worn_check &= ~obj->owornmask;
update_mon = TRUE;
- /* don't charge for an owned saddle on dead steed (provided
- that the hero is within the same shop at the time) */
- } else if (mon->mtame && (obj->owornmask & W_SADDLE) && !obj->unpaid
- && costly_spot(omx, omy)
+
+ /* don't charge for an owned saddle on dead steed (provided
+ that the hero is within the same shop at the time) */
+ } else if (mon->mtame && (obj->owornmask & W_SADDLE) != 0L
+ && !obj->unpaid && costly_spot(omx, omy)
/* being at costly_spot guarantees lev->roomno is not 0 */
&& index(in_rooms(u.ux, u.uy, SHOPBASE),
levl[omx][omy].roomno)) {
}
/* obj_no_longer_held(obj); -- done by place_object */
if (verbosely && cansee(omx, omy))
+/*JP
pline("%s drops %s.", Monnam(mon), distant_name(obj, doname));
+*/
+ pline("%s\82Í%s\82ð\92u\82¢\82½\81D", Monnam(mon), distant_name(obj, doname));
+/*JP
if (!flooreffects(obj, omx, omy, "fall")) {
+*/
+ if (!flooreffects(obj, omx, omy, "\97\8e\82¿\82é")) {
place_object(obj, omx, omy);
stackobj(obj);
}
/* some monsters bypass the normal rules for moving between levels or
even leaving the game entirely; when that happens, prevent them from
- taking the Amulet or invocation tools with them */
+ taking the Amulet, invocation items, or quest artifact with them */
void
mdrop_special_objs(mon)
struct monst *mon;
for (obj = mon->minvent; obj; obj = otmp) {
otmp = obj->nobj;
/* the Amulet, invocation tools, and Rider corpses resist even when
- artifacts and ordinary objects are given 0% resistance chance */
- if (obj_resists(obj, 0, 0)) {
+ artifacts and ordinary objects are given 0% resistance chance;
+ current role's quest artifact is rescued too--quest artifacts
+ for the other roles are not */
+ if (obj_resists(obj, 0, 0) || is_quest_artifact(obj)) {
obj_extract_self(obj);
- mdrop_obj(mon, obj, FALSE);
+ if (mon->mx) {
+ mdrop_obj(mon, obj, FALSE);
+ } else { /* migrating monster not on map */
+ if (obj->owornmask) {
+ mon->misc_worn_check &= ~obj->owornmask;
+ if (obj->owornmask & W_WEP)
+ setmnotwielded(mon, obj);
+ obj->owornmask = 0L;
+ }
+ rloco(obj);
+ }
}
}
}
/* vault guard's gold goes away rather than be dropped... */
if (mtmp->isgd && (otmp = findgold(mtmp->minvent)) != 0) {
if (canspotmon(mtmp))
+#if 0 /*JP:T*/
pline("%s gold %s.", s_suffix(Monnam(mtmp)),
canseemon(mtmp) ? "vanishes" : "seems to vanish");
+#else
+ pline("%s\82Ì\8bà\82Í\8fÁ\82¦\82½%s\81D", Monnam(mtmp),
+ canseemon(mtmp) ? "" : "\82æ\82¤\82¾");
+#endif
obj_extract_self(otmp);
obfree(otmp, (struct obj *) 0);
} /* isgd && has gold */