diff options
author | Neil Moore <neil@s-z.org> | 2014-05-13 14:39:26 -0400 |
---|---|---|
committer | Neil Moore <neil@s-z.org> | 2014-05-13 14:39:26 -0400 |
commit | fd921b9b8d6767a1270f40944ab01c0ec4f047d1 (patch) | |
tree | e3935bbcef337333e3feed8a067b9cbab6a4794b /crawl-ref/source/invent.cc | |
parent | b9d8caaabee5428e8441df15021f85fe17357c36 (diff) | |
download | crawl-ref-fd921b9b8d6767a1270f40944ab01c0ec4f047d1.tar.gz crawl-ref-fd921b9b8d6767a1270f40944ab01c0ec4f047d1.zip |
Improve enchant weapon selection (#8407, #8552)
Now you are not prompted for, or allowed to select, weapons which
are enchantable but not by this scroll---for example, a +9,+0 weapon
with EW_I. Take care to handle blowguns correctly: they have no +dam,
but EW_II increases their +acc.
The message "You aren't carrying any weapons that can be enchanted."
isn't quite right anymore, but I can't think of a good way to make it
more pendant-friendly without being too wordy.
Diffstat (limited to 'crawl-ref/source/invent.cc')
-rw-r--r-- | crawl-ref/source/invent.cc | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index b651fb2a75..e3df65d0e5 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -527,7 +527,10 @@ static string _no_selectables_message(int item_selector) return "You aren't wearing any piece of uncursed jewellery."; case OSEL_BRANDABLE_WEAPON: return "You aren't carrying any weapons that can be branded."; - case OSEL_ENCHANTABLE_WEAPON: + case OSEL_ENCHANTABLE_WEAPON_I: + case OSEL_ENCHANTABLE_WEAPON_II: + case OSEL_ENCHANTABLE_WEAPON_III: + // TODO: this message isn't quite right for _I and _II return "You aren't carrying any weapons that can be enchanted."; } @@ -1240,14 +1243,31 @@ static bool _item_class_selected(const item_def &i, int selector) case OSEL_BRANDABLE_WEAPON: return is_brandable_weapon(i, true); - case OSEL_ENCHANTABLE_WEAPON: - return is_weapon(i) - && (itype == OBJ_WEAPONS - && !is_artefact(i) - && (i.plus < MAX_WPN_ENCHANT - || i.plus2 < MAX_WPN_ENCHANT - || !(item_ident(i, ISFLAG_KNOW_PLUSES))) - || i.cursed()); + case OSEL_ENCHANTABLE_WEAPON_I: + case OSEL_ENCHANTABLE_WEAPON_II: + case OSEL_ENCHANTABLE_WEAPON_III: + { + if (!is_weapon(i)) + return false; + if (i.cursed()) + return true; + if (itype != OBJ_WEAPONS || is_artefact(i)) + return false; + if (!item_ident(i, ISFLAG_KNOW_PLUSES)) + return true; + + // Might this enchant +acc? + const bool acc = selector != OSEL_ENCHANTABLE_WEAPON_II + || i.sub_type == WPN_BLOWGUN; + const bool dam = selector != OSEL_ENCHANTABLE_WEAPON_I + && i.sub_type != WPN_BLOWGUN; + + if (acc && i.plus < MAX_WPN_ENCHANT) + return true; + if (dam && i.plus2 < MAX_WPN_ENCHANT) + return true; + return false; + } default: return false; |