mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Spells: Corrected radius calculation
This commit is contained in:
@@ -1677,9 +1677,9 @@ struct SpellFocusObjectEntry
|
||||
struct SpellRadiusEntry
|
||||
{
|
||||
uint32 ID;
|
||||
float radiusMin;
|
||||
//uint32 Unk //always 0
|
||||
float radiusMax;
|
||||
float RadiusMin;
|
||||
float RadiusPerLevel;
|
||||
float RadiusMax;
|
||||
};
|
||||
|
||||
struct SpellRangeEntry
|
||||
|
||||
@@ -106,7 +106,7 @@ const std::string CustomSpellEntryIndex = "Id";
|
||||
char const SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
|
||||
char const SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiiiii";
|
||||
char const SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";
|
||||
char const SpellRadiusfmt[]="nfxf";
|
||||
char const SpellRadiusfmt[]="nfff";
|
||||
char const SpellRangefmt[]="nffffixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
char const SpellRuneCostfmt[]="niiii";
|
||||
char const SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixiiixxiiiiiiii";
|
||||
|
||||
@@ -1698,7 +1698,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
|
||||
{
|
||||
trigger->setFaction(owner->getFaction());
|
||||
// needed for GO casts for proper target validation checks
|
||||
trigger->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID());
|
||||
trigger->SetOwnerGUID(owner->GetGUID());
|
||||
trigger->CastSpell(target ? target : trigger, spellInfo, true, 0, 0, owner->GetGUID());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -499,9 +499,14 @@ float SpellEffectInfo::CalcRadius(Unit* caster, Spell* spell) const
|
||||
if (!HasRadius())
|
||||
return 0.0f;
|
||||
|
||||
float radius = RadiusEntry->radiusMax;
|
||||
if (Player* modOwner = (caster ? caster->GetSpellModOwner() : NULL))
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
|
||||
float radius = RadiusEntry->RadiusMin;
|
||||
if (caster)
|
||||
{
|
||||
radius += RadiusEntry->RadiusPerLevel * caster->getLevel();
|
||||
radius = std::min(radius, RadiusEntry->RadiusMax);
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(_spellInfo->Id, SPELLMOD_RADIUS, radius, spell);
|
||||
}
|
||||
|
||||
return radius;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user