@@ -112,6 +112,7 @@ export class FroggerGame extends GameBase {
112112 private marketsize : number = 6 ;
113113 private deck ! : Deck ;
114114 private suitboard ! : Map < string , string > ;
115+ private selected : string [ ] = [ ] ;
115116
116117 constructor ( state : number | IFroggerState | string , variants ?: string [ ] ) {
117118 super ( ) ;
@@ -1232,6 +1233,7 @@ export class FroggerGame extends GameBase {
12321233 if ( ! complete ) {
12331234 result . valid = true ;
12341235 result . complete = - 1 ;
1236+ result . canrender = true ;
12351237 result . message = i18next . t ( "apgames:validation.frogger.PIECE_NEXT" ) ;
12361238 return result ;
12371239 } else {
@@ -1267,6 +1269,7 @@ export class FroggerGame extends GameBase {
12671269 if ( ! complete ) {
12681270 result . valid = true ;
12691271 result . complete = - 1 ;
1272+ // result.canrender = true;
12701273 result . message = i18next . t ( "apgames:validation.frogger.PLACE_NEXT" ) ;
12711274 return result ;
12721275 } else {
@@ -1380,6 +1383,7 @@ export class FroggerGame extends GameBase {
13801383
13811384 //Really really done.
13821385 result . valid = true ;
1386+ result . canrender = true ;
13831387 result . complete = ( allcomplete && moves . length === this . nummoves ) ? 1 : 0 ;
13841388 result . message = i18next . t ( "apgames:validation._general.VALID_MOVE" ) ;
13851389 return result ;
@@ -1400,6 +1404,8 @@ export class FroggerGame extends GameBase {
14001404 }
14011405
14021406 this . results = [ ] ;
1407+ this . selected = [ ] ;
1408+
14031409 let marketEmpty = false ;
14041410 let refill = false ;
14051411 let remaining : number ;
@@ -1425,42 +1431,25 @@ export class FroggerGame extends GameBase {
14251431
14261432 if ( subIFM . refill )
14271433 refill = true ;
1428- /*
1429-
1430- if (submove.indexOf(":") > -1) {
1431- //Card followed by move is a hand card.
1432- [ca, mv] = submove.split(":");
1433- handcard = true;
1434- } else if (submove.indexOf(",") > -1) {
1435- //Move followed by card is a backwards move.
1436- [mv, ca] = submove.split(",");
1437- } else if (submove.indexOf("-") > -1) {
1438- //Raw move is a unproductive or partial backwards move.
1439- [from, to] = submove.split("-");
1440- // nocard = true;
1441- } else {
1442- //Raw card must be a blocked move or a partial.
1443- ca = submove;
1444- if (!partial)
1445- this.results.push({type: "claim", what: ca});
1446- }
14471434
1448- if ( mv )
1449- [from, to] = mv!.split("-");
1450- */
14511435 //Make the submove.
14521436 //Possible card adjustments.
14531437 if ( subIFM . forward && subIFM . card ) {
1454- this . popHand ( subIFM . card ) ;
1455- this . results . push ( { type : "move" , from : subIFM . from ! , to : subIFM . to ! , what : subIFM . card ! , how : "forward" } ) ;
1456- const bounced = this . moveNeighbors ( subIFM . to ! , subIFM . card ! ) ;
1457- bounced . forEach ( ( [ from , to ] ) => {
1458- this . results . push ( { type : "eject" , from : from , to : to , what : "a Crown or Ace" } ) ;
1459- } ) ;
1438+ if ( subIFM . from && subIFM . to ) {
1439+ this . popHand ( subIFM . card ) ;
1440+ this . results . push ( { type : "move" , from : subIFM . from , to : subIFM . to , what : subIFM . card , how : "forward" } ) ;
1441+ const bounced = this . moveNeighbors ( subIFM . to , subIFM . card ) ;
1442+ bounced . forEach ( ( [ from , to ] ) => {
1443+ this . results . push ( { type : "eject" , from : from , to : to , what : "a Crown or Ace" } ) ;
1444+ } ) ;
1445+ } else {
1446+ //Partial.
1447+ }
14601448 } else if ( subIFM . card ) {
14611449 marketEmpty = this . popMarket ( subIFM . card ) ;
1450+
14621451 if ( subIFM . from ) {
1463- this . results . push ( { type : "move" , from : subIFM . from ! , to : subIFM . to ! , what : subIFM . card ! , how : "back" } ) ;
1452+ this . results . push ( { type : "move" , from : subIFM . from , to : subIFM . to ! , what : subIFM . card ! , how : "back" } ) ;
14641453 }
14651454 } else {
14661455 this . results . push ( { type : "move" , from : subIFM . from ! , to : subIFM . to ! , what : "no card" , how : "back" } ) ;
@@ -1474,6 +1463,11 @@ export class FroggerGame extends GameBase {
14741463 remaining = 2 - s ;
14751464 break ;
14761465 }
1466+
1467+ if ( subIFM . card ) {
1468+ this . selected . push ( subIFM . card ) ;
1469+ //console.log("selecting ", subIFM.card);
1470+ }
14771471 }
14781472 }
14791473
@@ -1694,7 +1688,16 @@ export class FroggerGame extends GameBase {
16941688 // build legend of ALL cards
16951689 const legend : ILegendObj = { } ;
16961690 for ( const card of allcards ) {
1697- legend [ "c" + card . uid ] = card . toGlyph ( ) ;
1691+ let glyph = card . toGlyph ( ) ;
1692+ if ( this . selected . indexOf ( card . uid ) > - 1 ) {
1693+ glyph = card . toGlyph ( { border : true , fill : {
1694+ func : "flatten" ,
1695+ fg : "_context_fill" ,
1696+ bg : "_context_background" ,
1697+ opacity : 0.2
1698+ } } ) ;
1699+ }
1700+ legend [ "c" + card . uid ] = glyph ;
16981701 }
16991702
17001703 const excuses = [ ...cardsExtended . filter ( c => c . rank . uid === "0" ) ] ;
0 commit comments