From d54f454b7fc085b792e569ed131bc7be460768f7 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 25 Jan 2009 14:24:54 +0000 Subject: * Move randart book names into a new file, randbook.txt. * Remove quotes from book names (use the props vector instead for book_has_title()), and occasionally allow random owner names for Sif's gifts (25% chance), as per FR 2532818. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8741 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/database/randbook.txt | 646 +++++++++++++++++++++++++++++ crawl-ref/source/dat/database/randname.txt | 606 +-------------------------- crawl-ref/source/database.cc | 1 + crawl-ref/source/spl-book.cc | 32 +- 4 files changed, 670 insertions(+), 615 deletions(-) create mode 100644 crawl-ref/source/dat/database/randbook.txt diff --git a/crawl-ref/source/dat/database/randbook.txt b/crawl-ref/source/dat/database/randbook.txt new file mode 100644 index 0000000000..6e9069cbbf --- /dev/null +++ b/crawl-ref/source/dat/database/randbook.txt @@ -0,0 +1,646 @@ +###################################################### +# Randart Names +# ------------- +# randbook.txt: keywords for randart BOOKS +# +# This file contains the lists of keywords (and their +# weights) for most of the keywords used for randart +# books. +# There are two types of randart books: +# - fixed theme, varying level (Conjurations, Summoning/Earth, ...) +# - fixed level, varying theme (level 2 spells etc.) +# +# The books are filled with spells matching their type in spl-book.cc, +# either make_book_theme_randart() or make_book_level_randart(). +# The name should likewise take into account the book's type. +# +# Themed books use one of the following two naming schemes: +# a) @book_name@ @ adj@ @@ +# b) @book_name@ @@ and @@ +# +# or, if there is no (obvious) secondary school, simply: +# +# @book_name@ @@ +# +# Fixed level books are categorized into "easy" (level 1-3), +# "moderate" (level 4-6) and "difficult" (level 7-9), a keyword that is +# used as a prefix for "level book". +# +# See the explanation in the main file, randname.txt, for more general +# information on randart naming. +###################################################### +# 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 + +Book of Bugginess +%%%% +book appearance + +@book_adjective@ +%%%% +book_noun + +Book + +Tome + +Grimoire + +Almanach + +Volume + +Compendium + +Handbook + +Incunabulum + +Papyrus +%%%% +book_noun_on + +Guide + +Collected Works + +Disquisition + +Reference Book +%%%% +book_name + +w:9 +@book_noun@ of + +w:4 +@book_noun_on@ on +%%%% +book_adjective + +glistering + +sparkling + +levitating + +droning + +conspicuous + +inconspicuous + +colourful + +graven + +engraved + +antique + +yellowed + +rare + +black + +blackened + +torn +%%%% +the_book_magic + +w:9 +# capitalise later as needed +the Arcane Arts + +w:1 +the Hermit's Heritage + +w:90 +@book_magic@ +%%%% +book_magic + +Magic + +Theurgy + +Casting + +Wizardry + +Sorcery + +Witchcraft + +Witchery + +Spellcraft + +w:5 +Secret Knowledge + +w:5 +Rites and Rhymes + +w:5 +Hermeneutics +%%%% +# level 1-3 +easy level book + +A Primer on @the_book_magic@ + +@the_book_magic@ in Simple Steps + +Early Guide to @the_book_magic@ + +@the_book_magic@ for Beginners + +Foundations of @book_magic@ + +Introduction to @the_book_magic@ + +Easy @book_magic@ + +Beginning Course on @the_book_magic@ + +w:5 +@the_book_magic@ 101 + +w:1 +@book_magic@, and How To Use It + +w:1 +@the_book_magic@ for Dummies +%%%% +# level 4-6 +moderate level book + +Advanced Steps in @the_book_magic@ + +Advanced Guide to @the_book_magic@ + +Further Steps in @the_book_magic@ + +@the_book_magic@, Part Two + +Advanced @book_magic@ + +Sophisticated @book_magic@ + +Further Progress in @book_magic@ + +Second Course in @book_magic@ + +w:1 +Improving Your @book_magic@ + +%%%% +# powerful casters, used for high level books +powerful_caster + +Archmage + +w:3 +Deep Elf Lorekeeper + +w:3 +Blind Seer + +w:3 +Prophet + +w:1 +Greatest Mummy +%%%% +the_powerful_caster + +the @powerful_caster@ + +w:3 +Boris + +w:1 +Sif Muna +%%%% +# level 7-9, books in the form of "XYZ's " +difficult level book owner + +Thorough Guide to @the_book_magic@ + +Last Secrets of @the_book_magic@ + +Arcane Secrets of @book_magic@ + +Intricacies of @the_book_magic@ + +@book_name@ Greatest Risks and Utility + +w:1 +Mastering @book_magic@ +%%%% +last_or_lost + +Last + +Lost +%%%% +# level 7-9, books without being named after their owner/author +difficult level book + +w:50 +@difficult level book owner@ + +@last_or_lost@ @book_noun@ of @the_powerful_caster@ + +w:1 +Testament of @the_powerful_caster@ +%%%% +# synonyms for predominant spell schools +# variants starting with the definite article will get "the" prepended +# to the adjective version +Conjuration + +Conjuration + +Confrontation + +Attacks + +w:5 +Battle Magic + +w:5 +Combat Magic + +w:5 +Arcane Weapons + +w:1 +Blows and Bruises + +w:1 +Damage Dealing +%%%% +Enchantment + +Enchantment + +Bewitchment + +Infatuation + +w:1 +Glamour + +w:1 +Fascination +%%%% +Fire + +Fire + +Flames + +Heat + +the Volcanoes + +the Blaze + +Ignition + +the Arsonist +%%%% +Ice + +Ice + +Snow + +Cold + +the Snowflakes + +the Glacier + +the Frostbite +%%%% +Transmutation + +Transmigration + +Transmutation + +Transformation + +Shape Shifting + +Changing + +Moulding +%%%% +# for necromantic books +Evil_adjective + +Evil + +Dark + +Black + +Sinister + +Unholy +%%%% +# also for necromantic books +Evil_noun + +Rites + +Arts + +Secrets + +Rituals + +Magic +%%%% +Necromancy + +Necromancy + +Evil + +Darkness + +Stolen Souls + +w:60 +@Evil_adjective@ @Evil_noun@ +%%%% +Summoning + +Summoning + +Calling + +Creation + +the Entourage + +Companions + +the Escort + +w:1 +Illusion + +w:2 +Slavery +%%%% +Divination + +Divination + +Augury + +Prophecy + +Foreboding + +Prediction + +Omens + +Sight + +Visions + +Truth +%%%% +Translocation + +Translocation + +Displacement + +Dislocation + +Orientation +%%%% +Poison + +Poison + +Venom + +Toxins + +Poisoning + +Intoxication + +Envenoming + +Contamination +%%%% +Earth + +Earth + +Stones + +Clay + +the Mountains + +the Rocks +%%%% +Air + +Air + +Lightness + +Weightlessness + +Flight + +the Birds + +Feathers +%%%% +# adjectives for secondary spell school +Conjuration adj + +Destructive + +Harmful + +Damaging + +Hurtful + +Excruciating + +w:5 +Lethal +%%%% +Enchantment adj + +Enchanting + +Bewitching + +Captivating + +Fetching + +Enthralling + +Ensnaring + +Entrancing +%%%% +Fire adj + +Fiery + +Scorching + +Burning + +Blistering + +Igneous + +Flamy + +Torrid +%%%% +Ice adj + +Glacial + +Freezing + +Icy + +Congealing + +Frigorific +%%%% +Transmutation adj + +Shifting + +Mutagenic + +w:5 +Unstable +%%%% +Necromancy adj + +Dark + +Evil + +w:5 +Lethal + +Doomed + +Sinister + +Unholy + +Ghastly + +w:5 +Twisted +%%%% +Summoning adj + +Creative + +Supportive +%%%% +Divination adj + +Divine + +Prophetic + +w:5 +All-Knowing + +w:5 +All-Seeing + +Spiritual +%%%% +Translocation adj + +Spatial + +Displaced + +Dislocated + +Warped + +w:5 +Unstable + +w:5 +Twisted + +Quantum +%%%% +Poison adj + +Poisonous + +Venomous + +Toxic + +Cankerous + +Nocuous + +Noxious + +Virous + +Vitriolic + +w:1 +Viperous +%%%% +Earth adj + +Earthen + +Ashen + +Dusty +%%%% +Air adj + +Aerial + +Flying + +Floating + +Feathery + +Cloudy + +Gliding +%%%% diff --git a/crawl-ref/source/dat/database/randname.txt b/crawl-ref/source/dat/database/randname.txt index abc1a7979f..ef392f162b 100644 --- a/crawl-ref/source/dat/database/randname.txt +++ b/crawl-ref/source/dat/database/randname.txt @@ -4,8 +4,8 @@ # randname.txt: lookup randart type # # This file contains the lists of keywords (and their weights) for some lookup -# phrases of randart type, namely "weapon", "armour" and "jewellery" as well -# as in combination with those gods that occasionally gift randarts, i.e. +# phrases of randart type, namely "weapon", "armour" and "jewellery" as well +# as in combination with those gods that occasionally gift randarts, i.e. # "Trog weapon", "Okawaru weapon", "Okawaru armour", "Xom weapon", "Xom armour" # and "Xom jewellery". Incidentally, they are listed in precisely that order. # At the end of the file you will also find a few lists of adjectives used for @@ -20,6 +20,7 @@ # o rand_arm.txt - keywords used mainly for armour # o rand_all.txt - keywords used for jewellery # as well as for all three types +# o randbook.txt - keywords used for randart books # o hardcoded (randart.cc) # # The latter allows the use of phrases elsewhere defined in Crawl. The list of @@ -32,7 +33,7 @@ # * xom_name - one of Xom's long names # # In the case of god_name this actually allows some more refined handling. In -# fact, the god will not be picked entirely at random as there are some +# fact, the god will not be picked entirely at random as there are some # restrictions to make sure that e.g. no good god is chosen for evil weapons, # that Beogh isn't matched with orc slaying, or that Zin doesn't get picked for # randarts with mutagenic properties. @@ -519,7 +520,7 @@ of @player_death@ w:400 @armour@ -# why not some other names? +# why not some other names? # (sadly, some weapon names don't make sense even for Xom) @jewellery@ %%%% @@ -554,7 +555,7 @@ of @player_doom@ w:300 @jewellery@ -# why not some other names? +# why not some other names? # (sadly, some weapon names don't make sense even for Xom) @armour@ %%%% @@ -783,598 +784,3 @@ amulet appearance @jewellery appearance@ @amulet material@ %%%% -###################################################### -# Books -###################################################### -# 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 - -Book of Bugginess -%%%% -book appearance - -@book_adjective@ -%%%% -book_noun - -Book - -Tome - -Grimoire - -Almanach - -Guide - -Volume - -Compendium - -Handbook - -Incunabulum - -Papyrus -%%%% -book_adjective - -glistering - -sparkling - -levitating - -droning - -conspicuous - -inconspicuous - -colourful - -graven - -engraved - -antique - -yellowed - -rare - -black - -blackened - -torn -%%%% -the_book_magic - -w:9 -# capitalise later as needed -the Arcane Arts - -w:1 -the Hermit's Heritage - -w:90 -@book_magic@ -%%%% -book_magic - -Magic - -Theurgy - -Casting - -Wizardry - -Sorcery - -Witchcraft - -Witchery - -Spellcraft - -w:5 -Secret Knowledge - -w:5 -Rites and Rhymes - -w:5 -Hermeneutics -%%%% -# level 1-3 -easy level book - -A Primer on @the_book_magic@ - -@the_book_magic@ in Simple Steps - -Early Guide to @book_magic@ - -@the_book_magic@ for Beginners - -Foundations of @book_magic@ - -Introduction to @book_magic@ - -Easy @book_magic@ - -w:1 -@book_magic@, and how to use it - -w:1 -@the_book_magic@ 101 -%%%% -# level 4-6 -moderate level book - -Advanced Steps in @the_book_magic@ - -Advanced Guide to @the_book_magic@ - -Further Steps in @the_book_magic@ - -@the_book_magic@, Part Two - -Advanced @book_magic@ - -Sophisticated @book_magic@ - -Further Progress in @book_magic@ - -Second Course in @book_magic@ - -w:1 -Improve Your @book_magic@ - -%%%% -# powerful casters, used for high level books -powerful_caster - -Archmage - -w:3 -Deep Elf Lorekeeper - -w:3 -Blind Seer - -w:3 -Prophet - -w:1 -Greatest Mummy -%%%% -the_powerful_caster - -the @powerful_caster@ - -w:3 -Boris - -w:1 -Sif Muna -%%%% -# level 7-9, books in the form of "XYZ's " -difficult level book owner - -Thorough Guide to @the_book_magic@ - -Last Secrets of @the_book_magic@ - -Arcane Secrets of @book_magic@ - -Intricacies of @the_book_magic@ - -@book_noun@ of Greatest Risks and Utility - -w:1 -Mastering @book_magic@ -%%%% -# level 7-9, books without being named after their owner/author -difficult level book - -w:50 -@difficult level book owner@ - -w:5 -Last @book_noun@ of @the_powerful_caster@ - -w:5 -Lost @book_noun@ of @the_powerful_caster@ - -w:1 -Testament of @the_powerful_caster@ -%%%% -# synonyms for predominant spell schools -# variants starting with the definite article will get "the" prepended -# to the adjective version -Conjuration - -Conjuration - -Confrontation - -Attacks - -w:5 -Battle Magic - -w:5 -Combat Magic - -w:5 -Arcane Weapons - -w:1 -Blows and Bruises - -w:1 -Damage Dealing -%%%% -Enchantment - -Enchantment - -Bewitchment - -Infatuation - -w:1 -Glamour - -w:1 -Fascination -%%%% -Fire - -Fire - -Flames - -Heat - -the Volcanoes - -the Blaze - -Ignition - -the Arsonist -%%%% -Ice - -Ice - -Snow - -Cold - -the Snowflakes - -the Glacier - -the Frostbite -%%%% -Transmutation - -Transmigration - -Transmutation - -Transformation - -Shape Shifting - -Changing - -Moulding -%%%% -# for necromantic books -Evil_adjective - -Evil - -Dark - -Black - -Sinister - -Unholy -%%%% -# also for necromantic books -Evil_noun - -Rites - -Arts - -Secrets - -Rituals - -Magic -%%%% -Necromancy - -Necromancy - -Evil - -Darkness - -Stolen Souls - -w:60 -@Evil_adjective@ @Evil_noun@ -%%%% -Summoning - -Summoning - -Calling - -Creation - -the Entourage - -Companions - -the Escort - -w:1 -Illusion - -w:2 -Slavery -%%%% -Divination - -Divination - -Augury - -Prophecy - -Foreboding - -Prediction - -Omens - -Sight - -Visions - -Truth -%%%% -Translocation - -Translocation - -Displacement - -Dislocation - -Orientation -%%%% -Poison - -Poison - -Venom - -Toxins - -Poisoning - -Intoxication - -Envenoming - -Contamination -%%%% -Earth - -Earth - -Stones - -Clay - -the Mountains - -the Rocks -%%%% -Air - -Air - -Lightness - -Weightlessness - -Flight - -the Birds - -Feathers -%%%% -# adjectives for secondary spell school -Conjuration adj - -Destructive - -Harmful - -Damaging - -Hurtful - -Excruciating - -w:5 -Lethal -%%%% -Enchantment adj - -Enchanting - -Bewitching - -Captivating - -Fetching - -Enthralling - -Ensnaring - -Entrancing -%%%% -Fire adj - -Fiery - -Scorching - -Burning - -Blistering - -Igneous - -Flamy - -Torrid -%%%% -Ice adj - -Glacial - -Freezing - -Icy - -Congealing - -Frigorific -%%%% -Transmutation adj - -Shifting - -Mutagenic - -w:5 -Unstable -%%%% -Necromancy adj - -Dark - -Evil - -w:5 -Lethal - -Doomed - -Sinister - -Unholy - -Ghastly - -w:5 -Twisted -%%%% -Summoning adj - -Creative - -Supportive -%%%% -Divination adj - -Divine - -Prophetic - -w:5 -All-Knowing - -w:5 -All-Seeing - -Spiritual -%%%% -Translocation adj - -Spatial - -Displaced - -Dislocated - -Warped - -w:5 -Unstable - -w:5 -Twisted - -Quantum -%%%% -Poison adj - -Poisonous - -Venomous - -Toxic - -Cankerous - -Nocuous - -Noxious - -Virous - -Vitriolic - -w:1 -Viperous -%%%% -Earth adj - -Earthen - -Ashen - -Dusty -%%%% -Air adj - -Aerial - -Flying - -Floating - -Feathery - -Cloudy - -Gliding -%%%% diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index d13935d31b..177dc34949 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -77,6 +77,7 @@ static TextDB AllDBs[] = "database/rand_wpn.txt", // mostly weapons "database/rand_arm.txt", // mostly armour "database/rand_all.txt", // jewellery and general + "database/randbook.txt", // artefact books // This doesn't really belong here, but they *are* god gifts... "database/monname.txt", // orcish names for Beogh to choose from NULL), diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 616a0a0c86..711592b957 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1947,8 +1947,7 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) spell_vec[i] = (long) chosen_spells[i]; bool has_owner = true; - std::string name = "\""; - + std::string name = ""; if (god != GOD_NO_GOD) name += apostrophise(god_name(god, false)) + " "; else if (one_chance_in(3)) @@ -1956,6 +1955,9 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) else has_owner = false; + // None of these books need a definite article prepended. + book.props["is_named"].get_bool() = true; + std::string lookup; if (level <= 3) lookup = "easy"; @@ -1980,7 +1982,6 @@ bool make_book_level_randart(item_def &book, int level, int num_spells) bookname = getRandNameString("book"); name += bookname; - name += '"'; set_randart_name(book, name); @@ -2399,21 +2400,24 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, std::string name; - bool need_quotes = true; + const bool god_gift = (god != GOD_NO_GOD); + bool has_owner = true; if (!owner.empty()) name = owner; - else if (god != GOD_NO_GOD) + else if (god_gift && !one_chance_in(4)) name = god_name(god, false); - else if (one_chance_in(5)) // Occasionally, use a random name. + else if (god_gift || one_chance_in(5)) // Occasionally, use a random name. name = make_name(random_int(), false); else - need_quotes = false; + has_owner = false; - if (need_quotes) - name = "\"" + apostrophise(name) + " "; + if (has_owner) + { + book.props["is_named"].get_bool() = true; + name = apostrophise(name) + " "; + } - name += getRandNameString("book_noun"); - name += " of "; + name += getRandNameString("book_name") + " "; // For the actual name there's a 50% chance of getting something like // Flames and Displacement (Fire/Translocation), else @@ -2465,9 +2469,6 @@ bool make_book_theme_randart(item_def &book, int disc1, int disc2, name += bookname; } - if (need_quotes) - name += '"'; - set_randart_name(book, name); book.plus = disc1; @@ -2492,5 +2493,6 @@ bool book_has_title(const item_def &book) if (!is_artefact(book)) return (false); - return (get_artefact_name(book)[0] == '"'); + return (book.props.exists("is_named") + && book.props["is_named"].get_bool() == true); } -- cgit v1.2.3-54-g00ecf