aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2cbbde67e6a..e7f7ea69611 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1414,7 +1414,26 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
float x, y, z, angle;
angle = (float)rand_norm() * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle);
- m_targets.SetDst(x, y, z, m_caster->GetOrientation());
+
+ float ground = z;
+ float liquidLevel = m_caster->GetMap()->GetWaterOrGroundLevel(x, y, z, &ground);
+ if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
+ {
+ SendCastResult(SPELL_FAILED_NOT_HERE);
+ SendChannelUpdate(0);
+ finish(false);
+ return;
+ }
+
+ if (ground + 0.75 > liquidLevel)
+ {
+ SendCastResult(SPELL_FAILED_TOO_SHALLOW);
+ SendChannelUpdate(0);
+ finish(false);
+ return;
+ }
+
+ m_targets.SetDst(x, y, liquidLevel, m_caster->GetOrientation());
return;
}
default: