Example #1
0
 private static void ObjMissileClientOnCreateDelayed(MissileClient missile, SpellData spellData)
 {
     var unit = missile.SpellCaster as Obj_AI_Hero;
     var missilePosition = missile.Position.ToVector2();
     var unitPosition = missile.StartPosition.ToVector2();
     var endPos = missile.EndPosition.ToVector2();
     var direction = (endPos - unitPosition).Normalized();
     if (unitPosition.Distance(endPos) > spellData.Range || spellData.FixedRange)
     {
         endPos = unitPosition + direction * spellData.Range;
     }
     if (spellData.ExtraRange != -1)
     {
         endPos = endPos
                  + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(unitPosition)) * direction;
     }
     var castTime = Variables.TickCount - Game.Ping / 2 - (spellData.MissileDelayed ? 0 : spellData.Delay)
                    - (int)(1000f * missilePosition.Distance(unitPosition) / spellData.MissileSpeed);
     spellData.TriggerOnDetectSkillshot(DetectionType.RecvPacket, castTime, unitPosition, endPos, unit);
 }