diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-21 19:52:14 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-21 19:52:14 +0000 |
commit | 6fe9d2d6362915f3ab999971c87dd2f4d09e905f (patch) | |
tree | 3815ce19535e80e61c54ab53234616c885688d2a /crawl-ref/source/skills2.cc | |
parent | 2846de53110f56c1732a3e9b2ab71b396af3c5a0 (diff) | |
download | crawl-ref-6fe9d2d6362915f3ab999971c87dd2f4d09e905f.tar.gz crawl-ref-6fe9d2d6362915f3ab999971c87dd2f4d09e905f.zip |
* Tweak spell number of randart books some more.
* Loosen restrictions on spell levels of unknown spells for normal books,
so there are more matches even for untrained schools.
* Add a new option dump_book_spells that, if set to true (default), will
dump the spells even for non-randart book. Useful if you don't know
the books' contents by heart and want to know spells at your disposal
without checking some spoilers.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9143 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/skills2.cc')
-rw-r--r-- | crawl-ref/source/skills2.cc | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index d546e2501f..7ff53d8054 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -1980,12 +1980,8 @@ std::string skill_title( unsigned char best_skill, unsigned char skill_lev, int species, int str, int dex, int god ) { // paranoia - if (best_skill == SK_UNUSED_1 - || best_skill > SK_UNARMED_COMBAT && best_skill < SK_SPELLCASTING - || best_skill >= NUM_SKILLS) - { + if (is_invalid_skill(best_skill)) return ("Adventurer"); - } if (species == -1) species = you.species; @@ -2072,12 +2068,8 @@ skill_type best_skill( int min_skill, int max_skill, int excl_skill ) for (int i = min_skill; i <= max_skill; i++) // careful!!! { - if (i == excl_skill - || i == SK_UNUSED_1 - || i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING) - { + if (i == excl_skill || is_invalid_skill(i)) continue; - } if (you.skills[i] > best_skill_level) { @@ -2118,8 +2110,7 @@ void init_skill_order( void ) { for (int i = SK_FIGHTING; i < NUM_SKILLS; i++) { - if (i == SK_UNUSED_1 - || (i > SK_UNARMED_COMBAT && i < SK_SPELLCASTING)) + if (is_invalid_skill(i)) { you.skill_order[i] = MAX_SKILL_ORDER; continue; @@ -2132,12 +2123,8 @@ void init_skill_order( void ) for (int j = SK_FIGHTING; j < NUM_SKILLS; j++) { - if (i == j - || j == SK_UNUSED_1 - || (j > SK_UNARMED_COMBAT && j < SK_SPELLCASTING)) - { + if (i == j || is_invalid_skill(j)) continue; - } const int j_diff = species_skills( j, you.species ); const unsigned int j_points = (you.skill_points[j] * 100) / j_diff; @@ -2296,3 +2283,14 @@ void wield_warning(bool newWeapon) } } } + +bool is_invalid_skill(int skill) +{ + if (skill < 0 || skill == SK_UNUSED_1 || skill >= NUM_SKILLS) + return (true); + + if (skill > SK_UNARMED_COMBAT && skill < SK_SPELLCASTING) + return (true); + + return (false); +} |