From f5d7515c3cd305b003f95ac5c636eb0c529a0b9c Mon Sep 17 00:00:00 2001 From: dshaligram Date: Mon, 29 Dec 2008 16:09:35 +0000 Subject: Implement divination miscasts for orange statues, fix silver and orange statues to attack monsters as they attack the player. Also fix clouds not being cleared on level reset in dungeon.cc. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8017 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/beam.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/beam.cc') diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 248c50f04c..13644d9d7d 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2562,7 +2562,7 @@ bool curare_hits_monster(actor *agent, monsters *monster, kill_category who, } if (monster->alive()) - enchant_monster_with_flavour(monster, BEAM_SLOW); + enchant_monster_with_flavour(monster, agent, BEAM_SLOW); } // Deities take notice. @@ -3593,7 +3593,7 @@ void bolt::affect_player_enchantment() { break; case BEAM_PETRIFY: - you.petrify( ench_power ); + you.petrify( agent(), ench_power ); obvious_effect = true; break; @@ -4608,11 +4608,13 @@ bool _ench_flavour_affects_monster(beam_type flavour, const monsters* mon) return rc; } -bool enchant_monster_with_flavour(monsters* mon, beam_type flavour, int powc) +bool enchant_monster_with_flavour(monsters* mon, actor *foe, + beam_type flavour, int powc) { bolt dummy; dummy.flavour = flavour; dummy.ench_power = powc; + dummy.set_agent(foe); dummy.apply_enchantment_to_monster(mon); return dummy.obvious_effect; } @@ -5462,6 +5464,23 @@ void bolt::setup_retrace() aimed_at_spot = true; } +void bolt::set_agent(actor *actor) +{ + // NULL actor is fine by us. + if (!actor) + return; + + if (actor->atype() == ACT_PLAYER) + { + thrower = KILL_YOU_MISSILE; + } + else + { + thrower = KILL_MON_MISSILE; + beam_source = monster_index(dynamic_cast(actor)); + } +} + actor* bolt::agent() const { if (YOU_KILL(this->thrower)) -- cgit v1.2.3-54-g00ecf