예제 #1
0
 public static bool IsValidEvadeSpell(this MissileClient missile, out SpellData spellData)
 {
     spellData = null;
     if (missile == null)
     {
         return(false);
     }
     //Check if spell is valid to continue
     if (missile.SpellCaster != null && missile.SData != null && missile.SData.Name != null)
     {
         return(missile.ShouldEvade(out spellData));
     }
     return(false);
 }
예제 #2
0
        private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args)
        {
            if (!spellbook.Owner.IsMe)
            {
                return;
            }

            var    sData = spellbook.GetSpell(args.Slot);
            string name;

            if (SpellDetector.ChanneledSpells.TryGetValue(sData.Name, out name))
            {
                //Evade.isChanneling = true;
                //Evade.channelPosition = GameData.HeroInfo.serverPos2D;
                LastStopEvadeTime = EvadeUtils.TickCount + Game.Ping + 100;
            }

            if (EvadeSpell.LastSpellEvadeCommand != null &&
                EvadeSpell.LastSpellEvadeCommand.Timestamp + Game.Ping + 150 > EvadeUtils.TickCount)
            {
                args.Process = false;
            }

            LastSpellCast     = args.Slot;
            LastSpellCastTime = EvadeUtils.TickCount;

            //moved from processPacket

            /*if (args.Slot == SpellSlot.Recall)
             * {
             *  lastStopPosition = GameData.MyHero.ServerPosition.To2D();
             * }*/

            if (Situation.ShouldDodge())
            {
                if (IsDodging && SpellDetector.Spells.Count() > 0)
                {
                    foreach (KeyValuePair <String, SpellData> entry in SpellDetector.WindupSpells)
                    {
                        SpellData spellData = entry.Value;

                        if (spellData.SpellKey == args.Slot) //check if it's a spell that we should block
                        {
                            args.Process = false;
                            return;
                        }
                    }
                }
            }

            foreach (var evadeSpell in EvadeSpell.EvadeSpells)
            {
                if (evadeSpell.IsItem == false && evadeSpell.SpellKey == args.Slot)
                {
                    if (evadeSpell.EvadeType == EvadeType.Blink ||
                        evadeSpell.EvadeType == EvadeType.Dash)
                    {
                        //Block spell cast if flashing/blinking into spells
                        if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash
                        {
                            args.Process = false;
                            return;
                        }

                        if (evadeSpell.EvadeType == EvadeType.Dash)
                        {
                            var extraDelayBuffer = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer);
                            var extraDist        = Config.Properties.GetInt(ConfigValue.ExtraCpaDistance);

                            var dashPos = Game.CursorPos.To2D(); //real pos?

                            if (evadeSpell.FixedRange)
                            {
                                var dir = (dashPos - GameData.MyHero.ServerPosition.To2D()).Normalized();
                                dashPos = GameData.MyHero.ServerPosition.To2D() + dir * evadeSpell.Range;
                            }

                            //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000));

                            var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.Speed,
                                                                       extraDelayBuffer + Game.Ping, extraDist);

                            if (posInfo.PosDangerLevel > 0)
                            {
                                args.Process = false;
                                return;
                            }
                        }

                        LastPosInfo = PositionInfo.SetAllUndodgeable(); //really?

                        if (IsDodging || EvadeUtils.TickCount < LastDodgingEndTime + 500)
                        {
                            EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto
                            LastStopEvadeTime = EvadeUtils.TickCount + Game.Ping + 100;
                        }
                    }
                    return;
                }
            }
        }
예제 #3
0
 public static bool ShouldEvade(this MissileClient missile, out SpellData spellData)
 {
     spellData = null;
     return((missile.SpellCaster.Team != MyHero.Team) && SpellDetector.OnMissileSpells.TryGetValue(missile.SData.Name, out spellData));
 }
예제 #4
0
 public static bool IsInRange(this MissileClient missile, SpellData spellData)
 {
     return(missile.StartPosition.Distance(MyHero.Position) <
            spellData.Range + ConfigValue.ExtraDetectionRange.GetInt());
 }
예제 #5
0
 public static bool ShouldEvade(this EloBuddy.SpellData eloData, Obj_AI_Base hero, out SpellData spellData)
 {
     spellData = null;
     return((hero.Team != MyHero.Team) && SpellDetector.OnProcessSpells.TryGetValue(eloData.Name, out spellData));
 }