(1-3), "moderate" (4-6) and "difficult" (7-9).
Recount how often each spell school is used and use the two most prominent schools (biasing by their order of definition in spl-util.h if two are tied). This doesn't completely work yet: I got a book of Enchantment and Divination although not a single spell in the book belonged to Divination (5 of them were Enchantment, so that was okay). Also, the way spells are currently selected (from two random disciplines) you can get a spell that does not fit either leading school (as later derived by counting) and might look odd with the title, e.g. a book is built on the premise of Conj/Fire and ends up as Conj/Air with Fire/Trm thrown in.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7848 c06c8d41-db1a-0410-9941-cceddc491573
UC6V7JDZ6CKQNL5AARWFJ4ZPX4ZYCO5J3FW52I52I3PBJO6T6VEAC SA3XGRMUEO3K6T4TJJWMWV2SG3JCEGLBM7SAN4IQ5A4VVMHFBCKQC NAC6PRRR6SLQHJ7JBBBAJNKSWZVZ4NFKVHCZEN7M5HASDLT4IPOAC QO5ZJWQ3JK3PEGBPTQSAYIPEJEHG2M2KTD74227G5VG7DVXUL3BQC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC FWNNTOEERPUKXPE4OC52UABFZLKIU3O5GRNNLDK4QI4HR2IOU36QC 46MRRHVYJ3BS74R2BEVUWEWJCI4FCRBSLZ3NWMQCE6FUCNE5P73QC CCRQESB4ADT4WA7FGLNZZXAJ6G5QMCTYCZIWORBN45P6ZPILC34AC EJKHYV2Z6UPRVYUAL4WRW33GBNHYBFPMPA57HMBX2LQKXHIUO5VQC BUB4UTCUKS54CWDOAU5TV43GL6VYDSRBFEQ6OZ44IQD7Z5OOAOEQC name += getRandNameString("level book");
std::string difficulty;if (level <= 3)difficulty = "easy";else if (level <= 6)difficulty = "moderate";elsedifficulty = "difficult";std::string bookname = getRandNameString(difficulty + " level book");bookname = uppercase_first(bookname);if (bookname.empty())bookname = getRandNameString("book");name += bookname;
int max1 = 0;int max2 = 0;for (int k = 1; k <= SPTYP_LAST_EXPONENT; k++){if (count[k] > count[max1]){max2 = max1;max1 = k;}else if (max2 == max1 || count[k] > count[max2])max2 = k;}disc1 = 1 << max1;if (max1 != max2 && count[max2] > 0 && count[max2] >= count[max1]/3)disc2 = 1 << max2;elsedisc2 = disc1;
# Book name should be set in make_book_level_randart() or# make_book_theme_randart(), so if this gets picked there's a bug.book
# level 4-6moderate level bookAdvanced Steps in @the_book_magic@Advanced Guide to @the_book_magic@Further Steps in @the_book_magic@