summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-19 05:12:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-19 05:12:15 +0000
commit30824b7084af3c2dce35d2eae4d4600f67ab4e06 (patch)
tree852963a375c0c492fd9202bfa2d1d64842b4f285 /crawl-ref/source/beam.cc
parent10391ff4e676a29fbc2836d1494ed2aae4b112a7 (diff)
downloadcrawl-ref-30824b7084af3c2dce35d2eae4d4600f67ab4e06.tar.gz
crawl-ref-30824b7084af3c2dce35d2eae4d4600f67ab4e06.zip
Added "The Stairs" card (not yet in any deck), eventually to be the card which
re-arranges all stairs on the level, but now is just used to test the code used to move stairs in LOS away or towards the player. Added beam flavour BEAM_VISUAL for animating someting moving in a line which doesn't have any effects on its own, and removed BEAM_LINE_OF_SIGHT, which was no longer being used. Added bolt structure field "delay", which can be used to change the delay between animating each square in a beam from the default of 15 msec. For eventual use as a Xom effect added the stairs-are-avoiding-you durations DUR_REPEL_STAIRS_MOVE and DUR_REPEL_STAIRS_CLIMB. If DUR_REPEL_STAIRS_MOVE alone is set then stepping onto a stairs/portal/etc has a 50% chance of making it move away in a random direction. If DUR_REPEL_STAIRS_CLIMB alone is set then attempting to climb a stairs/etc has a 50% chance of making it move away before you can get through it (and ending your turn in the process). If both are set then moving onto it and attempting to climb each have a 29% chance of making it move, for a combined chance of 49.59% of a move-and-climb making the stairs move away. Once a stair is successfully taken there's a 50% chance of the stair on the other end moving away from the player, and then both durations are reset to 0. These can be tested by drawing The Stairs card ("&c stair"), which will set DUR_REPEL_STAIRS_CLIMB if you're on top of a stair or DUR_REPEL_STAIRS_MOVE if your'e not. Added a few wizard targetting command placeholders. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7865 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc68
1 files changed, 34 insertions, 34 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index da31322807..5adae5ff09 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -1531,7 +1531,7 @@ static void _munge_bounced_bolt(bolt &old_bolt, bolt &new_bolt,
void fire_beam(bolt &pbolt)
{
- ASSERT(pbolt.flavour > BEAM_NONE && pbolt.flavour < NUM_BEAMS);
+ ASSERT(pbolt.flavour > BEAM_NONE && pbolt.flavour < BEAM_FIRST_PSEUDO);
ASSERT(!pbolt.drop_item || pbolt.item);
ASSERT(!pbolt.dropped_item);
@@ -1540,6 +1540,9 @@ void fire_beam(bolt &pbolt)
const bool beam_invisible =
pbolt.type == 0 || (!pbolt.name.empty() && pbolt.name[0] == '0');
+ ASSERT(pbolt.flavour != BEAM_VISUAL
+ || (!beam_invisible && pbolt.colour != BLACK));
+
const int reflections = pbolt.reflections;
if (reflections == 0)
{
@@ -1554,8 +1557,8 @@ void fire_beam(bolt &pbolt)
pbolt.seen = true;
int midx = mgrd(pbolt.source);
- if (!pbolt.is_tracer && !YOU_KILL(pbolt.thrower)
- && !crawl_state.is_god_acting()
+ if (pbolt.flavour != BEAM_VISUAL && !pbolt.is_tracer
+ && !YOU_KILL(pbolt.thrower) && !crawl_state.is_god_acting()
&& (midx == NON_MONSTER || !you.can_see(&menv[midx])))
{
mprf("%s appears from out of thin air!",
@@ -1611,21 +1614,18 @@ void fire_beam(bolt &pbolt)
#endif
#if DEBUG_DIAGNOSTICS
- if (pbolt.flavour != BEAM_LINE_OF_SIGHT)
- {
- mprf( MSGCH_DIAGNOSTICS, "%s%s%s [%s] (%d,%d) to (%d,%d): "
- "ty=%d col=%d flav=%d hit=%d dam=%dd%d range=%d",
- (pbolt.is_beam) ? "beam" : "missile",
- (pbolt.is_explosion) ? "*" :
- (pbolt.is_big_cloud) ? "+" : "",
- (pbolt.is_tracer) ? " tracer" : "",
- pbolt.name.c_str(),
- pbolt.source.x, pbolt.source.y,
- pbolt.target.x, pbolt.target.y,
- pbolt.type, pbolt.colour, pbolt.flavour,
- pbolt.hit, pbolt.damage.num, pbolt.damage.size,
- pbolt.range);
- }
+ mprf( MSGCH_DIAGNOSTICS, "%s%s%s [%s] (%d,%d) to (%d,%d): "
+ "ty=%d col=%d flav=%d hit=%d dam=%dd%d range=%d",
+ (pbolt.is_beam) ? "beam" : "missile",
+ (pbolt.is_explosion) ? "*" :
+ (pbolt.is_big_cloud) ? "+" : "",
+ (pbolt.is_tracer) ? " tracer" : "",
+ pbolt.name.c_str(),
+ pbolt.source.x, pbolt.source.y,
+ pbolt.target.x, pbolt.target.y,
+ pbolt.type, pbolt.colour, pbolt.flavour,
+ pbolt.hit, pbolt.damage.num, pbolt.damage.size,
+ pbolt.range);
#endif
// init
@@ -1753,7 +1753,8 @@ void fire_beam(bolt &pbolt)
pbolt.seen = true;
}
- if (!was_seen && pbolt.seen && !pbolt.is_tracer)
+ if (pbolt.flavour != BEAM_VISUAL && !was_seen && pbolt.seen
+ && !pbolt.is_tracer)
{
mprf("%s appears from out of your range of vision.",
article_a(pbolt.name, false).c_str());
@@ -1824,7 +1825,7 @@ void fire_beam(bolt &pbolt)
if (tile_beam != -1 && in_los_bounds(drawpos))
{
tiles.add_overlay(testpos, tile_beam);
- delay(15);
+ delay(pbolt.delay);
}
else
#endif
@@ -1841,7 +1842,7 @@ void fire_beam(bolt &pbolt)
// Get curses to update the screen so we can see the beam.
update_screen();
- delay(15);
+ delay(pbolt.delay);
#ifdef MISSILE_TRAILS_OFF
// mv: It's not optimal but is usually enough.
@@ -2939,13 +2940,6 @@ static void _beam_explodes(bolt &beam, const coord_def& p)
static bool _beam_term_on_target(bolt &beam, const coord_def& p)
{
- if (beam.flavour == BEAM_LINE_OF_SIGHT)
- {
- if (beam.thrower != KILL_YOU_MISSILE)
- beam.foe_count++;
- return (true);
- }
-
// Generic - all explosion-type beams can be targeted at empty space,
// and will explode there. This semantic also means that a creature
// in the target cell will have no chance to dodge or block, so we
@@ -3085,10 +3079,6 @@ int affect(bolt &beam, const coord_def& _p, item_def *item, bool affect_items)
// Extra range used by hitting something.
int rangeUsed = 0;
- // Line of sight never affects anything.
- if (beam.flavour == BEAM_LINE_OF_SIGHT)
- return (0);
-
coord_def p = _p;
if (!in_bounds(_p))
p = beam.pos;
@@ -3096,6 +3086,14 @@ int affect(bolt &beam, const coord_def& _p, item_def *item, bool affect_items)
if (!item)
item = beam.item;
+ if (beam.flavour == BEAM_VISUAL)
+ {
+ if (mgrd(p) != NON_MONSTER)
+ behaviour_event( &menv[mgrd(p)], ME_DISTURB );
+
+ return (0);
+ }
+
if (grid_is_solid(grd(p)))
{
if (beam.is_tracer) // Tracers always stop on walls.
@@ -3654,6 +3652,7 @@ static bool _beam_is_harmless(bolt &beam, monsters *mon)
// The others are handled here.
switch (beam.flavour)
{
+ case BEAM_VISUAL:
case BEAM_DIGGING:
return (true);
@@ -3704,6 +3703,7 @@ static bool _beam_is_harmless_player(bolt &beam)
// The others are handled here.
switch (beam.flavour)
{
+ case BEAM_VISUAL:
case BEAM_DIGGING:
return (true);
@@ -5756,7 +5756,7 @@ bolt::bolt() : range(0), type('*'),
beam_source(MHITNOT), name(), short_name(), is_beam(false),
is_explosion(false), is_big_cloud(false), aimed_at_spot(false),
aux_source(), affects_nothing(false), effect_known(true),
- obvious_effect(false),
+ delay(15), obvious_effect(false),
fr_count(0), foe_count(0), fr_power(0), foe_power(0),
fr_hurt(0), foe_hurt(0), fr_helped(0),foe_helped(0),
dropped_item(false), item_pos(), item_index(NON_ITEM),
@@ -5934,9 +5934,9 @@ std::string beam_type_name(beam_type type)
case BEAM_POTION_BLUE_SMOKE: return("blue smoke");
case BEAM_POTION_PURP_SMOKE: return("purple smoke");
case BEAM_POTION_RANDOM: return("random potion");
+ case BEAM_VISUAL: return ("visual effects");
case BEAM_TORMENT_DAMAGE: return("torment damage");
case BEAM_STEAL_FOOD: return("steal food");
- case BEAM_LINE_OF_SIGHT: return("line of sight");
case NUM_BEAMS:
DEBUGSTR("invalid beam type");
return("INVALID");