Skip to content

Commit 153cc6b

Browse files
committed
Jacynth: Hopefully correct implementation of 'emulated'
1 parent f70d60a commit 153cc6b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/games/jacynth.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class JacynthGame extends GameBase {
131131
public stack!: Array<IMoveState>;
132132
public results: Array<APMoveResult> = [];
133133
private deck!: Deck;
134-
// private emulated = false;
134+
private emulated = false;
135135

136136
constructor(state: number | IJacynthState | string, variants?: string[]) {
137137
super();
@@ -495,7 +495,7 @@ export class JacynthGame extends GameBase {
495495
}
496496
}
497497

498-
public move(m: string, {trusted = false, partial = false} = {}): JacynthGame {
498+
public move(m: string, {trusted = false, partial = false, emulation = false} = {}): JacynthGame {
499499
if (this.gameover) {
500500
throw new UserFacingError("MOVES_GAMEOVER", i18next.t("apgames:MOVES_GAMEOVER"));
501501
}
@@ -510,7 +510,7 @@ export class JacynthGame extends GameBase {
510510
}
511511

512512
this.results = [];
513-
// this.emulated = emulation;
513+
this.emulated = emulation;
514514
const [mv, influence] = m.split(",");
515515
let [card, to] = mv.split("-");
516516
card = card.toUpperCase();
@@ -611,6 +611,7 @@ export class JacynthGame extends GameBase {
611611
}
612612

613613
public render(): APRenderRep {
614+
const prevplayer = this.currplayer === 1 ? 2 : 1;
614615
// Build piece string
615616
let pstr = "";
616617
for (let row = 0; row < 6; row++) {
@@ -687,7 +688,11 @@ export class JacynthGame extends GameBase {
687688
// build pieces areas
688689
const areas: AreaPieces[] = [];
689690
for (let p = 1; p <= this.numplayers; p++) {
690-
const hand = this.hands[p-1];
691+
let hand = this.hands[p-1];
692+
// if emulated and current player, drop the right-most card
693+
if (this.emulated && p === prevplayer) {
694+
hand = hand.slice(0, -1);
695+
}
691696
if (hand.length > 0) {
692697
areas.push({
693698
type: "pieces",

0 commit comments

Comments
 (0)