summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/makeitem.cc7
-rw-r--r--crawl-ref/source/mon-spll.h2
-rw-r--r--crawl-ref/source/mon-util.cc41
-rw-r--r--crawl-ref/source/monstuff.cc30
4 files changed, 59 insertions, 21 deletions
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 1c916d0c7b..3093e091e3 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2846,10 +2846,9 @@ static bool weapon_is_visibly_special(const item_def &item)
&& get_equip_desc(item) == ISFLAG_NO_DESC;
}
-static void give_monster_item(
- monsters *mon, int thing,
- bool force_item = false,
- bool (monsters::*pickupfn)(item_def&, int) = NULL)
+static void give_monster_item(monsters *mon, int thing,
+ bool force_item = false,
+ bool (monsters::*pickupfn)(item_def&, int) = NULL)
{
item_def &mthing = mitm[thing];
diff --git a/crawl-ref/source/mon-spll.h b/crawl-ref/source/mon-spll.h
index 96a5748218..0dbb0b19db 100644
--- a/crawl-ref/source/mon-spll.h
+++ b/crawl-ref/source/mon-spll.h
@@ -671,7 +671,7 @@
SPELL_CALL_IMP,
SPELL_SUMMON_DEMON,
SPELL_CANTRIP }, // this should be cute -- bw
- },
+ },
{ MST_NAGA,
{
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index c5487f9386..809aa252ce 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -41,6 +41,7 @@
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
+#include "it_use2.h"
#include "Kills.h"
#include "message.h"
#include "misc.h"
@@ -3108,6 +3109,23 @@ bool monsters::pickup_launcher(item_def &launch, int near)
return (eslot == -1? false : pickup(launch, eslot, near));
}
+static bool _is_unique_weapon(monsters *monster, const item_def &weapon)
+{
+ if (is_fixed_artefact(weapon))
+ {
+ switch (weapon.special)
+ {
+ case SPWPN_SCEPTRE_OF_ASMODEUS:
+ return (monster->type == MONS_ASMODEUS);
+ case SPWPN_STAFF_OF_DISPATER:
+ return (monster->type == MONS_DISPATER);
+ case SPWPN_SWORD_OF_CEREBOV:
+ return (monster->type == MONS_CEREBOV);
+ }
+ }
+ return false;
+}
+
bool monsters::pickup_melee_weapon(item_def &item, int near)
{
if (mons_wields_two_weapons(this))
@@ -3129,6 +3147,9 @@ bool monsters::pickup_melee_weapon(item_def &item, int near)
if (is_range_weapon(*weap))
continue;
+ if (_is_unique_weapon(this, *weap))
+ continue;
+
has_melee = true;
if (mons_weapon_damage_rating(*weap) < mdam_rating)
return (drop_item(i, near) && pickup(item, i, near));
@@ -3313,6 +3334,24 @@ bool monsters::pickup_scroll(item_def &item, int near)
bool monsters::pickup_potion(item_def &item, int near)
{
+ // only allow monsters to pick up healing potions
+ // if they can actually use them
+ if ((item.sub_type == POT_HEALING || item.sub_type == POT_HEAL_WOUNDS)
+ && (mons_holiness(this) == MH_UNDEAD
+ || mons_holiness(this) == MH_NONLIVING
+ || mons_holiness(this) == MH_PLANT))
+ {
+ return false;
+ }
+
+
+ if (::mons_species(this->type) != MONS_VAMPIRE
+ && (item.sub_type == POT_BLOOD
+ || item.sub_type == POT_BLOOD_COAGULATED))
+ {
+ return false;
+ }
+
return pickup(item, MSLOT_POTION, near);
}
@@ -3372,7 +3411,7 @@ bool monsters::pickup_item(item_def &item, int near, bool force)
case OBJ_SCROLLS:
return pickup_scroll(item, near);
case OBJ_POTIONS:
- return pickup(item, MSLOT_POTION, near);
+ return pickup_potion(item, near);
case OBJ_CORPSES:
return eat_corpse(item, near);
case OBJ_MISCELLANY:
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index a2f51d20d9..af33afa77a 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3628,23 +3628,23 @@ static bool _handle_wand(monsters *monster, bolt &beem)
return (false);
// set up the beam
- int power = 30 + monster->hit_dice;
+ int power = 30 + monster->hit_dice;
bolt theBeam = mons_spells(mzap, power);
- beem.name = theBeam.name;
- beem.beam_source = monster_index(monster);
- beem.source_x = monster->x;
- beem.source_y = monster->y;
- beem.colour = theBeam.colour;
- beem.range = theBeam.range;
- beem.rangeMax = theBeam.rangeMax;
- beem.damage = theBeam.damage;
- beem.ench_power = theBeam.ench_power;
- beem.hit = theBeam.hit;
- beem.type = theBeam.type;
- beem.flavour = theBeam.flavour;
- beem.thrower = theBeam.thrower;
- beem.is_beam = theBeam.is_beam;
+ beem.name = theBeam.name;
+ beem.beam_source = monster_index(monster);
+ beem.source_x = monster->x;
+ beem.source_y = monster->y;
+ beem.colour = theBeam.colour;
+ beem.range = theBeam.range;
+ beem.rangeMax = theBeam.rangeMax;
+ beem.damage = theBeam.damage;
+ beem.ench_power = theBeam.ench_power;
+ beem.hit = theBeam.hit;
+ beem.type = theBeam.type;
+ beem.flavour = theBeam.flavour;
+ beem.thrower = theBeam.thrower;
+ beem.is_beam = theBeam.is_beam;
beem.is_explosion = theBeam.is_explosion;
#if HISCORE_WEAPON_DETAIL