Core/Spells: Fixed target radius calculation for TARGET_DEST_*_RANDOM (#29479)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_remnant_of_a_fallen_king_echoes_of_andorhal';
|
||||
@@ -1604,7 +1604,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
break;
|
||||
case TARGET_DEST_CASTER_RANDOM:
|
||||
if (dist > objSize)
|
||||
dist = objSize + (dist - objSize) * rand_norm();
|
||||
dist = objSize + (dist - objSize);
|
||||
break;
|
||||
case TARGET_DEST_CASTER_FRONT_LEFT:
|
||||
case TARGET_DEST_CASTER_BACK_LEFT:
|
||||
@@ -1655,8 +1655,6 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffectInfo const& spellEffectIn
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(nullptr, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_TARGET_RANDOM)
|
||||
dist *= rand_norm();
|
||||
|
||||
Position pos = dest._position;
|
||||
target->MovePositionToFirstCollision(pos, dist, angle);
|
||||
@@ -1709,8 +1707,6 @@ void Spell::SelectImplicitDestDestTargets(SpellEffectInfo const& spellEffectInfo
|
||||
{
|
||||
float angle = targetType.CalcDirectionAngle();
|
||||
float dist = spellEffectInfo.CalcRadius(m_caster, targetIndex);
|
||||
if (targetType.GetTarget() == TARGET_DEST_DEST_RANDOM)
|
||||
dist *= rand_norm();
|
||||
|
||||
Position pos = dest._position;
|
||||
m_caster->MovePositionToFirstCollision(pos, dist, angle);
|
||||
|
||||
@@ -674,17 +674,26 @@ float SpellEffectInfo::CalcRadius(WorldObject* caster /*= nullptr*/, SpellTarget
|
||||
// TargetA -> TargetARadiusEntry
|
||||
// TargetB -> TargetBRadiusEntry
|
||||
// Aura effects have TargetARadiusEntry == TargetBRadiusEntry (mostly)
|
||||
SpellImplicitTargetInfo target = TargetA;
|
||||
SpellRadiusEntry const* entry = TargetARadiusEntry;
|
||||
if (targetIndex == SpellTargetIndex::TargetB && HasRadius(targetIndex))
|
||||
{
|
||||
target = TargetB;
|
||||
entry = TargetBRadiusEntry;
|
||||
}
|
||||
|
||||
if (!entry)
|
||||
return 0.0f;
|
||||
|
||||
float radius = entry->RadiusMin;
|
||||
|
||||
// Client uses max if min is 0
|
||||
if (radius == 0.0f)
|
||||
// Random targets use random value between RadiusMin and RadiusMax
|
||||
// For other cases, client uses RadiusMax if RadiusMin is 0
|
||||
if (target.GetTarget() == TARGET_DEST_CASTER_RANDOM ||
|
||||
target.GetTarget() == TARGET_DEST_TARGET_RANDOM ||
|
||||
target.GetTarget() == TARGET_DEST_DEST_RANDOM)
|
||||
radius += (entry->RadiusMax - radius) * rand_norm();
|
||||
else if (radius == 0.0f)
|
||||
radius = entry->RadiusMax;
|
||||
|
||||
if (caster)
|
||||
|
||||
@@ -3669,21 +3669,6 @@ class spell_remnant_of_a_fallen_king_army_of_the_dead : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 362863 - Echoes of Andorhal
|
||||
class spell_remnant_of_a_fallen_king_echoes_of_andorhal : public SpellScript
|
||||
{
|
||||
void SetDest(SpellDestination& dest) const
|
||||
{
|
||||
Position const echoesSummon = GetCaster()->GetRandomPoint(DominationGraspCenter, frand(20.5f, 30.0f));
|
||||
dest.Relocate(echoesSummon);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnDestinationTargetSelect += SpellDestinationTargetSelectFn(spell_remnant_of_a_fallen_king_echoes_of_andorhal::SetDest, EFFECT_0, TARGET_DEST_DEST_RANDOM);
|
||||
}
|
||||
};
|
||||
|
||||
// 362543 - Remorseless Winter
|
||||
class spell_remnant_of_a_fallen_king_remorseless_winter_periodic : public AuraScript
|
||||
{
|
||||
@@ -3868,7 +3853,6 @@ void AddSC_boss_anduin_wrynn()
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_spawn);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_energize_runic_power);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_army_of_the_dead);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_echoes_of_andorhal);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_soul_reaper);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_remorseless_winter_periodic);
|
||||
RegisterSpellScript(spell_remnant_of_a_fallen_king_remorseless_winter_damage);
|
||||
|
||||
Reference in New Issue
Block a user