summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mon-project.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2010-03-08 12:57:48 +0100
committerAdam Borowski <kilobyte@angband.pl>2010-03-08 12:57:48 +0100
commit40663473c6f8bc4ce5cd0cb432b594458d93bda1 (patch)
treead7e1c27ea9381b104a2b673e8d1e7ee203ca067 /crawl-ref/source/mon-project.cc
parent60b9351a1e2500dc7090b41ee5b44eb4e4218941 (diff)
downloadcrawl-ref-40663473c6f8bc4ce5cd0cb432b594458d93bda1.tar.gz
crawl-ref-40663473c6f8bc4ce5cd0cb432b594458d93bda1.zip
Fix IOODs disappearing above submerged monsters.
Diffstat (limited to 'crawl-ref/source/mon-project.cc')
-rw-r--r--crawl-ref/source/mon-project.cc35
1 files changed, 30 insertions, 5 deletions
diff --git a/crawl-ref/source/mon-project.cc b/crawl-ref/source/mon-project.cc
index e28ec7fc7f..8bdbd098d6 100644
--- a/crawl-ref/source/mon-project.cc
+++ b/crawl-ref/source/mon-project.cc
@@ -251,7 +251,7 @@ bool iood_act(monsters &mon, bool no_trail)
mon.props["iood_vy"] = vy;
}
-reflected:
+move_again:
x += vx;
y += vy;
@@ -293,17 +293,42 @@ reflected:
mprf("%s hits %s", mon.name(DESC_CAP_THE, true).c_str(),
feature_description(pos, false, DESC_NOCAP_A).c_str());
}
- if (victim && mons_is_projectile(victim->id()))
+
+ monsters* monster = (victim && victim->atype() == ACT_MONSTER) ?
+ (monsters*) victim : 0;
+
+ if (monster && mons_is_projectile(victim->id()))
{
if (mon.observable())
mpr("The orbs collide in a blinding explosion!");
else
noisy(40, pos, "You hear a loud magical explosion!");
- monster_die((monsters*)victim, KILL_DISMISSED, NON_MONSTER);
+ monster_die(monster, KILL_DISMISSED, NON_MONSTER);
_iood_hit(mon, pos, true);
return (true);
}
+ if (monster && monster->submerged())
+ {
+ // Try to swap with the submerged creature.
+ if (monster->is_habitable(mon.pos()))
+ {
+ dprf("iood: Swapping with a submerged monster.");
+ monster->set_position(mon.pos());
+ mon.set_position(pos);
+ mgrd(monster->pos()) = monster->mindex();
+ mgrd(pos) = mon.mindex();
+
+ return (false);
+ }
+ else // if swap fails, move ahead
+ {
+ dprf("iood: Boosting above a submerged monster (can't swap).");
+ mon.lose_energy(EUT_MOVE);
+ goto move_again;
+ }
+ }
+
if (victim && _iood_shielded(mon, *victim))
{
item_def *shield = victim->shield();
@@ -315,7 +340,7 @@ reflected:
}
else
{
- simple_monster_message((monsters*)victim, (" blocks "
+ simple_monster_message(monster, (" blocks "
+ mon.name(DESC_NOCAP_THE, true) + ".").c_str());
}
victim->shield_block_succeeded(&mon);
@@ -358,7 +383,7 @@ reflected:
// reflection, this can lead to a brief game of ping-pong, but
// rapidly increasing shield penalties will make it short.
mon.lose_energy(EUT_MOVE);
- goto reflected;
+ goto move_again;
}
// Yay for inconsistencies in beam-vs-player and beam-vs-monsters.