private void MapViewer_MouseUp(object sender, MouseEventArgs e) { this.mouseDown = false; if (skipNextMouseUp) { this.skipNextMouseUp = false; return; } if (this.hdcSrcBackground == IntPtr.Zero) { return; } if (this.MapHighPerformanceMode && this.MapFastScaling) { this.MapFastScaling = false; this.Refresh(); } if (!this.MapHighPerformanceMode && (this.CS.X != e.X || this.CS.Y != e.Y)) // mouse moved, do momentum { this.momentumSpeed = Misc.DistanceBetween(this.prevMouseLocation, e.Location); if (this.momentumSpeed > 1) { this.momuntumAngle = Misc.AngleBetween(this.prevMouseLocation, e.Location); tmrMomentum.Start(); } } }
public void Fill(INativeManager nativeManager) { nativeManager.AddSkillNative( "charge", "charge", "charge", new[] { "damage", "target", "movement", "control", "weapon", "direct", "physic" }, 7, 4, 3, 10, new Targets() { Allies = true, NotAllies = true, Bearable = true, Decorations = true }, true, (scene, owner, targetTile, skill) => { targetTile.DoDamageAttack(skill); if (Misc.RangeBetween(owner.X, owner.Y, targetTile.X, targetTile.Y) >= 2) { targetTile.AddBuff("stun", 0, 1, true); } var angle = Misc.AngleBetween(targetTile.X, targetTile.Y, owner.X, owner.Y); var sin = (float)Math.Sin(angle); var cos = (float)Math.Cos(angle); var x = (float)targetTile.X; var y = (float)targetTile.Y; var xRound = targetTile.X; var yRound = targetTile.Y; while (scene.Tiles[xRound][yRound].TempObject != null) { x += cos; y += sin; xRound = (int)Math.Round(x, MidpointRounding.AwayFromZero); yRound = (int)Math.Round(y, MidpointRounding.AwayFromZero); } owner.ChangePosition(scene.Tiles[(int)Math.Round(x, MidpointRounding.AwayFromZero)][(int)Math.Round(y, MidpointRounding.AwayFromZero)], true); }); }
private bool CheckMilliness(Tile target) { var range = Misc.RangeBetween(parent.X, parent.Y, target.X, target.Y); var incrementingRange = 0; var angleBetween = Misc.AngleBetween(parent.X, parent.Y, target.X, target.Y); var sin = Math.Sin(angleBetween); var cos = Math.Cos(angleBetween); var currentTile = parent.TempTile; while (incrementingRange <= range) { incrementingRange++; Tile nextTarget; if (incrementingRange >= range) { nextTarget = target; } else { var nextXFloat = parent.X + (incrementingRange * cos); var nextYFloat = parent.Y + (incrementingRange * sin); var nextX = (int)Math.Round(nextXFloat, MidpointRounding.AwayFromZero); var nextY = (int)Math.Round(nextYFloat, MidpointRounding.AwayFromZero); nextTarget = parent.Parent.Tiles[nextX][nextY]; if (nextTarget == currentTile) { continue; } } if (nextTarget.Height - currentTile.Height >= 10 || (Range <= 1 && currentTile.Height - nextTarget.Height >= 10) || (nextTarget != target && nextTarget.TempObject != null) || nextTarget.Native.Unbearable) { return(false); } currentTile = nextTarget; } return(true); }