summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/beam.cc10
-rw-r--r--crawl-ref/source/fight.cc20
-rw-r--r--crawl-ref/source/food.cc6
-rw-r--r--crawl-ref/source/item_use.cc11
-rw-r--r--crawl-ref/source/itemname.cc4
-rw-r--r--crawl-ref/source/itemprop.cc4
-rw-r--r--crawl-ref/source/mon-util.cc3
-rw-r--r--crawl-ref/source/monplace.cc41
-rw-r--r--crawl-ref/source/monstuff.cc5
-rw-r--r--crawl-ref/source/mstuff2.cc24
10 files changed, 73 insertions, 55 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 7727b70f7d..870fc2bc59 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -2685,7 +2685,7 @@ bool curare_hits_monster( const bolt &beam,
return (mondied);
}
-// actually poisons a monster (w/ message)
+// Actually poisons a monster (w/ message).
bool poison_monster( monsters *monster,
kill_category from_whom,
int levels,
@@ -2702,8 +2702,8 @@ bool poison_monster( monsters *monster,
monster->add_ench( mon_enchant(ENCH_POISON, levels, from_whom) );
const mon_enchant new_pois = monster->get_ench(ENCH_POISON);
- // actually do the poisoning
- // note: order important here
+ // Actually do the poisoning.
+ // Note: order important here.
if (verbose && new_pois.degree > old_pois.degree)
{
simple_monster_message( monster,
@@ -2711,14 +2711,14 @@ bool poison_monster( monsters *monster,
: " looks even sicker." );
}
- // finally, take care of deity preferences
+ // Finally, take care of deity preferences.
if (from_whom == KC_YOU)
did_god_conduct( DID_POISON, 5 + random2(3) );
return (new_pois.degree > old_pois.degree);
}
-// actually napalms a monster (w/ message)
+// Actually napalms a monster (w/ message).
void _sticky_flame_monster( int mn, kill_category who, int levels )
{
monsters *monster = &menv[mn];
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index 9b2a31a6ef..40de539dd2 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -674,7 +674,7 @@ static bool _vamp_wants_blood_from_monster(const monsters *mon)
const int chunk_type = mons_corpse_effect( mon->type );
- // don't drink poisonous or mutagenic blood
+ // Don't drink poisonous or mutagenic blood.
return (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED
|| chunk_type == CE_POISONOUS && player_res_poison());
}
@@ -2187,10 +2187,12 @@ bool melee_attack::apply_damage_brand()
case SPWPN_STAFF_OF_OLGREB:
if (!one_chance_in(4))
{
- int old_poison = 0;
+ int old_poison;
if (defender->atype() == ACT_PLAYER)
old_poison = you.duration[DUR_POISONING];
+ else
+ old_poison = (def->get_ench(ENCH_POISON)).degree;
// Poison monster message needs to arrive after hit message.
emit_nodmg_hit_message();
@@ -2200,7 +2202,9 @@ bool melee_attack::apply_damage_brand()
defender->poison( attacker, 2 );
if (defender->atype() == ACT_PLAYER
- && old_poison < you.duration[DUR_POISONING])
+ && old_poison < you.duration[DUR_POISONING]
+ || defender->atype() != ACT_PLAYER
+ && old_poison < (def->get_ench(ENCH_POISON)).degree)
{
obvious_effect = true;
}
@@ -2212,16 +2216,14 @@ bool melee_attack::apply_damage_brand()
drain_defender();
break;
- // 9 = speed - done before
case SPWPN_VORPAL:
special_damage = 1 + random2(damage_done) / 2;
- // note: leaving special_damage_message empty because there
- // isn't one.
+ // Note: Leaving special_damage_message empty because there isn't one.
break;
case SPWPN_VAMPIRICISM:
{
- // vampire bat form, why the special handling?
+ // Vampire bat form -- why the special handling?
if (attacker->atype() == ACT_PLAYER && you.species == SP_VAMPIRE
&& you.attribute[ATTR_TRANSFORMATION] == TRAN_BAT)
{
@@ -2239,7 +2241,7 @@ bool melee_attack::apply_damage_brand()
obvious_effect = true;
- // handle weapon effects
+ // Handle weapon effects.
// We only get here if we've done base damage, so no
// worries on that score.
@@ -2261,7 +2263,7 @@ bool melee_attack::apply_damage_brand()
int hp_boost = 0;
- // thus is probably more valuable on larger weapons?
+ // Thus is probably more valuable on larger weapons?
if (weapon && is_fixed_artefact( *weapon )
&& weapon->special == SPWPN_VAMPIRES_TOOTH)
{
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index f030f9af06..a9bb28244e 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -1510,12 +1510,6 @@ static void _eating(unsigned char item_class, int item_type)
break;
} // end carnivore/herbivore modifier listing {dlb}
- // Next, let's take care of messaging {dlb}:
- if (how_carnivorous > 0 && carnivore_modifier < 0)
- mpr("Blech - you need meat!");
- else if (how_herbivorous > 0 && herbivore_modifier < 0)
- mpr("Blech - you need greens!");
-
// Finally, modify player's hunger level {dlb}:
if (carnivore_modifier && how_carnivorous > 0)
food_value += (carnivore_modifier * how_carnivorous);
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 34c11516dd..7b95625f88 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1747,8 +1747,8 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
int exHitBonus = 0, exDamBonus = 0; // 'extra' bonus from skill/dex/str
int effSkill = 0; // effective launcher skill
int dice_mult = 100;
- bool returning = false; // item can return to pack
- bool did_return = false; // returning item actually does return to pack
+ bool returning = false; // Item can return to pack.
+ bool did_return = false; // Returning item actually does return to pack.
int slayDam = 0;
if (!teleport)
@@ -2538,7 +2538,12 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// Player saw the item return.
if (!is_artefact(you.inv[throw_2]))
- set_ident_flags(you.inv[throw_2], ISFLAG_KNOW_TYPE);
+ {
+ // Since this only happens for non-artefacts, also mark properties
+ // as known.
+ set_ident_flags(you.inv[throw_2],
+ ISFLAG_KNOW_TYPE | ISFLAG_KNOW_PROPERTIES);
+ }
}
else
{
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index e63f4bd751..f44bbfcd7f 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1187,8 +1187,8 @@ std::string item_def::name_aux( description_level_type desc,
break;
if (item_typ == ARM_ROBE || item_typ == ARM_CLOAK
|| item_typ == ARM_GLOVES || item_typ == ARM_BOOTS
- || (get_armour_slot( *this ) == EQ_HELMET &&
- !is_hard_helmet( *this )))
+ || get_armour_slot( *this ) == EQ_HELMET
+ && !is_hard_helmet( *this ))
{
buff << "embroidered ";
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index df2d9250bf..0d0c0a4ddc 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -145,7 +145,7 @@ static armour_def Armour_prop[NUM_ARMOURS] =
{ ARM_NAGA_BARDING, "naga barding", 4, -2, 100,
true, EQ_BOOTS, SIZE_MEDIUM, SIZE_LARGE },
- // Note: shields use ac-value as sh-value, EV pen is used for heavy_shield
+ // Note: shields use ac-value as sh-value, EV pen is used for heavy_shield.
{ ARM_BUCKLER, "buckler", 3, 0, 90,
true, EQ_SHIELD, SIZE_LITTLE, SIZE_MEDIUM },
{ ARM_SHIELD, "shield", 5, -1, 150,
@@ -639,7 +639,7 @@ unsigned long full_ident_mask( const item_def& item )
break;
case OBJ_WEAPONS:
case OBJ_ARMOUR:
- // all flags necessary for full identification
+ // All flags necessary for full identification.
default:
break;
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index b9acb16df5..9d5f0a755f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -2838,6 +2838,7 @@ bool monsters::can_drown() const
|| mons_genus(type) == MONS_MUMMY
|| mons_genus(type) == MONS_GHOUL
|| mons_genus(type) == MONS_VAMPIRE
+ || mons_is_zombified(this)
|| holiness() == MH_DEMONIC);
}
@@ -5502,7 +5503,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
hurt_monster( this, dam );
#if DEBUG_DIAGNOSTICS
- // for debugging, we don't have this silent.
+ // For debugging, we don't have this silent.
simple_monster_message( this, " takes poison damage.",
MSGCH_DIAGNOSTICS );
mprf(MSGCH_DIAGNOSTICS, "poison damage: %d", dam );
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 128626aec1..141920fb15 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -2258,9 +2258,16 @@ bool monster_pathfind::start_pathfind(monsters *mon, coord_def dest, bool msg)
return (true);
}
+ // NOTE: We never do any traversable() check for the starting square
+ // (target). This means that even if the target cannot be reached
+ // we may still find a path leading adjacent to this position, which
+ // is desirable if e.g. the player is hovering over deep water
+ // surrounded by shallow water or floor, or if a foe is hiding in
+ // a wall.
+ // If the surrounding squares also are not traversable, we return
+ // early that no path could be found.
max_length = min_length = grid_distance(pos.x, pos.y, target.x, target.y);
-// memset(dist, INFINITE_DISTANCE, sizeof(dist));
for (int i = 0; i < GXM; i++)
for (int j = 0; j < GYM; j++)
dist[i][j] = INFINITE_DISTANCE;
@@ -2443,6 +2450,7 @@ bool monster_pathfind::traversable(coord_def p)
if (tt == TRAP_ZOT && grd(p) != DNGN_UNDISCOVERED_TRAP
&& mons_friendly(mons))
{
+ // Don't allow allies to pass over known Zot traps.
return (false);
}
@@ -2464,12 +2472,16 @@ int monster_pathfind::travel_cost(coord_def npos)
if (grd(npos) == DNGN_CLOSED_DOOR || grd(npos) == DNGN_SECRET_DOOR)
return 2;
- // Moving from floor to water (or vice versa) is a bit more expensive.
- // The deep water checks are only done in case of amphibious monsters.
- if ((grd(pos) == DNGN_SHALLOW_WATER || grd(pos) == DNGN_DEEP_WATER)
- && grid_compatible(grd(npos), DNGN_FLOOR)
- || (grd(npos) == DNGN_SHALLOW_WATER || grd(npos) == DNGN_DEEP_WATER)
- && grid_compatible(grd(pos), DNGN_FLOOR))
+ const int montype = mons_is_zombified(mons) ? mons_zombie_base(mons)
+ : mons->type;
+
+ const bool airborne = _mons_airborne(montype, -1, false);
+
+ // Travelling through water, entering or leaving water is more expensive
+ // for non-amphibious monsters, so they'll avoid it where possible.
+ // Only tested for shallow water since they can't enter deep water anywa.
+ if (!airborne && !mons_amphibious(montype)
+ && (grd(pos) == DNGN_SHALLOW_WATER || grd(npos) == DNGN_SHALLOW_WATER))
{
return 2;
}
@@ -2500,16 +2512,10 @@ int monster_pathfind::travel_cost(coord_def npos)
return 1;
}
- if (knows_trap)
- {
- const int montype = mons_is_zombified(mons) ? mons_zombie_base(mons)
- : mons->type;
-
- // Mechanical traps can be avoided by flying, as can shafts, and
- // tele traps are never traversable anyway.
- if (!_mons_airborne(montype, -1, false))
- return 2;
- }
+ // Mechanical traps can be avoided by flying, as can shafts, and
+ // tele traps are never traversable anyway.
+ if (knows_trap && !airborne)
+ return 2;
return 1;
}
@@ -2538,7 +2544,6 @@ void monster_pathfind::update_pos(coord_def npos, int total)
{
if (vec[i] == npos)
{
-// mpr("Attempting to erase entry.");
vec.erase(vec.begin() + i);
break;
}
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 04fbbadd3a..9bb733e6f3 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5892,6 +5892,11 @@ void mons_check_pool(monsters *mons, killer_type killer, int killnum)
simple_monster_message( mons, " falls apart.",
MSGCH_MONSTER_DAMAGE, MDAM_DEAD);
}
+ else if (mons_is_zombified(mons))
+ {
+ simple_monster_message( mons, " sinks like a rock.",
+ MSGCH_MONSTER_DAMAGE, MDAM_DEAD);
+ }
else
{
simple_monster_message( mons, " drowns.",
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index b090a1e68b..ccafa312d9 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1163,7 +1163,7 @@ void setup_generic_throw(struct monsters *monster, struct bolt &pbolt)
bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
{
- // XXX: ugly hack, but avoids adding dynamic allocation to this code
+ // XXX: Ugly hack, but avoids adding dynamic allocation to this code.
char throw_buff[ ITEMNAME_SIZE ];
bool returning = (get_weapon_brand(mitm[hand_used]) == SPWPN_RETURNING
@@ -1179,7 +1179,7 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
int damMult = 0;
int diceMult = 100;
- // some initial convenience & initializations
+ // Some initial convenience & initializations.
int wepClass = mitm[hand_used].base_type;
int wepType = mitm[hand_used].sub_type;
@@ -1499,7 +1499,7 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
// decrease inventory
bool really_returns;
- if ( returning && !one_chance_in(mons_power(monster->type) + 3) )
+ if (returning && !one_chance_in(mons_power(monster->type) + 3))
really_returns = true;
else
really_returns = false;
@@ -1514,20 +1514,26 @@ bool mons_throw(struct monsters *monster, struct bolt &pbolt, int hand_used)
really_returns = false;
}
- if ( really_returns )
+ if (really_returns)
{
- // Fire beam in reverse
+ // Fire beam in reverse.
pbolt.setup_retrace();
viewwindow(true, false);
fire_beam(pbolt, &item, false);
- msg::stream << "The weapon returns to "
+ msg::stream << "The weapon returns "
<< (player_monster_visible(monster)?
- monster->name(DESC_NOCAP_THE) : "where it came from")
+ ("to " + monster->name(DESC_NOCAP_THE))
+ : "whence it came from")
<< "!" << std::endl;
- // Player saw the item return
+ // Player saw the item return.
if (!is_artefact(item))
- set_ident_flags(mitm[hand_used], ISFLAG_KNOW_TYPE);
+ {
+ // Since this only happens for non-artefacts, also mark properties
+ // as known.
+ set_ident_flags(mitm[hand_used],
+ ISFLAG_KNOW_TYPE | ISFLAG_KNOW_PROPERTIES);
+ }
}
else if (dec_mitm_item_quantity( hand_used, 1 ))
monster->inv[returning ? MSLOT_WEAPON : MSLOT_MISSILE] = NON_ITEM;