From f176a95f03207f9225ba1d4085005f3756df35a3 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 23 Sep 2009 21:21:11 +0000 Subject: * 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 --- crawl-ref/source/fight.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/fight.cc') 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()); -- cgit v1.2.3-54-g00ecf