Core/Spells: Remade trajectory target selection (#19048)

* Remade trajectory target selection
* Added possibility to apply conditions to trajectory spells
* Properly recalculate delay time if CMSG_UPDATE_PROJECTILE_POSITION is received
This commit is contained in:
xinef1
2017-02-06 01:10:15 +01:00
committed by ariel-
parent d06391d062
commit c6060dd0c5
11 changed files with 115 additions and 117 deletions

View File

@@ -2744,6 +2744,24 @@ void SpellMgr::LoadSpellInfoCorrections()
if (!spellInfo)
continue;
// Fix range for trajectory triggered spell
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (spellInfo->Effects[j].IsEffect() && (spellInfo->Effects[j].TargetA.GetTarget() == TARGET_DEST_TRAJ || spellInfo->Effects[j].TargetB.GetTarget() == TARGET_DEST_TRAJ))
{
// Get triggered spell if any
if (SpellInfo* spellInfoTrigger = const_cast<SpellInfo*>(GetSpellInfo(spellInfo->Effects[j].TriggerSpell)))
{
float maxRangeMain = spellInfo->RangeEntry ? spellInfo->RangeEntry->maxRangeHostile : 0.0f;
float maxRangeTrigger = spellInfoTrigger->RangeEntry ? spellInfoTrigger->RangeEntry->maxRangeHostile : 0.0f;
// check if triggered spell has enough max range to cover trajectory
if (maxRangeTrigger < maxRangeMain)
spellInfoTrigger->RangeEntry = spellInfo->RangeEntry;
}
}
}
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
switch (spellInfo->Effects[j].Effect)