summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-util.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-15 19:34:39 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-15 19:34:39 +0000
commite4209979f264bb890bd22269e752cbde2ed0d58c (patch)
tree25ba88a058aa13bbbd3fc050abee9cdb875264cc /crawl-ref/source/spl-util.cc
parent1be0369055dab6a8c64b35b083dd4ef58b411b2c (diff)
downloadcrawl-ref-e4209979f264bb890bd22269e752cbde2ed0d58c.tar.gz
crawl-ref-e4209979f264bb890bd22269e752cbde2ed0d58c.zip
Overhaul book acquirement.
1. Do a skill check to decide on manual vs. spellbook (except for Xom and Sif Muna who never gift manuals). 2. If a spellbook, pick randart or normal books with fixed chances. 3. Make randart themes dependant on actual skills, not aptitudes. 4. For normal spellbooks, pick the book randomly with weights favouring books with many unknown spells of schools you're highly skilled in. (Bye-bye, fixed book acquirement order!) Formulas (as suggested by David) may need tweaking, feedback welcome! git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9093 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-util.cc')
-rw-r--r--crawl-ref/source/spl-util.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 4f892d6f4e..5b4ab85812 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -104,12 +104,16 @@ void init_spell_descs(void)
end(1, false, "spell #%d, id %d has no name", i, data.id);
if (data.level < 1 || data.level > 9)
+ {
end(1, false, "spell '%s' has invalid level %d",
data.title, data.level);
+ }
if (data.min_range > data.max_range)
+ {
end(1, false, "spell '%s' has min_range larger than max_range",
data.title);
+ }
if (data.flags & SPFLAG_TARGETING_MASK)
{
@@ -312,14 +316,14 @@ int spell_hunger(spell_type which_spell)
int hunger;
- if ( level < 10 && level > 0 )
+ if (level < 10 && level > 0)
hunger = basehunger[level-1];
else
hunger = (basehunger[0] * level * level) / 4;
hunger -= you.intel * you.skills[SK_SPELLCASTING];
- if ( hunger < 0 )
+ if (hunger < 0)
hunger = 0;
return hunger;