summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/docs/options_guide.txt3
-rw-r--r--crawl-ref/settings/init.txt1
-rw-r--r--crawl-ref/source/acr.cc8
-rw-r--r--crawl-ref/source/dat/database/rand_arm.txt6
-rw-r--r--crawl-ref/source/debug.cc20
-rw-r--r--crawl-ref/source/describe.cc49
-rw-r--r--crawl-ref/source/describe.h3
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/initfile.cc6
-rw-r--r--crawl-ref/source/item_use.cc9
-rw-r--r--crawl-ref/source/makeitem.cc1
-rw-r--r--crawl-ref/source/notes.cc14
-rw-r--r--crawl-ref/source/notes.h2
-rw-r--r--crawl-ref/source/randart.cc9
-rw-r--r--crawl-ref/source/religion.cc7
-rw-r--r--crawl-ref/source/shopping.cc43
-rw-r--r--crawl-ref/source/spells1.cc3
17 files changed, 136 insertions, 50 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt
index bd72eb905c..b484cb0a19 100644
--- a/crawl-ref/docs/options_guide.txt
+++ b/crawl-ref/docs/options_guide.txt
@@ -1431,6 +1431,9 @@ autoinscribe = <regex>:<inscription>
lose charges of important wands accidentally, as in
autoinscribe = wand of healing:!z
+autoinscribe_randarts = true
+ Automatically inscribes identified randarts with their properties.
+
4-n Macro related Options.
------------------------------
diff --git a/crawl-ref/settings/init.txt b/crawl-ref/settings/init.txt
index b7fc1eb00a..0f082af20b 100644
--- a/crawl-ref/settings/init.txt
+++ b/crawl-ref/settings/init.txt
@@ -299,6 +299,7 @@ menu_colour = notes:white:Reached XP level
# autoinscribe = royal jell:=g
# autoinscribe = distortion:!w
# autoinscribe = potion.*mutation:!q
+# autoinscribe_randarts = false
##### 4-n Macro related Options #################
#
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 01f8fa54b3..754da29a37 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -613,14 +613,18 @@ static void _handle_wizard_command( void )
if (is_random_artefact( you.inv[i] ))
unuse_randart( i );
-
break;
}
}
make_item_randart( you.inv[i] );
+ if (Options.autoinscribe_randarts)
+ {
+ add_autoinscription(you.inv[i],
+ randart_auto_inscription(you.inv[i]));
+ }
- // if equipped, apply new randart benefits
+ // If equipped, apply new randart benefits.
if (j != NUM_EQUIP)
use_randart( i );
diff --git a/crawl-ref/source/dat/database/rand_arm.txt b/crawl-ref/source/dat/database/rand_arm.txt
index 3684fc81d0..2ec884633d 100644
--- a/crawl-ref/source/dat/database/rand_arm.txt
+++ b/crawl-ref/source/dat/database/rand_arm.txt
@@ -422,11 +422,11 @@ the Empire
Coronation
-Commoners
+the Commoners
-Peasants
+the Peasants
-Townfolk
+the Townfolk
the City
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index c1d90ae5a2..c113db3e96 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1402,6 +1402,24 @@ void wizard_create_spec_object()
mitm[thing_created].quantity = 12;
break;
+ case OBJ_JEWELLERY:
+ if (jewellery_is_amulet(mitm[thing_created]))
+ break;
+
+ switch(mitm[thing_created].sub_type)
+ {
+ case RING_SLAYING:
+ mitm[thing_created].plus2 = 5;
+ // intentional fall-through
+ case RING_PROTECTION:
+ case RING_EVASION:
+ case RING_STRENGTH:
+ case RING_DEXTERITY:
+ case RING_INTELLIGENCE:
+ mitm[thing_created].plus = 5;
+ default:
+ break;
+ }
default:
break;
}
@@ -4332,7 +4350,7 @@ void debug_miscast( int target_index )
else
mpr( "Enter miscast_level or spell_power,spell_failure: ",
MSGCH_PROMPT );
-
+
if (cancelable_get_line(specs, sizeof specs) || !*specs)
{
canned_msg(MSG_OK);
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index ffdffd68c9..9f0df160cd 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -418,14 +418,6 @@ static std::vector<std::string> _randart_propnames( const item_def& item )
return propnames;
}
-static std::string _randart_auto_inscription( const item_def& item )
-{
- const std::vector<std::string> propnames = _randart_propnames(item);
-
- return comma_separated_line(propnames.begin(), propnames.end(),
- " ", " ");
-}
-
// Remove randart auto-inscription. Do it once for each property
// string, rather than the return value of randart_auto_inscription(),
// in case more information about the randart has been learned since
@@ -442,6 +434,25 @@ static void _trim_randart_inscrip( item_def& item )
trim_string(item.inscription);
}
+std::string randart_auto_inscription( const item_def& item )
+{
+ const std::vector<std::string> propnames = _randart_propnames(item);
+
+ return comma_separated_line(propnames.begin(), propnames.end(),
+ " ", " ");
+}
+
+void add_autoinscription( item_def &item, std::string ainscrip)
+{
+ // Remove previous randart inscription.
+ _trim_randart_inscrip(item);
+
+ if (!item.inscription.empty())
+ item.inscription += ", ";
+
+ item.inscription += ainscrip;
+}
+
struct property_descriptor
{
randart_prop_type property;
@@ -1966,13 +1977,17 @@ void describe_feature_wide(int x, int y)
desc += "$$";
// Get rid of trailing .$$ before lookup
- desc += getLongDescription(grd[x][y] == DNGN_ENTER_SHOP ? "A shop"
- : desc.substr(0, desc.length() - 3));
+ std::string db_name =
+ grd[x][y] == DNGN_ENTER_SHOP ? "A shop"
+ : desc.substr(0, desc.length() - 3);
+ desc += getLongDescription(db_name);
// For things which require logic
desc += _get_feature_description_wide(grd[x][y]);
- print_description(desc);
+ std::string quote = getQuoteString(db_name);
+
+ print_description(desc, "", "", "", "", quote);
mouse_control mc(MOUSE_MODE_MORE);
@@ -2099,7 +2114,7 @@ void inscribe_item(item_def &item, bool proper_prompt)
bool need_autoinscribe = false;
if (is_random_artefact(item))
{
- ainscrip = _randart_auto_inscription(item);
+ ainscrip = randart_auto_inscription(item);
if (!ainscrip.empty()
&& (!is_inscribed
|| item.inscription.find(ainscrip) == std::string::npos))
@@ -2161,13 +2176,7 @@ void inscribe_item(item_def &item, bool proper_prompt)
case 'a':
if (need_autoinscribe)
{
- // Remove previous randart inscription.
- _trim_randart_inscrip(item);
-
- if (!item.inscription.empty())
- item.inscription += ", ";
-
- item.inscription += ainscrip;
+ add_autoinscription(item, ainscrip);
break;
}
// If autoinscription is impossible, prompt for an inscription instead.
@@ -3170,7 +3179,7 @@ void describe_god( god_type which_god, bool give_title )
numcols).c_str();
cgotoxy(1, bottom_line - std::count(extra.begin(), extra.end(), '\n')-1,
GOTO_CRT);
- textcolor(LIGHTGREY);
+ textcolor(LIGHTGREY);
cprintf( "%s", extra.c_str() );
}
diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h
index b1be3e68fc..71cc2f408f 100644
--- a/crawl-ref/source/describe.h
+++ b/crawl-ref/source/describe.h
@@ -91,6 +91,9 @@ void print_description(const std::string &d, const std::string title = "",
const std::string footer = "",
const std::string quote = "");
+std::string randart_auto_inscription( const item_def& item );
+void add_autoinscription( item_def &item, std::string ainscrip);
+
const char *trap_name(trap_type trap);
int str_to_trap(const std::string &s);
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 7279150d0e..dce4092aad 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1752,6 +1752,8 @@ public:
std::vector<text_pattern> note_items; // Objects to note
std::vector<int> note_skill_levels; // Skill levels to note
+ bool autoinscribe_randarts; // Auto-inscribe identified randarts.
+
bool pickup_thrown; // Pickup thrown missiles
bool pickup_dropped; // Pickup dropped objects
int travel_delay; // How long to pause between travel moves
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 91d8838aef..d160635440 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -905,6 +905,7 @@ void game_options::reset_options()
note_monsters.clear();
note_messages.clear();
autoinscriptions.clear();
+ autoinscribe_randarts = true;
note_items.clear();
note_skill_levels.clear();
travel_stop_message.clear();
@@ -1393,8 +1394,8 @@ void game_options::read_options(InitLineInput &il, bool runscript,
}
continue;
}
- else if (inscriptcond &&
- (str.find(">") == str.length() - 1 || str == ">L"))
+ else if (inscriptcond
+ && (str.find(">") == str.length() - 1 || str == ">L"))
{
inscriptcond = false;
str = str.substr(0, str.length() - 1);
@@ -2427,6 +2428,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
autoinscriptions.push_back(
std::pair<text_pattern,std::string>(thesplit[0], thesplit[1]));
}
+ else BOOL_OPTION(autoinscribe_randarts);
else if (key == "map_file_name")
{
map_file_name = field;
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 88fa351ec0..7b6c27254b 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2779,6 +2779,9 @@ void jewellery_wear_effects(item_def &item)
if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
learn_pluses = true;
+
+ if (Options.autoinscribe_randarts && is_random_artefact(item))
+ add_autoinscription( item, randart_auto_inscription(item));
break;
case RING_DEXTERITY:
@@ -2786,6 +2789,9 @@ void jewellery_wear_effects(item_def &item)
if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
learn_pluses = true;
+
+ if (Options.autoinscribe_randarts && is_random_artefact(item))
+ add_autoinscription( item, randart_auto_inscription(item));
break;
case RING_INTELLIGENCE:
@@ -2793,6 +2799,9 @@ void jewellery_wear_effects(item_def &item)
if (item.plus != 0 && !artefact)
ident = ID_KNOWN_TYPE;
learn_pluses = true;
+
+ if (Options.autoinscribe_randarts && is_random_artefact(item))
+ add_autoinscription( item, randart_auto_inscription(item));
break;
case RING_MAGICAL_POWER:
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 304dcda8f5..a4af7327f5 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1838,7 +1838,6 @@ static bool _try_make_armour_artefact(item_def& item, int force_type,
else
hide2armour(item); // No randart hides.
-
// Needs to be done after the barding chance else we get randart
// bardings named Boots of xy.
make_item_randart( item );
diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc
index 9edff6b4cd..dbdb0bcdca 100644
--- a/crawl-ref/source/notes.cc
+++ b/crawl-ref/source/notes.cc
@@ -114,6 +114,8 @@ static bool _is_noteworthy( const Note& note )
|| note.type == NOTE_LOSE_MUTATION
|| note.type == NOTE_GET_ITEM
|| note.type == NOTE_ID_ITEM
+ || note.type == NOTE_BUY_ITEM
+ || note.type == NOTE_DONATE_MONEY
|| note.type == NOTE_SEEN_MONSTER
|| note.type == NOTE_KILL_MONSTER
|| note.type == NOTE_POLY_MONSTER
@@ -304,12 +306,20 @@ std::string Note::describe( bool when, bool where, bool what ) const
break;
case NOTE_ID_ITEM:
result << "Identified " << name;
- if ( !desc.empty() )
+ if (!desc.empty())
result << " (" << desc << ")";
break;
case NOTE_GET_ITEM:
result << "Got " << name;
break;
+ case NOTE_BUY_ITEM:
+ result << "Bought " << name << " for " << first << " gold piece"
+ << (first == 1 ? "" : "s");
+ break;
+ case NOTE_DONATE_MONEY:
+ result << "Donated " << first << " gold piece"
+ << (first == 1 ? "" : "s") << " to Zin";
+ break;
case NOTE_GAIN_SKILL:
result << "Reached skill " << second
<< " in " << skill_name(first);
@@ -318,7 +328,7 @@ std::string Note::describe( bool when, bool where, bool what ) const
result << "Noticed " << name;
break;
case NOTE_KILL_MONSTER:
- if ( second )
+ if (second)
result << name << " (ally) was defeated";
else
result << "Defeated " << name;
diff --git a/crawl-ref/source/notes.h b/crawl-ref/source/notes.h
index 7e8366bb3a..74d04a020d 100644
--- a/crawl-ref/source/notes.h
+++ b/crawl-ref/source/notes.h
@@ -46,6 +46,8 @@ enum NOTE_TYPES
NOTE_PENANCE, /* needs: god id */
NOTE_MOLLIFY_GOD, /* needs: god id */
NOTE_DEATH, /* needs: death cause */
+ NOTE_BUY_ITEM, /* needs: item name (string), price (int) */
+ NOTE_DONATE_MONEY, /* needs: amount of gold */
NOTE_NUM_TYPES
};
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index 65c2c512be..7c6d1ee8c0 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -25,6 +25,7 @@
#include "externs.h"
#include "database.h"
+#include "describe.h"
#include "itemname.h"
#include "itemprop.h"
#include "items.h"
@@ -371,7 +372,7 @@ void randart_desc_properties( const item_def &item,
if (!force_fake_props && item_ident( item, ISFLAG_KNOW_PROPERTIES ))
return;
- // only jewellery need fake randart properties
+ // Only jewellery need fake randart properties.
if (item.base_type != OBJ_JEWELLERY)
return;
@@ -1138,7 +1139,7 @@ void randart_wpn_properties( const item_def &item,
ASSERT( known_vec.size() == RA_PROPERTIES);
ASSERT( known_vec.get_max_size() == RA_PROPERTIES);
- if ( item_ident( item, ISFLAG_KNOW_PROPERTIES ) )
+ if (item_ident( item, ISFLAG_KNOW_PROPERTIES ))
{
for (vec_size i = 0; i < RA_PROPERTIES; i++)
known[i] = (bool) true;
@@ -1244,10 +1245,12 @@ void randart_wpn_learn_prop( item_def &item, randart_prop_type prop )
ASSERT( known_vec.size() == RA_PROPERTIES);
ASSERT( known_vec.get_max_size() == RA_PROPERTIES);
- if ( item_ident( item, ISFLAG_KNOW_PROPERTIES ) )
+ if (item_ident( item, ISFLAG_KNOW_PROPERTIES ))
return;
known_vec[prop] = (bool) true;
+ if (Options.autoinscribe_randarts)
+ add_autoinscription( item, randart_auto_inscription(item));
}
bool randart_wpn_known_prop( const item_def &item, randart_prop_type prop )
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index 807c31bf37..cb6c0ce683 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -4547,7 +4547,7 @@ static bool _beogh_followers_abandon_you()
if (is_orcish_follower(monster))
{
num_followers++;
-
+
if (mons_player_visible(monster)
&& !mons_is_sleeping(monster)
&& !mons_is_confused(monster)
@@ -5271,6 +5271,9 @@ void offer_items()
mprf(MSGCH_DIAGNOSTICS, "A donation of $%d amounts to an "
"increase of piety by %d.", you.gold, donation_value);
#endif
+ // Take a note of the donation.
+ take_note(Note(NOTE_DONATE_MONEY, you.gold));
+
you.gold = 0;
you.redraw_gold = true;
@@ -5664,7 +5667,7 @@ harm_protection_type god_protects_from_harm(god_type god, bool actual)
void god_smites_you(god_type god, const char *message,
kill_method_type death_type)
-
+
{
ASSERT(god != GOD_NO_GOD);
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index 4e9f6eb3f6..2a49378611 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -206,7 +206,8 @@ static std::string _shop_print_stock( const std::vector<int>& stock,
textcolor(i % 2 ? LIGHTGREY : WHITE);
cprintf("%-56s%5d gold",
- mitm[stock[i]].name(DESC_NOCAP_A, false, id).c_str(),
+ mitm[stock[i]].name(DESC_NOCAP_A, false, id).substr(0, 56).
+ c_str(),
gp_value);
si.add_item(mitm[stock[i]], gp_value);
@@ -254,6 +255,15 @@ static void _in_a_shop( int shopidx )
StashTrack.get_shop(shop.pos).reset();
std::vector<int> stock = _shop_get_stock(shopidx);
+ for (unsigned int k = 0; k < stock.size(); k++)
+ {
+ if (Options.autoinscribe_randarts
+ && is_random_artefact(mitm[stock[k]]))
+ {
+ mitm[stock[k]].inscription =
+ randart_auto_inscription(mitm[stock[k]]);
+ }
+ }
// Deselect all.
if (stock.size() != selected.size())
@@ -360,11 +370,16 @@ static void _in_a_shop( int shopidx )
item_def& item = mitm[stock[i]];
purchases.push_back(item.name(DESC_NOCAP_A));
+ const int gp_value = _shop_get_item_value(item,
+ shop.greed, id_stock);
+
+ // Take a note of the purchase.
+ take_note(Note(NOTE_BUY_ITEM, gp_value, 0,
+ item.name(DESC_NOCAP_A).c_str()));
+
quant = item.quantity;
num_items += quant;
- const int gp_value = _shop_get_item_value(item,
- shop.greed, id_stock);
if (!_purchase(shopidx, stock[i], gp_value,
id_stock))
{
@@ -379,17 +394,17 @@ static void _in_a_shop( int shopidx )
for (int i = 0; i < 5; i++)
_shop_print("\n", i);
- // This is so that note_messages can be used to note items
- // being bought, and also so you can use message history
- // to review what you bought.
- // FIXME: If you buy several items of the same type
- // they are not merged in the listing.
- mprf("You bought %s for a total of %d gold piece%s.",
- comma_separated_line(purchases.begin(),
- purchases.end(),
- ", and ", ", ").c_str(),
- total_cost,
- total_cost > 1 ? "s" : "");
+ if (purchases.size() > 1)
+ {
+ // FIXME: If you buy several items of the same type
+ // they are not merged in the listing.
+ mprf("You bought %s for a total of %d gold piece%s.",
+ comma_separated_line(purchases.begin(),
+ purchases.end(),
+ ", and ", ", ").c_str(),
+ total_cost,
+ total_cost > 1 ? "s" : "");
+ }
if (outside_items)
{
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index 5741f679f6..b286417d6d 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -29,6 +29,7 @@
#include "abyss.h"
#include "beam.h"
#include "cloud.h"
+#include "describe.h"
#include "directn.h"
#include "effects.h"
#include "invent.h"
@@ -446,6 +447,8 @@ void identify(int power, int item_slot)
set_ident_type( item, ID_KNOWN_TYPE );
set_ident_flags( item, ISFLAG_IDENT_MASK );
+ if (Options.autoinscribe_randarts && is_random_artefact(item))
+ add_autoinscription( item, randart_auto_inscription(item));
// For scrolls, now id the scroll, unless already known.
if (power == -1