From cba36e09a9f04f7e691fac4f1c720c9935227298 Mon Sep 17 00:00:00 2001 From: dolorous Date: Mon, 17 Nov 2008 21:02:13 +0000 Subject: 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 --- crawl-ref/source/itemprop.cc | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'crawl-ref/source/itemprop.cc') 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); } // -- cgit v1.2.3-54-g00ecf