summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-09 23:13:00 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-09 23:13:00 +0000
commit0f0a4a6229ca086c111ed663b505c18d570d8b89 (patch)
tree75af2c8c3da3667a37fab92794730fbd16689282
parentd5c63aa77e2f383e1e0a8a3e9b25174bb66db2a8 (diff)
downloadcrawl-ref-0f0a4a6229ca086c111ed663b505c18d570d8b89.tar.gz
crawl-ref-0f0a4a6229ca086c111ed663b505c18d570d8b89.zip
Trunk->0.3 merge (2832-2833): [1828918] [1829067] shadow creatures and mephitic cloud confusion credit fix.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.3@2834 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/beam.cc2
-rw-r--r--crawl-ref/source/beam.h2
-rw-r--r--crawl-ref/source/cloud.cc8
-rw-r--r--crawl-ref/source/defines.h2
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/monplace.cc9
-rw-r--r--crawl-ref/source/monstuff.cc14
-rw-r--r--crawl-ref/source/mstuff2.cc2
8 files changed, 29 insertions, 12 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index d842cdca0e..ef1ac0a1df 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -138,6 +138,8 @@ static kill_category whose_kill(const bolt &beam)
return (KC_YOU);
else if (MON_KILL(beam.thrower))
{
+ if (beam.beam_source == ANON_FRIENDLY_MONSTER)
+ return (KC_FRIENDLY);
if (beam.beam_source >= 0 && beam.beam_source < MAX_MONSTERS)
{
const monsters *mons = &menv[beam.beam_source];
diff --git a/crawl-ref/source/beam.h b/crawl-ref/source/beam.h
index 35c09d23b8..6f598fb57d 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -131,7 +131,7 @@ struct bolt
int ench_power, hit;
int target_x, target_y; // intended target
coord_def pos; // actual position
- char thrower; // what kind of thing threw this?
+ killer_type thrower; // what kind of thing threw this?
char ex_size; // explosion radius (0==none)
int beam_source; // NON_MONSTER or monster index #
std::string name;
diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc
index 05c5dcaa70..0649d03bba 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -297,3 +297,11 @@ cloud_type random_smoke_type()
}
return CLOUD_DEBUGGING;
}
+
+////////////////////////////////////////////////////////////////////////
+// cloud_struct
+
+killer_type cloud_struct::beam_thrower() const
+{
+ return (whose == KC_YOU? KILL_YOU_MISSILE : KILL_MON_MISSILE);
+}
diff --git a/crawl-ref/source/defines.h b/crawl-ref/source/defines.h
index 65d11999cf..9a1a137be3 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -127,7 +127,7 @@
#define MAX_RANDOM_SHOPS 5
// Can be passed to monster_die to indicate that a friendly did the killing.
-#define ANON_FRIENDLY_MONSTER -1
+#define ANON_FRIENDLY_MONSTER -1999
// This value is used to make test_hit checks always succeed
#define AUTOMATIC_HIT 1500
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 4139cddd7b..44acfffed5 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1124,6 +1124,8 @@ struct cloud_struct
cloud_type type;
int decay;
kill_category whose;
+
+ killer_type beam_thrower() const;
};
struct shop_struct
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 63ed816d5f..d74b478a38 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -616,10 +616,11 @@ bool place_monster(int &id, int mon_type, int power, beh_type behaviour,
// (5) for each band monster, loop call to place_monster_aux().
for(i = 1; i < band_size; i++)
{
- id = place_monster_aux( band_monsters[i], behaviour, target, px, py,
- lev_mons, extra, false, dur);
- if (id != -1 && id != NON_MONSTER)
- menv[id].flags |= MF_BAND_MEMBER;
+ const int band_id =
+ place_monster_aux( band_monsters[i], behaviour, target, px, py,
+ lev_mons, extra, false, dur);
+ if (band_id != -1 && band_id != NON_MONSTER)
+ menv[band_id].flags |= MF_BAND_MEMBER;
}
// placement of first monster, at least, was a success.
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 3b847748de..6f07e24420 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5284,7 +5284,8 @@ static void mons_in_cloud(monsters *monster)
return;
}
- switch (env.cloud[wc].type)
+ const cloud_struct &cloud(env.cloud[wc]);
+ switch (cloud.type)
{
case CLOUD_DEBUGGING:
end(1, false, "Fatal error: monster steps on nonexistent cloud!");
@@ -5319,6 +5320,9 @@ static void mons_in_cloud(monsters *monster)
return;
beam.flavour = BEAM_CONFUSION;
+ beam.thrower = cloud.beam_thrower();
+ if (cloud.whose == KC_FRIENDLY)
+ beam.beam_source = ANON_FRIENDLY_MONSTER;
if (1 + random2(27) >= monster->hit_dice)
mons_ench_f2(monster, beam);
@@ -5348,7 +5352,7 @@ static void mons_in_cloud(monsters *monster)
if (mons_res_poison(monster) > 0)
return;
- poison_monster(monster, env.cloud[wc].whose);
+ poison_monster(monster, cloud.whose);
// If the monster got poisoned, wake it up.
wake = true;
@@ -5371,7 +5375,7 @@ static void mons_in_cloud(monsters *monster)
if (mons_res_fire(monster) > 0)
return;
- const int steam_base_damage = steam_cloud_damage(env.cloud[wc]);
+ const int steam_base_damage = steam_cloud_damage(cloud);
hurted += (random2avg(steam_base_damage, 2) * 10) / speed;
if (mons_res_fire(monster) < 0)
@@ -5388,7 +5392,7 @@ static void mons_in_cloud(monsters *monster)
|| monster->type == MONS_DEATH_DRAKE)
return;
- poison_monster(monster, env.cloud[wc].whose);
+ poison_monster(monster, cloud.whose);
if (monster->max_hit_points > 4 && coinflip())
monster->max_hit_points--;
@@ -5426,7 +5430,7 @@ static void mons_in_cloud(monsters *monster)
if (monster->hit_points < 1)
{
- mon_enchant death_ench( ENCH_NONE, 0, env.cloud[wc].whose );
+ mon_enchant death_ench( ENCH_NONE, 0, cloud.whose );
monster_die(monster, death_ench.killer(), death_ench.kill_agent());
}
}
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 12780a59a9..5a697ca160 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1439,7 +1439,7 @@ bolt mons_spells( int spell_cast, int power )
beam.ench_power = -1;
beam.type = -1;
beam.flavour = -1;
- beam.thrower = -1;
+ beam.thrower = KILL_MISC;
beam.is_beam = false;
beam.is_explosion = false;