@@ -276,6 +276,25 @@ export class MoonSquadGame extends GameBase {
276276 return mine ;
277277 }
278278
279+ private myMovableSquads ( player ?: playerid ) : number {
280+ if ( player === undefined ) {
281+ player = this . currplayer ;
282+ }
283+ let count = 0 ;
284+
285+ const squads = this . mySquads ( player ) ;
286+ const islands = this . getIslands ( player ) ;
287+ for ( const isle of islands ) {
288+ const numsquads = isle . filter ( x => squads . includes ( x ) ) . length ;
289+ const numempty = isle . length - numsquads ;
290+ if ( numsquads > 0 ) {
291+ count += Math . min ( numsquads , numempty ) ;
292+ }
293+ }
294+
295+ return count ;
296+ }
297+
279298 public validateMove ( m : string ) : IValidationResult {
280299 const result : IValidationResult = { valid : false , message : i18next . t ( "apgames:validation._general.DEFAULT_HANDLER" ) } ;
281300
@@ -291,7 +310,7 @@ export class MoonSquadGame extends GameBase {
291310 if ( m === "" ) {
292311 result . valid = true ;
293312 result . complete = - 1 ;
294- if ( this . variants . includes ( "hex5" ) ) {
313+ if ( this . variants . includes ( "hex5" ) || this . variants . includes ( "limping" ) ) {
295314 result . message = i18next . t ( "apgames:validation.moonsquad.INITIAL_INSTRUCTIONS" , { context : this . stack . length === 1 ? "hexoffer" : this . stack . length === 2 ? "pie" : "normal" } ) ;
296315 } else {
297316 result . message = i18next . t ( "apgames:validation.moonsquad.INITIAL_INSTRUCTIONS" , { context : this . stack . length === 1 ? "offer" : this . stack . length === 2 ? "pie" : "normal" } ) ;
@@ -303,8 +322,8 @@ export class MoonSquadGame extends GameBase {
303322
304323 // pie offer handling
305324 if ( this . stack . length === 1 ) {
306- // hex5 is a single piece offer
307- if ( this . variants . includes ( "hex5" ) ) {
325+ // both hexes are single piece offer
326+ if ( this . variants . includes ( "hex5" ) || this . variants . includes ( "limping" ) ) {
308327 // cell is valid
309328 if ( ! ( g . listCells ( false ) as string [ ] ) . includes ( m ) ) {
310329 result . valid = false ;
@@ -383,6 +402,7 @@ export class MoonSquadGame extends GameBase {
383402 }
384403 const mvs = mvStr . split ( "," ) ;
385404 const mySquads = this . mySquads ( ) ;
405+ const numMovable = this . myMovableSquads ( ) ;
386406 for ( const mv of mvs ) {
387407 const [ from , to ] = mv . split ( "-" ) ;
388408 if ( from === undefined || from === "" ) { continue ; }
@@ -436,7 +456,7 @@ export class MoonSquadGame extends GameBase {
436456 }
437457 // if we make it here, then it's valid and possibly complete
438458 result . valid = true ;
439- result . complete = this . highlights . length > 0 ? 0 : 1 ;
459+ result . complete = mvs . length === numMovable ? 1 : 0 ;
440460 result . canrender = true ;
441461 result . message = i18next . t ( "apgames:validation._general.VALID_MOVE" ) ;
442462 return result ;
0 commit comments