summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-17 21:02:13 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-11-17 21:02:13 +0000
commitcba36e09a9f04f7e691fac4f1c720c9935227298 (patch)
tree776c117b04216422ef4b806749916bdfa1ba0c27 /crawl-ref/source/itemprop.cc
parent2d63ab533a35163bf93d03f5db33b5ed8ec5a2ea (diff)
downloadcrawl-ref-cba36e09a9f04f7e691fac4f1c720c9935227298.tar.gz
crawl-ref-cba36e09a9f04f7e691fac4f1c720c9935227298.zip
Clean up handling of thrown items (mostly large rocks) again.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7467 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 79735afe46..1a417abe2a 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -2063,24 +2063,39 @@ bool has_launcher(const item_def &ammo)
}
// Returns true if item can be reasonably thrown without a launcher.
-bool is_throwable(const item_def &wpn, size_type bodysize, bool force)
+bool is_throwable(const actor *actor, const item_def &wpn, bool force)
{
+ size_type bodysize = actor->body_size();
+
if (wpn.base_type == OBJ_WEAPONS)
- return (Weapon_prop[ Weapon_index[wpn.sub_type] ].throwable);
+ return (Weapon_prop[Weapon_index[wpn.sub_type]].throwable);
else if (wpn.base_type == OBJ_MISSILES)
{
- if (!force && bodysize < SIZE_MEDIUM
- && (wpn.sub_type == MI_JAVELIN || wpn.sub_type == MI_THROWING_NET))
+ if (!force)
{
- return (false);
+ if ((bodysize < SIZE_LARGE
+ || !actor->can_throw_large_rocks())
+ && wpn.sub_type == MI_LARGE_ROCK)
+ {
+ return (false);
+ }
+
+ if (bodysize < SIZE_MEDIUM
+ && (wpn.sub_type == MI_JAVELIN
+ || wpn.sub_type == MI_THROWING_NET))
+ {
+ return (false);
+ }
}
- return (Missile_prop[ Missile_index[wpn.sub_type] ].throwable);
+
+ return (Missile_prop[Missile_index[wpn.sub_type]].throwable);
}
+
return (false);
}
// Decide if something is launched or thrown.
-launch_retval is_launched(actor *actor, const item_def *launcher,
+launch_retval is_launched(const actor *actor, const item_def *launcher,
const item_def &missile)
{
if (missile.base_type == OBJ_MISSILES
@@ -2090,8 +2105,7 @@ launch_retval is_launched(actor *actor, const item_def *launcher,
return (LRET_LAUNCHED);
}
- return (is_throwable(missile, actor->body_size()) ? LRET_THROWN
- : LRET_FUMBLED);
+ return (is_throwable(actor, missile) ? LRET_THROWN : LRET_FUMBLED);
}
//