summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.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/items.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/items.cc')
-rw-r--r--crawl-ref/source/items.cc54
1 files changed, 41 insertions, 13 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index f7aa0a111b..06ccc9d944 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1530,10 +1530,7 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
&& (mitm[obj].sub_type == POT_BLOOD
|| mitm[obj].sub_type == POT_BLOOD_COAGULATED))
{
- // use average age
- int age = you.inv[m].special * you.inv[m].quantity
- + mitm[obj].special * quant_got;
- you.inv[m].special = age / (you.inv[m].quantity + quant_got);
+ pick_up_blood_potions_stack(mitm[obj], quant_got);
}
inc_inv_item_quantity( m, quant_got );
dec_mitm_item_quantity( obj, quant_got );
@@ -1586,20 +1583,34 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
check_note_item(item);
item.quantity = quant_got;
+ if (mitm[obj].base_type == OBJ_POTIONS
+ && (mitm[obj].sub_type == POT_BLOOD
+ || mitm[obj].sub_type == POT_BLOOD_COAGULATED))
+ {
+ if (quant_got != mitm[obj].quantity)
+ {
+ // remove oldest timers from original stack
+ for (int i = 0; i < quant_got; i++)
+ remove_oldest_blood_potion(mitm[obj]);
+
+ // ... and newest ones from picked up stack
+ remove_newest_blood_potion(item);
+ }
+ }
dec_mitm_item_quantity( obj, quant_got );
you.m_quiver->on_inv_quantity_changed(freeslot, quant_got);
burden_change();
if (!quiet)
mpr( you.inv[freeslot].name(DESC_INVENTORY).c_str() );
-
+
if (Options.tutorial_left)
{
taken_new_item(item.base_type);
if (is_artefact(item) || get_equip_desc( item ) != ISFLAG_NO_DESC)
learned_something_new(TUT_SEEN_RANDART);
}
-
+
if (item.base_type == OBJ_ORBS
&& you.char_direction == GDT_DESCENDING)
{
@@ -1737,17 +1748,16 @@ bool copy_item_to_grid( const item_def &item, int x_plos, int y_plos,
{
if (items_stack( item, mitm[i] ))
{
+ inc_mitm_item_quantity( i, quant_drop );
+
if (item.base_type == OBJ_POTIONS
&& (item.sub_type == POT_BLOOD
|| item.sub_type == POT_BLOOD_COAGULATED))
{
- // calculate average age
- int age = mitm[i].special * mitm[i].quantity
- + item.special * quant_drop;
- mitm[i].special = age / (mitm[i].quantity + quant_drop);
+ item_def help = item;
+ drop_blood_potions_stack(help, quant_drop, x_plos, y_plos);
}
- inc_mitm_item_quantity( i, quant_drop );
-
+
// If the items on the floor already have a nonzero slot,
// leave it as such, otherwise set the slot.
if (mark_dropped && !mitm[i].slot)
@@ -1780,6 +1790,15 @@ bool copy_item_to_grid( const item_def &item, int x_plos, int y_plos,
}
move_item_to_grid( &new_item, x_plos, y_plos );
+ if (item.base_type == OBJ_POTIONS
+ && (item.sub_type == POT_BLOOD
+ || item.sub_type == POT_BLOOD_COAGULATED)
+ && item.quantity != quant_drop) // partial drop only
+ {
+ // since only the oldest potions have been dropped,
+ // remove the newest ones
+ remove_newest_blood_potion(mitm[new_item]);
+ }
return (true);
} // end copy_item_to_grid()
@@ -1893,7 +1912,16 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
}
else if (strstr(you.inv[item_dropped].inscription.c_str(), "=s") != 0)
StashTrack.add_stash();
-
+
+ if (you.inv[item_dropped].base_type == OBJ_POTIONS
+ && (you.inv[item_dropped].sub_type == POT_BLOOD
+ || you.inv[item_dropped].sub_type == POT_BLOOD_COAGULATED)
+ && you.inv[item_dropped].quantity != quant_drop)
+ {
+ // oldest potions have been dropped
+ for (int i = 0; i < quant_drop; i++)
+ remove_oldest_blood_potion(you.inv[item_dropped]);
+ }
dec_inv_item_quantity( item_dropped, quant_drop );
you.turn_is_over = true;