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-03-28 00:04:30 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-28 00:04:30 +0000
commitde8f4030ab16a4d839e67096aa45c89de5b0d9ab (patch)
tree18290573c22137d17c4738045a4d524e9c8be1fc /crawl-ref/source/food.cc
parentd492483ffce1744f3bfb0812c6aef470a7aa36c6 (diff)
downloadcrawl-ref-de8f4030ab16a4d839e67096aa45c89de5b0d9ab.tar.gz
crawl-ref-de8f4030ab16a4d839e67096aa45c89de5b0d9ab.zip
Clean up vampire biting attack, and call the new method whenever a
vampire successfully stabs one of those walking blood replenishers. All in all, vampires will bite monsters that don't yield blood less often (1/3 chance), though their overall biting chance has been slightly increases, and much so when stabbing. Weapons of vampiricism are now a distinct case, so vampiric biting (that also is signified by SPWPN_VAMPIRICISM, occasionally) consistently doesn't check for life protection (though that might be added) and instead always respects the mons_has_blood checks. Also, food messages ("You are very hungry.") are now displayed in green if your food level has increased. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3904 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc36
1 files changed, 22 insertions, 14 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 79b577551a..d9f9585905 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -613,6 +613,7 @@ static bool food_change(bool suppress_message)
{
char newstate = HS_ENGORGED;
bool state_changed = false;
+ bool less_hungry = false;
you.hunger = std::max(you_min_hunger(), you.hunger);
you.hunger = std::min(you_max_hunger(), you.hunger);
@@ -636,6 +637,8 @@ static bool food_change(bool suppress_message)
if (newstate != you.hunger_state)
{
state_changed = true;
+ if (newstate > you.hunger_state)
+ less_hungry = true;
you.hunger_state = newstate;
set_redraw_status( REDRAW_HUNGER );
@@ -645,41 +648,44 @@ static bool food_change(bool suppress_message)
&& you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT
&& you.duration[DUR_TRANSFORMATION] > 2)
{
- mpr("Your bloodfilled body can't sustain your transformation much longer.",
- MSGCH_WARN);
+ mpr("Your bloodfilled body can't sustain your transformation much "
+ "longer.", MSGCH_WARN);
you.duration[DUR_TRANSFORMATION] = 2;
}
- if (suppress_message == false)
+ if (!suppress_message)
{
+ std::string msg = "You ";
switch (you.hunger_state)
{
case HS_STARVING:
if (you.species == SP_VAMPIRE)
- mpr("You feel devoid of blood!");
+ msg += "feel devoid of blood!";
else
- mpr("You are starving!", MSGCH_FOOD);
+ msg += "are starving!";
learned_something_new(TUT_YOU_STARVING);
you.check_awaken(500);
break;
case HS_NEAR_STARVING:
if (you.species == SP_VAMPIRE)
- mpr("You feel almost devoid of blood!");
+ msg += "feel almost devoid of blood!";
else
- mpr("You are near starving.", MSGCH_FOOD);
+ msg += "are near starving!";
learned_something_new(TUT_YOU_HUNGRY);
break;
case HS_VERY_HUNGRY:
- mprf(MSGCH_FOOD, "You are feeling very %s.", how_hungry().c_str());
- learned_something_new(TUT_YOU_HUNGRY);
- break;
case HS_HUNGRY:
- mprf(MSGCH_FOOD, "You are feeling %s.", how_hungry().c_str());
+ msg += "are feeling ";
+ if (you.hunger_state == HS_VERY_HUNGRY)
+ msg += "very ";
+ msg += how_hungry();
+ msg += ".";
learned_something_new(TUT_YOU_HUNGRY);
break;
default:
- break;
+ return (state_changed);
}
+ mpr(msg.c_str(), MSGCH_FOOD, less_hungry);
}
}
@@ -736,8 +742,9 @@ void eat_from_inventory(int which_inventory_slot)
return;
const int mons_type = food.plus;
- const int chunk_type = mons_corpse_effect( mons_type );
const bool rotten = food_is_rotten(food);
+ const int chunk_type
+ = determine_chunk_effect(mons_corpse_effect( mons_type ), rotten);
const int mass = mons_weight(food.plus)/150;
if (!vampire_consume_corpse(mons_type, mass, chunk_type, rotten))
@@ -780,8 +787,9 @@ void eat_floor_item(int item_link)
if (food.base_type == OBJ_CORPSES && food.sub_type == CORPSE_BODY)
{
const int mons_type = food.plus;
- const int chunk_type = mons_corpse_effect( mons_type );
const bool rotten = food_is_rotten(food);
+ const int chunk_type
+ = determine_chunk_effect(mons_corpse_effect( mons_type ), rotten);
const int mass = mons_weight(food.plus)/150;
if (!vampire_consume_corpse(mons_type, mass, chunk_type, rotten))