summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/beam.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-25 13:23:23 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-25 13:23:23 +0000
commitbdb45bf27b86ff63c5afdff311b4065c83faf37d (patch)
treecf3a914532ecc372932b8d897e8c9abf57fbe2a4 /crawl-ref/source/beam.cc
parentc500c6b3582877a10bd362722bde81eb9b94b917 (diff)
downloadcrawl-ref-bdb45bf27b86ff63c5afdff311b4065c83faf37d.tar.gz
crawl-ref-bdb45bf27b86ff63c5afdff311b4065c83faf37d.zip
Merged in crawl.akrasiac.org patches (simple messaging, milestones). These take
effect only if compiled with -DDGAMELAUNCH. Simple messaging: interacts with dgamelaunch's messaging facility allowing viewers to send messages to the player. Milestones: Writes a milestones.txt file (in xlogfile format) for things like the player killing uniques, reaching the end of a dungeon branch, etc. (similar to notes). milestones.txt is used for game announcements by an IRC bot. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1095 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/beam.cc')
-rw-r--r--crawl-ref/source/beam.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 601019f7b3..c9c77dbb2a 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -71,6 +71,8 @@ static FixedArray < bool, 19, 19 > explode_map;
static void sticky_flame_monster( int mn, kill_category who, int hurt_final );
static bool affectsWall(const bolt &beam, int wall_feature);
static bool isBouncy(struct bolt &beam, unsigned char gridtype);
+static int beam_source(const bolt &beam);
+static std::string beam_zapper(const bolt &beam);
static void beam_drop_object( struct bolt &beam, item_def *item, int x, int y );
static bool beam_term_on_target(struct bolt &beam, int x, int y);
static void beam_explodes(struct bolt &beam, int x, int y);
@@ -2895,7 +2897,19 @@ static bool fuzz_invis_tracer(bolt &beem)
// 4.0.
bool test_beam_hit(int attack, int defence)
{
- return (random2(attack) >= random2avg(defence, 2));
+ return (attack == AUTOMATIC_HIT
+ || random2(attack) >= random2avg(defence, 2));
+}
+
+static std::string beam_zapper(const bolt &beam)
+{
+ const int bsrc = beam_source(beam);
+ if (bsrc == MHITYOU)
+ return ("self");
+ else if (bsrc == MHITNOT)
+ return ("");
+ else
+ return ptr_monam( &menv[bsrc], DESC_PLAIN );
}
// return amount of extra range used up by affectation of the player
@@ -3091,6 +3105,7 @@ static int affect_player( struct bolt &beam )
break;
}
you.banished = true;
+ you.banished_by = beam_zapper(beam);
beam.obvious_effect = true;
break; // banishment to the abyss