summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 21:32:07 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-07 21:32:07 +0000
commit5a806811128416a0c67409e137c929873c28cd7a (patch)
treefbde21511115a46723c43fcc07f7701e89cbefa4 /crawl-ref
parentf5a70a7cbd7c9a7dd6c41fdfade1dc53dbb77f0f (diff)
downloadcrawl-ref-5a806811128416a0c67409e137c929873c28cd7a.tar.gz
crawl-ref-5a806811128416a0c67409e137c929873c28cd7a.zip
Nerf damage of the bat transformation. Reduced from
2 + skill(unarmed_combat)/3 to 2 + rnd(skill(unarmed_combat)/5 + 1) Also replace the menu_colour_prefix colouring for prompts and the like to use message_colour instead, so those "msg" abbreviations in food_colouring.txt actually have an effect now, and players can disable colouring of prompts etc. (respects channels) while leaving it on in the inventory. I'm leaving the menu_colour_prefix function in for now, in case it can be used somewhere else. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5558 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/settings/food_colouring.txt5
-rw-r--r--crawl-ref/source/directn.cc4
-rw-r--r--crawl-ref/source/fight.cc37
-rw-r--r--crawl-ref/source/food.cc4
-rw-r--r--crawl-ref/source/itemname.cc37
-rw-r--r--crawl-ref/source/itemname.h3
-rw-r--r--crawl-ref/source/items.cc12
7 files changed, 75 insertions, 27 deletions
diff --git a/crawl-ref/settings/food_colouring.txt b/crawl-ref/settings/food_colouring.txt
index f483f5fb0c..12e9db5a1a 100644
--- a/crawl-ref/settings/food_colouring.txt
+++ b/crawl-ref/settings/food_colouring.txt
@@ -1,6 +1,9 @@
### Colouring of corpses, depending on whether you can eat them, and
### whether it's safe to eat them.
-### Colours both on the ground and in inventory!
+### Use menu_colour (inv) to colour items in your inventory or the
+### pickup menu.
+### Use message_colour (msg) to highlight items in prompts and when
+### listed on the ground.
msg := message_colour
inv := menu_colour
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 9f80ac29e4..02f3bd766c 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -1166,14 +1166,14 @@ bool in_los(int x, int y)
static bool find_monster( int x, int y, int mode, bool need_path,
int range = -1)
{
- // target the player for friendly and general spells
+ // Target the player for friendly and general spells.
if ((mode == TARG_FRIEND || mode == TARG_ANY)
&& x == you.x_pos && y == you.y_pos)
{
return (true);
}
- // don't target out of range
+ // Don't target out of range.
if (!_is_target_in_range(x, y, range))
return (false);
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 08b2c65d9f..e460f85141 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -289,11 +289,11 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker,
{
unchivalric_attack_type unchivalric = UCAT_NO_ATTACK;
- // no unchivalric attacks on monsters that cannot fight (e.g.
- // plants) or invisible monsters
+ // No unchivalric attacks on monsters that cannot fight (e.g.
+ // plants) or invisible monsters.
if (!defender->cannot_fight() && defender->visible_to(attacker))
{
- // distracted (but not batty); this only applies to players
+ // Distracted (but not batty); this only applies to players.
if (attacker->atype() == ACT_PLAYER && def->foe != MHITYOU
&& !testbits(def->flags, MF_BATTY))
{
@@ -699,7 +699,7 @@ static bool _player_vampire_draws_blood(const int mons, const int damage,
const int chunk_type = mons_corpse_effect( mon->type );
- // now print message, need biting unless already done (never for bat form!)
+ // Now print message, need biting unless already done (never for bat form!)
if (needs_bite_msg && you.attribute[ATTR_TRANSFORMATION] != TRAN_BAT)
{
mprf( "You bite %s, and draw %s blood!",
@@ -709,7 +709,7 @@ static bool _player_vampire_draws_blood(const int mons, const int damage,
else
mprf( "You draw %s's blood!", mon->name(DESC_NOCAP_THE, true).c_str() );
- // regain hp
+ // Regain hp.
if (you.hp < you.hp_max)
{
int heal = 1 + random2(damage);
@@ -723,7 +723,7 @@ static bool _player_vampire_draws_blood(const int mons, const int damage,
mprf("You feel %sbetter.", (you.hp == you.hp_max) ? "much " : "");
}
- // gain nutrition
+ // Gain nutrition.
if (you.hunger_state != HS_ENGORGED)
{
int food_value = 0;
@@ -735,7 +735,7 @@ static bool _player_vampire_draws_blood(const int mons, const int damage,
food_value = 15 + random2avg(29, 2);
}
- // bats get a little less nutrition out of it
+ // Bats get a little less nutrition out of it
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
food_value -= 5 + random2(16);
@@ -1037,7 +1037,7 @@ bool melee_attack::player_aux_unarmed()
continue;
}
- // no punching with a shield or 2-handed wpn, except staves
+ // No punching with a shield or 2-handed wpn, except staves.
if (shield || coinflip()
|| (weapon
&& hands == HANDS_TWO
@@ -1168,7 +1168,7 @@ bool melee_attack::player_apply_aux_unarmed()
aux_damage = random2(aux_damage);
- // Clobber wpn_skill
+ // Clobber wpn_skill.
wpn_skill = SK_UNARMED_COMBAT;
aux_damage = player_apply_weapon_skill(aux_damage);
aux_damage = player_apply_fighting_skill(aux_damage, true);
@@ -1577,7 +1577,7 @@ int melee_attack::player_weapon_type_modify(int damage)
return (damage);
}
- // take transformations into account, if no weapon is wielded
+ // Take transformations into account, if no weapon is wielded.
if (weap_type == WPN_UNARMED
&& you.attribute[ATTR_TRANSFORMATION] != TRAN_NONE)
{
@@ -1770,12 +1770,12 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
{
player_check_weapon_effects();
- // thirsty vampires will try to use a stabbing situation to draw blood
+ // Thirsty vampires will try to use a stabbing situation to draw blood.
if (you.species == SP_VAMPIRE && you.hunger_state < HS_SATIATED
&& mondied && stab_attempt && stab_bonus > 0
&& _player_vampire_draws_blood(monster_index(def), damage_done, true))
{
- // no further effects
+ // No further effects.
}
// Vampiric *weapon* effects for the killing blow.
else if (mondied && damage_brand == SPWPN_VAMPIRICISM
@@ -2966,7 +2966,7 @@ int melee_attack::player_unarmed_speed()
min_delay = 5;
- // Unarmed speed
+ // Unarmed speed.
if (you.burden_state == BS_UNENCUMBERED
&& one_chance_in(heavy_armour_penalty + 1))
{
@@ -2975,7 +2975,7 @@ int melee_attack::player_unarmed_speed()
else
unarmed_delay = 10 - you.skills[SK_UNARMED_COMBAT] / 5;
- // this shouldn't happen anyway... sanity
+ // This shouldn't happen anyway... sanity.
if (unarmed_delay < min_delay)
unarmed_delay = min_delay;
}
@@ -3010,7 +3010,7 @@ int melee_attack::player_calc_base_unarmed_damage()
if (you.duration[DUR_CONFUSING_TOUCH])
{
- // no base hand damage while using this spell
+ // No base hand damage while using this spell.
damage = 0;
}
@@ -3047,7 +3047,7 @@ int melee_attack::player_calc_base_unarmed_damage()
}
else if (you.equip[ EQ_GLOVES ] == -1)
{
- // claw damage only applies for bare hands
+ // Claw damage only applies for bare hands.
if (you.species == SP_TROLL)
damage += 5;
else if (you.species == SP_GHOUL)
@@ -3057,7 +3057,10 @@ int melee_attack::player_calc_base_unarmed_damage()
}
if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
- damage += you.skills[SK_UNARMED_COMBAT]/3;
+ {
+ // Bats really don't do a lot of damage.
+ damage += random2(you.skills[SK_UNARMED_COMBAT]/5 + 1);
+ }
else
damage += you.skills[SK_UNARMED_COMBAT];
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index a9bb28244e..07759d0fcc 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -564,8 +564,8 @@ bool butchery(int which_corpse)
// Also, don't bother colouring if it's only for sacrificing.
if (!sacrifice && !you.is_undead)
{
- corpse_name = get_menu_colour_prefix_tags(mitm[o],
- DESC_NOCAP_A);
+ corpse_name = get_message_colour_tags(mitm[o], DESC_NOCAP_A,
+ MSGCH_PROMPT);
}
// Shall we butcher this corpse?
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index f44bbfcd7f..47a39c3f9a 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -2283,6 +2283,43 @@ const std::string get_menu_colour_prefix_tags(item_def &item,
return (item_name);
}
+const std::string get_message_colour_tags(item_def &item,
+ description_level_type desc,
+ msg_channel_type channel)
+{
+ std::string cprf = menu_colour_item_prefix(item);
+ std::string colour = "";
+ std::string colour_off = "";
+ std::string item_name = item.name(desc);
+ cprf += " " + item_name;
+
+ int col = -1;
+ const std::vector<message_colour_mapping>& mcm
+ = Options.message_colour_mappings;
+ typedef std::vector<message_colour_mapping>::const_iterator mcmci;
+
+ for (mcmci ci = mcm.begin(); ci != mcm.end(); ++ci)
+ {
+ if (ci->message.is_filtered(channel, cprf))
+ {
+ col = ci->colour;
+ break;
+ }
+ }
+
+ if (col != -1)
+ 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 e1a01c241c..48ae1ad239 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -133,6 +133,9 @@ void set_ident_type( object_class_type basetype, int subtype,
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);
+const std::string get_message_colour_tags(item_def &item,
+ description_level_type desc,
+ msg_channel_type channel = MSGCH_PLAIN);
void init_item_name_cache();
item_types_pair item_types_by_name(std::string name);
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 0e9dd58955..157571a963 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -769,7 +769,8 @@ void item_check(bool verbose)
if (items.size() == 1 )
{
item_def it(*items[0]);
- std::string name = get_menu_colour_prefix_tags(it, DESC_NOCAP_A);
+ std::string name = get_message_colour_tags(it, DESC_NOCAP_A,
+ MSGCH_FLOOR_ITEMS);
strm << "You see here " << name << '.' << std::endl;
return;
}
@@ -824,7 +825,8 @@ void item_check(bool verbose)
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);
+ std::string name = get_message_colour_tags(it, DESC_NOCAP_A,
+ MSGCH_FLOOR_ITEMS);
strm << name << std::endl;
}
}
@@ -1214,7 +1216,7 @@ void pickup()
mpr("There are several objects here.");
while ( o != NON_ITEM )
{
- // must save this because pickup can destroy the item
+ // Must save this because pickup can destroy the item.
next = mitm[o].link;
if ( num_nonsquelched && _invisible_to_player(mitm[o]) )
@@ -1226,8 +1228,8 @@ void pickup()
if (keyin != 'a')
{
mprf(MSGCH_PROMPT, "Pick up %s? (y/n/a/*?g,/q)",
- get_menu_colour_prefix_tags(mitm[o],
- DESC_NOCAP_A).c_str());
+ get_message_colour_tags(mitm[o], DESC_NOCAP_A,
+ MSGCH_PROMPT).c_str());
#ifndef USE_TILE
keyin = get_ch();
#else