Core/Spells: Use orientation given in destTarget instead of always taking casters orientation for all effect types

This commit is contained in:
Shauren authored and Ovahlord committed 2021-12-30 20:06:10 +01:00
1 parent 28f79765ca
commit adfc991f02
1 file changed
+23 -12
+23 -12
View File
@@ -2937,9 +2937,12 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
float x, y, z, o;
if (m_targets.HasDst())
destTarget->GetPosition(x, y, z);
destTarget->GetPosition(x, y, z, o);
else
{
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
o = target->GetOrientation();
}
o = frand(0, float(M_PI * 2));
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
@@ -2947,7 +2950,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
if (!pGameObj->Create(map->GenerateLowGuid<HighGuid::GameObject>(), gameobject_id, map,
Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
Position(x, y, z, o), rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3992,16 +3995,19 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
else
go = new GameObject();
float x, y, z;
float x, y, z, o;
// If dest location if present
if (m_targets.HasDst())
destTarget->GetPosition(x, y, z);
destTarget->GetPosition(x, y, z, o);
// Summon in random point all other units if location present
else
{
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
o = m_caster->GetOrientation();
}
Map* map = m_caster->GetMap();
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), go_id, map, Position(x, y, z, m_caster->GetOrientation()), QuaternionData(), 255, GO_STATE_READY))
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), go_id, map, Position(x, y, z, o), QuaternionData(), 255, GO_STATE_READY))
{
delete go;
return;
@@ -4778,6 +4784,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
{
float dis = m_spellInfo->Effects[effIndex].CalcRadius(m_originalCaster);
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
fo = m_caster->GetOrientation();
}
else
{
@@ -4787,12 +4794,13 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis);
fo = m_caster->GetOrientation();
}
Map* cMap = m_caster->GetMap();
// if gameobject is summoning object, it should be spawned right on caster's position
if (goinfo->type == GAMEOBJECT_TYPE_SUMMONING_RITUAL)
m_caster->GetPosition(fx, fy, fz);
m_caster->GetPosition(fx, fy, fz, fo);
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(fo, 0.f, 0.f);
@@ -4800,7 +4808,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
{
pGameObj = new Transport();
if (!pGameObj->Create(cMap->GenerateLowGuid<HighGuid::Transport>(), name_id, cMap, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY))
if (!pGameObj->Create(cMap->GenerateLowGuid<HighGuid::Transport>(), name_id, cMap, Position(fx, fy, fz, fo), rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4809,7 +4817,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
else
{
pGameObj = new GameObject();
if (!pGameObj->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), name_id, cMap, Position(fx, fy, fz, m_caster->GetOrientation()), rot, 255, GO_STATE_READY))
if (!pGameObj->Create(cMap->GenerateLowGuid<HighGuid::GameObject>(), name_id, cMap, Position(fx, fy, fz, fo), rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -5570,15 +5578,18 @@ void Spell::EffectSummonPersonalGameObject(SpellEffIndex effIndex)
if (!goId)
return;
float x, y, z;
float x, y, z, o;
if (m_targets.HasDst())
destTarget->GetPosition(x, y, z);
destTarget->GetPosition(x, y, z, o);
else
{
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
o = m_caster->GetOrientation();
}
Map* map = m_caster->GetMap();
Position pos = Position(x, y, z, m_caster->GetOrientation());
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
Position pos = Position(x, y, z, o);
QuaternionData rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
GameObject* go = new GameObject();
if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), goId, map, pos, rot, 255, GO_STATE_READY))