using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace chess
{
/// <summary>
/// 棋子士
/// </summary>
[Serializable()]
class chessItemShi : ChessItemBase
{
/// <summary>
/// 重写父类限制走法方法
/// </summary>
/// <param name="ChessX">坐标点的X坐标</param>
/// <param name="ChessY">坐标点的Y坐标</param>
/// <returns>返回结果bool</returns>
protected override bool LimitPoint(int ChessX, int ChessY)
{
//先执行基类中的方法
if (base.LimitPoint(ChessX, ChessY))
{
Point begin = PointToGrid(this.Location.X, this.Location.Y);
begin.Offset(1, 1);
Point end = PointToGrid(ChessX, ChessY);
if (((begin.X - end.X) == 1) || ((begin.X - end.X) == -1))
{
if(((begin.Y-end.Y)==1)||((begin.Y-end.Y)==-1)){
if((4<=end.X)&&(end.X<=6)){
if (this.chesstype == ChessTypes.black)
{
if((8<=end.Y)&&(end.Y<=10)){
return true;
}
}
else if (this.chesstype == ChessTypes.blue)
{
if((1<=end.Y)&&(end.Y<=3)){
return true;
}
}
}
}
}
}
return false;
}
}
}