diff options
-rw-r--r-- | crawl-ref/settings/init.txt | 2 | ||||
-rw-r--r-- | crawl-ref/source/beam.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/delay.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/describe.cc | 39 | ||||
-rw-r--r-- | crawl-ref/source/effects.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 1 | ||||
-rw-r--r-- | crawl-ref/source/invent.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/itemname.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.cc | 33 | ||||
-rw-r--r-- | crawl-ref/source/itemprop.h | 6 | ||||
-rw-r--r-- | crawl-ref/source/randart.cc | 8 | ||||
-rw-r--r-- | crawl-ref/source/randart.h | 1 |
13 files changed, 106 insertions, 35 deletions
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt index debc523c6c..0a30f19b95 100644 --- a/crawl-ref/settings/init.txt +++ b/crawl-ref/settings/init.txt @@ -223,7 +223,7 @@ stash_filter = ring of hunger, amulet of inaccuracy # msg_condense_repeats = false # sort_menus = pickup: true : basename, qualname, curse, qty -sort_menus = inv: true : equipped +sort_menus = inv: true : equipped, freshness ##### 4-j Messages and Display Enhancements ##### diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 394760c4ce..99b1e1b0ab 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -3490,7 +3490,8 @@ bool bolt::misses_player() return (false); } -void bolt::affect_player_enchantment() { +void bolt::affect_player_enchantment() +{ if ((has_saving_throw() || flavour == BEAM_POLYMORPH) && you_resist_magic(ench_power)) { @@ -4606,9 +4607,9 @@ bool _ench_flavour_affects_monster(beam_type flavour, const monsters* mon) break; case BEAM_SLEEP: - rc = !mon->has_ench(ENCH_SLEEP_WARY) // slept recently - && mons_holiness(mon) == MH_NATURAL // no unnatural - && mons_res_cold(mon) <= 0; // can't be hibernated + rc = !mon->has_ench(ENCH_SLEEP_WARY) // slept recently + && mons_holiness(mon) == MH_NATURAL // no unnatural + && mons_res_cold(mon) <= 0; // can't be hibernated break; default: diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index 4006414ab9..3d4cda5f72 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -588,7 +588,7 @@ void handle_interrupted_swap(bool swap_if_safe, bool force_unsafe) // If ATTR_WEAPON_SWAP_INTERRUPTED is set while a corpse is being // butchered/bottled/offered, then fake a weapon swap delay. if (_is_butcher_delay(delay) - && (safe || prompt && yesno(prompt_str, false))) + && (safe || prompt && yesno(prompt_str, true, 'n'))) { start_delay(DELAY_WEAPON_SWAP, 1, weap); you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; @@ -601,7 +601,7 @@ void handle_interrupted_swap(bool swap_if_safe, bool force_unsafe) if (!swap_if_safe) return; } - else if (!prompt || !yesno(prompt_str, false)) + else if (!prompt || !yesno(prompt_str, true, 'n')) { return; } diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 3f3be7e6c6..a2ba75be49 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -1116,7 +1116,7 @@ static std::string _describe_weapon(const item_def &item, bool verbose) } } - if (!is_artefact(item)) + if (!is_known_artefact(item)) { if (item_ident( item, ISFLAG_KNOW_PLUSES ) && item.plus >= MAX_WPN_ENCHANT && item.plus2 >= MAX_WPN_ENCHANT) @@ -1440,7 +1440,7 @@ static std::string _describe_armour( const item_def &item, bool verbose ) } } - if (!is_artefact(item)) + if (!is_known_artefact(item)) { const int max_ench = armour_max_enchant(item); if (item.plus < max_ench || !item_ident( item, ISFLAG_KNOW_PLUSES )) @@ -1724,7 +1724,7 @@ bool is_dumpable_artefact( const item_def &item, bool verbose) { bool ret = false; - if (is_artefact( item ) ) + if (is_known_artefact( item )) { ret = item_ident( item, ISFLAG_KNOW_PROPERTIES ); } @@ -1820,7 +1820,7 @@ std::string get_item_description( const item_def &item, bool verbose, { std::string db_name = item.name(DESC_DBNAME, true, false, false); std::string db_desc = getLongDescription(db_name); - if (!noquote && !is_artefact(item)) + if (!noquote && !is_known_artefact(item)) { const unsigned int lineWidth = get_number_of_cols(); const int height = get_number_of_lines(); @@ -2004,24 +2004,33 @@ std::string get_item_description( const item_def &item, bool verbose, break; case OBJ_STAVES: - if (item_type_known(item)) + if (item_is_rod( item )) { - if (item_is_rod( item )) + description << + "$It uses its own mana reservoir for casting spells, and " + "recharges automatically by channeling mana from its " + "wielder."; + + const int max_charges = MAX_ROD_CHARGE * ROD_CHARGE_MULT; + if (item_ident(item, ISFLAG_KNOW_PLUSES) + && item.plus2 >= max_charges && item.plus >= item.plus2) { - description << - "$It uses its own mana reservoir for casting spells, and " - "recharges automatically by channeling mana from its " - "wielder."; + description << "$It is fully charged."; } else { - description << - "$Damage rating: 7 Accuracy rating: +6 " - "Attack delay: 120%"; - - description << "$$It falls into the 'staves' category."; + description << "$It can have at most " << max_charges + << " charges."; } } + else + { + description << + "$Damage rating: 7 Accuracy rating: +6 " + "Attack delay: 120%"; + + description << "$$It falls into the 'staves' category."; + } break; case OBJ_MISCELLANY: diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 8569033d78..c07a8bec86 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1921,12 +1921,15 @@ bool recharge_wand(int item_slot) desc.c_str()); wand.plus = new_charges; + + if (!charged) + wand.plus2 = ZAPCOUNT_MAX_CHARGED; } else // It's a rod. { bool work = false; - if (wand.plus2 <= MAX_ROD_CHARGE * ROD_CHARGE_MULT) + if (wand.plus2 < MAX_ROD_CHARGE * ROD_CHARGE_MULT) { wand.plus2 += ROD_CHARGE_MULT; diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 6822d10043..06727e4dca 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -1398,6 +1398,7 @@ enum item_type_id_state_type ID_UNKNOWN_TYPE = 0, ID_MON_TRIED_TYPE, ID_TRIED_TYPE, + ID_TRIED_ITEM_TYPE, ID_KNOWN_TYPE }; diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index d1e47e9b16..d91d2512b7 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -846,7 +846,7 @@ static bool _item_class_selected(const item_def &i, int selector) return (item_is_rechargeable(i, true)); case OSEL_ENCH_ARM: - return (is_enchantable_armour(i, true)); + return (is_enchantable_armour(i, true, true)); case OSEL_VAMP_EAT: return (itype == OBJ_CORPSES && i.sub_type == CORPSE_BODY diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index a1d9ba74a8..e503e5b4a2 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3562,7 +3562,7 @@ void zap_wand(int slot) wand.plus--; // Zap counts count from the last recharge. - if (wand.plus2 == ZAPCOUNT_RECHARGED) + if (wand.plus2 == ZAPCOUNT_MAX_CHARGED || wand.plus2 == ZAPCOUNT_RECHARGED) wand.plus2 = 0; // Increment zap count. if (wand.plus2 >= 0) @@ -4391,6 +4391,7 @@ void read_scroll(int slot) // It is the exception, not the rule, that the scroll will not // be identified. {dlb} bool id_the_scroll = true; // to prevent unnecessary repetition + bool tried_on_item = false; // used to modify item (?EA, ?RC, ?ID) switch (which_scroll) { @@ -4545,27 +4546,39 @@ void read_scroll(int slot) case SCR_VORPALISE_WEAPON: id_the_scroll = _vorpalise_weapon(); - if ( !id_the_scroll ) + if (!id_the_scroll) canned_msg(MSG_NOTHING_HAPPENS); break; case SCR_IDENTIFY: if (!item_type_known(scroll)) + { id_the_scroll = _scroll_modify_item(scroll); + if (!id_the_scroll) + tried_on_item = true; + } else identify(-1); break; case SCR_RECHARGING: if (!item_type_known(scroll)) + { id_the_scroll = _scroll_modify_item(scroll); + if (!id_the_scroll) + tried_on_item = true; + } else recharge_wand(-1); break; case SCR_ENCHANT_ARMOUR: if (!item_type_known(scroll)) + { id_the_scroll = _scroll_modify_item(scroll); + if (!id_the_scroll) + tried_on_item = true; + } else _handle_enchant_armour(-1); break; @@ -4633,8 +4646,9 @@ void read_scroll(int slot) break; } - set_ident_type(scroll, - (id_the_scroll) ? ID_KNOWN_TYPE : ID_TRIED_TYPE); + set_ident_type(scroll, id_the_scroll ? ID_KNOWN_TYPE : + tried_on_item ? ID_TRIED_ITEM_TYPE + : ID_TRIED_TYPE); // Finally, destroy and identify the scroll. // Scrolls of immolation were already destroyed earlier. diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index d682c92f65..58356b012e 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -250,6 +250,8 @@ std::string item_def::name(description_level_type descrip, if (id_type == ID_MON_TRIED_TYPE) tried_str = "tried by monster"; + else if (id_type == ID_TRIED_ITEM_TYPE) + tried_str = "tried on item"; else tried_str = "tried"; } @@ -1247,6 +1249,8 @@ std::string item_def::name_aux( description_level_type desc, { if (item_plus2 == ZAPCOUNT_EMPTY) buff << " {empty}"; + else if (item_plus2 == ZAPCOUNT_MAX_CHARGED) + buff << " {fully recharged}"; else if (item_plus2 == ZAPCOUNT_RECHARGED) buff << " {recharged}"; else if (item_plus2 > 0) @@ -1704,8 +1708,9 @@ bool item_type_tried( const item_def& item ) const item_type_id_type idt = objtype_to_idtype(item.base_type); if (idt != NUM_IDTYPE && item.sub_type < 50) { - return ( type_ids[idt][item.sub_type] == ID_TRIED_TYPE - || type_ids[idt][item.sub_type] == ID_MON_TRIED_TYPE); + return (type_ids[idt][item.sub_type] == ID_TRIED_TYPE + || type_ids[idt][item.sub_type] == ID_MON_TRIED_TYPE + || type_ids[idt][item.sub_type] == ID_TRIED_ITEM_TYPE); } else return (false); diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 9d79151650..d7d4311da8 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -1324,12 +1324,30 @@ bool check_armour_shape( const item_def &item, bool quiet ) return (true); } -// If known is true, only returns true for *known* weapons of electrocution. +// If known is true, only returns true for *known* weapons of electrocution, +// and returns false for wands/rods known to be fully charged. bool item_is_rechargeable(const item_def &it, bool known) { // These are obvious... - if (it.base_type == OBJ_WANDS || item_is_rod(it)) + if (it.base_type == OBJ_WANDS) + { + if (known && (it.plus == ZAPCOUNT_MAX_CHARGED + || item_ident(it, ISFLAG_KNOW_PLUSES) + && it.plus < 3 * wand_charge_value(it.sub_type))) + { + return (false); + } + return (true); + } + else if (item_is_rod(it)) + { + if (known && item_ident(it, ISFLAG_KNOW_PLUSES)) + { + return (it.plus2 < MAX_ROD_CHARGE * ROD_CHARGE_MULT + || it.plus < it.plus2); + } return (true); + } // ...but electric weapons can also be charged. return (it.base_type == OBJ_WEAPONS @@ -1388,7 +1406,9 @@ bool is_enchantable_weapon(const item_def &wpn, bool uncurse) return (true); } -bool is_enchantable_armour(const item_def &arm, bool uncurse) +// Returns whether a piece of armour can be enchanted further. +// If unknown is true, unidentified armour will return true. +bool is_enchantable_armour(const item_def &arm, bool uncurse, bool unknown) { if (arm.base_type != OBJ_ARMOUR) return (false); @@ -1397,6 +1417,13 @@ bool is_enchantable_armour(const item_def &arm, bool uncurse) if (!you_tran_can_wear(arm) && item_is_equipped(arm)) return (false); + // If we don't know the plusses, assume enchanting is possible. + if (unknown && !is_known_artefact(arm) + && !item_ident(arm, ISFLAG_KNOW_PLUSES )) + { + return (true); + } + // Artefacts or highly enchanted armour cannot be enchanted, only // uncursed. if (is_artefact(arm) || arm.plus >= armour_max_enchant(arm)) diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index df7862a950..3051c31ef4 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -567,7 +567,8 @@ enum zap_count_type { ZAPCOUNT_EMPTY = -1, ZAPCOUNT_UNKNOWN = -2, - ZAPCOUNT_RECHARGED = -3 + ZAPCOUNT_RECHARGED = -3, + ZAPCOUNT_MAX_CHARGED = -4 }; void init_properties(void); @@ -637,7 +638,8 @@ bool check_armour_shape( const item_def &item, bool quiet ); bool item_is_rechargeable(const item_def &it, bool known = false); int wand_charge_value(int type); bool is_enchantable_weapon(const item_def &wpn, bool uncurse); -bool is_enchantable_armour(const item_def &arm, bool uncurse); +bool is_enchantable_armour(const item_def &arm, bool uncurse, + bool unknown = false); bool is_shield(const item_def &item); bool is_shield_incompatible(const item_def &weapon, diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 0ba286f991..50b60cd456 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -324,6 +324,14 @@ bool does_unrandart_exist(int whun) return (unrandart_exist[whun]); } +bool is_known_artefact( const item_def &item ) +{ + if (!item_type_known(item)) + return (false); + + return (is_artefact(item)); +} + bool is_artefact( const item_def &item ) { return (is_random_artefact(item) || is_fixed_artefact(item)); diff --git a/crawl-ref/source/randart.h b/crawl-ref/source/randart.h index 93724ee224..0cacf2b3bf 100644 --- a/crawl-ref/source/randart.h +++ b/crawl-ref/source/randart.h @@ -20,6 +20,7 @@ #define RANDART_SEED_MASK 0x00ffffff +bool is_known_artefact( const item_def &item ); bool is_artefact( const item_def &item ); bool is_random_artefact( const item_def &item ); bool is_unrandom_artefact( const item_def &item ); |