summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-17 20:52:54 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-07-17 20:52:54 +0000
commit4b806f77ff9f7da60fd0faf201b8ab83f76ce457 (patch)
treec0ea487b56eb55ac5f4bb3929f85ec1e5a961213
parent4280b1792236d066241fd6c6f36e4900f032180a (diff)
downloadcrawl-ref-4b806f77ff9f7da60fd0faf201b8ab83f76ce457.tar.gz
crawl-ref-4b806f77ff9f7da60fd0faf201b8ab83f76ce457.zip
A number of small bug fixes:
* 2811005: unknown mimics being stabbable * 2818709: restrict monsters picking up stuff to 2 items per turn * 2820097: reintroduce prompts for firing _in the direction_ of allies and fix message * 2821462: returning from tutorial screen swallowing a keypress * 2822771: fire elementals could be placed in shallow water Also, Azrael is no longer generated in the Shoals/Swamp Also, implement the second part of FR 2820876: Xom will no longer confuse the player if there's adjacent deep water or lava. This restriction doesn't apply if Xom is feeling nasty (penance or bored) and there's also no checks for water/lava further away. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10255 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/acr.cc1
-rw-r--r--crawl-ref/source/beam.cc15
-rw-r--r--crawl-ref/source/dungeon.cc7
-rw-r--r--crawl-ref/source/externs.h5
-rw-r--r--crawl-ref/source/fight.cc20
-rw-r--r--crawl-ref/source/misc.cc42
-rw-r--r--crawl-ref/source/misc.h2
-rw-r--r--crawl-ref/source/monplace.cc15
-rw-r--r--crawl-ref/source/monstuff.cc19
-rw-r--r--crawl-ref/source/spells1.cc7
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/spells3.cc4
-rw-r--r--crawl-ref/source/tutorial.cc2
-rw-r--r--crawl-ref/source/xom.cc8
14 files changed, 112 insertions, 39 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 1d04eef458..f4de428b41 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -3077,7 +3077,6 @@ static void _open_door(coord_def move, bool check_confused)
}
while (door_move.delta.origin());
}
- ASSERT(door_move.isValid);
// We got a valid direction.
const coord_def doorpos = you.pos() + door_move.delta;
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 6e7eb9c717..8a7df4e6e6 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -191,7 +191,7 @@ bool zapping(zap_type ztype, int power, bolt &pbolt,
bool needs_tracer, const char* msg)
{
#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "zapping: power=%d", power );
+ mprf(MSGCH_DIAGNOSTICS, "zapping: power=%d", power);
#endif
pbolt.thrower = KILL_YOU_MISSILE;
@@ -2030,7 +2030,7 @@ void bolt::do_fire()
}
ASSERT(!grid_is_solid(grd(pos()))
- || (is_tracer && affects_wall(grd(pos()))));
+ || is_tracer && affects_wall(grd(pos())));
const bool was_seen = seen;
if (!was_seen && range > 0 && !invisible() && see_grid(pos()))
@@ -3531,7 +3531,7 @@ bool bolt::misses_player()
void bolt::affect_player_enchantment()
{
- if (has_saving_throw() && flavour != BEAM_POLYMORPH
+ if (flavour != BEAM_POLYMORPH && has_saving_throw()
&& you_resist_magic(ench_power))
{
// You resisted it.
@@ -4140,8 +4140,7 @@ void bolt::handle_stop_attack_prompt(monsters* mon)
if (friend_info.count == 1 && !friend_info.dont_stop
|| foe_info.count == 1 && !foe_info.dont_stop)
{
- const bool on_target = (target == mon->pos());
- if (stop_attack_prompt(mon, true, on_target))
+ if (stop_attack_prompt(mon, true, target))
{
beam_cancelled = true;
finish_beam();
@@ -4192,7 +4191,7 @@ void bolt::tracer_nonenchantment_affect_monster(monsters* mon)
return;
// Check only if actual damage.
- if (final > 0)
+ if (!is_tracer && final > 0)
{
for (unsigned int i = 0; i < messages.size(); ++i)
mpr(messages[i].c_str(), MSGCH_MONSTER_DAMAGE);
@@ -5067,6 +5066,10 @@ int bolt::range_used_on_hit(const actor* victim) const
else
used = 1;
+ // Assume we didn't hit, after all.
+ if (is_tracer && used == BEAM_STOP)
+ return 1;
+
if (in_explosion_phase)
return (used);
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index f741f1326c..3dba2c23a0 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3345,6 +3345,13 @@ static monster_type _pick_unique(int lev)
(lev <= 19) ? _choose_unique_by_depth(5) :
_choose_unique_by_depth(6));
+ // Azrael may not be created in the Swamp or Shoals.
+ if (which_unique == MONS_AZRAEL
+ && (player_in_branch(BRANCH_SWAMP) || player_in_branch(BRANCH_SHOALS)))
+ {
+ return MONS_PROGRAM_BUG;
+ }
+
// If applicable, replace it with one of the uniques appearing
// only in some branches.
if (player_in_branch(BRANCH_VESTIBULE_OF_HELL))
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index c2a0ec73be..3b5157309d 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -118,6 +118,11 @@ struct coord_def
return (x < other.x) || (x == other.x && y < other.y);
}
+ bool operator > (const coord_def &other) const
+ {
+ return (x > other.x) || (x == other.x && y > other.y);
+ }
+
const coord_def &operator += (const coord_def &other)
{
x += other.x;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index ebb45c0720..d024e025a7 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -567,7 +567,7 @@ bool melee_attack::attack()
if (attacker->atype() == ACT_PLAYER && defender->atype() == ACT_MONSTER)
{
- if (stop_attack_prompt(defender_as_monster(), false, false))
+ if (stop_attack_prompt(defender_as_monster(), false, attacker->pos()))
{
cancel_attack = true;
return (false);
@@ -1180,7 +1180,7 @@ bool melee_attack::player_aux_unarmed()
continue;
}
// no biting with visored helmet
- if (you.equip[EQ_HELMET] != -1
+ if (you.equip[EQ_HELMET] != -1
&& (get_helmet_desc((you.inv[you.equip[EQ_HELMET]])) == THELM_DESC_VISORED))
{
continue;
@@ -3751,6 +3751,14 @@ int melee_attack::player_to_hit(bool random_factor)
void melee_attack::player_stab_check()
{
+ // Unknown mimics cannot be stabbed.
+ if (mons_is_unknown_mimic(defender_as_monster()))
+ {
+ stab_attempt = false;
+ stab_bonus = 0;
+ return;
+ }
+
const unchivalric_attack_type uat = is_unchivalric_attack(&you, defender);
stab_attempt = (uat != UCAT_NO_ATTACK);
const bool roll_needed = (uat != UCAT_SLEEPING && uat != UCAT_PARALYSED);
@@ -3761,7 +3769,9 @@ void melee_attack::player_stab_check()
switch (uat)
{
- case UCAT_NO_ATTACK: stab_bonus = 0; break;
+ case UCAT_NO_ATTACK:
+ stab_bonus = 0;
+ break;
case UCAT_HELD_IN_NET:
case UCAT_PETRIFYING:
case UCAT_PETRIFIED:
@@ -3774,7 +3784,9 @@ void melee_attack::player_stab_check()
case UCAT_FLEEING:
stab_bonus = 2;
break;
- case UCAT_DISTRACTED: stab_bonus = 3; break;
+ case UCAT_DISTRACTED:
+ stab_bonus = 3;
+ break;
}
// See if we need to roll against dexterity / stabbing.
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index b33c0c0c93..90d89d074f 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -3039,7 +3039,7 @@ std::string your_hand(bool plural)
}
bool stop_attack_prompt(const monsters *mon, bool beam_attack,
- bool beam_target)
+ coord_def beam_target)
{
ASSERT(!crawl_state.arena);
@@ -3049,6 +3049,7 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
bool retval = false;
bool prompt = false;
+ const bool mon_target = (beam_target == mon->pos());
const bool inSanctuary = (is_sanctuary(you.pos())
|| is_sanctuary(mon->pos()));
const bool wontAttack = mons_wont_attack(mon);
@@ -3063,13 +3064,34 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
if (isFriendly)
{
// Listed in the form: "your rat", "Blork the orc".
- snprintf(info, INFO_SIZE, "Really %s %s%s?",
- (beam_attack) ? (beam_target) ? "fire at"
- : "fire through"
- : "attack",
- mon->name(DESC_NOCAP_THE).c_str(),
- (inSanctuary) ? ", despite your sanctuary"
- : "");
+ std::string verb = "";
+ bool need_mon_name = true;
+ if (beam_attack)
+ {
+ verb = "fire ";
+ if (mon_target)
+ verb += "at ";
+ else if (you.pos() < beam_target && beam_target < mon->pos()
+ || you.pos() > beam_target && beam_target > mon->pos())
+ {
+ verb += "in " + mon->name(DESC_NOCAP_THE) + "'s direction";
+ need_mon_name = false;
+ }
+ else
+ {
+ verb += "through ";
+ }
+ }
+ else
+ verb = "attack ";
+
+ if (need_mon_name)
+ verb += mon->name(DESC_NOCAP_THE);
+
+ snprintf(info, INFO_SIZE, "Really %s%s?",
+ verb.c_str(),
+ (inSanctuary) ? ", despite your sanctuary" : "");
+
prompt = true;
}
else if (inSanctuary || wontAttack
@@ -3079,8 +3101,8 @@ bool stop_attack_prompt(const monsters *mon, bool beam_attack,
&& !tso_unchivalric_attack_safe_monster(mon))
{
snprintf(info, INFO_SIZE, "Really %s the %s%s%s%s%s?",
- (beam_attack) ? (beam_target) ? "fire at"
- : "fire through"
+ (beam_attack) ? (mon_target) ? "fire at"
+ : "fire through"
: "attack",
(isUnchivalric) ? "helpless "
: "",
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 0ced7ed8e9..e15bce8eb1 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -112,7 +112,7 @@ void reveal_secret_door(const coord_def& p);
std::string your_hand(bool plural);
bool stop_attack_prompt(const monsters *mon, bool beam_attack,
- bool beam_target);
+ coord_def beam_target);
bool is_orckind(const actor *act);
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 212a8147f4..da3f64f1e5 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -140,11 +140,20 @@ bool monster_habitable_grid(int monster_class,
dungeon_feature_type actual_grid,
int flies, bool paralysed)
{
+ // No monster may be placed on open sea.
+ if (actual_grid == DNGN_OPEN_SEA)
+ return (false);
+
const dungeon_feature_type grid_preferred =
habitat2grid(mons_class_primary_habitat(monster_class));
const dungeon_feature_type grid_nonpreferred =
habitat2grid(mons_class_secondary_habitat(monster_class));
+ // Special check for fire elementals since their habitat is floor which
+ // is generally considered compatible with shallow water.
+ if (monster_class == MONS_FIRE_ELEMENTAL && grid_is_watery(actual_grid))
+ return (false);
+
if (grid_compatible(grid_preferred, actual_grid)
|| (grid_nonpreferred != grid_preferred
&& grid_compatible(grid_nonpreferred, actual_grid)))
@@ -1014,10 +1023,10 @@ static int _place_monster_aux(const mgen_data &mg,
ASSERT(mgrd(fpos) == NON_MONSTER);
- if (crawl_state.arena)
+ if (crawl_state.arena
+ && arena_veto_place_monster(mg, first_band_member, fpos))
{
- if (arena_veto_place_monster(mg, first_band_member, fpos))
- return (-1);
+ return (-1);
}
// Now, actually create the monster. (Wheeee!)
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index ccd9b07b4e..a6c288e72a 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3835,8 +3835,10 @@ static void _check_wander_target(monsters *mon, bool isPacified = false,
bool need_target = true;
if (!can_move)
+ {
can_move = (mons_amphibious(mon))
? DNGN_DEEP_WATER : DNGN_SHALLOW_WATER;
+ }
if (mon->is_travelling())
need_target = _handle_monster_travelling(mon, can_move);
@@ -7704,7 +7706,7 @@ static bool _handle_pickup(monsters *monster)
}
else
{
- // shouldn't be much trouble to digest a huge pile of gold!
+ // Shouldn't be much trouble to digest a huge pile of gold!
if (quant > 500)
quant = 500 + roll_dice( 2, (quant - 500) / 2 );
@@ -7748,17 +7750,16 @@ static bool _handle_pickup(monsters *monster)
// Note: Monsters only look at stuff near the top of stacks.
// XXX: Need to put in something so that monster picks up multiple items
// (eg ammunition) identical to those it's carrying.
- // Monsters may now pick up several items in the same turn, though with
- // reducing chances. (jpeg)
- bool success = false;
+ // Monsters may now pick up up to two items in the same turn. (jpeg)
+ int count_pickup = 0;
for (stack_iterator si(monster->pos()); si; ++si)
{
if (monster->pickup_item(*si, monster_nearby))
- success = true;
- if (coinflip())
+ count_pickup++;
+ if (count_pickup > 1 || coinflip())
break;
}
- return (success);
+ return (count_pickup > 0);
}
static void _jelly_grows(monsters *monster)
@@ -8193,6 +8194,10 @@ static bool _mon_can_move_to_pos(const monsters *monster,
if (!in_bounds(targ))
return (false);
+ // No monster may enter the open sea.
+ if (grd(targ) == DNGN_OPEN_SEA)
+ return (false);
+
// Non-friendly and non-good neutral monsters won't enter
// sanctuaries.
if (!mons_wont_attack(monster)
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index c4085823d4..c0cb9fe8aa 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -138,7 +138,12 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink)
continue;
}
- if (see_grid_no_trans(beam.target))
+ if (!wizard_blink && grd(beam.target) == DNGN_OPEN_SEA)
+ {
+ mesclr();
+ mpr("You can't blink into the sea!");
+ }
+ else if (see_grid_no_trans(beam.target))
{
// Grid in los, no problem.
break;
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 13409640aa..efa10e4b85 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -725,7 +725,7 @@ bool vampiric_drain(int pow, const dist &vmove)
god_conduct_trigger conducts[3];
disable_attack_conducts(conducts);
- const bool success = !stop_attack_prompt(monster, false, false);
+ const bool success = !stop_attack_prompt(monster, false, you.pos());
if (success)
{
@@ -804,7 +804,7 @@ bool burn_freeze(int pow, beam_type flavour, monsters *monster)
god_conduct_trigger conducts[3];
disable_attack_conducts(conducts);
- const bool success = !stop_attack_prompt(monster, false, false);
+ const bool success = !stop_attack_prompt(monster, false, you.pos());
if (success)
{
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index 5969ba834a..0a960b525f 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -199,7 +199,7 @@ bool cast_smiting(int power, const coord_def& where)
god_conduct_trigger conducts[3];
disable_attack_conducts(conducts);
- const bool success = !stop_attack_prompt(m, false, false);
+ const bool success = !stop_attack_prompt(m, false, you.pos());
if (success)
{
@@ -240,7 +240,7 @@ int airstrike(int power, dist &beam)
god_conduct_trigger conducts[3];
disable_attack_conducts(conducts);
- success = !stop_attack_prompt(monster, false, false);
+ success = !stop_attack_prompt(monster, false, you.pos());
if (success)
{
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index dc2d8b6798..7569039127 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -200,10 +200,8 @@ bool pick_tutorial()
{
case CK_BKSP:
case ESCAPE:
- choose_race();
return (false);
case ' ':
- choose_class();
return (false);
case 'X':
cprintf(EOL "Goodbye!");
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 78310ba4a3..6a1a389ac1 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -2246,6 +2246,14 @@ static bool _xom_chaos_upgrade_nearby_monster()
static bool _xom_player_confusion_effect(int sever)
{
+ if (!_xom_feels_nasty())
+ {
+ // Don't confuse the player if standing next to lava or deep water.
+ for (adjacent_iterator ai; ai; ++ai)
+ if (in_bounds(*ai) && is_grid_dangerous(grd(*ai)))
+ return (false);
+ }
+
bool rc = false;
// Looks like this will *always* succeed?