1 /**
2 * @file
3 * @brief Collection of tutorial related functions.
4 **/
5
6 #include "AppHdr.h"
7
8 #include "tutorial.h"
9
10 #include "hints.h"
11 #include "message.h"
12 #include "skills.h"
13 #include "state.h"
14
15
set_tutorial_skill(const char * skill,int level)16 void set_tutorial_skill(const char *skill, int level)
17 {
18 if (!crawl_state.game_is_tutorial())
19 return;
20
21 bool need_exercise_check = true;
22 if (strcmp(skill, "spellcasting") == 0)
23 you.skills[SK_SPELLCASTING] = level;
24 else if (strcmp(skill, "conjurations") == 0)
25 you.skills[SK_CONJURATIONS] = level;
26 else if (strcmp(skill, "invocations") == 0)
27 you.skills[SK_INVOCATIONS] = level;
28 else
29 need_exercise_check = false;
30
31 if (need_exercise_check)
32 reassess_starting_skills();
33 }
34
35 // FIXME: There's got to be a less hacky solution!
tutorial_init_hint(const char * hintstr)36 void tutorial_init_hint(const char* hintstr)
37 {
38 hints_event_type hint = HINT_EVENTS_NUM;
39 if (strcmp(hintstr, "HINT_NEW_LEVEL") == 0)
40 hint = HINT_NEW_LEVEL;
41 else if (strcmp(hintstr, "HINT_CHOOSE_STAT") == 0)
42 hint = HINT_CHOOSE_STAT;
43 else if (strcmp(hintstr, "HINT_MULTI_PICKUP") == 0)
44 hint = HINT_MULTI_PICKUP;
45
46 if (hint != HINT_EVENTS_NUM)
47 Hints.hints_events[hint] = true;
48 }
49
tutorial_death_message()50 void tutorial_death_message()
51 {
52 canned_msg(MSG_YOU_DIE);
53 mpr_nojoin(MSGCH_TUTORIAL,
54 "In Crawl, death is a sad but common occurrence. "
55 "Note that there's usually something you could have done to "
56 "survive, for example by using some kind of item, running away, "
57 "resting between fights, or by avoiding combat entirely. "
58 "Keep trying, eventually you'll prevail!");
59 more();
60 }
61