private void ProcessSpell_TwitchSprayandPrayAttack(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args, SpellData spellData, SpecialSpellEventArgs specialSpellArgs) { if (spellData.spellName == "TwitchSprayandPrayAttack") { if (args.Target != null) { var start = hero.ServerPosition; var end = hero.ServerPosition + (args.Target.Position - hero.ServerPosition) * spellData.range; var data = spellData.CopyData(); data.spellDelay = hero.AttackCastDelay * 1000; SpellDetector.CreateSpellData(hero, start, end, data); } } }
private void SpellDetector_OnProcessSpecialSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args, SpellData spellData, SpecialSpellEventArgs specialSpellArgs) { if (spellData.spellName.ToLower() == "syndrae") { var estart = args.Start; var eend = args.Start + (args.End - args.Start).Normalized() * 700; foreach (var sphere in _spheres.Where(s => s.IsValid && !s.IsDead)) { // check if e whill hit the sphere var proj = sphere.Position.To2D().ProjectOn(estart.To2D(), eend.To2D()); if (proj.IsOnSegment && sphere.Position.To2D().Distance(proj.SegmentPoint) <= sphere.BoundingRadius + 155) { var start = sphere.Position; var end = hero.ServerPosition + (sphere.Position - hero.ServerPosition).Normalized() * spellData.range; var data = spellData.CopyData(); data.spellDelay = sphere.Distance(hero.ServerPosition) / spellData.projectileSpeed * 1000; SpellDetector.CreateSpellData(hero, start, end, data, sphere); } } foreach (var entry in _qSpots) { var spherePosition = entry.Value; // check if e whill hit the sphere var proj = spherePosition.To2D().ProjectOn(estart.To2D(), eend.To2D()); if (proj.IsOnSegment && spherePosition.To2D().Distance(proj.SegmentPoint) <= 155) { var start = spherePosition; var end = hero.ServerPosition + (spherePosition - hero.ServerPosition).Normalized() * spellData.range; var data = spellData.CopyData(); data.spellDelay = spherePosition.Distance(hero.ServerPosition) / spellData.projectileSpeed * 1000; SpellDetector.CreateSpellData(hero, start, end, data, null); } } specialSpellArgs.noProcess = true; } if (spellData.spellName.ToLower() == "syndraq") { var end = args.End; if (args.Start.Distance(end) > spellData.range) { end = args.Start + (args.End - args.Start).Normalized() * spellData.range; } _qSpots.Add(Game.Time, end); } if (spellData.spellName.ToLower() == "syndrawcast") { var end = args.End; if (args.Start.Distance(end) > spellData.range) { end = args.Start + (args.End - args.Start).Normalized() * spellData.range; } _qSpots.Add(Game.Time, end); } }