In this example, Sergeant specifies the preferred graphic to use. Also, under the Tools menu, there is an XBetza Expression Tester so you can make sure your XBetza is supported. (ChessV does not support everything.)
For a more complicated example, lets say the double move is only supported on the second rank. Then you have to use PieceType.AddMoveCapability, which takes a MoveCapability object, who's constructor looks like this:
MoveCapability( Direction dir, int maxSteps = 9999, int minSteps = 1, bool canCapture = true, bool mustCapture = false )
The maxSteps is 2. The minSteps is also 2 because the single step would already be generated by the regular move capability that is applicable everywhere. canCapture is false, and mustCapture is left as the default (false). Then we set the Condition under which the move is available, which is a lambda function taking a location as a parameter and returning a bool. (location.Rank == 1 because, like all good programmers, we start counting at 0.)
For a good example of a game that does everything manually, look at the include file for Duke of Rutlands chess.
Why are the rank and files reversed when you define a move with steponly
Let me look into this. The file offset should always come first.
You can add additional promotion rules for other promotable types. You aren't limited to one. So for the Maasai:
AddRule( BasicPromotionRule( Maasai, { Queen, Eagle, Lion, Sorceress, Duchess, Rhinoceros, Buffalo }, { location: location.Rank = 11 } ) );
The simple way to do this is with XBetza. Don't specify an internal type and set it's move with XBetza like this:
AddPieceType( "Maasai", "M", 200, 200, "Sergeant" );
Maasai.XBetza = "msWcfFmfR2";
In this example, Sergeant specifies the preferred graphic to use. Also, under the Tools menu, there is an XBetza Expression Tester so you can make sure your XBetza is supported. (ChessV does not support everything.)
For a more complicated example, lets say the double move is only supported on the second rank. Then you have to use PieceType.AddMoveCapability, which takes a MoveCapability object, who's constructor looks like this:
MoveCapability( Direction dir, int maxSteps = 9999, int minSteps = 1, bool canCapture = true, bool mustCapture = false )
So you would have something like:
FancyPawn.AddMoveCapability( MoveCapability( <1, 0>, 2, 2, false ) ).Condition = { location: location.Rank == 1 };
The maxSteps is 2. The minSteps is also 2 because the single step would already be generated by the regular move capability that is applicable everywhere. canCapture is false, and mustCapture is left as the default (false). Then we set the Condition under which the move is available, which is a lambda function taking a location as a parameter and returning a bool. (location.Rank == 1 because, like all good programmers, we start counting at 0.)
For a good example of a game that does everything manually, look at the include file for Duke of Rutlands chess.
Let me look into this. The file offset should always come first.