/// <summary> /// 判断某个点是否为活N /// </summary> /// <param name="point">点坐标</param> /// <param name="count">活几</param> /// <param name="type">棋子类型</param> /// <returns></returns> public static Boolean IsActive(Point point, int count, ChessType type) { if (ChessRule.checkDirectOnChessForActive(point, Direction.Down, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UP, type) + 1 == count) { return(true); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownLeft, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpRight, type) + 1 == count) { return(true); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownRight, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpLeft, type) + 1 == count) { return(true); } if (ChessRule.checkDirectOnChessForActive(point, Direction.Left, type) + ChessRule.checkDirectOnChessForActive(point, Direction.Right, type) + 1 == count) { return(true); } return(false); }
/// <summary> /// 计算一个棋子的通用威力 /// </summary> /// <param name="point"></param> /// <param name="type"></param> /// <returns></returns> public static int CommonPower(Point point, ChessType type) { List <int> powerContainer = new List <int>(); //计算棋子通用威力 //单二 if (checkDirectOnChessForSingle(point, Direction.UP, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.UpLeft, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.Left, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.DownLeft, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.Down, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.DownRight, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.Right, type) + 1 == 2) { powerContainer.Add(5); } if (checkDirectOnChessForSingle(point, Direction.UpRight, type) + 1 == 2) { powerContainer.Add(5); } //单一 if (checkDirectOnChessForSingle(point, Direction.UP, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.UpLeft, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.Left, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.DownLeft, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.Down, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.DownRight, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.Right, type) + 1 == 1) { powerContainer.Add(1); } if (checkDirectOnChessForSingle(point, Direction.UpRight, type) + 1 == 1) { powerContainer.Add(1); } //活二 if (ChessRule.checkDirectOnChessForActive(point, Direction.Down, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UP, type) + 1 == 2) { powerContainer.Add(7); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownLeft, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpRight, type) + 1 == 2) { powerContainer.Add(7); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownRight, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpLeft, type) + 1 == 2) { powerContainer.Add(7); } if (ChessRule.checkDirectOnChessForActive(point, Direction.Left, type) + ChessRule.checkDirectOnChessForActive(point, Direction.Right, type) + 1 == 2) { powerContainer.Add(7); } //活一 if (ChessRule.checkDirectOnChessForActive(point, Direction.Down, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UP, type) + 1 == 1) { powerContainer.Add(3); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownLeft, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpRight, type) + 1 == 1) { powerContainer.Add(3); } if (ChessRule.checkDirectOnChessForActive(point, Direction.DownRight, type) + ChessRule.checkDirectOnChessForActive(point, Direction.UpLeft, type) + 1 == 1) { powerContainer.Add(3); } if (ChessRule.checkDirectOnChessForActive(point, Direction.Left, type) + ChessRule.checkDirectOnChessForActive(point, Direction.Right, type) + 1 == 1) { powerContainer.Add(3); } //排序 powerContainer.Sort(); //返回最大的两个值和 return(powerContainer[powerContainer.Count - 2] + powerContainer[powerContainer.Count - 1]); }