From 1d5b5da76795d490b6cd64b35d0c61d19f25b5e9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 28 Sep 2008 19:52:12 +0000 Subject: Vampire feeding changes: * remove randomness and unify formulas for nutrition value of blood potions and corpses, so bottling potions can no longer be used to enforce greater nutrition: this means that draining corpses give more nutrition now * draining duration now matches nutrition more closely (the formulas used to be completely distinct, and quite complicated) * decrease blood potions' nutrition again (I'd increased it in my previous related commit), coagulated blood gives only 80% nutrition * blood potions last a bit longer (counter 2000 -> 2500) * healing from blood potions is impossible * healing from corpses is only possible while they're still fresh (i.e. won't start rotting soon, counter > 150) * remove unrotting etc. effects, decrease healing from human corpses git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7055 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/misc.cc | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source/misc.cc') diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index aa9a7c04fd..04c51de4a5 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -194,7 +194,7 @@ void init_stack_blood_potions(item_def &stack, int age) if (age == -1) { if (stack.sub_type == POT_BLOOD) - age = 2000; + age = 2500; else // coagulated blood age = 500; } @@ -908,8 +908,29 @@ bool can_bottle_blood_from_corpse(int mons_type) return (false); } -// Maybe potions should automatically merge into those already on the floor, -// or the player's inventory. +int num_blood_potions_from_corpse(int mons_class, int chunk_type) +{ + if (chunk_type == -1) + chunk_type = mons_corpse_effect(mons_class); + + // Max. amount is about one third of the max. amount for chunks. + const int max_chunks = mons_weight( mons_class ) / 150; + + // Max. amount is about one third of the max. amount for chunks. + int pot_quantity = max_chunks/3; + pot_quantity = stepdown_value( pot_quantity, 2, 2, 6, 6 ); + + // Halve number of potions obtained from contaminated chunk type corpses. + if (chunk_type == CE_CONTAMINATED) + pot_quantity /= 2; + + if (pot_quantity < 1) + pot_quantity = 1; + + return (pot_quantity); +} + +// If autopickup is active, the potions are auto-picked up after creation. void turn_corpse_into_blood_potions( item_def &item ) { ASSERT( item.base_type == OBJ_CORPSES ); @@ -923,24 +944,12 @@ void turn_corpse_into_blood_potions( item_def &item ) item_colour(item); item.flags &= ~(ISFLAG_THROWN | ISFLAG_DROPPED); - // Max. amount is about one third of the max. amount for chunks. - const int max_chunks = mons_weight( mons_class ) / 150; - item.quantity = 1 + random2( max_chunks/3 ); - item.quantity = stepdown_value( item.quantity, 2, 2, 6, 6 ); - - // Lower number of potions obtained from contaminated chunk type corpses. - if (mons_corpse_effect( mons_class ) == CE_CONTAMINATED) - { - item.quantity /= (random2(3) + 1); - - if (item.quantity < 1) - item.quantity = 1; - } + item.quantity = num_blood_potions_from_corpse(mons_class); // Initialize timer depending on corpse age: // almost rotting: age = 100 --> potion timer = 500 --> will coagulate soon - // freshly killed: age = 200 --> potion timer = 2000 --> fresh !blood - init_stack_blood_potions(item, (item.special - 100) * 15 + 500); + // freshly killed: age = 200 --> potion timer = 2500 --> fresh !blood + init_stack_blood_potions(item, (item.special - 100) * 20 + 500); // Happens after the blood has been bottled. if (monster_descriptor(mons_class, MDSC_LEAVES_HIDE) && !one_chance_in(3)) -- cgit v1.2.3-54-g00ecf