static void Escape(escapeModes mode) { switch (mode) { case escapeModes.TOMOUSE: //Escaping to mouse { Vector3 cursorPos = Game.CursorPos; Vector3 pos = V3E(player.Position, cursorPos, (float)-15); if (!IsPassWall(player.Position, cursorPos)) //Escaping to mouse pos { Vector3 pass = V3E(player.Position, cursorPos, 100); //Point to move closer to the wall (could be better, i know, i'll improve it) player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(pass.X, pass.Y, 0)); SMouse.addMouseEvent(new Vector3(pass.X, pass.Y, 0), true, false); } else //Escape through the wall (Flash fail) { Vector3 jumpPred = V3E(pos, cursorPos, 700); if (IsWall(jumpPred.To2D()) && IsPassWall(player.Position, jumpPred)) //Can't we jump over? { Vector3 pass = V3E(player.Position, jumpPred, 100); //Point to move closer to the wall (could be better, i know, i'll improve it) player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(pass.X, pass.Y, 0)); //Move closer to the wall SMouse.addMouseEvent(new Vector3(pass.X, pass.Y, 0), true, false); return; } else //Yes! We can! { //Stand still player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(player.Position.X, player.Position.Y, 0)); } } if (!W.IsReady()) { return; //Simple! } W.Cast(pos); //Poof! W cast! SMouse.addMouseEvent(pos, false, CRB); Wmode = WModes.ESCAPE; //WMode } break; case escapeModes.FROMTURRET: { Vector3 WPos = V3E(player.Position, TUnit_obj.Position, 40); //Positions Vector3 escapePos = V3E(player.Position, TUnit_obj.Position, -450); player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(escapePos.X, escapePos.Y, 0)); //Move away if (!W.IsReady()) { return; //Simple! } W.Cast(WPos); //Cast W to move away SMouse.addMouseEvent(WPos, false, CRB); //TUnit_obj.isAggred = false;//Turrent isn't focusing us anymore Wmode = WModes.ESCAPE; //???PROFIT } break; } }
private static void Escape(escapeModes mode) { switch (mode) { case escapeModes.TOMOUSE: //Escaping to mouse { Vector3 cursorPos = Game.CursorPos; Vector3 pos = V3E(player.Position, cursorPos, (float)-15); if (!IsPassWall(player.Position, cursorPos)) //Escaping to mouse pos { Vector3 pass = V3E(player.Position, cursorPos, 100); //Point to move closer to the wall (could be better, i know, i'll improve it) Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(pass.X, pass.Y)).Send(); } else //Escape through the wall (Flash fail) { Vector3 jumpPred = V3E(pos, cursorPos, 700); if (IsWall(jumpPred.To2D()) && IsPassWall(player.Position, jumpPred)) //Can't we jump over? { Vector3 pass = V3E(player.Position, jumpPred, 100); //Point to move closer to the wall (could be better, i know, i'll improve it) Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(pass.X, pass.Y)).Send(); //Move closer to the wall return; } else //Yes! We can! { //Stand still Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(player.Position.X, player.Position.Y)).Send(); } } if (!W.IsReady()) { return; //Simple! } W.Cast(pos); //Poof! W cast! Wmode = WModes.ESCAPE; //WMode } break; case escapeModes.FROMTURRET: { Vector3 WPos = V3E(player.Position, TUnit_obj.Position, 40); //Positions Vector3 escapePos = V3E(player.Position, TUnit_obj.Position, -450); Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(escapePos.X, escapePos.Y)).Send(); //Move away if (!W.IsReady()) { return; //Simple! } W.Cast(WPos); //Cast W to move away //TUnit_obj.isAggred = false;//Turrent isn't focusing us anymore Wmode = WModes.ESCAPE; //???PROFIT } break; } }
static void Escape(escapeModes mode) { switch (mode) { case escapeModes.TOMOUSE: //Escaping to mouse { Vector3 cursorPos = Game.CursorPos; Vector3 pos = V3E(player.Position, cursorPos, (float)-15); if (!IsPassWall(player.Position, cursorPos))//Escaping to mouse pos { Vector3 pass = V3E(player.Position, cursorPos, 100);//Point to move closer to the wall (could be better, i know, i'll improve it) player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(pass.X, pass.Y, 0)); SMouse.addMouseEvent(new Vector3(pass.X, pass.Y, 0), true, false); } else //Escape through the wall (Flash fail) { Vector3 jumpPred = V3E(pos, cursorPos, 700); if (IsWall(jumpPred.To2D()) && IsPassWall(player.Position, jumpPred))//Can't we jump over? { Vector3 pass = V3E(player.Position, jumpPred, 100);//Point to move closer to the wall (could be better, i know, i'll improve it) player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(pass.X, pass.Y, 0));//Move closer to the wall SMouse.addMouseEvent(new Vector3(pass.X, pass.Y, 0), true, false); return; } else //Yes! We can! { //Stand still player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(player.Position.X, player.Position.Y, 0)); } } if (!W.IsReady()) return;//Simple! W.Cast(pos);//Poof! W cast! SMouse.addMouseEvent(pos, false, CRB); Wmode = WModes.ESCAPE;//WMode } break; case escapeModes.FROMTURRET: { Vector3 WPos = V3E(player.Position, TUnit_obj.Position, 40);//Positions Vector3 escapePos = V3E(player.Position, TUnit_obj.Position, -450); player.IssueOrder(GameObjectOrder.MoveTo, new Vector3(escapePos.X, escapePos.Y, 0));//Move away if (!W.IsReady()) return;//Simple! W.Cast(WPos);//Cast W to move away SMouse.addMouseEvent(WPos, false, CRB); //TUnit_obj.isAggred = false;//Turrent isn't focusing us anymore Wmode = WModes.ESCAPE;//???PROFIT } break; } }