summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/fight.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-23 21:21:11 +0000
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-09-24 02:58:10 +0530
commitf176a95f03207f9225ba1d4085005f3756df35a3 (patch)
tree72977967f7be44bd447a04813b44a679a1820c5a /crawl-ref/source/fight.cc
parent2e8eedbf4838b52d091c4a0a1754ec85813794ff (diff)
downloadcrawl-ref-f176a95f03207f9225ba1d4085005f3756df35a3.tar.gz
crawl-ref-f176a95f03207f9225ba1d4085005f3756df35a3.zip
* Also allow Maurice to steal the occasional spellbook or piece of
jewellery. * As per FR 1937144, leave a purple cloud if the player or a monster blinks or teleports away. For some reason this doesn't yet work correctly with scrolls of blinking, even though wizard blink (which uses the same function) does work. -- (from svn) Signed-off-by: Darshan Shaligram <dshaligram@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/fight.cc')
-rw-r--r--crawl-ref/source/fight.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 35a7a34926..1276ec3185 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -4511,6 +4511,7 @@ void melee_attack::splash_defender_with_acid(int strength)
static void _steal_item_from_player(monsters *mon)
{
+ mon_inv_type mslot = NUM_MONSTER_SLOTS;
int steal_what = -1;
int total_value = 0;
for (int m = 0; m < ENDOFPACK; ++m)
@@ -4527,7 +4528,16 @@ static void _steal_item_from_player(monsters *mon)
mon_inv_type monslot = item_to_mslot(you.inv[m]);
if (monslot == NUM_MONSTER_SLOTS)
- continue;
+ {
+ // Try a related slot instead to allow for stealing of other
+ // valuable items.
+ if (you.inv[m].base_type == OBJ_BOOKS)
+ monslot = MSLOT_SCROLL;
+ else if (you.inv[m].base_type == OBJ_JEWELLERY)
+ monslot = MSLOT_MISCELLANY;
+ else
+ continue;
+ }
// Only try to steal stuff we can still store somewhere.
if (mon->inv[monslot] != NON_ITEM)
@@ -4546,7 +4556,10 @@ static void _steal_item_from_player(monsters *mon)
total_value += value;
if (x_chance_in_y(value, total_value))
+ {
steal_what = m;
+ mslot = monslot;
+ }
}
if (steal_what == -1 || you.gold > 0 && one_chance_in(10))
@@ -4622,6 +4635,8 @@ static void _steal_item_from_player(monsters *mon)
}
ASSERT(steal_what != -1);
+ ASSERT(mslot != NUM_MONSTER_SLOTS);
+ ASSERT(mon->inv[mslot] == NON_ITEM);
// Create new item.
int index = get_item_slot(10);
@@ -4638,8 +4653,6 @@ static void _steal_item_from_player(monsters *mon)
new_item.pos.reset();
new_item.link = NON_ITEM;
- const mon_inv_type mslot = item_to_mslot(new_item);
-
mprf("%s steals %s!",
mon->name(DESC_CAP_THE).c_str(),
new_item.name(DESC_NOCAP_YOUR).c_str());