summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/food.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-08 21:53:05 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-08 21:53:05 +0000
commit7cc66e61e50963ba90a5db8db19cf75890d3c733 (patch)
treefa2ee702c472095c0c3c2326fd7920d02875e29a /crawl-ref/source/food.cc
parent8cbb227becdc172839b901aedf972022dc73118d (diff)
downloadcrawl-ref-7cc66e61e50963ba90a5db8db19cf75890d3c733.tar.gz
crawl-ref-7cc66e61e50963ba90a5db8db19cf75890d3c733.zip
Apply more commits into 0.4 branch, again mostly by Haran:
6950, 6954, 6959, 6962, 6963, 6965, 6968, 6970 (partly), 6997, 6998, 7001, 7061, 7065, 7071, 7132 (partly), 7174, 7186, 7213, 7233, 7268, 7268, 7293, 7319, 7339, 7358, 7393 (partly) * Tweak a few monster flags. * Fix autoswapping jewellery taking longer than manual swapping. * Fix crash when attempting to create nonexisting monster in wizmode. * Make ego armour descriptions follow abbreviation guidelines. * Fixed buggy monster movement away from the player. * Disabled traps in the Abyss. * Fixed a few other minor bugs, and improves messaging. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@7788 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 29914b32c1..b70dc6d8da 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -136,7 +136,7 @@ void weapon_switch( int targ )
if (targ == -1) // Unarmed Combat.
{
// Already unarmed?
- if (you.equip[EQ_WEAPON] == -1)
+ if (!you.weapon())
return;
mpr( "You switch back to your bare hands." );
@@ -161,7 +161,7 @@ void weapon_switch( int targ )
// Well yeah, but that's because interacting with the wielding
// code is a mess... this whole function's purpose was to
// isolate this hack until there's a proper way to do things. -- bwr
- if (you.equip[EQ_WEAPON] != -1)
+ if (you.weapon())
unwield_item(false);
you.equip[EQ_WEAPON] = targ;
@@ -173,13 +173,25 @@ void weapon_switch( int targ )
if (Options.chunks_autopickup || you.species == SP_VAMPIRE)
autopickup();
+ // Same amount of time as normal wielding.
+ // FIXME: this duplicated code is begging for a bug.
+ if (you.weapon())
+ {
+ you.time_taken /= 2;
+ }
+ else // swapping to empty hands is faster
+ {
+ you.time_taken *= 3;
+ you.time_taken /= 10;
+ }
+
you.turn_is_over = true;
}
// Look for a butchering implement. If fallback is true,
// prompt the user if no obvious options exist.
// Returns whether a weapon was switched.
-static int _find_butchering_implement(int &butcher_tool)
+static bool _find_butchering_implement(int &butcher_tool)
{
// When berserk, you can't change weapons. Sanity check!
if (!can_wield(NULL, true))
@@ -209,7 +221,7 @@ static int _find_butchering_implement(int &butcher_tool)
// Look for a butchering implement in your pack.
for (int i = 0; i < ENDOFPACK; ++i)
{
- const item_def& tool(you.inv[i]);
+ item_def& tool(you.inv[i]);
if (is_valid_item( tool )
&& tool.base_type == OBJ_WEAPONS
&& can_cut_meat( tool )
@@ -241,7 +253,7 @@ static int _find_butchering_implement(int &butcher_tool)
const int item_slot = prompt_invent_item(
"What would you like to use? (- for none)?",
- MT_INVLIST, OSEL_WIELD,
+ MT_INVLIST, OSEL_BUTCHERY,
true, true, true, '-', -1, NULL, OPER_WIELD);
if (prompt_failed(item_slot))
@@ -2012,6 +2024,9 @@ bool is_preferred_food(const item_def &food)
if (food.base_type != OBJ_FOOD)
return (false);
+
+ if (is_poisonous(food))
+ return (false);
// Honeycombs are tasty for everyone.
if (food.sub_type == FOOD_HONEYCOMB || food.sub_type == FOOD_ROYAL_JELLY)