trucoshi 0.3.3 → 0.3.5

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.
Files changed (43) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +60 -60
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +18 -18
  5. package/dist/lib/classes/Deck.d.ts +17 -17
  6. package/dist/lib/classes/Deck.js +41 -41
  7. package/dist/lib/classes/Envido.d.ts +34 -0
  8. package/dist/lib/classes/Envido.js +168 -0
  9. package/dist/lib/classes/Flor.d.ts +0 -0
  10. package/dist/lib/classes/Flor.js +1 -0
  11. package/dist/lib/classes/GameLoop.d.ts +26 -23
  12. package/dist/lib/classes/GameLoop.js +106 -78
  13. package/dist/lib/classes/Hand.d.ts +43 -39
  14. package/dist/lib/classes/Hand.js +295 -197
  15. package/dist/lib/classes/Lobby.d.ts +27 -27
  16. package/dist/lib/classes/Lobby.js +113 -113
  17. package/dist/lib/classes/Match.d.ts +21 -20
  18. package/dist/lib/classes/Match.js +88 -87
  19. package/dist/lib/classes/Play.d.ts +22 -21
  20. package/dist/lib/classes/Play.js +44 -29
  21. package/dist/lib/classes/Player.d.ts +35 -30
  22. package/dist/lib/classes/Player.js +126 -74
  23. package/dist/lib/classes/Round.d.ts +17 -17
  24. package/dist/lib/classes/Round.js +33 -33
  25. package/dist/lib/classes/Table.d.ts +12 -12
  26. package/dist/lib/classes/Table.js +38 -30
  27. package/dist/lib/classes/Team.d.ts +20 -20
  28. package/dist/lib/classes/Team.js +59 -59
  29. package/dist/lib/classes/Truco.d.ts +30 -21
  30. package/dist/lib/classes/Truco.js +97 -131
  31. package/dist/lib/classes/index.d.ts +11 -11
  32. package/dist/lib/classes/index.js +27 -27
  33. package/dist/lib/constants.d.ts +43 -45
  34. package/dist/lib/constants.js +46 -84
  35. package/dist/lib/index.d.ts +2 -2
  36. package/dist/lib/index.js +18 -18
  37. package/dist/lib/types.d.ts +44 -36
  38. package/dist/lib/types.js +21 -18
  39. package/dist/lib/utils.d.ts +5 -5
  40. package/dist/lib/utils.js +58 -58
  41. package/dist/types.d.ts +193 -182
  42. package/dist/types.js +123 -106
  43. package/package.json +1 -1
