trucoshi 0.3.4 → 0.3.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -674
- package/README.md +60 -60
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -18
- package/dist/lib/classes/Deck.d.ts +17 -17
- package/dist/lib/classes/Deck.js +41 -41
- package/dist/lib/classes/Envido.d.ts +34 -34
- package/dist/lib/classes/Envido.js +168 -167
- package/dist/lib/classes/Flor.js +1 -1
- package/dist/lib/classes/GameLoop.d.ts +28 -26
- package/dist/lib/classes/GameLoop.js +115 -105
- package/dist/lib/classes/Hand.d.ts +43 -43
- package/dist/lib/classes/Hand.js +295 -295
- package/dist/lib/classes/Lobby.d.ts +27 -27
- package/dist/lib/classes/Lobby.js +113 -113
- package/dist/lib/classes/Match.d.ts +21 -21
- package/dist/lib/classes/Match.js +90 -88
- package/dist/lib/classes/Play.d.ts +22 -22
- package/dist/lib/classes/Play.js +44 -44
- package/dist/lib/classes/Player.d.ts +35 -35
- package/dist/lib/classes/Player.js +114 -126
- package/dist/lib/classes/Round.d.ts +17 -17
- package/dist/lib/classes/Round.js +33 -33
- package/dist/lib/classes/Table.d.ts +12 -12
- package/dist/lib/classes/Table.js +38 -38
- package/dist/lib/classes/Team.d.ts +20 -20
- package/dist/lib/classes/Team.js +59 -59
- package/dist/lib/classes/Truco.d.ts +30 -30
- package/dist/lib/classes/Truco.js +97 -97
- package/dist/lib/classes/index.d.ts +11 -11
- package/dist/lib/classes/index.js +27 -27
- package/dist/lib/constants.d.ts +43 -43
- package/dist/lib/constants.js +46 -46
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +18 -18
- package/dist/lib/types.d.ts +44 -44
- package/dist/lib/types.js +21 -21
- package/dist/lib/utils.d.ts +5 -5
- package/dist/lib/utils.js +58 -58
- package/dist/types.d.ts +195 -184
- package/dist/types.js +123 -121
- package/package.json +1 -1
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { ECommand, ETrucoCommand } from "../../types";
|
|
2
|
-
import { IPlayer } from "./Player";
|
|
3
|
-
import { ITeam } from "./Team";
|
|
4
|
-
interface IPlayerCurrentCommands {
|
|
5
|
-
player: IPlayer;
|
|
6
|
-
add: Array<ECommand>;
|
|
7
|
-
del: Array<ECommand>;
|
|
8
|
-
}
|
|
9
|
-
export interface ITruco {
|
|
10
|
-
state: 1 | 2 | 3 | 4;
|
|
11
|
-
teamIdx: 0 | 1 | null;
|
|
12
|
-
waitingAnswer: boolean;
|
|
13
|
-
answer: boolean | null;
|
|
14
|
-
turn: number;
|
|
15
|
-
teams: [ITeam, ITeam];
|
|
16
|
-
players: Array<IPlayer>;
|
|
17
|
-
currentCommands: Array<IPlayerCurrentCommands>;
|
|
18
|
-
currentPlayer: IPlayer | null;
|
|
19
|
-
generator: Generator<ITruco, void, unknown>;
|
|
20
|
-
sayTruco(player: IPlayer): ITruco;
|
|
21
|
-
sayAnswer(player: IPlayer, answer: boolean | null): ITruco;
|
|
22
|
-
setTurn(turn: number): number;
|
|
23
|
-
setTeam(idx: 0 | 1): 0 | 1;
|
|
24
|
-
getNextTrucoCommand(): ETrucoCommand | null;
|
|
25
|
-
setCurrentPlayer(player: IPlayer | null): IPlayer | null;
|
|
26
|
-
getNextPlayer(): IteratorResult<ITruco, ITruco | void>;
|
|
27
|
-
reset(): void;
|
|
28
|
-
}
|
|
29
|
-
export declare function Truco(teams: [ITeam, ITeam]): ITruco;
|
|
30
|
-
export {};
|
|
1
|
+
import { ECommand, ETrucoCommand } from "../../types";
|
|
2
|
+
import { IPlayer } from "./Player";
|
|
3
|
+
import { ITeam } from "./Team";
|
|
4
|
+
interface IPlayerCurrentCommands {
|
|
5
|
+
player: IPlayer;
|
|
6
|
+
add: Array<ECommand>;
|
|
7
|
+
del: Array<ECommand>;
|
|
8
|
+
}
|
|
9
|
+
export interface ITruco {
|
|
10
|
+
state: 1 | 2 | 3 | 4;
|
|
11
|
+
teamIdx: 0 | 1 | null;
|
|
12
|
+
waitingAnswer: boolean;
|
|
13
|
+
answer: boolean | null;
|
|
14
|
+
turn: number;
|
|
15
|
+
teams: [ITeam, ITeam];
|
|
16
|
+
players: Array<IPlayer>;
|
|
17
|
+
currentCommands: Array<IPlayerCurrentCommands>;
|
|
18
|
+
currentPlayer: IPlayer | null;
|
|
19
|
+
generator: Generator<ITruco, void, unknown>;
|
|
20
|
+
sayTruco(player: IPlayer): ITruco;
|
|
21
|
+
sayAnswer(player: IPlayer, answer: boolean | null): ITruco;
|
|
22
|
+
setTurn(turn: number): number;
|
|
23
|
+
setTeam(idx: 0 | 1): 0 | 1;
|
|
24
|
+
getNextTrucoCommand(): ETrucoCommand | null;
|
|
25
|
+
setCurrentPlayer(player: IPlayer | null): IPlayer | null;
|
|
26
|
+
getNextPlayer(): IteratorResult<ITruco, ITruco | void>;
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
29
|
+
export declare function Truco(teams: [ITeam, ITeam]): ITruco;
|
|
30
|
+
export {};
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Truco = void 0;
|
|
4
|
-
const types_1 = require("../../types");
|
|
5
|
-
const EMPTY_TRUCO = {
|
|
6
|
-
turn: 0,
|
|
7
|
-
teamIdx: null,
|
|
8
|
-
answer: null,
|
|
9
|
-
waitingAnswer: false,
|
|
10
|
-
currentPlayer: null,
|
|
11
|
-
players: [],
|
|
12
|
-
};
|
|
13
|
-
const TRUCO_STATE_MAP = {
|
|
14
|
-
1: types_1.ETrucoCommand.TRUCO,
|
|
15
|
-
2: types_1.ETrucoCommand.RE_TRUCO,
|
|
16
|
-
3: types_1.ETrucoCommand.VALE_CUATRO,
|
|
17
|
-
4: null,
|
|
18
|
-
};
|
|
19
|
-
function Truco(teams) {
|
|
20
|
-
function* trucoAnswerGeneratorSequence() {
|
|
21
|
-
let i = 0;
|
|
22
|
-
while (i < truco.players.length && truco.answer === null) {
|
|
23
|
-
const player = truco.players[truco.turn];
|
|
24
|
-
truco.setCurrentPlayer(player);
|
|
25
|
-
if (player.disabled || !player.ready) {
|
|
26
|
-
truco.setCurrentPlayer(null);
|
|
27
|
-
}
|
|
28
|
-
if (truco.turn >= truco.players.length - 1) {
|
|
29
|
-
truco.setTurn(0);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
truco.setTurn(truco.turn + 1);
|
|
33
|
-
}
|
|
34
|
-
i++;
|
|
35
|
-
yield truco;
|
|
36
|
-
}
|
|
37
|
-
yield truco;
|
|
38
|
-
}
|
|
39
|
-
const truco = Object.assign(Object.assign({}, EMPTY_TRUCO), { state: 1, teams, currentCommands: [], generator: trucoAnswerGeneratorSequence(), getNextTrucoCommand() {
|
|
40
|
-
return TRUCO_STATE_MAP[truco.state];
|
|
41
|
-
},
|
|
42
|
-
reset() {
|
|
43
|
-
Object.assign(truco, EMPTY_TRUCO);
|
|
44
|
-
},
|
|
45
|
-
sayTruco(player) {
|
|
46
|
-
if (truco.state === 4) {
|
|
47
|
-
return truco;
|
|
48
|
-
}
|
|
49
|
-
truco.turn = 0;
|
|
50
|
-
const playerTeamIdx = player.teamIdx;
|
|
51
|
-
const teamIdx = truco.teamIdx;
|
|
52
|
-
if (teamIdx === null || teamIdx !== playerTeamIdx) {
|
|
53
|
-
truco.waitingAnswer = true;
|
|
54
|
-
truco.state++;
|
|
55
|
-
const opponentIdx = Number(!playerTeamIdx);
|
|
56
|
-
truco.teamIdx = playerTeamIdx;
|
|
57
|
-
truco.answer = null;
|
|
58
|
-
truco.players = teams[opponentIdx].players;
|
|
59
|
-
truco.generator = trucoAnswerGeneratorSequence();
|
|
60
|
-
return truco;
|
|
61
|
-
}
|
|
62
|
-
return truco;
|
|
63
|
-
},
|
|
64
|
-
sayAnswer(player, answer) {
|
|
65
|
-
if (player.teamIdx === truco.teamIdx) {
|
|
66
|
-
return truco;
|
|
67
|
-
}
|
|
68
|
-
if (answer !== null) {
|
|
69
|
-
truco.currentCommands = [];
|
|
70
|
-
if (answer === false) {
|
|
71
|
-
truco.state--;
|
|
72
|
-
const playerTeam = teams[player.teamIdx];
|
|
73
|
-
playerTeam.players.forEach((player) => playerTeam.disable(player));
|
|
74
|
-
}
|
|
75
|
-
truco.waitingAnswer = false;
|
|
76
|
-
truco.answer = answer;
|
|
77
|
-
}
|
|
78
|
-
return truco;
|
|
79
|
-
},
|
|
80
|
-
setTeam(idx) {
|
|
81
|
-
truco.teamIdx = idx;
|
|
82
|
-
return truco.teamIdx;
|
|
83
|
-
},
|
|
84
|
-
setTurn(turn) {
|
|
85
|
-
truco.turn = turn;
|
|
86
|
-
return truco.turn;
|
|
87
|
-
},
|
|
88
|
-
setCurrentPlayer(player) {
|
|
89
|
-
truco.currentPlayer = player;
|
|
90
|
-
return truco.currentPlayer;
|
|
91
|
-
},
|
|
92
|
-
getNextPlayer() {
|
|
93
|
-
return truco.generator.next();
|
|
94
|
-
} });
|
|
95
|
-
return truco;
|
|
96
|
-
}
|
|
97
|
-
exports.Truco = Truco;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Truco = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
const EMPTY_TRUCO = {
|
|
6
|
+
turn: 0,
|
|
7
|
+
teamIdx: null,
|
|
8
|
+
answer: null,
|
|
9
|
+
waitingAnswer: false,
|
|
10
|
+
currentPlayer: null,
|
|
11
|
+
players: [],
|
|
12
|
+
};
|
|
13
|
+
const TRUCO_STATE_MAP = {
|
|
14
|
+
1: types_1.ETrucoCommand.TRUCO,
|
|
15
|
+
2: types_1.ETrucoCommand.RE_TRUCO,
|
|
16
|
+
3: types_1.ETrucoCommand.VALE_CUATRO,
|
|
17
|
+
4: null,
|
|
18
|
+
};
|
|
19
|
+
function Truco(teams) {
|
|
20
|
+
function* trucoAnswerGeneratorSequence() {
|
|
21
|
+
let i = 0;
|
|
22
|
+
while (i < truco.players.length && truco.answer === null) {
|
|
23
|
+
const player = truco.players[truco.turn];
|
|
24
|
+
truco.setCurrentPlayer(player);
|
|
25
|
+
if (player.disabled || !player.ready) {
|
|
26
|
+
truco.setCurrentPlayer(null);
|
|
27
|
+
}
|
|
28
|
+
if (truco.turn >= truco.players.length - 1) {
|
|
29
|
+
truco.setTurn(0);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
truco.setTurn(truco.turn + 1);
|
|
33
|
+
}
|
|
34
|
+
i++;
|
|
35
|
+
yield truco;
|
|
36
|
+
}
|
|
37
|
+
yield truco;
|
|
38
|
+
}
|
|
39
|
+
const truco = Object.assign(Object.assign({}, EMPTY_TRUCO), { state: 1, teams, currentCommands: [], generator: trucoAnswerGeneratorSequence(), getNextTrucoCommand() {
|
|
40
|
+
return TRUCO_STATE_MAP[truco.state];
|
|
41
|
+
},
|
|
42
|
+
reset() {
|
|
43
|
+
Object.assign(truco, EMPTY_TRUCO);
|
|
44
|
+
},
|
|
45
|
+
sayTruco(player) {
|
|
46
|
+
if (truco.state === 4) {
|
|
47
|
+
return truco;
|
|
48
|
+
}
|
|
49
|
+
truco.turn = 0;
|
|
50
|
+
const playerTeamIdx = player.teamIdx;
|
|
51
|
+
const teamIdx = truco.teamIdx;
|
|
52
|
+
if (teamIdx === null || teamIdx !== playerTeamIdx) {
|
|
53
|
+
truco.waitingAnswer = true;
|
|
54
|
+
truco.state++;
|
|
55
|
+
const opponentIdx = Number(!playerTeamIdx);
|
|
56
|
+
truco.teamIdx = playerTeamIdx;
|
|
57
|
+
truco.answer = null;
|
|
58
|
+
truco.players = teams[opponentIdx].players;
|
|
59
|
+
truco.generator = trucoAnswerGeneratorSequence();
|
|
60
|
+
return truco;
|
|
61
|
+
}
|
|
62
|
+
return truco;
|
|
63
|
+
},
|
|
64
|
+
sayAnswer(player, answer) {
|
|
65
|
+
if (player.teamIdx === truco.teamIdx) {
|
|
66
|
+
return truco;
|
|
67
|
+
}
|
|
68
|
+
if (answer !== null) {
|
|
69
|
+
truco.currentCommands = [];
|
|
70
|
+
if (answer === false) {
|
|
71
|
+
truco.state--;
|
|
72
|
+
const playerTeam = teams[player.teamIdx];
|
|
73
|
+
playerTeam.players.forEach((player) => playerTeam.disable(player));
|
|
74
|
+
}
|
|
75
|
+
truco.waitingAnswer = false;
|
|
76
|
+
truco.answer = answer;
|
|
77
|
+
}
|
|
78
|
+
return truco;
|
|
79
|
+
},
|
|
80
|
+
setTeam(idx) {
|
|
81
|
+
truco.teamIdx = idx;
|
|
82
|
+
return truco.teamIdx;
|
|
83
|
+
},
|
|
84
|
+
setTurn(turn) {
|
|
85
|
+
truco.turn = turn;
|
|
86
|
+
return truco.turn;
|
|
87
|
+
},
|
|
88
|
+
setCurrentPlayer(player) {
|
|
89
|
+
truco.currentPlayer = player;
|
|
90
|
+
return truco.currentPlayer;
|
|
91
|
+
},
|
|
92
|
+
getNextPlayer() {
|
|
93
|
+
return truco.generator.next();
|
|
94
|
+
} });
|
|
95
|
+
return truco;
|
|
96
|
+
}
|
|
97
|
+
exports.Truco = Truco;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from "./Deck";
|
|
2
|
-
export * from "./GameLoop";
|
|
3
|
-
export * from "./Hand";
|
|
4
|
-
export * from "./Lobby";
|
|
5
|
-
export * from "./Match";
|
|
6
|
-
export * from "./Play";
|
|
7
|
-
export * from "./Player";
|
|
8
|
-
export * from "./Round";
|
|
9
|
-
export * from "./Table";
|
|
10
|
-
export * from "./Team";
|
|
11
|
-
export * from "./Truco";
|
|
1
|
+
export * from "./Deck";
|
|
2
|
+
export * from "./GameLoop";
|
|
3
|
+
export * from "./Hand";
|
|
4
|
+
export * from "./Lobby";
|
|
5
|
+
export * from "./Match";
|
|
6
|
+
export * from "./Play";
|
|
7
|
+
export * from "./Player";
|
|
8
|
+
export * from "./Round";
|
|
9
|
+
export * from "./Table";
|
|
10
|
+
export * from "./Team";
|
|
11
|
+
export * from "./Truco";
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Deck"), exports);
|
|
18
|
-
__exportStar(require("./GameLoop"), exports);
|
|
19
|
-
__exportStar(require("./Hand"), exports);
|
|
20
|
-
__exportStar(require("./Lobby"), exports);
|
|
21
|
-
__exportStar(require("./Match"), exports);
|
|
22
|
-
__exportStar(require("./Play"), exports);
|
|
23
|
-
__exportStar(require("./Player"), exports);
|
|
24
|
-
__exportStar(require("./Round"), exports);
|
|
25
|
-
__exportStar(require("./Table"), exports);
|
|
26
|
-
__exportStar(require("./Team"), exports);
|
|
27
|
-
__exportStar(require("./Truco"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Deck"), exports);
|
|
18
|
+
__exportStar(require("./GameLoop"), exports);
|
|
19
|
+
__exportStar(require("./Hand"), exports);
|
|
20
|
+
__exportStar(require("./Lobby"), exports);
|
|
21
|
+
__exportStar(require("./Match"), exports);
|
|
22
|
+
__exportStar(require("./Play"), exports);
|
|
23
|
+
__exportStar(require("./Player"), exports);
|
|
24
|
+
__exportStar(require("./Round"), exports);
|
|
25
|
+
__exportStar(require("./Table"), exports);
|
|
26
|
+
__exportStar(require("./Team"), exports);
|
|
27
|
+
__exportStar(require("./Truco"), exports);
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
export declare const CARDS: {
|
|
2
|
-
"1e": number;
|
|
3
|
-
"1b": number;
|
|
4
|
-
"7e": number;
|
|
5
|
-
"7o": number;
|
|
6
|
-
"3e": number;
|
|
7
|
-
"3o": number;
|
|
8
|
-
"3b": number;
|
|
9
|
-
"3c": number;
|
|
10
|
-
"2e": number;
|
|
11
|
-
"2o": number;
|
|
12
|
-
"2b": number;
|
|
13
|
-
"2c": number;
|
|
14
|
-
"1o": number;
|
|
15
|
-
"1c": number;
|
|
16
|
-
re: number;
|
|
17
|
-
ro: number;
|
|
18
|
-
rb: number;
|
|
19
|
-
rc: number;
|
|
20
|
-
ce: number;
|
|
21
|
-
co: number;
|
|
22
|
-
cb: number;
|
|
23
|
-
cc: number;
|
|
24
|
-
pe: number;
|
|
25
|
-
po: number;
|
|
26
|
-
pb: number;
|
|
27
|
-
pc: number;
|
|
28
|
-
"7b": number;
|
|
29
|
-
"7c": number;
|
|
30
|
-
"6e": number;
|
|
31
|
-
"6o": number;
|
|
32
|
-
"6b": number;
|
|
33
|
-
"6c": number;
|
|
34
|
-
"5e": number;
|
|
35
|
-
"5o": number;
|
|
36
|
-
"5b": number;
|
|
37
|
-
"5c": number;
|
|
38
|
-
"4e": number;
|
|
39
|
-
"4o": number;
|
|
40
|
-
"4b": number;
|
|
41
|
-
"4c": number;
|
|
42
|
-
};
|
|
43
|
-
export declare const TEAM_SIZE_VALUES: number[];
|
|
1
|
+
export declare const CARDS: {
|
|
2
|
+
"1e": number;
|
|
3
|
+
"1b": number;
|
|
4
|
+
"7e": number;
|
|
5
|
+
"7o": number;
|
|
6
|
+
"3e": number;
|
|
7
|
+
"3o": number;
|
|
8
|
+
"3b": number;
|
|
9
|
+
"3c": number;
|
|
10
|
+
"2e": number;
|
|
11
|
+
"2o": number;
|
|
12
|
+
"2b": number;
|
|
13
|
+
"2c": number;
|
|
14
|
+
"1o": number;
|
|
15
|
+
"1c": number;
|
|
16
|
+
re: number;
|
|
17
|
+
ro: number;
|
|
18
|
+
rb: number;
|
|
19
|
+
rc: number;
|
|
20
|
+
ce: number;
|
|
21
|
+
co: number;
|
|
22
|
+
cb: number;
|
|
23
|
+
cc: number;
|
|
24
|
+
pe: number;
|
|
25
|
+
po: number;
|
|
26
|
+
pb: number;
|
|
27
|
+
pc: number;
|
|
28
|
+
"7b": number;
|
|
29
|
+
"7c": number;
|
|
30
|
+
"6e": number;
|
|
31
|
+
"6o": number;
|
|
32
|
+
"6b": number;
|
|
33
|
+
"6c": number;
|
|
34
|
+
"5e": number;
|
|
35
|
+
"5o": number;
|
|
36
|
+
"5b": number;
|
|
37
|
+
"5c": number;
|
|
38
|
+
"4e": number;
|
|
39
|
+
"4o": number;
|
|
40
|
+
"4b": number;
|
|
41
|
+
"4c": number;
|
|
42
|
+
};
|
|
43
|
+
export declare const TEAM_SIZE_VALUES: number[];
|
package/dist/lib/constants.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEAM_SIZE_VALUES = exports.CARDS = void 0;
|
|
4
|
-
exports.CARDS = {
|
|
5
|
-
"1e": 14,
|
|
6
|
-
"1b": 13,
|
|
7
|
-
"7e": 12,
|
|
8
|
-
"7o": 11,
|
|
9
|
-
"3e": 10,
|
|
10
|
-
"3o": 10,
|
|
11
|
-
"3b": 10,
|
|
12
|
-
"3c": 10,
|
|
13
|
-
"2e": 9,
|
|
14
|
-
"2o": 9,
|
|
15
|
-
"2b": 8,
|
|
16
|
-
"2c": 8,
|
|
17
|
-
"1o": 7,
|
|
18
|
-
"1c": 7,
|
|
19
|
-
re: 6,
|
|
20
|
-
ro: 6,
|
|
21
|
-
rb: 6,
|
|
22
|
-
rc: 6,
|
|
23
|
-
ce: 5,
|
|
24
|
-
co: 5,
|
|
25
|
-
cb: 5,
|
|
26
|
-
cc: 5,
|
|
27
|
-
pe: 4,
|
|
28
|
-
po: 4,
|
|
29
|
-
pb: 4,
|
|
30
|
-
pc: 4,
|
|
31
|
-
"7b": 3,
|
|
32
|
-
"7c": 3,
|
|
33
|
-
"6e": 2,
|
|
34
|
-
"6o": 2,
|
|
35
|
-
"6b": 2,
|
|
36
|
-
"6c": 2,
|
|
37
|
-
"5e": 1,
|
|
38
|
-
"5o": 1,
|
|
39
|
-
"5b": 1,
|
|
40
|
-
"5c": 1,
|
|
41
|
-
"4e": 0,
|
|
42
|
-
"4o": 0,
|
|
43
|
-
"4b": 0,
|
|
44
|
-
"4c": 0,
|
|
45
|
-
};
|
|
46
|
-
exports.TEAM_SIZE_VALUES = [1, 2, 3];
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEAM_SIZE_VALUES = exports.CARDS = void 0;
|
|
4
|
+
exports.CARDS = {
|
|
5
|
+
"1e": 14,
|
|
6
|
+
"1b": 13,
|
|
7
|
+
"7e": 12,
|
|
8
|
+
"7o": 11,
|
|
9
|
+
"3e": 10,
|
|
10
|
+
"3o": 10,
|
|
11
|
+
"3b": 10,
|
|
12
|
+
"3c": 10,
|
|
13
|
+
"2e": 9,
|
|
14
|
+
"2o": 9,
|
|
15
|
+
"2b": 8,
|
|
16
|
+
"2c": 8,
|
|
17
|
+
"1o": 7,
|
|
18
|
+
"1c": 7,
|
|
19
|
+
re: 6,
|
|
20
|
+
ro: 6,
|
|
21
|
+
rb: 6,
|
|
22
|
+
rc: 6,
|
|
23
|
+
ce: 5,
|
|
24
|
+
co: 5,
|
|
25
|
+
cb: 5,
|
|
26
|
+
cc: 5,
|
|
27
|
+
pe: 4,
|
|
28
|
+
po: 4,
|
|
29
|
+
pb: 4,
|
|
30
|
+
pc: 4,
|
|
31
|
+
"7b": 3,
|
|
32
|
+
"7c": 3,
|
|
33
|
+
"6e": 2,
|
|
34
|
+
"6o": 2,
|
|
35
|
+
"6b": 2,
|
|
36
|
+
"6c": 2,
|
|
37
|
+
"5e": 1,
|
|
38
|
+
"5o": 1,
|
|
39
|
+
"5b": 1,
|
|
40
|
+
"5c": 1,
|
|
41
|
+
"4e": 0,
|
|
42
|
+
"4o": 0,
|
|
43
|
+
"4b": 0,
|
|
44
|
+
"4c": 0,
|
|
45
|
+
};
|
|
46
|
+
exports.TEAM_SIZE_VALUES = [1, 2, 3];
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./classes";
|
|
2
|
-
export * from "./constants";
|
|
1
|
+
export * from "./classes";
|
|
2
|
+
export * from "./constants";
|
package/dist/lib/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./classes"), exports);
|
|
18
|
-
__exportStar(require("./constants"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./classes"), exports);
|
|
18
|
+
__exportStar(require("./constants"), exports);
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { ECommand, EEnvidoCommand } from "../types";
|
|
2
|
-
import { IPlayer } from "./classes/Player";
|
|
3
|
-
import { ITeam } from "./classes/Team";
|
|
4
|
-
export declare enum EHandState {
|
|
5
|
-
WAITING_PLAY = "WAITING_PLAY",
|
|
6
|
-
WAITING_FOR_TRUCO_ANSWER = "WAITING_FOR_TRUCO_ANSWER",
|
|
7
|
-
WAITING_ENVIDO_ANSWER = "WAITING_ENVIDO_ANSWER",
|
|
8
|
-
FINISHED = "FINISHED"
|
|
9
|
-
}
|
|
10
|
-
export declare enum GAME_ERROR {
|
|
11
|
-
MATCH_ALREADY_STARTED = "MATCH_ALREADY_STARTED",
|
|
12
|
-
LOBBY_IS_FULL = "LOBBY_IS_FULL",
|
|
13
|
-
UNEXPECTED_TEAM_SIZE = "UNEXPECTED_TEAM_SIZE",
|
|
14
|
-
TEAM_NOT_READY = "TEAM_NOT_READY",
|
|
15
|
-
TEAM_IS_FULL = "TEAM_IS_FULL",
|
|
16
|
-
INVALID_ENVIDO_POINTS = "INVALID_ENVIDO_POINTS",
|
|
17
|
-
ENVIDO_NOT_ACCEPTED = "ENVIDO_NOT_ACCEPTED",
|
|
18
|
-
INVALID_COMAND = "INVALID_COMAND"
|
|
19
|
-
}
|
|
20
|
-
export interface EnvidoState {
|
|
21
|
-
accept: number;
|
|
22
|
-
decline: number;
|
|
23
|
-
teamIdx: 0 | 1 | null;
|
|
24
|
-
}
|
|
25
|
-
export type IHandCommands = {
|
|
26
|
-
[key in ECommand]: (player: IPlayer) => void;
|
|
27
|
-
};
|
|
28
|
-
export type IEnvidoCalculatorResult = {
|
|
29
|
-
accept: number;
|
|
30
|
-
decline: number;
|
|
31
|
-
replace?: number;
|
|
32
|
-
next: Array<ECommand>;
|
|
33
|
-
};
|
|
34
|
-
export type IFaltaEnvidoCalculatorArgs = {
|
|
35
|
-
teams: [ITeam, ITeam];
|
|
36
|
-
matchPoint: number;
|
|
37
|
-
};
|
|
38
|
-
export type IEnvidoCalculatorArgs = {
|
|
39
|
-
stake: number;
|
|
40
|
-
declineStake: number;
|
|
41
|
-
} & (IFaltaEnvidoCalculatorArgs | never);
|
|
42
|
-
export type IEnvidoCalculator = {
|
|
43
|
-
[key in EEnvidoCommand]: (args?: IEnvidoCalculatorArgs) => IEnvidoCalculatorResult;
|
|
44
|
-
};
|
|
1
|
+
import { ECommand, EEnvidoCommand } from "../types";
|
|
2
|
+
import { IPlayer } from "./classes/Player";
|
|
3
|
+
import { ITeam } from "./classes/Team";
|
|
4
|
+
export declare enum EHandState {
|
|
5
|
+
WAITING_PLAY = "WAITING_PLAY",
|
|
6
|
+
WAITING_FOR_TRUCO_ANSWER = "WAITING_FOR_TRUCO_ANSWER",
|
|
7
|
+
WAITING_ENVIDO_ANSWER = "WAITING_ENVIDO_ANSWER",
|
|
8
|
+
FINISHED = "FINISHED"
|
|
9
|
+
}
|
|
10
|
+
export declare enum GAME_ERROR {
|
|
11
|
+
MATCH_ALREADY_STARTED = "MATCH_ALREADY_STARTED",
|
|
12
|
+
LOBBY_IS_FULL = "LOBBY_IS_FULL",
|
|
13
|
+
UNEXPECTED_TEAM_SIZE = "UNEXPECTED_TEAM_SIZE",
|
|
14
|
+
TEAM_NOT_READY = "TEAM_NOT_READY",
|
|
15
|
+
TEAM_IS_FULL = "TEAM_IS_FULL",
|
|
16
|
+
INVALID_ENVIDO_POINTS = "INVALID_ENVIDO_POINTS",
|
|
17
|
+
ENVIDO_NOT_ACCEPTED = "ENVIDO_NOT_ACCEPTED",
|
|
18
|
+
INVALID_COMAND = "INVALID_COMAND"
|
|
19
|
+
}
|
|
20
|
+
export interface EnvidoState {
|
|
21
|
+
accept: number;
|
|
22
|
+
decline: number;
|
|
23
|
+
teamIdx: 0 | 1 | null;
|
|
24
|
+
}
|
|
25
|
+
export type IHandCommands = {
|
|
26
|
+
[key in ECommand]: (player: IPlayer) => void;
|
|
27
|
+
};
|
|
28
|
+
export type IEnvidoCalculatorResult = {
|
|
29
|
+
accept: number;
|
|
30
|
+
decline: number;
|
|
31
|
+
replace?: number;
|
|
32
|
+
next: Array<ECommand>;
|
|
33
|
+
};
|
|
34
|
+
export type IFaltaEnvidoCalculatorArgs = {
|
|
35
|
+
teams: [ITeam, ITeam];
|
|
36
|
+
matchPoint: number;
|
|
37
|
+
};
|
|
38
|
+
export type IEnvidoCalculatorArgs = {
|
|
39
|
+
stake: number;
|
|
40
|
+
declineStake: number;
|
|
41
|
+
} & (IFaltaEnvidoCalculatorArgs | never);
|
|
42
|
+
export type IEnvidoCalculator = {
|
|
43
|
+
[key in EEnvidoCommand]: (args?: IEnvidoCalculatorArgs) => IEnvidoCalculatorResult;
|
|
44
|
+
};
|