summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-29 15:17:07 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-29 15:17:07 +0000
commit26814eb205cba00b5f81f7689043d0ca6a235106 (patch)
treea493902bef13bf6ff526cc818337496f79165d96
parent018f4e0bb5ddd7dcdd565ec5e790577cf93c97be (diff)
downloadcrawl-ref-26814eb205cba00b5f81f7689043d0ca6a235106.tar.gz
crawl-ref-26814eb205cba00b5f81f7689043d0ca6a235106.zip
Disallow dualwielders to wield 2-handed weapons, even if they currently
only have one weapon since this would mean they'd never replace it again with a 1-handed weapon to pair another weapon with. Remove orc warlords from Beogh reinforcement and increase chance for plain orcs. Change "Heel!" command to "Come here!" because "Heel!" looks completely out of place for intelligent followers. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4764 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/itemprop.cc2
-rw-r--r--crawl-ref/source/mon-util.cc104
-rw-r--r--crawl-ref/source/religion.cc4
4 files changed, 61 insertions, 51 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index faf62d166c..1554ed0064 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2008,7 +2008,7 @@ void yell(bool force)
}
noisy( 10, you.x_pos, you.y_pos );
- mpr(mons_targd == MHITYOU ? "Heel!" : "Attack!");
+ mpr(mons_targd == MHITYOU ? "Come here!" : "Attack!");
} // end yell()
bool forget_inventory(bool quiet)
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 81eb901b36..27c2bfe7b2 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -2633,7 +2633,7 @@ bool is_colourful_item( const item_def &item )
bool is_shield(const item_def &item)
{
return item.base_type == OBJ_ARMOUR
- && get_armour_slot(item) == EQ_SHIELD;
+ && get_armour_slot(item) == EQ_SHIELD;
}
// Returns true if the given item cannot be wielded with the given shield.
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 966f8218f6..7a5590235e 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -3329,49 +3329,59 @@ static bool _is_signature_weapon(monsters *monster, const item_def &weapon)
bool monsters::pickup_melee_weapon(item_def &item, int near)
{
- const bool is_2handed =
- (hands_reqd(item, body_size(PSIZE_BODY)) == HANDS_TWO);
- size_type size = body_size(PSIZE_BODY);
-
if (mons_wields_two_weapons(this))
{
- const item_def *wpn = mslot_item(MSLOT_WEAPON);
- const item_def *alt = mslot_item(MSLOT_ALT_WEAPON);
-
// If we have either weapon slot free, pick up the weapon.
- if (!wpn && (!alt || hands_reqd(*alt, size) < HANDS_TWO && !is_2handed))
+ if (inv[MSLOT_WEAPON] == NON_ITEM)
return pickup(item, MSLOT_WEAPON, near);
- if (!alt && (!wpn || hands_reqd(*wpn, size) < HANDS_TWO && !is_2handed))
+ if (inv[MSLOT_ALT_WEAPON] == NON_ITEM)
return pickup(item, MSLOT_ALT_WEAPON, near);
}
const int mdam_rating = mons_weapon_damage_rating(item);
int eslot = -1;
- bool has_melee = false;
+ item_def *weap;
+
for (int i = MSLOT_WEAPON; i <= MSLOT_ALT_WEAPON; ++i)
{
- if (const item_def *weap = mslot_item(static_cast<mon_inv_type>(i)))
+ weap = mslot_item(static_cast<mon_inv_type>(i));
+
+ if (!weap)
{
- if (is_range_weapon(*weap))
- continue;
+ // If no weapon in this slot, pick up this one.
+ eslot = i;
+ break;
+ }
- // Don't drop weapons specific to the monster.
- if (_is_signature_weapon(this, *weap))
- continue;
+ if (is_range_weapon(*weap))
+ continue;
- has_melee = true;
- if (mons_weapon_damage_rating(*weap) < mdam_rating)
- return (drop_item(i, near) && pickup(item, i, near));
- }
- else
+ // Don't drop weapons specific to the monster.
+ if (_is_signature_weapon(this, *weap))
+ continue;
+
+ // If the new weapon is better than the current one, replace it.
+ // If wielding two weapons, replace the one with the lower dam. rating.
+ if (mons_weapon_damage_rating(*weap) < mdam_rating
+ && ( eslot == -1 // current is main weapon
+ || !weap->cursed()
+ && mons_weapon_damage_rating(*weap)
+ < mons_weapon_damage_rating(*mslot_item(MSLOT_WEAPON)) ))
+ {
eslot = i;
+ }
}
- if (eslot == MSLOT_ALT_WEAPON && inv[MSLOT_WEAPON] == NON_ITEM)
- eslot = MSLOT_WEAPON;
+ // No slot found to place this item.
+ if (eslot == -1)
+ return false;
- return (eslot == -1 || has_melee? false : pickup(item, eslot, near));
+ // Current item cannot be dropped.
+ if (inv[eslot] != NON_ITEM && !drop_item(eslot, near))
+ return false;
+
+ return (pickup(item, eslot, near));
}
// Arbitrary damage adjustment for quantity of missiles. So sue me.
@@ -3423,6 +3433,14 @@ bool monsters::wants_weapon(const item_def &weap) const
if (!check_weapon_wieldable_size( weap, body_size(PSIZE_BODY) ))
return (false);
+ // Monsters capable of dual-wielding will always prefer two weapons
+ // to a single two-handed one, however strong.
+ if (mons_wields_two_weapons(this)
+ && hands_reqd(weap, body_size(PSIZE_BODY)) == HANDS_TWO)
+ {
+ return false;
+ }
+
// Nobody picks up giant clubs.
// Starting equipment is okay, of course.
if (weap.sub_type == WPN_GIANT_CLUB
@@ -3452,11 +3470,19 @@ static bool _item_race_matches_monster(const item_def &item, monsters *mons)
bool monsters::wants_armour(const item_def &item) const
{
+ // Monsters that are capable of dual wielding won't pick up shields.
+ // Neither will monsters that are already wielding a two-hander.
+ if (is_shield(item)
+ && (mons_wields_two_weapons(this)
+ || mslot_item(MSLOT_WEAPON)
+ && hands_reqd(*mslot_item(MSLOT_WEAPON), body_size(PSIZE_BODY))
+ == HANDS_TWO))
+ {
+ return (false);
+ }
+
// Returns whether this armour is the monster's size.
return (check_armour_size(item, mons_size(this)));
-
-// For now, never attempt to change armour.
-// return (!mslot_item(MSLOT_ARMOUR));
}
static mon_inv_type _equip_slot_to_mslot(equipment_type eq)
@@ -3509,17 +3535,6 @@ bool monsters::pickup_armour(item_def &item, int near, bool force)
if (mslot == NUM_MONSTER_SLOTS)
return (false);
- // Monsters that are capable of dual wielding won't pick up shields.
- // Neither will monsters that are already wielding a two-hander.
- if (mslot == MSLOT_SHIELD
- && (mons_wields_two_weapons(this)
- || mslot_item(MSLOT_WEAPON)
- && hands_reqd(*mslot_item(MSLOT_WEAPON), body_size(PSIZE_BODY))
- == HANDS_TWO))
- {
- return (false);
- }
-
int newAC = item.armour_rating();
// no armour yet -> get this one
if (!mslot_item(mslot) && newAC > 0)
@@ -3575,15 +3590,6 @@ bool monsters::pickup_weapon(item_def &item, int near, bool force)
// - If it is a throwable weapon, and we're carrying no missiles (or our
// missiles are the same type), pick it up.
- // Monsters capable of dual-wielding will always prefer two weapons
- // to a single two-handed one, however strong.
- if (mons_wields_two_weapons(this)
- && hands_reqd(item, body_size(PSIZE_BODY)) == HANDS_TWO
- && mslot_item(MSLOT_ALT_WEAPON))
- {
- return (false);
- }
-
if (is_range_weapon(item))
return (pickup_launcher(item, near));
@@ -3734,6 +3740,10 @@ bool monsters::pickup_misc(item_def &item, int near)
if (item.sub_type == MISC_RUNE_OF_ZOT)
return (false);
+ // Holy monsters won't pick up unholy misc. items.
+ if (mons_holiness(this) == MH_HOLY && is_evil_item(item))
+ return (false);
+
return pickup(item, MSLOT_MISCELLANY, near);
}
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 6534e9b4fc..b58e434a08 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -1024,11 +1024,11 @@ static bool _beogh_blessing_reinforcement()
// Possible reinforcement.
const monster_type followers[] = {
- MONS_ORC, MONS_ORC_WIZARD, MONS_ORC_PRIEST
+ MONS_ORC, MONS_ORC, MONS_ORC_WIZARD, MONS_ORC_PRIEST
};
const monster_type high_xl_followers[] = {
- MONS_ORC_PRIEST, MONS_ORC_WARRIOR, MONS_ORC_KNIGHT, MONS_ORC_WARLORD
+ MONS_ORC_PRIEST, MONS_ORC_WARRIOR, MONS_ORC_KNIGHT
};
// Send up to four followers.