Exemplo n.º 1
0
        public static void TeleportTo(ObjAiBase unit, float x, float y)
        {
            var coords  = new Vector2(x, y);
            var truePos = _game.Map.NavGrid.GetClosestTerrainExit(coords);

            CancelDash(unit);
            unit.TeleportTo(truePos.X, truePos.Y);
        }
Exemplo n.º 2
0
        public static void CancelDash(ObjAiBase unit)
        {
            // Allow the user to move the champion
            unit.SetDashingState(false);

            // Reset the default run animation
            var animList = new List <string> {
                "RUN", ""
            };

            _game.PacketNotifier.NotifySetAnimation(unit, animList);
        }
Exemplo n.º 3
0
        public static void DashToUnit(ObjAiBase unit,
                                      Target target,
                                      float dashSpeed,
                                      bool keepFacingLastDirection,
                                      string animation = null,
                                      float leapHeight = 0.0f,
                                      float followTargetMaxDistance = 0.0f,
                                      float backDistance            = 0.0f,
                                      float travelTime = 0.0f
                                      )
        {
            if (animation != null)
            {
                var animList = new List <string> {
                    "RUN", animation
                };
                _game.PacketNotifier.NotifySetAnimation(unit, animList);
            }

            if (target.IsSimpleTarget)
            {
                var newCoords = _game.Map.NavGrid.GetClosestTerrainExit(new Vector2(target.X, target.Y));
                var newTarget = new Target(newCoords);
                unit.DashToTarget(newTarget, dashSpeed, followTargetMaxDistance, backDistance, travelTime);
                _game.PacketNotifier.NotifyDash(
                    unit,
                    newTarget,
                    dashSpeed,
                    keepFacingLastDirection,
                    leapHeight,
                    followTargetMaxDistance,
                    backDistance,
                    travelTime
                    );
            }
            else
            {
                unit.DashToTarget(target, dashSpeed, followTargetMaxDistance, backDistance, travelTime);
                _game.PacketNotifier.NotifyDash(
                    unit,
                    target,
                    dashSpeed,
                    keepFacingLastDirection,
                    leapHeight,
                    followTargetMaxDistance,
                    backDistance,
                    travelTime
                    );
            }
            unit.TargetUnit = null;
        }
Exemplo n.º 4
0
 public Buff(Game game, string buffName, float dur, int stacks, BuffType buffType, ObjAiBase onto, ObjAiBase from)
 {
     _game         = game;
     _scriptEngine = game.ScriptEngine;
     Duration      = dur;
     Stacks        = stacks;
     Name          = buffName;
     TimeElapsed   = 0;
     _remove       = false;
     TargetUnit    = onto;
     SourceUnit    = from;
     BuffType      = buffType;
     Slot          = onto.GetNewBuffSlot(this);
 }
Exemplo n.º 5
0
        public BuffGameScriptController(Game game, ObjAiBase unit, string buffNamespace, string buffClass, Spell ownerSpell, float duration = -1f)
        {
            _scriptEngine = game.ScriptEngine;
            BuffNamespace = buffNamespace;
            BuffClass     = buffClass;
            OwnerSpell    = ownerSpell;
            Unit          = unit;
            _duration     = duration;
            GameScript    = _scriptEngine.CreateObject <IBuffGameScript>(buffNamespace, buffClass);

            if (_duration >= 0)
            {
                ApiFunctionManager.CreateTimer(_duration, DeactivateBuff);
            }
        }
Exemplo n.º 6
0
        public Placeable(
            Game game,
            ObjAiBase owner,
            float x,
            float y,
            string model,
            string name,
            uint netId = 0
            ) : base(game, model, new Stats.Stats(), 40, x, y, 0, netId)
        {
            SetTeam(owner.Team);

            Owner = owner;

            SetVisibleByTeam(Team, true);

            MoveOrder = MoveOrder.MOVE_ORDER_MOVE;

            Name = name;
        }
Exemplo n.º 7
0
 public static void DashToLocation(ObjAiBase unit,
                                   float x,
                                   float y,
                                   float dashSpeed,
                                   bool keepFacingLastDirection,
                                   string animation = null,
                                   float leapHeight = 0.0f,
                                   float followTargetMaxDistance = 0.0f,
                                   float backDistance            = 0.0f,
                                   float travelTime = 0.0f
                                   )
 {
     DashToUnit(
         unit,
         new Target(x, y),
         dashSpeed,
         keepFacingLastDirection,
         animation,
         leapHeight,
         followTargetMaxDistance,
         backDistance,
         travelTime
         );
 }
Exemplo n.º 8
0
        public static Buff AddBuffHudVisual(string buffName, float duration, int stacks, BuffType buffType, ObjAiBase onto, ObjAiBase from, float removeAfter = -1.0f)
        {
            var b = new Buff(_game, buffName, duration, stacks, buffType, onto, from);

            _game.PacketNotifier.NotifyAddBuff(b);
            if (removeAfter >= 0)
            {
                CreateTimer(removeAfter, () => RemoveBuffHudVisual(b));
            }

            return(b);
        }
Exemplo n.º 9
0
 public static Buff AddBuffHudVisual(string buffName, float duration, int stacks, BuffType buffType, ObjAiBase onto, float removeAfter = -1.0f)
 {
     return(AddBuffHudVisual(buffName, duration, stacks, buffType, onto, onto, removeAfter));
 }
Exemplo n.º 10
0
        public static void AddBuff(string buffName, float duration, int stacks, BuffType buffType, ObjAiBase onto, ObjAiBase from)
        {
            var buff = new Buff(_game, buffName, duration, stacks, buffType, onto, from);

            onto.AddBuff(buff);
            _game.PacketNotifier.NotifyAddBuff(buff);
        }
Exemplo n.º 11
0
 public Buff(Game game, string buffName, float dur, int stacks, BuffType buffType, ObjAiBase onto)
     : this(game, buffName, dur, stacks, buffType, onto, onto)    //no attacker specified = selfbuff, attacker aka source is same as attachedto
 {
 }