summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-03 08:43:56 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-03 08:43:56 +0000
commitc0baf5ac213911f1c407b1cbb5b1c41c69375522 (patch)
tree073bf7cf2c444d9408ebf6345263aafa288bb628 /crawl-ref/source/effects.cc
parentc70705a813e3a43c321f024f952a07291bf28a5c (diff)
downloadcrawl-ref-c0baf5ac213911f1c407b1cbb5b1c41c69375522.tar.gz
crawl-ref-c0baf5ac213911f1c407b1cbb5b1c41c69375522.zip
* Change "Your inventory suddenly weighs less" message to messages which
are more self explanatory. * Remove tutorial event explaining the "Your inventory suddenly weighs less". git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9885 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc83
1 files changed, 81 insertions, 2 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 52d7a395c8..670f4344eb 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2977,12 +2977,24 @@ static bool _food_item_needs_time_check(item_def &item)
return (true);
}
+#define ROTTING_WARNED_KEY "rotting_warned"
+
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;
std::vector<char> rotten_items;
+
+ int num_chunks = 0;
+ int num_chunks_rotting = 0;
+ int num_chunks_gone = 0;
+ int num_bones = 0;
+ int num_bones_gone = 0;
+ int num_corpses = 0;
+ int num_corpses_rotted = 0;
+ int num_corpses_gone = 0;
+
for (int i = 0; i < ENDOFPACK; i++)
{
if (you.inv[i].quantity < 1)
@@ -2999,6 +3011,13 @@ static void _rot_inventory_food(long time_delta)
continue;
}
+ if (you.inv[i].base_type == OBJ_FOOD)
+ num_chunks++;
+ else if (you.inv[i].sub_type == CORPSE_SKELETON)
+ num_bones++;
+ else
+ num_corpses++;
+
// Food item timed out -> make it disappear.
if ((time_delta / 20) >= you.inv[i].special)
{
@@ -3007,8 +3026,13 @@ static void _rot_inventory_food(long time_delta)
if (you.equip[EQ_WEAPON] == i)
unwield_item();
+ // In case time_delta >= 210
+ if (!you.inv[i].props.exists(ROTTING_WARNED_KEY))
+ num_chunks_gone++;
+
destroy_item(you.inv[i]);
burden_changed_by_rot = true;
+
continue;
}
@@ -3019,6 +3043,11 @@ static void _rot_inventory_food(long time_delta)
if (you.equip[EQ_WEAPON] == i)
unwield_item();
+ if (you.inv[i].sub_type == CORPSE_SKELETON)
+ num_bones_gone++;
+ else
+ num_corpses_gone++;
+
destroy_item(you.inv[i]);
burden_changed_by_rot = true;
continue;
@@ -3027,6 +3056,8 @@ static void _rot_inventory_food(long time_delta)
turn_corpse_into_skeleton(you.inv[i]);
you.wield_change = true;
burden_changed_by_rot = true;
+
+ num_corpses_rotted++;
continue;
}
@@ -3038,6 +3069,15 @@ static void _rot_inventory_food(long time_delta)
{
rotten_items.push_back(index_to_letter(i));
}
+
+ if (you.inv[i].base_type == OBJ_FOOD && you.inv[i].special <= 10
+ && !you.inv[i].props.exists(ROTTING_WARNED_KEY))
+ {
+ // In case time_delta >= 210
+ you.inv[i].props[ROTTING_WARNED_KEY] = true;
+
+ num_chunks_rotting++;
+ }
}
//mv: messages when chunks/corpses become rotten
@@ -3103,10 +3143,49 @@ static void _rot_inventory_food(long time_delta)
if (burden_changed_by_rot)
{
- mpr("Your equipment suddenly weighs less.", MSGCH_ROTTEN_MEAT);
- learned_something_new(TUT_ROTTEN_GONE);
+ if ((num_chunks_gone + num_bones_gone + num_corpses_gone) > 0)
+ {
+ std::vector<std::string> strs;
+ if (num_chunks_gone > 0)
+ strs.push_back(make_stringf("%s of the chunks of flesh",
+ num_chunks_gone < num_chunks ?
+ "some" : "all"));
+ if (num_bones_gone > 0)
+ strs.push_back(make_stringf("%s of the skeletons",
+ num_bones_gone < num_bones ?
+ "some" : "all"));
+
+ if (num_corpses_gone > 0)
+ strs.push_back(make_stringf("%s of the corpses",
+ num_corpses_gone < num_corpses ?
+ "some" : "all"));
+
+ strs[0] = upcase_first(strs[0]);
+
+ std::string line = comma_separated_line(strs.begin(), strs.end());
+ line += " in your inventory have completely rotted away.";
+ mprf("%s", line.c_str());
+ }
+
+ num_corpses -= num_corpses_gone;
+ if (num_corpses_rotted > 0)
+ {
+ mprf("%s of the %scorpses in your invetory rotted away into "
+ "skeletons.",
+ num_corpses_rotted < num_corpses ? "Some" : "All",
+ num_corpses_gone > 0 ? "remaining " : "");
+ }
burden_change();
}
+
+ num_chunks -= num_chunks_gone;
+ if (num_chunks_rotting > 0)
+ {
+ mprf("%s of the %schunks of flesh in your inventory are close to "
+ "completely rotting away.",
+ num_chunks_rotting < num_chunks ? "Some" : "All",
+ num_chunks_gone > 0 ? "remaining " : "");
+ }
}
// Do various time related actions...