summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-07 23:32:49 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-07 23:32:49 +0000
commit8a7a6bec16baff41290ee02908c6032a668406ed (patch)
tree40537723f25c9ba73160a4f6c2e6b95c5bfbebf2
parentc844b7e9a0da9d6953de36eaf1229b36c31a85f6 (diff)
downloadcrawl-ref-8a7a6bec16baff41290ee02908c6032a668406ed.tar.gz
crawl-ref-8a7a6bec16baff41290ee02908c6032a668406ed.zip
Merge r9885 and r9887 from trunk: replace "your inventory suddenly weighs"
with one that's self explanatory. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@9918 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/effects.cc119
-rw-r--r--crawl-ref/source/enum.h33
-rw-r--r--crawl-ref/source/tutorial.cc8
3 files changed, 119 insertions, 41 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 52d7a395c8..7fd6a699ba 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -2977,67 +2977,109 @@ 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)
+ item_def &item(you.inv[i]);
+
+ if (item.quantity < 1)
continue;
- if (!_food_item_needs_time_check(you.inv[i]))
+ if (!_food_item_needs_time_check(item))
continue;
- if (you.inv[i].base_type == OBJ_POTIONS)
+ if (item.base_type == OBJ_POTIONS)
{
// Also handles messaging.
- if (maybe_coagulate_blood_potions_inv(you.inv[i]))
+ if (maybe_coagulate_blood_potions_inv(item))
burden_changed_by_rot = true;
continue;
}
+ if (item.base_type == OBJ_FOOD)
+ num_chunks++;
+ else if (item.sub_type == CORPSE_SKELETON)
+ num_bones++;
+ else
+ num_corpses++;
+
// Food item timed out -> make it disappear.
- if ((time_delta / 20) >= you.inv[i].special)
+ if ((time_delta / 20) >= item.special)
{
- if (you.inv[i].base_type == OBJ_FOOD)
+ if (item.base_type == OBJ_FOOD)
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
- destroy_item(you.inv[i]);
+ // In case time_delta >= 220
+ if (!item.props.exists(ROTTING_WARNED_KEY))
+ num_chunks_gone++;
+
+ destroy_item(item);
burden_changed_by_rot = true;
+
continue;
}
// The item is of type carrion.
- if (you.inv[i].sub_type == CORPSE_SKELETON
- || !mons_skeleton(you.inv[i].plus))
+ if (item.sub_type == CORPSE_SKELETON
+ || !mons_skeleton(item.plus))
{
if (you.equip[EQ_WEAPON] == i)
unwield_item();
- destroy_item(you.inv[i]);
+ if (item.sub_type == CORPSE_SKELETON)
+ num_bones_gone++;
+ else
+ num_corpses_gone++;
+
+ destroy_item(item);
burden_changed_by_rot = true;
continue;
}
- turn_corpse_into_skeleton(you.inv[i]);
+ turn_corpse_into_skeleton(item);
you.wield_change = true;
burden_changed_by_rot = true;
+
+ num_corpses_rotted++;
continue;
}
// If it hasn't disappeared, reduce the rotting timer.
- you.inv[i].special -= (time_delta / 20);
+ item.special -= (time_delta / 20);
- if (food_is_rotten(you.inv[i])
- && (you.inv[i].special + (time_delta / 20) >= 100))
+ if (food_is_rotten(item)
+ && (item.special + (time_delta / 20) >= 100))
{
rotten_items.push_back(index_to_letter(i));
}
+
+ if (item.base_type == OBJ_FOOD && you.inv[i].special <= 10
+ && !item.props.exists(ROTTING_WARNED_KEY))
+ {
+ // In case time_delta >= 220
+ item.props[ROTTING_WARNED_KEY] = true;
+
+ num_chunks_rotting++;
+ }
}
//mv: messages when chunks/corpses become rotten
@@ -3103,10 +3145,55 @@ 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
+ + num_corpses_rotted) > 0)
+ {
+ std::string msg;
+ if (num_chunks_gone == num_chunks
+ && num_bones_gone == num_bones
+ && (num_corpses_gone + num_corpses_rotted) == num_corpses)
+ {
+ msg = "All of the ";
+ }
+ else
+ msg = "Some of the ";
+
+ std::vector<std::string> strs;
+ if (num_chunks_gone > 0)
+ strs.push_back("chunks of flesh");
+ if (num_bones_gone > 0)
+ strs.push_back("skeletons");
+ if ((num_corpses_gone + num_corpses_rotted) > 0)
+ strs.push_back("corpses");
+
+ msg += comma_separated_line(strs.begin(), strs.end());
+ msg += " in your inventory have ";
+
+ if (num_corpses_rotted == 0)
+ msg += "completely ";
+ else if ((num_chunks_gone + num_bones_gone
+ + num_corpses_gone) == 0)
+ {
+ msg += "partially ";
+ }
+ else
+ msg += "completely or partially ";
+
+ msg += "rotted away.";
+ mprf(MSGCH_ROTTEN_MEAT, "%s", msg.c_str());
+ }
burden_change();
}
+
+ num_chunks -= num_chunks_gone;
+ if (num_chunks_rotting > 0)
+ {
+ mprf(MSGCH_ROTTEN_MEAT,
+ "%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...
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 976ff874cb..da71bb4991 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2918,48 +2918,47 @@ enum tutorial_event_type
TUT_NEW_ABILITY_ITEM, // 40
TUT_FLEEING_MONSTER,
TUT_ROTTEN_FOOD,
- TUT_ROTTEN_GONE,
TUT_CONVERT,
- TUT_GOD_DISPLEASED, // 45
- TUT_EXCOMMUNICATE,
+ TUT_GOD_DISPLEASED,
+ TUT_EXCOMMUNICATE, // 45
TUT_SPELL_MISCAST,
TUT_SPELL_HUNGER,
TUT_GLOWING,
- TUT_YOU_RESIST, // 50
+ TUT_YOU_RESIST,
// status changes
- TUT_YOU_ENCHANTED,
+ TUT_YOU_ENCHANTED, // 50
TUT_YOU_SICK,
TUT_YOU_POISON,
TUT_YOU_ROTTING,
- TUT_YOU_CURSED, // 55
- TUT_YOU_HUNGRY,
+ TUT_YOU_CURSED,
+ TUT_YOU_HUNGRY, // 55
TUT_YOU_STARVING,
TUT_YOU_MUTATED,
TUT_CAN_BERSERK,
- TUT_POSTBERSERK, // 60
- TUT_CAUGHT_IN_NET,
+ TUT_POSTBERSERK,
+ TUT_CAUGHT_IN_NET, // 60
// warning
TUT_RUN_AWAY,
TUT_RETREAT_CASTER,
TUT_WIELD_WEAPON,
- TUT_NEED_HEALING, // 65
- TUT_NEED_POISON_HEALING,
+ TUT_NEED_HEALING,
+ TUT_NEED_POISON_HEALING, // 65
TUT_INVISIBLE_DANGER,
TUT_NEED_HEALING_INVIS,
TUT_ABYSS,
// interface
- TUT_MULTI_PICKUP, // 70
- TUT_HEAVY_LOAD,
+ TUT_MULTI_PICKUP,
+ TUT_HEAVY_LOAD, // 70
TUT_SHIFT_RUN,
TUT_MAP_VIEW,
TUT_AUTO_EXPLORE,
- TUT_DONE_EXPLORE, // 75
- TUT_AUTO_EXCLUSION,
+ TUT_DONE_EXPLORE,
+ TUT_AUTO_EXCLUSION, // 75
TUT_STAIR_BRAND,
TUT_HEAP_BRAND,
TUT_TRAP_BRAND,
- TUT_LOAD_SAVED_GAME, // 80
- TUT_EVENTS_NUM // 81
+ TUT_LOAD_SAVED_GAME,
+ TUT_EVENTS_NUM // 80
};
// NOTE: For numbers higher than 85 change size of tutorial_events in externs.h.
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 62b21fa015..a67b6804da 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -418,8 +418,6 @@ static std::string _tut_debug_list(int event)
return "were encumbered";
case TUT_ROTTEN_FOOD:
return "carried rotten food";
- case TUT_ROTTEN_GONE:
- return "rotten food rotted away completely";
case TUT_NEED_HEALING:
return "needed healing";
case TUT_NEED_POISON_HEALING:
@@ -2598,12 +2596,6 @@ void learned_something_new(tutorial_event_type seen_what, coord_def gc)
"and rotten chunks or corpses in the stash at once.";
break;
- case TUT_ROTTEN_GONE:
- text << "One of the skeletons or rotten chunks of meat you carried "
- "rotted away completely, or one of the rotten corpses you "
- "carried rotted away into a skeleton.";
- break;
-
case TUT_MAKE_CHUNKS:
text << "How lucky! That monster left a corpse which you can now "
"<w>c</w>hop up";