diff --git a/common/item_data.h b/common/item_data.h index e5d1a24f2..ae7e3bbdb 100644 --- a/common/item_data.h +++ b/common/item_data.h @@ -332,7 +332,7 @@ namespace EQEmu }; struct ItemEffect_Struct { - int16 Effect; + int32 Effect; uint8 Type; uint8 Level; uint8 Level2; diff --git a/zone/spells.cpp b/zone/spells.cpp index 001c6895c..2be0a0bce 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2140,6 +2140,27 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui spell_target->CalcSpellPowerDistanceMod(spell_id, dist2); } + //AE Duration spells were ignoring distance check from item clickies + if(ae_center != nullptr && ae_center != this) { + //casting a spell on somebody but ourself, make sure they are in range + float dist2 = DistanceSquared(m_Position, ae_center->GetPosition()); + float range2 = range * range; + float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; + if(dist2 > range2) { + //target is out of range. + Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is out of range (squared: %f > %f)", spell_id, dist2, range2); + Message_StringID(13, TARGET_OUT_OF_RANGE); + return(false); + } + else if (dist2 < min_range2){ + //target is too close range. + Log(Logs::Detail, Logs::Spells, "Spell %d: Spell target is too close (squared: %f < %f)", spell_id, dist2, min_range2); + Message_StringID(13, TARGET_TOO_CLOSE); + return(false); + } + + ae_center->CalcSpellPowerDistanceMod(spell_id, dist2); + } // // Switch #2 - execute the spell