public static int MoveHarry(AMove theMove) { if (theMove.Weight > 0) { while (theMove.Weight > 0 && harryPotter.Cords[theMove.Dimension] < cube[theMove.Dimension] - 1) { harryPotter.Cords[theMove.Dimension]++; if (HarryCheck()) { return(-1); } theMove.Weight--; } } else { while (theMove.Weight < 0 && harryPotter.Cords[theMove.Dimension] > 0) { harryPotter.Cords[theMove.Dimension]--; if (HarryCheck()) { return(-1); } theMove.Weight++; } } return(0); }
public static int MoveBasilisk(AMove theMove, int basiliskIndex) { if (theMove.Weight > 0) { while (theMove.Weight > 0 && unitsList[basiliskIndex].Cords[theMove.Dimension] < cube[theMove.Dimension] - 1) { unitsList[basiliskIndex].Cords[theMove.Dimension]++; if (BasiliskCheck(basiliskIndex)) { return(-1); } theMove.Weight--; } } else { while (theMove.Weight < 0 && unitsList[basiliskIndex].Cords[theMove.Dimension] > 0) { unitsList[basiliskIndex].Cords[theMove.Dimension]--; if (BasiliskCheck(basiliskIndex)) { return(-1); } theMove.Weight++; } } return(0); }