summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 17:36:50 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-18 17:36:50 +0000
commit50c201eae4fa07d6901dc5632c294660fb1a0745 (patch)
tree01fce245e2693ab4c54ef55d06ffdf89fd035390 /crawl-ref/source/describe.cc
parent88b3b611b4a78d557eed9f2266c74bdad2b38cd8 (diff)
downloadcrawl-ref-50c201eae4fa07d6901dc5632c294660fb1a0745.tar.gz
crawl-ref-50c201eae4fa07d6901dc5632c294660fb1a0745.zip
Outsource the tutorial descriptions of skills, and make them searchable
in the database. Apply Zaba's patch to view skills from the skill menu ('m'). The melee, ranged and magic skills currently only have really generic descriptions shamelessly copied from the tutorial. There's a front end function get_skill_description that appends extra information like what types of unarmed attacks the current character is capable of (kicking, clawing, punching, ...) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5955 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc129
1 files changed, 129 insertions, 0 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 877f61d546..255572a9b1 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -58,6 +58,7 @@
#include "spl-book.h"
#include "stuff.h"
#include "spl-util.h"
+#include "transfor.h"
#include "tutorial.h"
#include "xom.h"
@@ -2992,3 +2993,131 @@ void describe_god( god_type which_god, bool give_title )
if (keyin == '!')
_detailed_god_description(which_god);
}
+
+std::string get_skill_description(int skill, bool need_title)
+{
+ std::string lookup = skill_name(skill);
+ std::string result = "";
+
+ if (need_title)
+ {
+ result = lookup;
+ result += EOL EOL;
+ }
+
+ result += getLongDescription(lookup);
+
+ switch (skill)
+ {
+ case SK_UNARMED_COMBAT:
+ {
+ // Give a detailed listing of what attacks the character may perform.
+ std::vector<std::string> unarmed_attacks;
+
+ if (you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
+ || player_genus(GENPC_DRACONIAN)
+ || (you.species == SP_MERFOLK && player_is_swimming())
+ || player_mutation_level( MUT_STINGER ))
+ {
+ unarmed_attacks.push_back("slap monsters with your tail");
+ }
+
+ if (player_mutation_level(MUT_FANGS)
+ || you.attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON)
+ {
+ unarmed_attacks.push_back("bite other creatures");
+ }
+
+ if (you.species == SP_KENKU)
+ unarmed_attacks.push_back("peck at monsters with your beak");
+
+ if (player_mutation_level(MUT_HORNS))
+ unarmed_attacks.push_back("do a headbutt attack with your horns");
+ else if (you.species == SP_NAGA)
+ unarmed_attacks.push_back("do a headbutt attack");
+
+ if (player_mutation_level(MUT_HOOVES))
+ {
+ unarmed_attacks.push_back("kick your enemies with your hooves");
+ }
+ else if (player_mutation_level(MUT_TALONS))
+ {
+ unarmed_attacks.push_back("claw at your enemies with your talons");
+ }
+ else if (you.species != SP_NAGA
+ && (you.species != SP_MERFOLK || !player_is_swimming()))
+ {
+ unarmed_attacks.push_back("kick your enemies");
+ }
+
+ unarmed_attacks.push_back("punch monsters with your free hand");
+
+ if (!unarmed_attacks.empty())
+ {
+ std::string broken = "For example, you could ";
+ broken += comma_separated_line(unarmed_attacks.begin(),
+ unarmed_attacks.end(),
+ " or ", ", ");
+ broken += ".";
+ linebreak_string2(broken, 72);
+
+ result += EOL;
+ result += broken;
+ }
+ break;
+ }
+ case SK_INVOCATIONS:
+ if (you.species == SP_DEMIGOD)
+ {
+ result += EOL;
+ result += "How on earth did you manage to pick this up?";
+ }
+ else if (you.religion == GOD_TROG)
+ {
+ result += EOL;
+ result += "Note that Trog doesn't use Invocations, it being too "
+ "closely connected to magic.";
+ }
+ else if (you.religion == GOD_NEMELEX_XOBEH)
+ {
+ result += EOL;
+ result += "Note that Nemelex uses Evocations rather than "
+ "Invocations.";
+ }
+ break;
+
+ case SK_EVOCATIONS:
+ if (you.religion == GOD_NEMELEX_XOBEH)
+ {
+ result += EOL;
+ result += "This is the skill all of Nemelex' abilities rely on.";
+ }
+ break;
+
+ case SK_SPELLCASTING:
+ if (you.religion == GOD_TROG)
+ {
+ result += EOL;
+ result += "Keep in mind, though, that Trog will greatly disapprove "
+ "of this.";
+ }
+ break;
+ default:
+ // No further information.
+ break;
+ }
+
+ return result;
+}
+
+void describe_skill(int skill)
+{
+ std::ostringstream data;
+
+ data << get_skill_description(skill, true);
+
+ clrscr();
+ print_description(data.str());
+ if (getch() == 0)
+ getch();
+}