internal void PlayerMoveOrAttack(int dx, int dy) { int targetX = X + dx; int targetY = Y + dy; if (GameMap.MapBlocked(X + dx, Y + dy)) { return; } foreach (GameObject obj in Rogue.GameWorld.Objects) { if (obj.X == targetX && obj.Y == targetY && obj.Fighter != null && obj.Fighter.AI.Type != Constants.AI.None) { Fighter.MeleeAttack(obj); return; } } Move(dx, dy); }
private static void ThrowingAnimation(GameObject obj, GameObject user) { for (int times = 0; times < Constants.SpellRange; times++) { if (user.Fighter.Direction == 90 || user.Fighter.Direction == 270) { int dx = user.Fighter.Direction == 90 ? -1 : 1; if (GameMap.MapBlocked(obj.X + dx, obj.Y)) { break; } if (CommonMethods.TargetInCoordinate(obj.X, obj.Y)) { break; } for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { Rendering.RenderAll(obj); obj.OffsetX += Constants.MoveSmoothSteps * dx; if (GameMap.MapExplored(obj.X + dx, obj.Y) || FoV.InFov(user.X, user.Y, obj.X + dx, obj.Y, user)) { obj.Draw("white", true); } Terminal.Refresh(); } obj.X += dx; obj.OffsetX = 0; } else if (user.Fighter.Direction == 0 || user.Fighter.Direction == 180) { int dy = user.Fighter.Direction == 0 ? -1 : 1; if (GameMap.MapBlocked(obj.X, obj.Y + dy)) { break; } if (CommonMethods.TargetInCoordinate(obj.X, obj.Y)) { break; } for (int x = 0; x < 64 / Constants.MoveSmoothSteps; x++) { Rendering.RenderAll(obj); obj.OffsetY += Constants.MoveSmoothSteps * dy; if (GameMap.MapExplored(obj.X, obj.Y + dy) || FoV.InFov(user.X, user.Y, obj.X, obj.Y + dy, user)) { obj.Draw("white", true); } Terminal.Refresh(); } obj.Y += dy; obj.OffsetY = 0; } } }