[7442] Implement TARGET_DIRECTLY_FORWARD spell target mode.

It used in many cannon/rocket ike spells.
This commit is contained in:
VladimirMangos 2009-03-11 22:40:12 +03:00
parent 903b810353
commit 498ab2df07
3 changed files with 25 additions and 3 deletions

View file

@ -448,6 +448,9 @@ void Spell::FillTargetMap()
default:
switch(m_spellInfo->EffectImplicitTargetB[i])
{
case 0:
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
break;
case TARGET_SCRIPT_COORDINATES: // B case filled in canCast but we need fill unit list base at A case
SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap);
break;
@ -2065,7 +2068,25 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
// if parent spell create dynamic object extract area from it
if(DynamicObject* dynObj = m_caster->GetDynObject(m_triggeredByAuraSpell ? m_triggeredByAuraSpell->Id : m_spellInfo->Id))
m_targets.setDestination(dynObj->GetPositionX(), dynObj->GetPositionY(), dynObj->GetPositionZ());
}break;
break;
}
case TARGET_DIRECTLY_FORWARD:
{
if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION))
{
SpellRangeEntry const* rEntry = sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex);
float minRange = GetSpellMinRange(rEntry);
float maxRange = GetSpellMaxRange(rEntry);
float dist = minRange+ rand_norm()*(maxRange-minRange);
float _target_x, _target_y, _target_z;
m_caster->GetClosePoint(_target_x, _target_y, _target_z, m_caster->GetObjectSize(), dist);
m_targets.setDestination(_target_x, _target_y, _target_z);
}
TagUnitMap.push_back(m_caster);
break;
}
default:
break;
}