summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-09 17:42:56 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-11-09 17:42:56 +0000
commit4a591f576e92c1aaba8a2bebff490ca1d2d46bd2 (patch)
tree5a1a55c1bb54a04d04e80f5277e875288f66b670
parent26e7da694c06b16e51c76c9a804c72bcf3cc8360 (diff)
downloadcrawl-ref-4a591f576e92c1aaba8a2bebff490ca1d2d46bd2.tar.gz
crawl-ref-4a591f576e92c1aaba8a2bebff490ca1d2d46bd2.zip
[1829067] Fixed mephitic cloud not setting enchantment owner correctly on affected monsters.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2833 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/monstuff.cc14
-rw-r--r--crawl-ref/source/mstuff2.cc2
7 files changed, 24 insertions, 8 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index 6e154a706e..64c8c2d22e 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -139,6 +139,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 78b3eaf484..028018a47f 100644
--- a/crawl-ref/source/beam.h
+++ b/crawl-ref/source/beam.h
@@ -132,7 +132,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 3685977ee8..7af542e463 100644
--- a/crawl-ref/source/cloud.cc
+++ b/crawl-ref/source/cloud.cc
@@ -301,3 +301,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 f846c167cc..b396283eb0 100644
--- a/crawl-ref/source/defines.h
+++ b/crawl-ref/source/defines.h
@@ -134,7 +134,7 @@ const int LABYRINTH_BORDER = 12;
#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 6259972fbc..6dc8d733f4 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1187,6 +1187,8 @@ struct cloud_struct
int decay;
unsigned char spread_rate;
kill_category whose;
+
+ killer_type beam_thrower() const;
};
struct shop_struct
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 0261cb3b4b..ea537946a2 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -5702,7 +5702,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!");
@@ -5737,6 +5738,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);
@@ -5765,7 +5769,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;
@@ -5788,7 +5792,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)
@@ -5805,7 +5809,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--;
@@ -5843,7 +5847,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 4fa901ca08..eb6dd494b0 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1503,7 +1503,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;