@@ -1,197 +1,295 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Hand = void 0;
4
- const types_1 = require("../../types");
5
- const utils_1 = require("../utils");
6
- const Deck_1 = require("./Deck");
7
- const Play_1 = require("./Play");
8
- const Round_1 = require("./Round");
9
- const Truco_1 = require("./Truco");
10
- function Hand(match, deck, idx) {
11
- for (const team of match.teams) {
12
- for (const player of team.players) {
13
- player.enable();
14
- player.setHand(deck.takeThree());
15
- }
16
- }
17
- function* roundsGeneratorSequence() {
18
- let currentRoundIdx = 0;
19
- let forehandTeamIdx = match.table.player(hand.turn).teamIdx;
20
- while (currentRoundIdx < 3 && !hand.finished()) {
21
- const round = (0, Round_1.Round)();
22
- hand.setCurrentRound(round);
23
- hand.pushRound(round);
24
- let previousRound = hand.rounds[currentRoundIdx - 1];
25
- // Put previous round winner as forehand
26
- if (previousRound && previousRound.winner) {
27
- if (!previousRound.tie) {
28
- const newTurn = match.table.getPlayerPosition(previousRound.winner.id);
29
- if (newTurn !== -1) {
30
- hand.setTurn(newTurn);
31
- }
32
- }
33
- else {
34
- hand.setTurn(match.table.forehandIdx);
35
- }
36
- }
37
- while (round.turn < match.table.players.length) {
38
- while (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
39
- const { value } = hand.truco.getNextPlayer();
40
- if (value && value.currentPlayer) {
41
- hand.setCurrentPlayer(value.currentPlayer);
42
- yield hand;
43
- }
44
- }
45
- if (hand.truco.answer === false) {
46
- hand.setState(types_1.EHandState.FINISHED);
47
- break;
48
- }
49
- const player = match.table.player(hand.turn);
50
- hand.setCurrentPlayer(player);
51
- if (player.disabled) {
52
- hand.setCurrentPlayer(null);
53
- }
54
- if (match.teams.some((team) => team.isTeamDisabled())) {
55
- hand.setState(types_1.EHandState.FINISHED);
56
- break;
57
- }
58
- yield hand;
59
- }
60
- let winnerTeamIdx = (0, utils_1.checkHandWinner)(hand.rounds, forehandTeamIdx);
61
- if (match.teams[0].isTeamDisabled()) {
62
- winnerTeamIdx = 1;
63
- }
64
- if (match.teams[1].isTeamDisabled()) {
65
- winnerTeamIdx = 0;
66
- }
67
- if (winnerTeamIdx !== null) {
68
- hand.addPoints(winnerTeamIdx, hand.truco.state);
69
- hand.setState(types_1.EHandState.FINISHED);
70
- }
71
- currentRoundIdx++;
72
- }
73
- yield hand;
74
- }
75
- const roundsGenerator = roundsGeneratorSequence();
76
- const commands = {
77
- [types_1.ESayCommand.MAZO]: (player) => {
78
- hand.disablePlayer(player);
79
- hand.setState(types_1.EHandState.WAITING_PLAY);
80
- hand.truco.reset();
81
- hand.nextTurn();
82
- },
83
- [types_1.ESayCommand.TRUCO]: (player) => {
84
- hand.truco.sayTruco(player, () => {
85
- hand.setState(types_1.EHandState.WAITING_FOR_TRUCO_ANSWER);
86
- });
87
- },
88
- [types_1.ESayCommand.QUIERO]: (player) => {
89
- if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
90
- hand.truco.sayAnswer(player, true, () => {
91
- hand.setState(types_1.EHandState.WAITING_PLAY);
92
- });
93
- }
94
- },
95
- [types_1.ESayCommand.NO_QUIERO]: (player) => {
96
- if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
97
- hand.truco.sayAnswer(player, false, () => {
98
- hand.setState(types_1.EHandState.WAITING_PLAY);
99
- });
100
- }
101
- },
102
- [types_1.ESayCommand.FLOR]: () => { },
103
- [types_1.ESayCommand.CONTRAFLOR]: () => { },
104
- [types_1.EEnvidoCommand.ENVIDO]: () => { },
105
- [types_1.EEnvidoCommand.ENVIDO_ENVIDO]: () => { },
106
- [types_1.EEnvidoCommand.REAL_ENVIDO]: () => { },
107
- [types_1.EEnvidoCommand.FALTA_ENVIDO]: () => { },
108
- };
109
- const hand = {
110
- idx,
111
- started: false,
112
- turn: Number(match.table.forehandIdx),
113
- state: types_1.EHandState.WAITING_PLAY,
114
- rounds: [],
115
- truco: (0, Truco_1.Truco)(match.teams),
116
- envido: {
117
- accept: 1,
118
- decline: 2,
119
- teamIdx: null,
120
- },
121
- points: [0, 0],
122
- currentRound: null,
123
- _currentPlayer: null,
124
- set currentPlayer(player) {
125
- hand._currentPlayer = player;
126
- },
127
- get currentPlayer() {
128
- if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
129
- return hand.truco.currentPlayer;
130
- }
131
- return hand._currentPlayer;
132
- },
133
- commands,
134
- play(prevHand) {
135
- return (0, Play_1.PlayInstance)(hand, prevHand, match.teams);
136
- },
137
- use(idx, card) {
138
- hand.started = true;
139
- const player = hand.currentPlayer;
140
- const round = hand.currentRound;
141
- if (!player || !round) {
142
- return null;
143
- }
144
- const playerCard = player.useCard(idx, card);
145
- if (playerCard) {
146
- const card = round.use((0, Deck_1.PlayedCard)(player, playerCard));
147
- hand.nextTurn();
148
- return card;
149
- }
150
- return null;
151
- },
152
- nextTurn() {
153
- var _a;
154
- if (hand.turn >= match.table.players.length - 1) {
155
- hand.setTurn(0);
156
- }
157
- else {
158
- hand.setTurn(hand.turn + 1);
159
- }
160
- (_a = hand.currentRound) === null || _a === void 0 ? void 0 : _a.nextTurn();
161
- },
162
- getNextPlayer() {
163
- return roundsGenerator.next();
164
- },
165
- disablePlayer(player) {
166
- match.teams[player.teamIdx].disable(player);
167
- },
168
- addPoints(team, points) {
169
- hand.points[team] = hand.points[team] + points;
170
- },
171
- pushRound(round) {
172
- hand.rounds.push(round);
173
- return round;
174
- },
175
- setTurn(turn) {
176
- hand.turn = turn;
177
- return match.table.player(hand.turn);
178
- },
179
- setCurrentRound(round) {
180
- hand.currentRound = round;
181
- return hand.currentRound;
182
- },
183
- setCurrentPlayer(player) {
184
- hand._currentPlayer = player;
185
- return hand._currentPlayer;
186
- },
187
- setState(state) {
188
- hand.state = state;
189
- return hand.state;
190
- },
191
- finished: () => {
192
- return hand.state === types_1.EHandState.FINISHED;
193
- },
194
- };
195
- return hand;
196
- }
197
- exports.Hand = Hand;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Hand = void 0;
4
+ const types_1 = require("../../types");
5
+ const utils_1 = require("../utils");
6
+ const Deck_1 = require("./Deck");
7
+ const Envido_1 = require("./Envido");
8
+ const Play_1 = require("./Play");
9
+ const Round_1 = require("./Round");
10
+ const Truco_1 = require("./Truco");
11
+ function Hand(match, deck, idx) {
12
+ for (const team of match.teams) {
13
+ for (const player of team.players) {
14
+ player.enable();
15
+ player.setHand(deck.takeThree());
16
+ player.resetCommands();
17
+ }
18
+ }
19
+ function* roundsGeneratorSequence() {
20
+ let currentRoundIdx = 0;
21
+ let forehandTeamIdx = match.table.getPlayer(hand.turn).teamIdx;
22
+ while (currentRoundIdx < 3 && !hand.finished()) {
23
+ const round = (0, Round_1.Round)();
24
+ hand.setCurrentRound(round);
25
+ hand.pushRound(round);
26
+ let previousRound = hand.rounds[currentRoundIdx - 1];
27
+ // Put previous round winner as forehand
28
+ if (previousRound && previousRound.winner) {
29
+ if (previousRound.tie) {
30
+ hand.setTurn(match.table.forehandIdx);
31
+ }
32
+ else {
33
+ const newTurn = match.table.getPlayerPosition(previousRound.winner.key);
34
+ if (newTurn !== -1) {
35
+ hand.setTurn(newTurn);
36
+ }
37
+ }
38
+ }
39
+ while (round.turn < match.table.players.length) {
40
+ while (hand.state === types_1.EHandState.WAITING_ENVIDO_ANSWER ||
41
+ hand.state === types_1.EHandState.WAITING_ENVIDO_POINTS_ANSWER) {
42
+ const { value } = hand.envido.getNextPlayer();
43
+ if (value && value.currentPlayer) {
44
+ hand.setCurrentPlayer(value.currentPlayer);
45
+ yield hand;
46
+ }
47
+ }
48
+ while (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
49
+ const { value } = hand.truco.getNextPlayer();
50
+ if (value && value.currentPlayer) {
51
+ hand.setCurrentPlayer(value.currentPlayer);
52
+ yield hand;
53
+ }
54
+ }
55
+ if (hand.truco.answer === false) {
56
+ hand.setState(types_1.EHandState.FINISHED);
57
+ break;
58
+ }
59
+ const player = match.table.getPlayer(hand.turn);
60
+ hand.setCurrentPlayer(player);
61
+ if (match.teams.some((team) => team.isTeamDisabled())) {
62
+ hand.setState(types_1.EHandState.FINISHED);
63
+ break;
64
+ }
65
+ yield hand;
66
+ }
67
+ let winnerTeamIdx = (0, utils_1.checkHandWinner)(hand.rounds, forehandTeamIdx);
68
+ if (match.teams[0].isTeamDisabled()) {
69
+ winnerTeamIdx = 1;
70
+ }
71
+ if (match.teams[1].isTeamDisabled()) {
72
+ winnerTeamIdx = 0;
73
+ }
74
+ if (winnerTeamIdx !== null) {
75
+ hand.addPoints(winnerTeamIdx, hand.truco.state);
76
+ hand.setState(types_1.EHandState.FINISHED);
77
+ if (hand.envido.winner && hand.envido.winningPlayer) {
78
+ hand.addPoints(hand.envido.winningPlayer.teamIdx, hand.envido.answer === false ? hand.envido.declineStake : hand.envido.stake);
79
+ }
80
+ }
81
+ currentRoundIdx++;
82
+ }
83
+ yield hand;
84
+ }
85
+ const roundsGenerator = roundsGeneratorSequence();
86
+ const trucoCommand = (player) => {
87
+ hand.truco.sayTruco(player);
88
+ hand.setState(types_1.EHandState.WAITING_FOR_TRUCO_ANSWER);
89
+ };
90
+ const hand = {
91
+ idx,
92
+ started: false,
93
+ turn: Number(match.table.forehandIdx),
94
+ state: types_1.EHandState.WAITING_PLAY,
95
+ rounds: [],
96
+ envido: (0, Envido_1.Envido)(match.teams, match.matchPoint, match.table),
97
+ truco: (0, Truco_1.Truco)(match.teams),
98
+ setTurnCommands() {
99
+ var _a;
100
+ match.table.players.forEach((player) => {
101
+ player.resetCommands();
102
+ });
103
+ if (hand.rounds.length === 1) {
104
+ if (hand.envido.teamIdx !== null && !hand.envido.answered) {
105
+ match.teams[Number(!hand.envido.teamIdx)].players.forEach((player) => {
106
+ hand.envido.possibleAnswerCommands.forEach((command) => {
107
+ player._commands.add(command);
108
+ });
109
+ });
110
+ }
111
+ if (hand.envido.accepted && !hand.envido.finished && hand.envido.winningPointsAnswer) {
112
+ (_a = hand.currentPlayer) === null || _a === void 0 ? void 0 : _a._commands.add(types_1.EEnvidoAnswerCommand.SON_BUENAS);
113
+ }
114
+ if (hand.currentPlayer &&
115
+ !hand.envido.started &&
116
+ (hand.truco.state < 2 || (hand.truco.state === 2 && hand.truco.answer === null))) {
117
+ for (const key in types_1.EEnvidoCommand) {
118
+ hand.currentPlayer._commands.add(key);
119
+ }
120
+ }
121
+ }
122
+ if (hand.envido.finished || !hand.envido.started) {
123
+ if (hand.truco.waitingAnswer) {
124
+ match.teams[Number(!hand.truco.teamIdx)].players.forEach((player) => {
125
+ const nextCommand = hand.truco.getNextTrucoCommand();
126
+ if (nextCommand) {
127
+ player._commands.add(nextCommand);
128
+ }
129
+ player._commands.add(types_1.EAnswerCommand.QUIERO);
130
+ player._commands.add(types_1.EAnswerCommand.NO_QUIERO);
131
+ });
132
+ }
133
+ else {
134
+ match.table.players.forEach((player) => {
135
+ if (hand.truco.teamIdx !== player.teamIdx) {
136
+ const nextCommand = hand.truco.getNextTrucoCommand();
137
+ if (nextCommand) {
138
+ player._commands.add(nextCommand);
139
+ }
140
+ }
141
+ player._commands.add(types_1.ESayCommand.MAZO);
142
+ });
143
+ }
144
+ }
145
+ },
146
+ points: [0, 0],
147
+ currentRound: null,
148
+ _currentPlayer: null,
149
+ set currentPlayer(player) {
150
+ hand._currentPlayer = player;
151
+ },
152
+ get currentPlayer() {
153
+ let player = hand._currentPlayer;
154
+ if (hand.state === types_1.EHandState.WAITING_ENVIDO_ANSWER ||
155
+ hand.state === types_1.EHandState.WAITING_ENVIDO_POINTS_ANSWER) {
156
+ player = hand.envido.currentPlayer;
157
+ }
158
+ if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
159
+ player = hand.truco.currentPlayer;
160
+ }
161
+ if (player && player.disabled) {
162
+ return null;
163
+ }
164
+ return player;
165
+ },
166
+ say: {
167
+ [types_1.ESayCommand.MAZO]: (player) => {
168
+ hand.disablePlayer(player);
169
+ hand.nextTurn();
170
+ },
171
+ [types_1.EAnswerCommand.QUIERO]: (player) => {
172
+ if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
173
+ hand.truco.sayAnswer(player, true);
174
+ hand.setState(types_1.EHandState.WAITING_PLAY);
175
+ }
176
+ if (hand.state === types_1.EHandState.WAITING_ENVIDO_ANSWER) {
177
+ hand.envido.sayAnswer(player, true);
178
+ hand.setState(types_1.EHandState.WAITING_ENVIDO_POINTS_ANSWER);
179
+ }
180
+ },
181
+ [types_1.EAnswerCommand.NO_QUIERO]: (player) => {
182
+ if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
183
+ hand.truco.sayAnswer(player, false);
184
+ hand.setState(types_1.EHandState.WAITING_PLAY);
185
+ }
186
+ if (hand.state === types_1.EHandState.WAITING_ENVIDO_ANSWER) {
187
+ hand.envido.sayAnswer(player, false);
188
+ hand.endEnvido();
189
+ }
190
+ },
191
+ [types_1.EEnvidoAnswerCommand.SON_BUENAS]: (player) => {
192
+ if (hand.state === types_1.EHandState.WAITING_ENVIDO_POINTS_ANSWER) {
193
+ hand.envido.sayPoints(player, 0);
194
+ hand.endEnvido();
195
+ }
196
+ },
197
+ [types_1.ETrucoCommand.TRUCO]: trucoCommand,
198
+ [types_1.ETrucoCommand.RE_TRUCO]: trucoCommand,
199
+ [types_1.ETrucoCommand.VALE_CUATRO]: trucoCommand,
200
+ [types_1.EEnvidoCommand.ENVIDO]: (player) => {
201
+ hand.envido.sayEnvido(types_1.EEnvidoCommand.ENVIDO, player);
202
+ hand.setState(types_1.EHandState.WAITING_ENVIDO_ANSWER);
203
+ },
204
+ [types_1.EEnvidoCommand.REAL_ENVIDO]: (player) => {
205
+ hand.envido.sayEnvido(types_1.EEnvidoCommand.REAL_ENVIDO, player);
206
+ hand.setState(types_1.EHandState.WAITING_ENVIDO_ANSWER);
207
+ },
208
+ [types_1.EEnvidoCommand.FALTA_ENVIDO]: (player) => {
209
+ hand.envido.sayEnvido(types_1.EEnvidoCommand.FALTA_ENVIDO, player);
210
+ hand.setState(types_1.EHandState.WAITING_ENVIDO_ANSWER);
211
+ },
212
+ [types_1.EFlorCommand.FLOR]: () => { },
213
+ [types_1.EFlorCommand.CONTRAFLOR]: () => { },
214
+ },
215
+ play(prevHand) {
216
+ return (0, Play_1.PlayInstance)(hand, prevHand, match.teams);
217
+ },
218
+ sayEnvidoPoints(player, points) {
219
+ const { winner } = hand.envido.sayPoints(player, points);
220
+ if (winner) {
221
+ hand.endEnvido();
222
+ }
223
+ return hand.envido;
224
+ },
225
+ endEnvido() {
226
+ if (hand.truco.waitingAnswer) {
227
+ hand.setState(types_1.EHandState.WAITING_FOR_TRUCO_ANSWER);
228
+ }
229
+ else {
230
+ hand.setState(types_1.EHandState.WAITING_PLAY);
231
+ }
232
+ },
233
+ use(idx, card) {
234
+ hand.started = true;
235
+ const player = hand.currentPlayer;
236
+ const round = hand.currentRound;
237
+ if (!player || !round) {
238
+ return null;
239
+ }
240
+ const playerCard = player.useCard(idx, card);
241
+ if (playerCard) {
242
+ const card = round.use((0, Deck_1.PlayedCard)(player, playerCard));
243
+ hand.nextTurn();
244
+ return card;
245
+ }
246
+ return null;
247
+ },
248
+ nextTurn() {
249
+ var _a;
250
+ if (hand.turn >= match.table.players.length - 1) {
251
+ hand.setTurn(0);
252
+ }
253
+ else {
254
+ hand.setTurn(hand.turn + 1);
255
+ }
256
+ (_a = hand.currentRound) === null || _a === void 0 ? void 0 : _a.nextTurn();
257
+ },
258
+ getNextPlayer() {
259
+ const player = roundsGenerator.next();
260
+ hand.setTurnCommands();
261
+ return player;
262
+ },
263
+ disablePlayer(player) {
264
+ match.teams[player.teamIdx].disable(player);
265
+ },
266
+ addPoints(team, points) {
267
+ hand.points[team] = hand.points[team] + points;
268
+ },
269
+ pushRound(round) {
270
+ hand.rounds.push(round);
271
+ return round;
272
+ },
273
+ setTurn(turn) {
274
+ hand.turn = turn;
275
+ return match.table.getPlayer(hand.turn);
276
+ },
277
+ setCurrentRound(round) {
278
+ hand.currentRound = round;
279
+ return hand.currentRound;
280
+ },
281
+ setCurrentPlayer(player) {
282
+ hand._currentPlayer = player;
283
+ return hand._currentPlayer;
284
+ },
285
+ setState(state) {
286
+ hand.state = state;
287
+ return hand.state;
288
+ },
289
+ finished: () => {
290
+ return hand.state === types_1.EHandState.FINISHED;
291
+ },
292
+ };
293
+ return hand;
294
+ }
295
+ exports.Hand = Hand;
@@ -1,27 +1,27 @@
1
- import { IGameLoop } from "./GameLoop";
2
- import { IPlayer } from "./Player";
3
- import { ITable } from "./Table";
4
- import { ITeam } from "./Team";
5
- export interface IPrivateLobby {
6
- gameLoop?: IGameLoop;
7
- lastTeamIdx: 0 | 1;
8
- _players: Array<IPlayer | {
9
- id?: undefined;
10
- session?: undefined;
11
- }>;
12
- get players(): Array<IPlayer>;
13
- teams: Array<ITeam>;
14
- maxPlayers: number;
15
- table: ITable | null;
16
- full: boolean;
17
- ready: boolean;
18
- started: boolean;
19
- addPlayer(key: string, id: string, session: string, teamIdx?: 0 | 1, isOwner?: boolean): IPlayer;
20
- removePlayer(session: string): ILobby;
21
- calculateReady(): boolean;
22
- calculateFull(): boolean;
23
- startMatch(matchPoint?: 9 | 12 | 15): IGameLoop;
24
- }
25
- export interface ILobby extends Pick<IPrivateLobby, "addPlayer" | "removePlayer" | "startMatch" | "ready" | "full" | "started" | "teams" | "players" | "gameLoop" | "table" | "maxPlayers" | "calculateReady"> {
26
- }
27
- export declare function Lobby(teamSize?: 1 | 2 | 3): ILobby;
1
+ import { IGameLoop } from "./GameLoop";
2
+ import { IPlayer } from "./Player";
3
+ import { ITable } from "./Table";
4
+ import { ITeam } from "./Team";
5
+ export interface IPrivateLobby {
6
+ gameLoop?: IGameLoop;
7
+ lastTeamIdx: 0 | 1;
8
+ _players: Array<IPlayer | {
9
+ id?: undefined;
10
+ session?: undefined;
11
+ }>;
12
+ get players(): Array<IPlayer>;
13
+ teams: Array<ITeam>;
14
+ maxPlayers: number;
15
+ table: ITable | null;
16
+ full: boolean;
17
+ ready: boolean;
18
+ started: boolean;
19
+ addPlayer(key: string, id: string, session: string, teamIdx?: 0 | 1, isOwner?: boolean): IPlayer;
20
+ removePlayer(session: string): ILobby;
21
+ calculateReady(): boolean;
22
+ calculateFull(): boolean;
23
+ startMatch(matchPoint?: 9 | 12 | 15): IGameLoop;
24
+ }
25
+ export interface ILobby extends Pick<IPrivateLobby, "addPlayer" | "removePlayer" | "startMatch" | "ready" | "full" | "started" | "teams" | "players" | "gameLoop" | "table" | "maxPlayers" | "calculateReady"> {
26
+ }
27
+ export declare function Lobby(teamSize?: 1 | 2 | 3): ILobby;