summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 16:52:40 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-02 16:52:40 +0000
commit0a4efdf86b33220269f7439aeb5952a88d50efa7 (patch)
treefb0826c6072cd6f598ed9e905dea8faa4fd30601 /crawl-ref/source
parentb50eafe8de72cbcc4431813934695c22642cdd46 (diff)
downloadcrawl-ref-0a4efdf86b33220269f7439aeb5952a88d50efa7.tar.gz
crawl-ref-0a4efdf86b33220269f7439aeb5952a88d50efa7.zip
Fix a stupid bug I'd introduced when fixing another one.
Fix 1939901: Weapon listing not updated right away after being cursed. Put the code to colour arbitrary substrings of a message according to the menu_colour settings into a function of its own, and use it for pick up and eating prompts (currently from floor only) as well as for the "Things that are here" listing. Could be overly spammy, thus needs testing. If all works well, we can remove the "msg =" settings in food_colouring.txt that currently don't do anything anyway, or reuse them for non-prompt messages like "You see here a green rat corpse." git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5436 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/acr.cc6
-rw-r--r--crawl-ref/source/beam.cc65
-rw-r--r--crawl-ref/source/effects.cc26
-rw-r--r--crawl-ref/source/food.cc27
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/item_use.cc50
-rw-r--r--crawl-ref/source/itemname.cc25
-rw-r--r--crawl-ref/source/itemname.h6
-rw-r--r--crawl-ref/source/itemprop.cc14
-rw-r--r--crawl-ref/source/items.cc38
-rw-r--r--crawl-ref/source/misc.cc16
-rw-r--r--crawl-ref/source/spells3.cc6
-rw-r--r--crawl-ref/source/tutorial.cc2
13 files changed, 169 insertions, 114 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 327a50d4f9..612f125951 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1363,7 +1363,9 @@ static void _input()
Options.tut_just_triggered = false;
- if ( i_feel_safe() )
+ // He, we don't want those "Whew, it's safe to rest now" messages when
+ // you were just cast into the abyss. Right?
+ if (i_feel_safe() && you.level_type != LEVEL_ABYSS)
{
if (Options.tutorial_left)
{
@@ -2199,7 +2201,7 @@ void process_command( command_type cmd )
{
coord_def pos;
#ifdef USE_TILE
- // Since they're no actual overview map, but the functionality
+ // Since there's no actual overview map, but the functionality
// exists, give a message to explain what's going on.
std::string str = "Move the cursor to view the level map, or "
"type <w>?</w> for a list of commands.";
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 5d7b327212..25cc0aeee5 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -233,6 +233,7 @@ static void _beam_set_default_values(bolt &beam, int power)
// If needs_tracer is true, we need to check the beam path for friendly
// monsters for *player beams* only! If allies are found, the player is
// prompted to stop or continue.
+// NOTE: Doesn't check for the player being hit by a rebounding lightning bolt.
bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer,
std::string msg)
{
@@ -249,9 +250,9 @@ bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer,
_beam_set_default_values(pbolt, power);
// For player bolts, check whether tracer goes through friendlies.
- // NOTE: Whenever zapping() is called with a randomized value for power,
- // player_tracer should be called directly with the highest power possible
- // respecting current skill, experience level etc.
+ // NOTE: Whenever zapping() is called with a randomized value for power
+ // (or effect), player_tracer should be called directly with the highest
+ // power possible respecting current skill, experience level etc.
if (needs_tracer && pbolt.thrower == KILL_YOU_MISSILE
&& !player_tracer(ztype, power, pbolt))
@@ -259,7 +260,7 @@ bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer,
return (false);
}
- // fill in the bolt structure
+ // Fill in the bolt structure.
_zappy( ztype, power, pbolt );
if (!msg.empty())
@@ -267,14 +268,14 @@ bool zapping(zap_type ztype, int power, bolt &pbolt, bool needs_tracer,
if (ztype == ZAP_LIGHTNING)
{
- // XXX: needs to check silenced at other location, too {dlb}
+ // XXX: Needs to check silenced at other location, too. {dlb}
noisy(25, you.x_pos, you.y_pos, "You hear a mighty clap of thunder!");
}
fire_beam(pbolt);
return (true);
-} // end zapping()
+}
// pbolt needs to be initialized for tracing: with the the maximum range,
// and the flavour to allow for completely resistant monsters.
@@ -660,8 +661,6 @@ static void _get_max_range( zap_type z_type, int power, bolt &pbolt )
// Returns true if the path is considered "safe", and false if there are
// monsters in the way the player doesn't want to hit.
-// FIXME: Also needs to check for fleeing monster with TSO and neutrals for
-// all good gods.
bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
{
// Non-controlleable during confusion.
@@ -669,11 +668,17 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
if (you.duration[DUR_CONF])
return (true);
+ // If you target yourself, that's always deliberate.
+ // This is basically pbolt.aimed_at_feet except that that hasn't been
+ // initialized yet.
+ if (pbolt.target_x == you.x_pos && pbolt.target_y == you.y_pos);
+ return (true);
+
_beam_set_default_values(pbolt, power);
pbolt.name = "unimportant";
_get_max_range(ztype, power, pbolt);
- // override range if necessary
+ // Override range if necessary.
if (range > 0)
pbolt.rangeMax = range;
@@ -684,7 +689,7 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
pbolt.smart_monster = true;
pbolt.attitude = ATT_FRIENDLY;
- // init tracer variables
+ // Init tracer variables.
pbolt.foe_count = pbolt.fr_count = 0;
pbolt.foe_power = pbolt.fr_power = 0;
pbolt.fr_helped = pbolt.fr_hurt = 0;
@@ -1733,7 +1738,7 @@ static bool _affect_mon_in_wall(bolt &pbolt, item_def *item, int tx, int ty)
void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
{
- bool beamTerminate; // has beam been 'stopped' by something?
+ bool beamTerminate; // Has beam been 'stopped' by something?
int &tx(pbolt.pos.x), &ty(pbolt.pos.y); // test(new) x,y - integer
int rangeRemaining;
bool did_bounce = false;
@@ -1792,7 +1797,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
// Give chance for beam to affect one cell even if aimed_at_feet.
beamTerminate = false;
- // setup range
+ // Setup range.
rangeRemaining = pbolt.range;
if (pbolt.rangeMax > pbolt.range)
{
@@ -1892,7 +1897,9 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
// monsters have no chance to dodge or block such
// a beam, and we want to avoid silly messages.
if (tx == pbolt.target_x && ty == pbolt.target_y)
+ {
beamTerminate = _beam_term_on_target(pbolt, tx, ty);
+ }
// Affect the cell, except in the special case noted
// above -- affect() will early out if something gets
@@ -1909,7 +1916,9 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
}
if (!pbolt.affects_nothing)
+ {
rangeRemaining -= affect(pbolt, tx, ty, item);
+ }
if (random_beam)
{
@@ -1962,15 +1971,15 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
pbolt.colour == BLACK ? random_colour() : pbolt.colour,
pbolt.type );
- // get curses to update the screen so we can see the beam
+ // Get curses to update the screen so we can see the beam.
update_screen();
delay(15);
#ifdef MISSILE_TRAILS_OFF
+ // mv: It's not optimal but is usually enough.
if (!pbolt.is_beam || pbolt.name[0] == '0')
- viewwindow(1,false); // mv: added. It's not optimal but
- // is usually enough
+ viewwindow(1,false);
#endif
}
@@ -1982,9 +1991,9 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
ray.advance(true);
} // end- while !beamTerminate
- // the beam has finished, and terminated at tx, ty
+ // The beam has finished, and terminated at tx, ty.
- // leave an object, if applicable
+ // Leave an object, if applicable.
if (drop_item && item)
beam_drop_object( pbolt, item, tx, ty );
@@ -2022,7 +2031,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
else if (pbolt.foe_helped > 0 && pbolt.fr_helped == 0)
xom_is_stimulated(128);
- // allow friendlies to react to projectiles.
+ // Allow friendlies to react to projectiles.
const monsters *mon = &menv[pbolt.beam_source];
if (pbolt.foe_hurt > 0 && !mons_wont_attack(mon)
&& you.pet_target == MHITNOT)
@@ -2031,7 +2040,7 @@ void fire_beam( bolt &pbolt, item_def *item, bool drop_item )
}
}
- // that's it!
+ // That's it!
#ifdef WIN32CONSOLE
if (!pbolt.is_tracer)
set_buffering(oldValue);
@@ -3093,8 +3102,8 @@ int affect(bolt &beam, int x, int y, item_def *item)
return (BEAM_STOP);
}
- // if there is a monster at this location, affect it
- // submerged monsters aren't really there -- bwr
+ // If there is a monster at this location, affect it.
+ // Submerged monsters aren't really there. -- bwr
int mid = mgrd[x][y];
if (mid != NON_MONSTER)
{
@@ -3545,11 +3554,11 @@ static std::string _beam_zapper(const bolt &beam)
// Returns amount of extra range used up by affectation of the player.
static int _affect_player( bolt &beam, item_def *item )
{
- // digging -- don't care.
+ // Digging -- don't care.
if (beam.flavour == BEAM_DIGGING)
return (0);
- // check for tracer
+ // Check for tracer.
if (beam.is_tracer)
{
// Check whether thrower can see player, unless thrower == player.
@@ -3686,7 +3695,7 @@ static int _affect_player( bolt &beam, item_def *item )
&& you_resist_magic( beam.ench_power ))
{
bool need_msg = true;
- if (beam.beam_source != -1)
+ if (beam.thrower != KILL_YOU_MISSILE && beam.beam_source != -1)
{
monsters *mon = &menv[beam.beam_source];
if (!player_monster_visible(mon))
@@ -4649,9 +4658,9 @@ static int _affect_monster(bolt &beam, monsters *mon, item_def *item)
else
num_success = 1;
- if ( num_success )
+ if (num_success)
{
- if ( num_success == 2 )
+ if (num_success == 2)
num_levels++;
poison_monster( mon, _whose_kill(beam), num_levels );
}
@@ -4687,7 +4696,7 @@ static int _affect_monster_enchantment(bolt &beam, monsters *mon)
if (check_mons_resist_magic( mon, beam.ench_power )
&& !beam.aimed_at_feet)
{
- return mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST;
+ return (mons_immune_magic(mon) ? MON_UNAFFECTED : MON_RESIST);
}
if (mons_near(mon) && player_monster_visible(mon))
@@ -5549,7 +5558,7 @@ void bolt::set_target(const dist &d)
target_y = d.ty;
chose_ray = d.choseRay;
- if ( d.choseRay )
+ if (d.choseRay)
ray = d.ray;
if (d.isEndpoint)
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index f172544727..b6fbdf6106 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -304,16 +304,20 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
{
#ifdef DGL_MILESTONES
if (gate_type == DNGN_ENTER_ABYSS)
+ {
mark_milestone("abyss.enter",
"is cast into the Abyss!" + who_banished(who));
+ }
else if (gate_type == DNGN_EXIT_ABYSS)
+ {
mark_milestone("abyss.exit",
"escaped from the Abyss!" + who_banished(who));
+ }
#endif
std::string cast_into = "";
- switch(gate_type)
+ switch (gate_type)
{
case DNGN_ENTER_ABYSS:
if (you.level_type == LEVEL_ABYSS)
@@ -430,7 +434,7 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
take_note(Note(NOTE_MESSAGE, 0, 0, what.c_str()), true);
}
- // no longer held in net
+ // No longer held in net.
clear_trapping_net();
down_stairs(you.your_level, gate_type, you.entry_cause); // heh heh
@@ -1407,7 +1411,7 @@ static int find_acquirement_subtype(object_class_type class_wanted,
type_wanted = random_rod_subtype();
break;
- default: // invocations and leftover spell schools
+ default: // Invocations and leftover spell schools.
switch (random2(5))
{
case 0:
@@ -1499,7 +1503,7 @@ bool acquirement(object_class_type class_wanted, int agent,
if (grid_destroys_items(grd[you.x_pos][you.y_pos]))
{
- // how sad (and stupid)
+ // How sad (and stupid).
if (!silenced(you.pos()) && !quiet)
{
mprf(MSGCH_SOUND,
@@ -1515,7 +1519,7 @@ bool acquirement(object_class_type class_wanted, int agent,
{
int type_wanted = find_acquirement_subtype(class_wanted, quant);
- // clobber class_wanted for vampires
+ // Clobber class_wanted for vampires.
if (you.species == SP_VAMPIRE && class_wanted == OBJ_FOOD)
class_wanted = OBJ_POTIONS;
@@ -1569,13 +1573,13 @@ bool acquirement(object_class_type class_wanted, int agent,
randart_properties_t proprt;
randart_wpn_properties( doodad, proprt );
- // check vs stats. positive stats will automatically fall
+ // Check vs stats. positive stats will automatically fall
// through. As will negative stats that won't kill you.
if (-proprt[RAP_STRENGTH] >= you.strength
|| -proprt[RAP_INTELLIGENCE] >= you.intel
|| -proprt[RAP_DEXTERITY] >= you.dex)
{
- // try again
+ // Try again.
destroy_item(thing_created);
thing_created = NON_ITEM;
continue;
@@ -1592,10 +1596,10 @@ bool acquirement(object_class_type class_wanted, int agent,
return (false);
}
- // easier to read this way
+ // Easier to read this way.
item_def& thing(mitm[thing_created]);
- // give some more gold
+ // Give some more gold.
if ( class_wanted == OBJ_GOLD )
thing.quantity += 150;
else if (quant > 1)
@@ -1604,7 +1608,7 @@ bool acquirement(object_class_type class_wanted, int agent,
if (is_blood_potion(thing))
init_stack_blood_potions(thing);
- // remove curse flag from item
+ // Remove curse flag from item.
do_uncurse_item( thing );
if (thing.base_type == OBJ_BOOKS)
@@ -1616,7 +1620,7 @@ bool acquirement(object_class_type class_wanted, int agent,
switch (thing.sub_type)
{
case RING_SLAYING:
- // make sure plus to damage is >= 1
+ // Make sure plus to damage is >= 1.
thing.plus2 = abs( thing.plus2 );
if (thing.plus2 == 0)
thing.plus2 = 1;
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index c23724aa73..5283e0e9dc 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -387,13 +387,13 @@ static bool _have_corpses_in_pack(bool remind)
if (remind)
{
- text << "You might want to also " << verb << " the " << noun
- << " in your pack.";
+ mprf("You might want to also %s the %s in your pack.", verb.c_str(),
+ noun.c_str());
}
else
{
- text << "If you dropped the " << noun << " in your pack "
- << "then you could " << verb << " " << pronoun << ".";
+ mprf("If you dropped the %s in your pack you could %s %s.",
+ verb.c_str(), noun.c_str(), pronoun.c_str());
}
mpr(text.str().c_str());
@@ -550,24 +550,11 @@ bool butchery(int which_corpse)
// * Mummies can't eat
// * Ghouls relish the bad things
// * Vampires won't bottle bad corpses
+ // Also, don't bother colouring if it's only for sacrificing.
if (!sacrifice && !you.is_undead)
{
- // Don't bother colouring if it's only for sacrificing.
- std::string cprf = menu_colour_item_prefix(mitm[o]);
- std::string colour = "";
- std::string colour_off = "";
- int col = menu_colour(corpse_name, cprf, "pickup");
-
- if (col != LIGHTGRAY)
- colour = colour_to_str( col );
-
- if (!colour.empty())
- {
- // Order is important here.
- colour_off = "</" + colour + ">";
- colour = "<" + colour + ">";
- corpse_name = colour + corpse_name + colour_off;
- }
+ corpse_name = get_menu_colour_prefix_tags(mitm[o],
+ DESC_NOCAP_A);
}
// Shall we butcher this corpse?
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 2ec348288b..6665a7a096 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -126,7 +126,7 @@ const char* colour_to_str(unsigned char colour)
return cols[colour].c_str();
}
-// returns -1 if unmatched else returns 0-15
+// Returns -1 if unmatched else returns 0-15.
int str_to_colour( const std::string &str, int default_colour,
bool accept_number )
{
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 95337fcec1..c660210e59 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -3410,44 +3410,47 @@ void zap_wand( int slot )
zap_wand.ty = you.y_pos + random2(13) - 6;
}
- zap_type type_zapped = static_cast<zap_type>(wand.zap());
- bool random = false;
if (wand.sub_type == WAND_RANDOM_EFFECTS)
- {
beam.effect_known = false;
- random = true;
- if (dangerous)
- {
- // Xom loves it when you use a Wand of Random Effects and
- // there is a dangerous monster nearby...
- xom_is_stimulated(255);
- }
- }
+ zap_type type_zapped = static_cast<zap_type>(wand.zap());
beam.source_x = you.x_pos;
beam.source_y = you.y_pos;
beam.set_target(zap_wand);
+ beam.aimed_at_feet =
+ (beam.target_x == you.x_pos && beam.target_y == you.y_pos);
+
// Check whether we may hit friends, use "safe" values for random effects
- // (highest possible range, and unresistable beam flavour).
- if (!player_tracer(random ? ZAP_DEBUGGING_RAY : type_zapped,
- 2 * (you.skills[SK_EVOCATIONS] - 1), beam,
- random ? 17 : 0))
+ // and unknown wands (highest possible range, and unresistable beam
+ // flavour). Don't use the tracer if firing at self.
+ if (!beam.aimed_at_feet
+ && !player_tracer(!beam.effect_known ? ZAP_DEBUGGING_RAY
+ : type_zapped,
+ 2 * (you.skills[SK_EVOCATIONS] - 1),
+ beam, !beam.effect_known ? 17 : 0))
{
return;
}
- // zapping() updates beam
+ if (dangerous && alreadyknown && wand.sub_type == WAND_RANDOM_EFFECTS)
+ {
+ // Xom loves it when you use a Wand of Random Effects and
+ // there is a dangerous monster nearby...
+ xom_is_stimulated(255);
+ }
+
+ // zapping() updates beam.
zapping( type_zapped, 30 + roll_dice(2, you.skills[SK_EVOCATIONS]), beam );
- // take off a charge
+ // Take off a charge.
wand.plus--;
- // increment zap count
+ // Increment zap count.
if (wand.plus2 >= 0)
wand.plus2++;
- // identify if necessary
+ // Identify if necessary.
if (!alreadyknown && (beam.obvious_effect || type_zapped == ZAP_FIREBALL))
{
set_ident_type( wand.base_type, wand.sub_type, ID_KNOWN_TYPE );
@@ -3963,7 +3966,6 @@ bool enchant_armour( int &ac_change, bool quiet, item_def &arm )
mprf("%s glows silver for a moment.",
arm.name(DESC_CAP_YOUR).c_str());
}
-
do_uncurse_item( arm );
return (true);
}
@@ -4349,8 +4351,8 @@ void read_scroll( int slot )
}
else
{
+ // Also sets wield_change.
do_curse_item( you.inv[nthing], false );
- you.wield_change = true;
}
break;
@@ -4465,7 +4467,7 @@ void read_scroll( int slot )
}
else
{
- // make the name before we curse it
+ // Make the name before we curse it.
do_curse_item( you.inv[you.equip[affected]], false );
}
break;
@@ -4638,8 +4640,8 @@ void use_randart(item_def &item)
randart_wpn_learn_prop(item, RAP_BERSERK);
}
- if ( !item_cursed(item) && proprt[RAP_CURSED] > 0
- && one_chance_in(proprt[RAP_CURSED]) )
+ if (!item_cursed(item) && proprt[RAP_CURSED] > 0
+ && one_chance_in(proprt[RAP_CURSED]))
{
do_curse_item( item, false );
randart_wpn_learn_prop(item, RAP_CURSED);
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 947937e859..96069237a5 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -29,6 +29,7 @@
#include "decks.h"
#include "food.h"
+#include "initfile.h"
#include "invent.h"
#include "it_use2.h"
#include "itemprop.h"
@@ -2244,6 +2245,30 @@ const std::string menu_colour_item_prefix(const item_def &item)
return result;
}
+const std::string get_menu_colour_prefix_tags(item_def &item,
+ description_level_type desc)
+{
+ std::string cprf = menu_colour_item_prefix(item);
+ std::string colour = "";
+ std::string colour_off = "";
+ std::string item_name = item.name(desc);
+ int col = menu_colour(item_name, cprf, "pickup");
+
+ if (col != LIGHTGRAY)
+ colour = colour_to_str( col );
+
+ if (!colour.empty())
+ {
+ // Order is important here.
+ colour_off = "</" + colour + ">";
+ colour = "<" + colour + ">";
+ item_name = colour + item_name + colour_off;
+ }
+
+ return (item_name);
+}
+
+
typedef std::map<std::string, item_types_pair> item_names_map;
static item_names_map item_names_cache;
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index af5645892a..e1a01c241c 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -40,7 +40,7 @@ enum item_type_id_state_type // used for values in id[4][50]
ID_KNOWN_TYPE
};
-// [dshaligram] If you edit potion colours/descriptions, also update
+// [dshaligram] If you edit potion colours/descriptions, also update
// itemname.cc.
enum potion_description_colour_type
{
@@ -61,7 +61,7 @@ enum potion_description_colour_type
PDC_NCOLOURS
};
-// [dshaligram] If you edit potion colours/descriptions, also update
+// [dshaligram] If you edit potion colours/descriptions, also update
// itemname.cc.
enum potion_description_qualifier_type
{
@@ -131,6 +131,8 @@ void set_ident_type( object_class_type basetype, int subtype,
* called from: command - itemname - invent.h
* *********************************************************************** */
const std::string menu_colour_item_prefix(const item_def &item);
+const std::string get_menu_colour_prefix_tags(item_def &item,
+ description_level_type desc);
void init_item_name_cache();
item_types_pair item_types_by_name(std::string name);
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 01030b45f8..df2d9250bf 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -499,6 +499,11 @@ void do_curse_item( item_def &item, bool quiet )
{
amusement *= 2;
}
+ else if (you.equip[EQ_WEAPON] == item.link)
+ {
+ // Redraw the weapon.
+ you.wield_change = true;
+ }
}
xom_is_stimulated(amusement);
}
@@ -514,6 +519,11 @@ void do_curse_item( item_def &item, bool quiet )
void do_uncurse_item( item_def &item )
{
+ if (item.x == -1 && item.y == -1 && you.equip[EQ_WEAPON] == item.link)
+ {
+ // Redraw the weapon.
+ you.wield_change = true;
+ }
item.flags &= (~ISFLAG_CURSED);
}
@@ -1334,10 +1344,6 @@ bool is_enchantable_weapon(const item_def &wpn, bool uncurse)
if (wpn.base_type != OBJ_WEAPONS && wpn.base_type != OBJ_MISSILES)
return (false);
- // only equipped items should be affected
-// if (!item_is_equipped(wpn))
-// return (false);
-
// Artefacts cannot be enchanted (missiles can't be artefacts).
if (wpn.base_type == OBJ_WEAPONS
&& (is_fixed_artefact(wpn)
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 5ae4aa1229..96b3f907a2 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -768,8 +768,9 @@ void item_check(bool verbose)
if (items.size() == 1 )
{
- strm << "You see here " << items[0]->name(DESC_NOCAP_A)
- << '.' << std::endl;
+ item_def it(*items[0]);
+ std::string name = get_menu_colour_prefix_tags(it, DESC_NOCAP_A);
+ strm << "You see here " << name << '.' << std::endl;
return;
}
@@ -805,26 +806,32 @@ void item_check(bool verbose)
}
out_string += static_cast<unsigned char>(item_chars[i] / 0x100);
- if (i + 1 < item_chars.size() &&
- (item_chars[i] / 0x100) != (item_chars[i+1] / 0x100))
+ if (i + 1 < item_chars.size()
+ && (item_chars[i] / 0x100) != (item_chars[i+1] / 0x100))
+ {
out_string += ' ';
+ }
}
formatted_mpr(formatted_string::parse_string(out_string),
MSGCH_FLOOR_ITEMS);
done_init_line = true;
}
- if ( verbose || static_cast<int>(items.size() + 1) < crawl_view.msgsz.y )
+ if (verbose || static_cast<int>(items.size() + 1) < crawl_view.msgsz.y)
{
- if ( !done_init_line )
+ if (!done_init_line)
strm << "Things that are here:" << std::endl;
- for ( unsigned int i = 0; i < items.size(); ++i )
- strm << items[i]->name(DESC_NOCAP_A) << std::endl;
+ for (unsigned int i = 0; i < items.size(); ++i)
+ {
+ item_def it(*items[i]);
+ std::string name = get_menu_colour_prefix_tags(it, DESC_NOCAP_A);
+ strm << name << std::endl;
+ }
}
- else if ( !done_init_line )
+ else if (!done_init_line)
strm << "There are many items here." << std::endl;
- if ( items.size() > 5 )
+ if (items.size() > 5)
learned_something_new(TUT_MULTI_PICKUP);
}
@@ -1219,7 +1226,8 @@ void pickup()
if (keyin != 'a')
{
mprf(MSGCH_PROMPT, "Pick up %s? (y/n/a/*?g,/q)",
- mitm[o].name(DESC_NOCAP_A).c_str() );
+ get_menu_colour_prefix_tags(mitm[o],
+ DESC_NOCAP_A).c_str());
#ifndef USE_TILE
keyin = get_ch();
#else
@@ -1905,9 +1913,9 @@ bool drop_item( int item_dropped, int quant_drop, bool try_offer )
const dungeon_feature_type my_grid = grd[you.x_pos][you.y_pos];
- if ( !grid_destroys_items(my_grid)
- && !copy_item_to_grid( you.inv[item_dropped],
- you.x_pos, you.y_pos, quant_drop, true ))
+ if (!grid_destroys_items(my_grid)
+ && !copy_item_to_grid( you.inv[item_dropped],
+ you.x_pos, you.y_pos, quant_drop, true ))
{
mpr( "Too many items on this level, not dropping the item." );
return (false);
@@ -2155,10 +2163,8 @@ static void _autoinscribe_floor_items()
static void _autoinscribe_inventory()
{
for (int i = 0; i < ENDOFPACK; i++)
- {
if (is_valid_item(you.inv[i]))
_autoinscribe_item( you.inv[i] );
- }
}
bool need_to_autoinscribe()
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 1ce293a3e6..ddd1a0c1cb 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -2124,9 +2124,21 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
if (!player_is_airborne()
&& you.duration[DUR_CONF]
&& !grid_is_escape_hatch(stair_find)
- && random2(100) > you.dex)
+ && force_stair != DNGN_ENTER_ABYSS
+ /*&& random2(100) > you.dex*/)
{
- mpr("In your confused state, you trip and fall down the stairs.");
+ std::string fall_where = "down the stairs";
+
+ if (stair_find == DNGN_ENTER_ABYSS
+ || stair_find == DNGN_ENTER_PANDEMONIUM
+ || stair_find == DNGN_TRANSIT_PANDEMONIUM
+ || stair_find == DNGN_ENTER_PORTAL_VAULT)
+ {
+ fall_where = "through the gate";
+ }
+
+ mprf("In your confused state, you trip and fall %s.",
+ fall_where.c_str());
// Nastier than when climbing stairs, but you'll aways get to
// your destination. -- bwr
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index c58bf6b3a2..c8e970ceeb 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -89,7 +89,7 @@ bool cast_selective_amnesia(bool force)
break;
}
- // actual handling begins here {dlb}:
+ // Actual handling begins here {dlb}:
const spell_type spell = get_spell_by_letter( keyin );
const int slot = get_spell_slot_by_letter( keyin );
@@ -129,15 +129,15 @@ bool remove_curse(bool suppress_msg)
bool success = false; // whether or not curse(s) removed {dlb}
// Special "wield slot" case - see if you can figure out why {dlb}:
- // ... because only cursed weapons in hand count as cursed -- bwr
+ // ... because only cursed *weapons* in hand count as cursed -- bwr
if (you.equip[EQ_WEAPON] != -1
&& you.inv[you.equip[EQ_WEAPON]].base_type == OBJ_WEAPONS)
{
if (item_cursed( you.inv[you.equip[EQ_WEAPON]] ))
{
+ // Also sets wield_change.
do_uncurse_item( you.inv[you.equip[EQ_WEAPON]] );
success = true;
- you.wield_change = true;
}
}
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index 1c7fe0a5dd..42c24e53b2 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -921,7 +921,7 @@ void tutorial_healing_reminder()
std::string text;
text = "Remember to rest between fights and to enter unexplored "
"terrain with full hitpoints and magic. Ideally you "
- "should retreat back areas you've already explored and "
+ "should retreat into areas you've already explored and "
"cleared of monsters; resting on the edge of the explored "
"terrain increases the chances of your rest being "
"interrupted by wandering monsters. For resting, press "