summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tutorial.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2010-03-14 19:44:15 +0100
committerRobert Vollmert <rvollmert@gmx.net>2010-03-14 19:44:15 +0100
commit254d24dd8771cfb4e5e6a041a06652c6b213bcee (patch)
treef7d09ff6b6b24f264983173e4ab60f19b8169a9e /crawl-ref/source/tutorial.cc
parent899f0742cf48c3595511243db148f80c142d2701 (diff)
downloadcrawl-ref-254d24dd8771cfb4e5e6a041a06652c6b213bcee.tar.gz
crawl-ref-254d24dd8771cfb4e5e6a041a06652c6b213bcee.zip
Move some tutorial code from main.cc to tutorial.cc.
Diffstat (limited to 'crawl-ref/source/tutorial.cc')
-rw-r--r--crawl-ref/source/tutorial.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 075e421a6f..c2bfb7b219 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -788,6 +788,63 @@ void tut_starting_screen()
mpr("Again, press <w>?</w> for the help, and <w>Ctrl-P</w> to reread the message history.");
}
+// Called each turn from _input. Better name welcome.
+void tutorial_new_turn()
+{
+ if (Tutorial.tutorial_left)
+ {
+ Tutorial.tut_just_triggered = false;
+
+ if (you.attribute[ATTR_HELD])
+ learned_something_new(TUT_CAUGHT_IN_NET);
+ else if (i_feel_safe() && you.level_type != LEVEL_ABYSS)
+ {
+ // We don't want those "Whew, it's safe to rest now" messages
+ // if you were just cast into the Abyss. Right?
+
+ if (2 * you.hp < you.hp_max
+ || 2 * you.magic_points < you.max_magic_points)
+ {
+ tutorial_healing_reminder();
+ }
+ else if (!you.running
+ && Tutorial.tutorial_events[TUT_SHIFT_RUN]
+ && you.num_turns >= 200
+ && you.hp == you.hp_max
+ && you.magic_points == you.max_magic_points)
+ {
+ learned_something_new(TUT_SHIFT_RUN);
+ }
+ else if (!you.running
+ && Tutorial.tutorial_events[TUT_MAP_VIEW]
+ && you.num_turns >= 500
+ && you.hp == you.hp_max
+ && you.magic_points == you.max_magic_points)
+ {
+ learned_something_new(TUT_MAP_VIEW);
+
+ learned_something_new(TUT_MAP_VIEW);
+ }
+ else if (!you.running
+ && Tutorial.tutorial_events[TUT_AUTO_EXPLORE]
+ && you.num_turns >= 700
+ && you.hp == you.hp_max
+ && you.magic_points == you.max_magic_points)
+ {
+ learned_something_new(TUT_AUTO_EXPLORE);
+ }
+ }
+ else
+ {
+ if (2*you.hp < you.hp_max)
+ learned_something_new(TUT_RUN_AWAY);
+
+ if (Tutorial.tutorial_type == TUT_MAGIC_CHAR && you.magic_points < 1)
+ learned_something_new(TUT_RETREAT_CASTER);
+ }
+ }
+}
+
// Once a tutorial character dies, offer some playing hints.
void tutorial_death_screen()
{