From ab86f8464ed1b3f73f2e19e01a63089777d91c23 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 17 Apr 2008 11:33:08 +0000 Subject: git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4285 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/invent.cc | 2 ++ crawl-ref/source/makeitem.cc | 2 ++ crawl-ref/source/mon-util.cc | 29 ++++++++++++++--------------- crawl-ref/source/output.cc | 4 ---- crawl-ref/source/view.cc | 2 ++ 5 files changed, 20 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index f3f65cdea3..71850082ba 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -526,8 +526,10 @@ void init_item_sort_comparators(item_sort_comparators &list, } if (list.empty()) + { list.push_back( item_comparator(compare_item_str)); + } } const menu_sort_condition *InvMenu::find_menu_sort_condition() const diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 096eac8612..88820c61d2 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -2928,8 +2928,10 @@ static void give_potion(monsters *mon, int level) //mv - give potion if (mons_species( mon->type ) == MONS_VAMPIRE && one_chance_in(5)) { + // This handles initialization of stack timer. const int thing_created = items(0, OBJ_POTIONS, POT_BLOOD, true, level, 0); + if (thing_created == NON_ITEM) return; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 69105af2e7..aef44e153c 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -3340,23 +3340,21 @@ bool monsters::pickup_missile(item_def &item, int near, bool force) // monster may not pick up trapping net if (mons_is_caught(this) && item_is_stationary(item)) return (false); - - // else always pick up if no other missiles - if (!miss) - return true; } - - // Spellcasters should not waste time with ammunition. - if (mons_has_ranged_spell(this)) - return (false); - - // Monsters in a fight will only pick up missiles if doing so is worthwhile. - if (behaviour != BEH_WANDER - && (item.quantity < 5 || miss && miss->quantity >= 3)) + else // None of these exceptions hold for throwing nets. { - return (false); - } + // Spellcasters should not waste time with ammunition. + if (mons_has_ranged_spell(this)) + return (false); + // Monsters in a fight will only pick up missiles if doing so + // is worthwhile. + if (behaviour != BEH_WANDER + && (item.quantity < 5 || miss && miss->quantity >= 7)) + { + return (false); + } + } if (miss && items_stack(*miss, item)) return (pickup(item, MSLOT_MISSILE, near)); @@ -3461,7 +3459,7 @@ bool monsters::pickup_item(item_def &item, int near, bool force) // Weak(ened) monsters won't stop to pick up things as long as they // feel unsafe. - if (!wandering && (hit_points * 10 < max_hit_points || hit_points <= 10) + if (!wandering && (hit_points * 10 < max_hit_points || hit_points < 10) && mon_enemies_around(this)) { return false; @@ -3476,6 +3474,7 @@ bool monsters::pickup_item(item_def &item, int near, bool force) return false; } + // Fleeing monster only pick up emergency equipment. if (behaviour == BEH_FLEE && (itype == OBJ_WEAPONS || itype == OBJ_MISSILES)) { diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index e99a9ea3c4..10173cbc5f 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -16,10 +16,6 @@ #include #include -//#include -//#include -//#include -//#include #ifdef DOS #include diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 5eff25aa60..77785686e3 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -1286,6 +1286,8 @@ bool check_awaken(monsters* monster) if (player_light_armour(true) && you.burden_state == BS_UNENCUMBERED && you.special_wield != SPWLD_SHADOW + && !mons_friendly(monster) + && !mons_class_flag(monster->type, M_NO_EXP_GAIN) // if invisible, training happens much more rarely && (!unnatural_stealthy && one_chance_in(25) || one_chance_in(100))) { -- cgit v1.2.3-54-g00ecf