summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-06 21:21:30 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-07-06 21:21:30 +0000
commit7d423aef8123a887cb2d3188206aeea9b628bd84 (patch)
tree9c856fc3d14000851951b7920c20011f72c6e5d2 /crawl-ref
parent44d7fbb36c55859117824fe25a298afbe437221b (diff)
downloadcrawl-ref-7d423aef8123a887cb2d3188206aeea9b628bd84.tar.gz
crawl-ref-7d423aef8123a887cb2d3188206aeea9b628bd84.zip
Fix 2011722: Reallow targetting beams such that you may be hit. (There's
a new prompt now, but don't prompt a second time if you already confirmed another one before.) Fix some issues when creating items in the Abyss during GDT_GAME_START. This may or may not have played a role in 2008976. Lower spawning rate in the Abyss during GDT_GAME_START (10% spawning chance instead of guaranteed spawning per 5 turns). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6434 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/abyss.cc26
-rw-r--r--crawl-ref/source/beam.cc14
-rw-r--r--crawl-ref/source/beam.h1
-rw-r--r--crawl-ref/source/debug.cc34
-rw-r--r--crawl-ref/source/directn.cc21
-rw-r--r--crawl-ref/source/monplace.cc3
-rw-r--r--crawl-ref/source/monstuff.cc2
-rw-r--r--crawl-ref/source/spl-util.cc1
8 files changed, 56 insertions, 46 deletions
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 7d9a427909..2ef221a30a 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -219,6 +219,15 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2,
}
}
+ // During game start, number and level of items mustn't be higher than
+ // that on level 1.
+ int num_items = 150, items_level = 51;
+ if (you.char_direction == GDT_GAME_START)
+ {
+ num_items = 3 + roll_dice( 3, 11 );
+ items_level = 0;
+ }
+
for (int i = gx1; i <= gx2; i++)
for (int j = gy1; j <= gy2; j++)
{
@@ -226,7 +235,7 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2,
{
grd[i][j] = DNGN_FLOOR;
- if (items_placed < 150 && one_chance_in(200))
+ if (items_placed < num_items && one_chance_in(200))
{
if (!placed_abyssal_rune && abyssal_rune_roll != -1
&& you.char_direction != GDT_GAME_START
@@ -241,19 +250,8 @@ static void _generate_area(int gx1, int gy1, int gx2, int gy2,
}
else
{
- if (you.char_direction == GDT_GAME_START)
- {
- // Number and level of items as that on level 1.
- const int num_items = 3 + roll_dice( 3, 11 );
- const int items_level = 0;
- thing_created = items(1, OBJ_RANDOM, OBJ_RANDOM,
- true, items_level, num_items);
- }
- else
- {
- thing_created = items(1, OBJ_RANDOM, OBJ_RANDOM,
- true, 51, 250);
- }
+ thing_created = items(1, OBJ_RANDOM, OBJ_RANDOM,
+ true, items_level, 250);
}
move_item_to_grid( &thing_created, i, j );
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index b7ad0d4ce4..7ec80af5c5 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -3629,8 +3629,15 @@ static int _affect_player( bolt &beam, item_def *item )
// Check whether thrower can see player, unless thrower == player.
if (YOU_KILL(beam.thrower))
{
- beam.fr_count += 1;
- beam.fr_power += you.experience_level;
+ // Don't ask if we're aiming at ourselves.
+ if (!beam.aimed_at_feet && !beam.dont_stop_player
+ && !yesno("That beam is likely to hit yourself. Continue "
+ "anyway?", false, 'n'))
+ {
+ beam.fr_count += 1;
+ beam.fr_power += you.experience_level;
+ beam.dont_stop_player = true;
+ }
}
else if (beam.can_see_invis || !you.invisible()
|| _fuzz_invis_tracer(beam))
@@ -5638,7 +5645,8 @@ bolt::bolt() : range(0), rangeMax(0), type('*'),
msg_generated(false), in_explosion_phase(false),
smart_monster(false), can_see_invis(false),
attitude(ATT_HOSTILE), foe_ratio(0), chose_ray(false),
- beam_cancelled(false), dont_stop_foe(false), dont_stop_fr(false)
+ beam_cancelled(false), dont_stop_foe(false),
+ dont_stop_fr(false), dont_stop_player(false)
{
}
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index e81f4e6854..8ef7072978 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -152,6 +152,7 @@ struct bolt
bool dont_stop_foe; // stop_attack_prompt() returned false for foe
bool dont_stop_fr; // stop_attack_prompt() returned false for
// friend
+ bool dont_stop_player; // player answered self target prompt with 'y'
ray_def ray; // shoot on this specific ray
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index e7cb5544b2..f3cb294950 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1851,11 +1851,11 @@ void debug_item_scan( void )
if (x == 0 && y == 0)
continue;
- // Looking for infinite stacks (ie more links than tems allowed)
+ // Looking for infinite stacks (ie more links than items allowed)
// and for items which have bad coordinates (can't find their stack)
for (int obj = igrd[x][y]; obj != NON_ITEM; obj = mitm[obj].link)
{
- // Check for invalid (zero quantity) items that are linked in
+ // Check for invalid (zero quantity) items that are linked in.
if (!is_valid_item( mitm[obj] ))
{
mprf(MSGCH_ERROR, "Linked invalid item at (%d,%d)!", x, y);
@@ -1903,7 +1903,6 @@ void debug_item_scan( void )
// Let's check to see if it's an errant monster object:
for (int j = 0; j < MAX_MONSTERS; j++)
- {
for (int k = 0; k < NUM_MONSTER_SLOTS; k++)
{
if (menv[j].inv[k] == i)
@@ -1913,7 +1912,6 @@ void debug_item_scan( void )
menv[j].x, menv[j].y );
}
}
- }
}
// Current bad items of interest:
@@ -1937,21 +1935,21 @@ void debug_item_scan( void )
_dump_item( name, i, mitm[i] );
}
else if ((mitm[i].base_type == OBJ_WEAPONS
- && (abs(mitm[i].plus) > 30
+ && (abs(mitm[i].plus) > 30
|| abs(mitm[i].plus2) > 30
- || (!is_random_artefact( mitm[i] )
- && (mitm[i].special >= 30
- && mitm[i].special < 181))))
-
- || (mitm[i].base_type == OBJ_MISSILES
- && (abs(mitm[i].plus) > 25
- || (!is_random_artefact( mitm[i] )
- && mitm[i].special >= 30)))
-
- || (mitm[i].base_type == OBJ_ARMOUR
- && (abs(mitm[i].plus) > 25
- || (!is_random_artefact( mitm[i] )
- && mitm[i].special >= 30))))
+ || !is_random_artefact( mitm[i] )
+ && mitm[i].special >= 30
+ && mitm[i].special < 181))
+
+ || (mitm[i].base_type == OBJ_MISSILES
+ && (abs(mitm[i].plus) > 25
+ || !is_random_artefact( mitm[i] )
+ && mitm[i].special >= 30))
+
+ || (mitm[i].base_type == OBJ_ARMOUR
+ && (abs(mitm[i].plus) > 25
+ || !is_random_artefact( mitm[i] )
+ && mitm[i].special >= 30)))
{
mpr( "Bad plus or special value:", MSGCH_ERROR );
_dump_item( name, i, mitm[i] );
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 164d59c673..0729331445 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -1057,15 +1057,17 @@ void direction(dist& moves, targeting_type restricts,
mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER);
show_prompt = true;
}
- else if ( moves.isTarget && !see_grid(moves.tx, moves.ty) )
+ else if (moves.isTarget && !see_grid(moves.tx, moves.ty))
{
mpr("Sorry, you can't target what you can't see.",
MSGCH_EXAMINE_FILTER);
}
// Ask for confirmation if we're quitting for some odd reason.
- else if ( moves.isValid || moves.isCancel
- || yesno("Are you sure you want to fizzle?", false, 'n') )
+ else if (moves.isValid || moves.isCancel
+ || yesno("Are you sure you want to fizzle?", false, 'n'))
{
+ mpr("We're done.", MSGCH_DIAGNOSTICS);
+
// Finalize whatever is inside the loop
// (moves-internal finalizations can be done later).
moves.choseRay = show_beam;
@@ -1098,11 +1100,11 @@ void direction(dist& moves, targeting_type restricts,
if (have_moved)
{
// If the target x,y has changed, the beam must have changed.
- if ( show_beam )
+ if (show_beam)
need_beam_redraw = true;
- if ( !skip_iter ) // don't clear before we get a chance to see
- mesclr(true); // maybe not completely necessary
+ if (!skip_iter) // Don't clear before we get a chance to see.
+ mesclr(true); // Maybe not completely necessary.
terse_describe_square(moves.target());
}
@@ -1125,13 +1127,14 @@ void direction(dist& moves, targeting_type restricts,
// Draw the new ray with magenta '*'s, not including
// your square or the target square.
ray_def raycopy = ray; // temporary copy to work with
- while ( raycopy.pos() != moves.target() )
+ while (raycopy.pos() != moves.target())
{
- if ( raycopy.pos() != you.pos() )
+ if (raycopy.pos() != you.pos())
{
// Sanity: don't loop forever if the ray is problematic
- if ( !in_los(raycopy.x(), raycopy.y()) )
+ if (!in_los(raycopy.x(), raycopy.y()))
break;
+
draw_ray_glyph(raycopy.pos(), MAGENTA, '*',
MAGENTA | COLFLAG_REVERSE);
}
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 2eb35162b0..3b0bf92364 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -261,7 +261,8 @@ void spawn_random_monsters()
// Place Abyss monsters. (Now happens regularly every 5 turns which might
// look a bit strange for a place as chaotic as the Abyss. Then again,
// the player is unlikely to meet all of them and notice this.)
- if (you.level_type == LEVEL_ABYSS)
+ if (you.level_type == LEVEL_ABYSS
+ && (you.char_direction != GDT_GAME_START || one_chance_in(10)))
{
mons_place(mgen_data(WANDERING_MONSTER));
viewwindow(true, false);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 9633e0c81c..920f4d528e 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -2282,7 +2282,7 @@ static bool _choose_random_patrol_target_grid(monsters *mon)
return (count_grids);
}
-#define DEBUG_PATHFIND
+//#define DEBUG_PATHFIND
// Check all grids in LoS and mark lava and/or water as seen if the
// appropriate grids are encountered, so we later only need to do the
diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc
index 6edc0d33a8..675af72233 100644
--- a/crawl-ref/source/spl-util.cc
+++ b/crawl-ref/source/spl-util.cc
@@ -792,6 +792,7 @@ bool spell_direction( dist &spelld, bolt &pbolt,
if (!spelld.isValid)
{
+ mpr("Not valid after all?", MSGCH_DIAGNOSTICS);
// Check for user cancel.
canned_msg(MSG_OK);
return (false);