theft against punished hero with empty inventory

If a punished hero's inventory is empty, have a nymph usually take
off the attached chain and indirectly fix punishment.  If hero is
trapped by being chained to a buried iron ball, sometimes take off
the implicit chain and indirectly release hero from the trap.

Monkeys won't do this and nymphs will only do so if there is no
inventory (aside from gold and/or embedded dragon scales which they
aren't allowed to target).

It's a lot simpler than I was expecting when I wrote the TODO about
it recently.
This commit is contained in:
PatR
2024-02-18 11:24:21 -08:00
parent d688309012
commit 44de195718
2 changed files with 34 additions and 31 deletions

View File

@@ -2488,6 +2488,9 @@ erinyes overhaul; they now attempt to punish heroes who have violated their
accessibility options to tell where on map a message happened (accessiblemsg),
to notify when a monster is spotted (spot_monsters), and when
a monster moved (mon_movement)
if hero is punished or tethered to a buried iron ball and has no inventory (or
only carries gold or embedded dragon scales or both), a nymph might
remove the chain when finding nothing else to steal
Platform- and/or Interface-Specific New Features

View File

@@ -362,7 +362,7 @@ steal(struct monst* mtmp, char* objnambuf)
char Monnambuf[BUFSZ];
int tmp, could_petrify, armordelay, olddelay, icnt,
named = 0, retrycnt = 0;
boolean monkey_business, /* true iff an animal is doing the thievery */
boolean monkey_business = is_animal(mtmp->data),
was_doffing, was_punished = Punished;
if (objnambuf)
@@ -371,6 +371,15 @@ steal(struct monst* mtmp, char* objnambuf)
if (!monnear(mtmp, u.ux, u.uy))
return 0;
/* stealing a worn item might drop hero into water or lava where
teleporting to safety could result in a previously visible thief
no longer being visible; it could also be a case of a blinded
hero being able to see via wearing the Eyes of the Overworld and
having those stolen; remember the name in order to avoid "It"
in the eventual "<Monnam> stole <item>" message; (the name might
already be "It"; if so, that's ok) */
Strcpy(Monnambuf, Monnam(mtmp));
/* food being eaten might already be used up but will not have
been removed from inventory yet; we don't want to steal that,
so this will cause it to be removed now */
@@ -379,20 +388,34 @@ steal(struct monst* mtmp, char* objnambuf)
icnt = inv_cnt(FALSE); /* don't include gold */
if (!icnt || (icnt == 1 && uskin)) {
nothing_to_steal:
/* Not even a thousand men in armor can strip a naked man. */
if (Blind)
nothing_to_steal:
/* nymphs might target uchain if invent is empty; monkeys won't;
hero becomes unpunished but nymph ends up empty handed */
if (Punished && !monkey_business && rn2(4)) {
/* uball is not carried (uchain never is) */
assert(uball != NULL && uball->where == OBJ_FLOOR);
worn_item_removal(mtmp, uchain);
} else if (u.utrap && u.utraptype == TT_BURIEDBALL
&& !monkey_business && !rn2(4)) {
boolean dummy;
/* buried ball is not tracked via 'uball' and there is no chain
at all (hence no uchain to take off) */
pline("%s takes off your unseen chain.", Monnambuf);
(void) openholdingtrap(&gy.youmonst, &dummy);
} else if (Blind) {
pline("Somebody tries to rob you, but finds nothing to steal.");
else if (inv_cnt(TRUE) > inv_cnt(FALSE)) /* ('icnt' might be stale) */
} else if (inv_cnt(TRUE) > inv_cnt(FALSE)) {
pline("%s tries to rob you, but isn't interested in gold.",
Monnam(mtmp));
else
Monnambuf);
} else {
pline("%s tries to rob you, but there is nothing to steal!",
Monnam(mtmp));
Monnambuf);
}
return 1; /* let her flee */
}
monkey_business = is_animal(mtmp->data);
if (monkey_business || uarmg) {
; /* skip ring special cases */
} else if (Adornment & LEFT_RING) {
@@ -409,20 +432,6 @@ steal(struct monst* mtmp, char* objnambuf)
if ((!uarm || otmp != uarmc) && otmp != uskin
&& otmp->oclass != COIN_CLASS)
tmp += (otmp->owornmask & (W_ARMOR | W_ACCESSORY)) ? 5 : 1;
/*
* TODO?
* When inventory is empty and hero is Punished but not carrying
* uball (obviously, or invent wouldn't be empty), behave as if
* carrying uchain (at least when the thief is a nymph rather
* than a monkey)? Probably too complicated to bother with.
*
* (Simplest thing would be to move uchain to invent but that
* would be fraught with peril because every place that cares
* about uchain assumes that it is on the floor. Next simplest
* would be to move uball into invent and use that for otmp, but
* what about undesirable encumbrance feedback or being tethered
* to buried ball?)
*/
if (!tmp)
goto nothing_to_steal;
tmp = rn2(tmp);
@@ -456,15 +465,6 @@ steal(struct monst* mtmp, char* objnambuf)
if (otmp->o_id == gs.stealoid)
return 0;
/* stealing a worn item might drop hero into water or lava where
teleporting to safety could result in a previously visible thief
no longer being visible; it could also be a case of a blinded
hero being able to see via wearing the Eyes of the Overworld and
having those stolen; remember the name in order to avoid "It"
in the eventual "<Monnam> stole <item>" message; (the name might
already be "It"; if so, that's ok) */
Strcpy(Monnambuf, Monnam(mtmp));
if (otmp->otyp == BOULDER && !throws_rocks(mtmp->data)) {
if (!retrycnt++)
goto retry;