//射击敌方坦克函数
Order ShotEnermy(DataForAI data,int i)
{
Order order;
int Srow,Scol,t;
if(data.tank[i].type == Striker)
{
for(Srow=data.tank[i].row-3;Srow<=data.tank[i].row+3;Srow++)
{
for(Scol=data.tank[i].col-3;Scol<=data.tank[i].col+3;Scol++)
{
t=(Srow-data.tank[i].row)*(Srow-data.tank[i].row)+(Scol-data.tank[i].col)*(Scol-data.tank[i].col);
if(t<=9)
{
if(data.map[Srow][Scol].whoIsHere >=5 )
{
order.type=FIRE;
order.row=Srow;
order.col=Scol;
return order;
}
}
}
}
}
else if(data.tank[i].type == Pioneer)
{
for(Srow=data.tank[i].row-3;Srow<=data.tank[i].row+3;Srow++)
{
for(Scol=data.tank[i].col-3;Scol<=data.tank[i].col+3;Scol++)
{
t=(Srow-data.tank[i].row)*(Srow-data.tank[i].row)+(Scol-data.tank[i].col)*(Scol-data.tank[i].col);
if(t<=1)
{
if(data.map[Srow][Scol].whoIsHere >=5 && data.map[Srow][Scol].whoIsHere <9)
{
order.type=FIRE;
order.row=Srow;
order.col=Scol;
return order;
}
}
}
}
}
else if(data.tank[i].type == Sniper)
{
for(Srow=data.tank[i].row-3;Srow<=data.tank[i].row+3;Srow++)
{
for(Scol=data.tank[i].col-3;Scol<=data.tank[i].col+3;Scol++)
{
t=(Srow-data.tank[i].row)*(Srow-data.tank[i].row)+(Scol-data.tank[i].col)*(Scol-data.tank[i].col);
if(t<=25)
{
if(data.map[Srow][Scol].whoIsHere >=5 )
{
order.type=FIRE;
order.row=Srow;
order.col=Scol;
return order;
}
}
}
}
}
}