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); }
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); }
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; }
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); }
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); } }
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; }
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 ); }
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); }
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)); }
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); }
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 { }