summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-book.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 19:12:35 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-03 19:12:35 +0000
commitf965ee9d68e6b4d674897117f1711b1d439b3689 (patch)
tree76dee79218cb856a4d0dc83892172830c9e5e99e /crawl-ref/source/spl-book.cc
parenta6ba15c18bfc465daecb5390ad73f0a0f3df940b (diff)
downloadcrawl-ref-f965ee9d68e6b4d674897117f1711b1d439b3689.tar.gz
crawl-ref-f965ee9d68e6b4d674897117f1711b1d439b3689.zip
Fix 2483722: EQ_ALL_ARMOUR not skipping melded armour.
Fix 2483708: Transformations regarding wielded non-weapons as meldable. Fix 2483528: Disallow randart book names like "Sif Muna's Lost Book of Boris" Fix 2483332: Silly logic error that only offered fully recharged wands for recharging git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8175 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 5821601986..272d65579d 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1944,22 +1944,35 @@ bool make_book_level_randart(item_def &book, int level, int num_spells)
for (int i = 0; i < SPELLBOOK_SIZE; i++)
spell_vec[i] = (long) chosen_spells[i];
+ bool has_owner = true;
std::string name = "\"";
if (god != GOD_NO_GOD)
name += god_name(god, false) + "'s ";
else if (one_chance_in(3))
name += make_name(random_int(), false) + "'s ";
+ else
+ has_owner = false;
- std::string difficulty;
+ std::string lookup;
if (level <= 3)
- difficulty = "easy";
+ lookup = "easy";
else if (level <= 6)
- difficulty = "moderate";
+ lookup = "moderate";
else
- difficulty = "difficult";
+ lookup = "difficult";
+
+ lookup += " level book";
+
+ std::string bookname;
+ // First try for names respecting the book's previous owner/author
+ // (if one exists), then check for general difficulty.
+ if (has_owner)
+ bookname = getRandNameString(lookup + " owner");
+
+ if (!has_owner || bookname.empty())
+ bookname = getRandNameString(lookup);
- std::string bookname = getRandNameString(difficulty + " level book");
bookname = uppercase_first(bookname);
if (bookname.empty())
bookname = getRandNameString("book");