summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/effects.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-30 06:50:01 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-30 06:50:01 +0000
commit38ab56357907871b49728be279729e24038f83d5 (patch)
tree24e445fc69014f0ba6fd6177f81a61c2e77d56a9 /crawl-ref/source/effects.cc
parentfc944616f69e347423c408a9d3e3efee9140a46d (diff)
downloadcrawl-ref-38ab56357907871b49728be279729e24038f83d5.tar.gz
crawl-ref-38ab56357907871b49728be279729e24038f83d5.zip
A few improvements to banished() and entry cause tracking.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2257 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/effects.cc')
-rw-r--r--crawl-ref/source/effects.cc91
1 files changed, 86 insertions, 5 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index bc8bebd375..c6f3be2516 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -153,19 +153,91 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
"escaped from the Abyss!" + who_banished(who));
#endif
- if (gate_type == DNGN_ENTER_ABYSS)
+ std::string cast_into = "";
+
+ switch(gate_type)
{
- const std::string what = "Cast into the Abyss" + who_banished(who);
- take_note(Note(NOTE_USER_NOTE, 0, 0, what.c_str()), true);
+ case DNGN_ENTER_ABYSS:
+ if (you.level_type == LEVEL_ABYSS)
+ {
+ mpr("You feel trapped.");
+ return;
+ }
+ cast_into = "the Abyss";
+ break;
+
+ case DNGN_EXIT_ABYSS:
+ if (you.level_type != LEVEL_ABYSS)
+ {
+ mpr("You feel dizzy for a moment.");
+ return;
+ }
+ break;
+
+ case DNGN_ENTER_PANDEMONIUM:
+ if (you.level_type == LEVEL_PANDEMONIUM)
+ {
+ mpr("You feel trapped.");
+ return;
+ }
+ cast_into = "Pandemonium";
+ break;
+
+ case DNGN_TRANSIT_PANDEMONIUM:
+ if (you.level_type != LEVEL_PANDEMONIUM)
+ {
+ banished(DNGN_ENTER_PANDEMONIUM, who);
+ return;
+ }
+ break;
+
+ case DNGN_EXIT_PANDEMONIUM:
+ if (you.level_type != LEVEL_PANDEMONIUM)
+ {
+ mpr("You feel dizzy for a moment.");
+ return;
+ }
+ break;
+
+ case DNGN_ENTER_LABYRINTH:
+ if (you.level_type == LEVEL_LABYRINTH)
+ {
+ mpr("You feel trapped.");
+ return;
+ }
+ cast_into = "a Labyrinth";
+ break;
+
+ case DNGN_ENTER_HELL:
+ case DNGN_ENTER_DIS:
+ case DNGN_ENTER_GEHENNA:
+ case DNGN_ENTER_COCYTUS:
+ case DNGN_ENTER_TARTARUS:
+ if (player_in_hell() || player_in_branch(BRANCH_VESTIBULE_OF_HELL))
+ {
+ mpr("You feel dizzy for a moment.");
+ return;
+ }
+ cast_into = "Hell";
+ break;
+
+ default:
+ mprf(MSGCH_DIAGNOSTICS, "Invalid banished() gateway %d",
+ static_cast<int>(gate_type));
+ ASSERT(false);
}
// Now figure out how we got here.
- if (who.find("self") != std::string::npos || who == you.your_name
- || who == "you" || who == "You" || crawl_state.is_god_acting())
+ if (crawl_state.is_god_acting())
{
// down_stairs() will take care of setting things.
you.entry_cause = EC_UNKNOWN;
}
+ else if (who.find("self") != std::string::npos || who == you.your_name
+ || who == "you" || who == "You")
+ {
+ you.entry_cause = EC_SELF_EXPLICIT;
+ }
else if (who.find("distortion") != std::string::npos)
{
if (who.find("wield") != std::string::npos)
@@ -191,6 +263,15 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
else
you.entry_cause = EC_MONSTER;
+ if (!crawl_state.is_god_acting())
+ you.entry_cause_god = GOD_NO_GOD;
+
+ if (cast_into != "" && you.entry_cause != EC_SELF_EXPLICIT)
+ {
+ const std::string what = "Cast into " + cast_into + who_banished(who);
+ take_note(Note(NOTE_USER_NOTE, 0, 0, what.c_str()), true);
+ }
+
down_stairs(you.your_level, gate_type, you.entry_cause); // heh heh
}