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-06 17:16:58 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-06 17:16:58 +0000
commit07dc1fd248de5cf9f29683cb76c70277d6c7e156 (patch)
treef62952f5749df637ee34662e1994473ed1080a2b /crawl-ref/source/food.cc
parent4e14b2dc2f1ebcc6971995f013d81db61cfb17e7 (diff)
downloadcrawl-ref-07dc1fd248de5cf9f29683cb76c70277d6c7e156.tar.gz
crawl-ref-07dc1fd248de5cf9f29683cb76c70277d6c7e156.zip
Further improvements of vampires:
1) Quaffing and eating * They now get full effect of potions unless hungry (er, thirsty) or worse, in which case the effect gets halved as before. * Potions of blood heal on the level of heal wounds or healing, depending on hunger state. Healing always heals rotting and removes confusion - the chances involved were just frustrating to players. * Draining corpses has the same nutrition value as eating the (random) amount of chunks you get out of dissecting, but takes longer (and all at once, so draining your corpses in the middle of a battle is extremely risky). I guess this is still too good (when do you ever get to eat all chunks you get out of, say, an ogre or centaur?) so will have to be nerfed. 2) Resistances Resistances depend more strongly on hunger states now. Vampires are always poison resistant and can always see invisible. Additionally, they gain * rCold 1 at Hungry or worse, and rCold 2 at Near Starving or worse (The latter comes with susceptibility to fire.) * life protection 1 when satiated, 2 when hungry or worse, and 3 when near starving or worse * At starving they also get torment res. * Hungry vampires and vampires in bat form are stealthier, and starving vampires are even more stealthy. As before, they get the Necromancy boost (like Mummies do) at xl 13 and 26. Also, vampires can now cast spells while starving, but suffer a failure increase akin to that of Blade Hands. (I've no idea what these numbers actually mean, so this will most likely have to be changed as well.) Updated tables.txt. Still TODO: * Add special biting attack for successful stabbing. * Add distilling blood ability, and possibly distinguish between old and new potions (new food type, maybe). * Allow vampires to mutate, but these mutations to only take effect when Full, Very Full or Engorged. * Update manual. Apart from that, they are ready for playtesting once again. As always, feedback would be much appreciated. :) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3528 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc108
1 files changed, 65 insertions, 43 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 294eb27e45..79969268a5 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -503,13 +503,23 @@ bool prompt_eat_from_inventory(int slot)
return (false);
}
+ if (slot == -1 && you.species == SP_VAMPIRE)
+ {
+ slot = prompt_invent_item( "Drain what?",
+ MT_INVLIST,
+ OSEL_VAMP_EAT,
+ true, true, true, 0, NULL,
+ OPER_EAT );
+ }
+
int which_inventory_slot = (slot != -1)? slot:
prompt_invent_item(
"Eat which item?",
MT_INVLIST,
- you.species == SP_VAMPIRE ? OBJ_CORPSES : OBJ_FOOD,
+ OBJ_FOOD,
true, true, true, 0, NULL,
OPER_EAT );
+
if (which_inventory_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -708,10 +718,13 @@ void eat_from_inventory(int which_inventory_slot)
item_def& food(you.inv[which_inventory_slot]);
if (food.base_type == OBJ_CORPSES && food.sub_type == CORPSE_BODY)
{
- const int mons_type = food.plus;
+ if (you.species != SP_VAMPIRE)
+ 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 mass = item_mass( food );
+ const bool rotten = food_is_rotten(food);
+ const int mass = mons_weight(food.plus)/150;
if (!vampire_consume_corpse(mons_type, mass, chunk_type, rotten))
return;
@@ -726,16 +739,15 @@ void eat_from_inventory(int which_inventory_slot)
food.special = 90;
food.colour = LIGHTGREY;
}
- // dec_inv_item_quantity( which_inventory_slot, 1 );
return;
}
else if (food.sub_type == FOOD_CHUNK)
{
- const int mons_type = food.plus;
- const bool cannibal = is_player_same_species(mons_type);
- const int intel = mons_intel(mons_type) - I_ANIMAL;
+ const int mons_type = food.plus;
+ const bool cannibal = is_player_same_species(mons_type);
+ const int intel = mons_intel(mons_type) - I_ANIMAL;
const int chunk_type = mons_corpse_effect( mons_type );
- const bool rotten = food_is_rotten(food);
+ const bool rotten = food_is_rotten(food);
if (!prompt_eat_chunk(food, rotten))
return;
@@ -753,10 +765,10 @@ void eat_floor_item(int item_link)
item_def& food(mitm[item_link]);
if (food.base_type == OBJ_CORPSES && food.sub_type == CORPSE_BODY)
{
- const int mons_type = food.plus;
+ const int mons_type = food.plus;
const int chunk_type = mons_corpse_effect( mons_type );
- const bool rotten = food_is_rotten(food);
- const int mass = item_mass( food );
+ const bool rotten = food_is_rotten(food);
+ const int mass = mons_weight(food.plus)/150;
if (!vampire_consume_corpse(mons_type, mass, chunk_type, rotten))
return;
@@ -768,8 +780,8 @@ void eat_floor_item(int item_link)
else
{
food.sub_type = CORPSE_SKELETON;
- food.special = 90;
- food.colour = LIGHTGREY;
+ food.special = 90;
+ food.colour = LIGHTGREY;
}
// dec_mitm_item_quantity( item_link, 1 );
@@ -779,11 +791,13 @@ void eat_floor_item(int item_link)
else if (food.sub_type == FOOD_CHUNK)
{
const int chunk_type = mons_corpse_effect( food.plus );
- const int intel = mons_intel( food.plus ) - I_ANIMAL;
- const bool cannibal = is_player_same_species( food.plus );
- const bool rotten = food_is_rotten(food);
+ const int intel = mons_intel( food.plus ) - I_ANIMAL;
+ const bool cannibal = is_player_same_species( food.plus );
+ const bool rotten = food_is_rotten(food);
+
if (!prompt_eat_chunk(food, rotten))
return;
+
eat_chunk(determine_chunk_effect(chunk_type, rotten), cannibal, intel);
}
else
@@ -883,18 +897,18 @@ static int chunk_nutrition(bool likes_chunks)
int nutrition = CHUNK_BASE_NUTRITION;
if (likes_chunks || you.hunger_state < HS_SATIATED)
+ {
return (likes_chunks? nutrition
: apply_herbivore_chunk_effects(nutrition));
+ }
const int gourmand =
- wearing_amulet(AMU_THE_GOURMAND)?
- you.duration[DUR_GOURMAND]
- : 0;
+ wearing_amulet(AMU_THE_GOURMAND)? you.duration[DUR_GOURMAND] : 0;
int effective_nutrition =
- nutrition * (gourmand + GOURMAND_NUTRITION_BASE)
- / (GOURMAND_MAX + GOURMAND_NUTRITION_BASE);
-
+ nutrition * (gourmand + GOURMAND_NUTRITION_BASE)
+ / (GOURMAND_MAX + GOURMAND_NUTRITION_BASE);
+
#ifdef DEBUG_DIAGNOSTICS
const int epercent = effective_nutrition * 100 / nutrition;
mprf(MSGCH_DIAGNOSTICS,
@@ -920,10 +934,10 @@ static void eat_chunk( int chunk_effect, bool cannibal, int mon_intel )
bool likes_chunks = (you.omnivorous() ||
you.mutation[MUT_CARNIVOROUS]);
- int nutrition = chunk_nutrition(likes_chunks);
- int hp_amt = 0;
+ int nutrition = chunk_nutrition(likes_chunks);
+ int hp_amt = 0;
bool suppress_msg = false; // do we display the chunk nutrition message?
- bool do_eat = false;
+ bool do_eat = false;
if (you.species == SP_GHOUL)
{
@@ -1578,8 +1592,8 @@ static int determine_chunk_effect(int which_chunk_type, bool rotten_chunk)
return (this_chunk_effect);
} // end determine_chunk_effect()
-static bool vampire_consume_corpse(int mons_type, int mass,
- int chunk_type, bool rotten)
+static bool vampire_consume_corpse(const int mons_type, int max_chunks,
+ const int chunk_type, const bool rotten)
{
if (chunk_type == CE_HCL)
{
@@ -1587,10 +1601,27 @@ static bool vampire_consume_corpse(int mons_type, int mass,
return false;
}
+ // This is the exact formula of corpse nutrition for chunk lovers
+ max_chunks = 1 + random2(max_chunks);
+ int mass = CHUNK_BASE_NUTRITION * max_chunks;
int food_value = 0, hp_amt = 0, mp_amt = 0;
- if (!rotten)
+ if (rotten)
{
+ if (wearing_amulet(AMU_THE_GOURMAND))
+ {
+ food_value = mass/2 + random2(you.experience_level * 5);
+ mpr("Slurp.");
+ did_god_conduct(DID_DRINK_BLOOD, 8);
+ }
+ else
+ {
+ mpr("It's not fresh enough.");
+ return false;
+ }
+ }
+ else
+ {
hp_amt++;
switch (mons_type)
@@ -1632,26 +1663,17 @@ static bool vampire_consume_corpse(int mons_type, int mass,
}
did_god_conduct(DID_DRINK_BLOOD, 8);
}
- else if (wearing_amulet(AMU_THE_GOURMAND))
- {
- food_value = mass/3 + random2(you.experience_level * 5);
- mpr("Slurp.");
- did_god_conduct(DID_DRINK_BLOOD, 8);
- }
- else
- {
- mpr("It's not fresh enough.");
- return false;
- }
heal_from_food(hp_amt, mp_amt,
- !rotten && one_chance_in(4), one_chance_in(3));
+ !rotten && one_chance_in(4), one_chance_in(3));
lessen_hunger( food_value, true );
describe_food_change(food_value);
-// start_delay( DELAY_EAT, 3 );
- start_delay( DELAY_EAT, 1 + mass/300 );
+ // The delay for eating a chunk (mass 1000) is 2
+ // Here the base nutrition value equals that of chunks,
+ // but the delay should be greater.
+ start_delay( DELAY_EAT, mass / 400 );
return true;
} // end vampire_consume_corpse()