From f965ee9d68e6b4d674897117f1711b1d439b3689 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 3 Jan 2009 19:12:35 +0000 Subject: 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 --- crawl-ref/source/dat/database/randname.txt | 16 +++++++++++----- crawl-ref/source/itemname.cc | 2 +- crawl-ref/source/itemprop.cc | 5 +++-- crawl-ref/source/player.cc | 4 ++++ crawl-ref/source/spl-book.cc | 23 ++++++++++++++++++----- crawl-ref/source/transfor.cc | 20 +++++++++++++++++++- 6 files changed, 56 insertions(+), 14 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dat/database/randname.txt b/crawl-ref/source/dat/database/randname.txt index 03fe7d3f63..75dbd5ef9e 100644 --- a/crawl-ref/source/dat/database/randname.txt +++ b/crawl-ref/source/dat/database/randname.txt @@ -962,8 +962,8 @@ Boris w:1 Sif Muna %%%% -# level 7-9 -difficult level book +# level 7-9, books in the form of "XYZ's " +difficult level book owner Thorough Guide to @the_book_magic@ @@ -975,6 +975,15 @@ 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@ @@ -983,9 +992,6 @@ Lost @book_noun@ of @the_powerful_caster@ w:1 Testament of @the_powerful_caster@ - -w:1 -Mastering @book_magic@ %%%% # synonyms for predominant spell schools # variants starting with the definite article will get "the" prepended diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 1b6688c1cb..619b3e658e 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -203,7 +203,7 @@ std::string item_def::name(description_level_type descrip, ASSERT( this->link != -1 ); equipped = true; - if (!you_tran_can_wear(*this)) + if (!you_tran_can_wear(*this) && you.equip[EQ_WEAPON] != this->link) buff << " (melded)"; else if (this->link == you.equip[EQ_WEAPON]) { diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 1d3dcc353b..f0eab908dd 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -1332,9 +1332,10 @@ bool item_is_rechargeable(const item_def &it, bool known) // These are obvious... if (it.base_type == OBJ_WANDS) { - if (known && (it.plus == ZAPCOUNT_MAX_CHARGED + // Don't offer wands already maximally charged. + if (known && (it.plus2 == ZAPCOUNT_MAX_CHARGED || item_ident(it, ISFLAG_KNOW_PLUSES) - && it.plus < 3 * wand_charge_value(it.sub_type))) + && it.plus >= 3 * wand_charge_value(it.sub_type))) { return (false); } diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 1bc4a67654..66cc61224a 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -957,6 +957,10 @@ int player_equip_ego_type( int slot, int special ) // Check all armour slots: for (int i = EQ_CLOAK; i <= EQ_BODY_ARMOUR; i++) { + // ... but skip ones you can't currently use! + if (!you_tran_can_wear(i)) + continue; + if (you.equip[i] != -1 && get_armour_ego_type( you.inv[you.equip[i]] ) == special) { 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"); diff --git a/crawl-ref/source/transfor.cc b/crawl-ref/source/transfor.cc index 43fea5e51e..f7731bd1e2 100644 --- a/crawl-ref/source/transfor.cc +++ b/crawl-ref/source/transfor.cc @@ -252,11 +252,20 @@ static bool _check_for_cursed_equipment(const std::set &remove, if (you.equip[e] == -1) continue; - if (item_cursed( you.inv[ you.equip[e] ])) + const item_def item = you.inv[ you.equip[e] ]; + if (item_cursed(item)) { if (e != EQ_WEAPON && _tran_may_meld_cursed(trans)) continue; + // Wielding a cursed non-weapon/non-staff won't hinder + // transformations. + if (e == EQ_WEAPON && item.base_type != OBJ_WEAPONS + && item.base_type != OBJ_STAVES) + { + continue; + } + if (!quiet) { mpr( "Your cursed equipment won't allow you to complete the " @@ -309,6 +318,15 @@ bool check_transformation_stat_loss(const std::set &remove, if (you.equip[e] == -1) continue; + // Wielding a stat-boosting non-weapon/non-staff won't hinder + // transformations. + if (e == EQ_WEAPON) + { + const item_def item = you.inv[ you.equip[e] ]; + if (item.base_type != OBJ_WEAPONS && item.base_type != OBJ_STAVES) + continue; + } + item_def item = you.inv[you.equip[e]]; if (item.base_type == OBJ_JEWELLERY) { -- cgit v1.2.3-54-g00ecf