@@ -146,7 +146,7 @@ export class StawvsGame extends GameBase {
146146 }
147147 }
148148
149- const captured = Array ( this . numplayers ) . fill ( [ ] ) ;
149+ const captured = Array ( this . numplayers ) . fill ( [ ] ) ;
150150
151151 const fresh : IMoveState = {
152152 _version : StawvsGame . gameinfo . version ,
@@ -213,17 +213,19 @@ export class StawvsGame extends GameBase {
213213 return StawvsGame . coords2algebraic ( randx , randy ) ;
214214 }
215215
216- public canFish ( cellA : string , cellB : string ) : boolean {
216+ public canFish ( cellA : string , cellB : string , cellMe ?: string ) : boolean {
217217 //The unobstructed straight line test for moves and claims.
218218 //Named for Hey, That's My Fish!
219219 //Assumes that we're starting from a rational value of cellA.
220+ //cellMe permits shooting over the starting cell on captures
221+ // w/o actually updating the board
220222
221223 //Can't fish yourself.
222224 if ( cellA === cellB )
223225 return false ;
224226
225227 //Test cellB for existence and availability.
226- if ( ! this . isAvailable ( cellB ) )
228+ if ( ! this . isAvailable ( cellB ) )
227229 return false ;
228230
229231 // We need the coordinates for more testing.
@@ -239,7 +241,7 @@ export class StawvsGame extends GameBase {
239241 for ( let t = 0 ; t < testCells . length ; t ++ ) {
240242 const testCoords = testCells [ t ] ;
241243 const testCell = StawvsGame . coords2algebraic ( testCoords [ 0 ] , testCoords [ 1 ] ) ;
242- if ( ! this . isAvailable ( testCell ) )
244+ if ( ! this . isAvailable ( testCell ) && ( ( ! cellMe ) || ( testCell !== cellMe ) ) )
243245 return false ;
244246 }
245247
@@ -412,7 +414,7 @@ export class StawvsGame extends GameBase {
412414 for ( let subrow = 0 ; subrow < boardDim ; subrow ++ ) {
413415 for ( let subcol = 0 ; subcol < boardDim ; subcol ++ ) {
414416 const subcell = StawvsGame . coords2algebraic ( subcol , subrow ) ;
415- if ( this . canFish ( cell , subcell ) ) {
417+ if ( this . canFish ( cell , subcell , start ) ) {
416418 moves . push ( start + "-" + cell + "," + subcell ) ;
417419 }
418420 }
@@ -579,7 +581,7 @@ export class StawvsGame extends GameBase {
579581 }
580582 }
581583
582- if ( cell2 !== cell0 && ( ! this . canFish ( cell1 , cell2 ) ) ) {
584+ if ( cell2 !== cell0 && ( ! this . canFish ( cell1 , cell2 , cell0 ) ) ) {
583585 result . valid = false ;
584586 result . message = i18next . t ( "apgames:validation.stawvs.BAD_CLAIM" ) ;
585587 return result ;
@@ -1039,7 +1041,14 @@ export class StawvsGame extends GameBase {
10391041 }
10401042
10411043 public getPlayersScores ( ) : IScores [ ] {
1042- return [ { name : i18next . t ( "apgames:status.SCORES" ) , scores : [ this . getPlayerScore ( 1 ) , this . getPlayerScore ( 2 ) ] } ]
1044+ const iscoreObj = {
1045+ name : i18next . t ( "apgames:status.SCORES" ) ,
1046+ scores : [ this . getPlayerScore ( 1 ) , this . getPlayerScore ( 2 ) ]
1047+ } ;
1048+ for ( let n = 1 ; n <= this . numplayers ; n ++ ) {
1049+ iscoreObj . scores . push ( this . getPlayerScore ( n ) ) ;
1050+ }
1051+ return [ iscoreObj ] ;
10431052 }
10441053
10451054 // eslint-disable-next-line @typescript-eslint/no-explicit-any
0 commit comments