summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-14 16:33:14 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-14 16:33:14 +0000
commitbbbd701b88b0274d7f14d0957828ad4342648135 (patch)
treede63191fc5e12155f5260708ca2dd0fc3a9d15fa /crawl-ref/source/effects.cc
parent94ceb87517474ac372a41a52a3448104f51435bf (diff)
downloadcrawl-ref-bbbd701b88b0274d7f14d0957828ad4342648135.tar.gz
crawl-ref-bbbd701b88b0274d7f14d0957828ad4342648135.zip
Overhaul blood potions to work completely differently.
Instead of storing age in item.special they now use a dynamic vector (item.props, like decks do), so that a stack of potions doesn't have to coagulate all at once. Rather than counting down the timers every 20 turns or so, the time-out turn is calculated at creation, and comparison is done against the current turncount. Any action changing a stack (quaffing, firing, Evaporate, picking up, dropping) will always extract the oldest values from the vector, which is likely to be what the player wants. Blood potions now last about 2000 turns (a bit more if drawn from fresh corpses), and coagulate 500 turns before rotting away. I ran a lot of tests in wiz mode and out, but of course there may still be problems. I've added methods to calculate the new timers from old style age counters (item.special), but I'm not sure that they actually work... Oh well... if worst comes to worst, this commit breaks saves. Also: * vampires are not susceptible to fire anymore when Bloodless * make tile_plant_colour also apply for remembered plants out of LOS * fix 1941759: buggy orc dialogue git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4228 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc107
1 files changed, 23 insertions, 84 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index e050246104..d77f3c5a5d 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1547,12 +1547,11 @@ bool acquirement(object_class_type class_wanted, int agent,
else if (quant > 1)
thing.quantity = quant;
- if (thing.base_type == OBJ_POTIONS)
+ if (thing.base_type == OBJ_POTIONS
+ && (thing.sub_type == POT_BLOOD
+ || thing.sub_type == POT_BLOOD_COAGULATED))
{
- if (thing.sub_type == POT_BLOOD)
- thing.special = 1200;
- else if (thing.sub_type == POT_BLOOD_COAGULATED)
- thing.special = 200;
+ init_stack_blood_potions(thing);
}
// remove curse flag from item
@@ -2213,9 +2212,6 @@ static void rot_inventory_food(long time_delta)
// Update all of the corpses and food chunks in the player's
// inventory {should be moved elsewhere - dlb}
bool burden_changed_by_rot = false;
- int num_total_blood = 0, num_blood_coagulates = 0;
- int affected_potion = -1; // stack of coagulating blood potions
- // (only one possible at a time)
std::vector<char> rotten_items;
for (int i = 0; i < ENDOFPACK; i++)
{
@@ -2225,11 +2221,18 @@ static void rot_inventory_food(long time_delta)
if (!food_item_needs_time_check(you.inv[i]))
continue;
+ if (you.inv[i].base_type == OBJ_POTIONS)
+ {
+ // also handles messaging
+ if (maybe_coagulate_blood_potions_inv(you.inv[i]))
+ burden_changed_by_rot = true;
+ continue;
+ }
+
// food item timed out -> make it disappear
if ((time_delta / 20) >= you.inv[i].special)
{
- if (you.inv[i].base_type == OBJ_FOOD
- || you.inv[i].base_type == OBJ_POTIONS)
+ if (you.inv[i].base_type == OBJ_FOOD)
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
@@ -2263,18 +2266,8 @@ static void rot_inventory_food(long time_delta)
// if it hasn't disappeared, reduce the rotting timer
you.inv[i].special -= (time_delta / 20);
- if (you.inv[i].base_type == OBJ_POTIONS
- && you.inv[i].sub_type == POT_BLOOD)
- {
- num_total_blood += you.inv[i].quantity;
- if (you.inv[i].special < 200)
- {
- num_blood_coagulates += you.inv[i].quantity;
- affected_potion = i;
- }
- }
- else if (food_is_rotten(you.inv[i])
- && (you.inv[i].special + (time_delta / 20) >= 100 ))
+ if (food_is_rotten(you.inv[i])
+ && (you.inv[i].special + (time_delta / 20) >= 100 ))
{
rotten_items.push_back(index_to_letter( i ));
}
@@ -2339,50 +2332,6 @@ static void rot_inventory_food(long time_delta)
learned_something_new(TUT_ROTTEN_FOOD);
}
- if (num_blood_coagulates)
- {
- ASSERT(affected_potion != -1);
-
- std::string msg = "";
-
- if (num_total_blood == num_blood_coagulates)
- msg += you.inv[affected_potion].name(DESC_CAP_YOUR, false);
-/*
- // this is for later, when part of a stack can coagulate
- else
- {
- if (congealed_blood_num == 1)
- msg += "One of ";
- else
- msg += "Some of ";
-
- msg += you.inv[affected_potion].name(DESC_NOCAP_YOUR, false);
- }
-*/
- msg += " coagulate";
- if (num_blood_coagulates == 1)
- msg += "s";
- msg += ".";
-
- mpr(msg.c_str(), MSGCH_ROTTEN_MEAT);
-
- const bool known_blood = item_type_known(you.inv[affected_potion]);
- you.inv[affected_potion].sub_type = POT_BLOOD_COAGULATED;
- you.inv[affected_potion].plus
- = you.item_description[IDESC_POTIONS][POT_BLOOD_COAGULATED];
- const bool known_coag_blood = item_type_known(you.inv[affected_potion]);
-
- // identify both blood and coagulated blood, if necessary
- if (!known_blood)
- set_ident_type( OBJ_POTIONS, POT_BLOOD, ID_KNOWN_TYPE );
- if (!known_coag_blood)
- {
- set_ident_flags( you.inv[affected_potion], ISFLAG_IDENT_MASK );
- set_ident_type( OBJ_POTIONS, POT_BLOOD_COAGULATED, ID_KNOWN_TYPE );
- mpr(you.inv[affected_potion].name(DESC_INVENTORY, false).c_str());
- }
- }
-
if (burden_changed_by_rot)
{
mpr("Your equipment suddenly weighs less.", MSGCH_ROTTEN_MEAT);
@@ -2879,10 +2828,9 @@ static void _maybe_restart_fountain_flow(const int x, const int y,
const int tries)
{
dungeon_feature_type grid = grd[x][y];
+
if (grid < DNGN_DRY_FOUNTAIN_BLUE || grid > DNGN_DRY_FOUNTAIN_BLOOD)
- {
return;
- }
int t = 0;
while (tries > t++)
@@ -2941,9 +2889,15 @@ void update_corpses(double elapsedTime)
if (!food_item_needs_time_check(it))
continue;
+ if (it.base_type == OBJ_POTIONS)
+ {
+ maybe_coagulate_blood_potions_floor(c);
+ continue;
+ }
+
if (rot_time >= it.special && !is_being_butchered(it))
{
- if (it.base_type == OBJ_FOOD || it.base_type == OBJ_POTIONS)
+ if (it.base_type == OBJ_FOOD)
{
destroy_item(c);
}
@@ -2964,22 +2918,7 @@ void update_corpses(double elapsedTime)
}
else
{
- // potions of blood have a longer rot time
- if (it.base_type != OBJ_POTIONS)
- ASSERT(rot_time < 256);
-
it.special -= rot_time;
-
- if (it.base_type == OBJ_POTIONS
- && it.sub_type == POT_BLOOD
- && it.special < 200)
- {
- ASSERT(rot_time < 1200);
- it.sub_type = POT_BLOOD_COAGULATED;
-
- it.plus
- = you.item_description[IDESC_POTIONS][POT_BLOOD_COAGULATED];
- }
}
}