@konoui/mjimage 0.0.40 → 0.0.42
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/dist/index.cjs +11 -13
- package/dist/index.d.cts +174 -101
- package/dist/index.d.ts +174 -101
- package/dist/index.js +2487 -2346
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -24,12 +24,12 @@ import { Use } from '@svgdotjs/svg.js';
|
|
|
24
24
|
export declare class ActorHand extends Hand {
|
|
25
25
|
isBackHand(): boolean;
|
|
26
26
|
clone(): ActorHand;
|
|
27
|
-
dec(tiles: readonly Tile[]): Tile[];
|
|
27
|
+
dec(tiles: readonly Tile[]): readonly Tile[];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export declare abstract class BaseActor {
|
|
31
31
|
id: string;
|
|
32
|
-
river:
|
|
32
|
+
river: IRiver;
|
|
33
33
|
placeManager: PlaceManager;
|
|
34
34
|
scoreManager: ScoreManager;
|
|
35
35
|
hands: {
|
|
@@ -52,7 +52,7 @@ declare class BaseHelper {
|
|
|
52
52
|
readonly tileHeight: number;
|
|
53
53
|
readonly imageHostPath: string;
|
|
54
54
|
readonly imageHostUrl: string;
|
|
55
|
-
readonly imageExt:
|
|
55
|
+
readonly imageExt: "svg" | "webp";
|
|
56
56
|
readonly scale: number;
|
|
57
57
|
readonly svgSprite: boolean;
|
|
58
58
|
constructor(props?: ImageHelperConfig);
|
|
@@ -90,13 +90,13 @@ export declare abstract class Block {
|
|
|
90
90
|
static deserialize(v: SerializedBlock): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
|
|
91
91
|
serialize(): {
|
|
92
92
|
tiles: string;
|
|
93
|
-
type:
|
|
93
|
+
type: BLOCK;
|
|
94
94
|
};
|
|
95
95
|
toJSON(): {
|
|
96
96
|
tiles: string;
|
|
97
|
-
type:
|
|
97
|
+
type: BLOCK;
|
|
98
98
|
};
|
|
99
|
-
get type():
|
|
99
|
+
get type(): BLOCK;
|
|
100
100
|
get tiles(): readonly Tile[];
|
|
101
101
|
abstract toString(): string;
|
|
102
102
|
is(type: BLOCK): boolean;
|
|
@@ -107,10 +107,6 @@ export declare abstract class Block {
|
|
|
107
107
|
tile: Tile;
|
|
108
108
|
};
|
|
109
109
|
}): Block | BlockHand | BlockOther | BlockChi | BlockPon | BlockAnKan | BlockDaiKan | BlockShoKan | BlockThree | BlockRun | BlockIsolated | BlockPair;
|
|
110
|
-
imageSize(scale: number): {
|
|
111
|
-
width: number;
|
|
112
|
-
height: number;
|
|
113
|
-
};
|
|
114
110
|
}
|
|
115
111
|
|
|
116
112
|
export declare class BlockAnKan extends Block {
|
|
@@ -123,12 +119,12 @@ export declare class BlockAnKan extends Block {
|
|
|
123
119
|
export declare class BlockCalculator {
|
|
124
120
|
hand: Hand;
|
|
125
121
|
constructor(hand: Hand);
|
|
126
|
-
calc(lastTile: Tile): Block[][];
|
|
127
|
-
markDrawn(hands: Block[][], lastTile: Tile): Block[][];
|
|
128
|
-
sevenPairs(): Block[][];
|
|
129
|
-
thirteenOrphans(): Block[][];
|
|
130
|
-
nineGates(): Block[][];
|
|
131
|
-
fourSetsOnePair(): Block[][];
|
|
122
|
+
calc(lastTile: Tile): readonly Block[][];
|
|
123
|
+
markDrawn(hands: readonly Block[][], lastTile: Tile): readonly Block[][];
|
|
124
|
+
sevenPairs(): readonly Block[][];
|
|
125
|
+
thirteenOrphans(): readonly Block[][];
|
|
126
|
+
nineGates(): readonly Block[][];
|
|
127
|
+
fourSetsOnePair(): readonly Block[][];
|
|
132
128
|
private commonAll;
|
|
133
129
|
private commonByType;
|
|
134
130
|
}
|
|
@@ -190,8 +186,8 @@ export declare class BlockThree extends Block {
|
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
export declare interface BoardContext {
|
|
193
|
-
doraMarkers: Tile[];
|
|
194
|
-
blindDoraMarkers?: Tile[];
|
|
189
|
+
doraMarkers: readonly Tile[];
|
|
190
|
+
blindDoraMarkers?: readonly Tile[];
|
|
195
191
|
round: Round;
|
|
196
192
|
myWind: Wind;
|
|
197
193
|
ronWind?: Wind;
|
|
@@ -211,6 +207,8 @@ declare type BoardRound = (typeof ROUND_MAP)[keyof typeof ROUND_MAP];
|
|
|
211
207
|
|
|
212
208
|
declare type BoardWind = (typeof WIND_MAP)[keyof typeof WIND_MAP];
|
|
213
209
|
|
|
210
|
+
export declare const callBlockIndex: (caller: Wind, discardedBy: Wind, type: typeof BLOCK.PON | typeof BLOCK.DAI_KAN) => 0 | 1 | 2 | 3;
|
|
211
|
+
|
|
214
212
|
export declare interface CallEvent {
|
|
215
213
|
id: string;
|
|
216
214
|
type: Extract<ChoiceEvent, "PON" | "CHI" | "AN_KAN" | "SHO_KAN" | "DAI_KAN">;
|
|
@@ -254,7 +252,7 @@ export declare interface ChoiceAfterDrawnEvent {
|
|
|
254
252
|
choices: DrawnChoice;
|
|
255
253
|
}
|
|
256
254
|
|
|
257
|
-
declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "
|
|
255
|
+
declare type ChoiceEvent = "PON" | "CHI" | "RON" | "DISCARD" | "TSUMO" | "REACH" | "AN_KAN" | "SHO_KAN" | "DAI_KAN" | "DRAWN_GAME_BY_NINE_ORPHANS";
|
|
258
256
|
|
|
259
257
|
export declare interface ChoiceForChanKan {
|
|
260
258
|
id: string;
|
|
@@ -267,8 +265,19 @@ export declare interface ChoiceForChanKan {
|
|
|
267
265
|
choices: Pick<DiscardedChoice, "RON">;
|
|
268
266
|
}
|
|
269
267
|
|
|
268
|
+
export declare interface ChoiceForReachAcceptance {
|
|
269
|
+
id: string;
|
|
270
|
+
type: Extract<Event_2, "CHOICE_FOR_REACH_ACCEPTANCE">;
|
|
271
|
+
wind: Wind;
|
|
272
|
+
reacherInfo: {
|
|
273
|
+
wind: Wind;
|
|
274
|
+
tile: string;
|
|
275
|
+
};
|
|
276
|
+
choices: Pick<DiscardedChoice, "RON">;
|
|
277
|
+
}
|
|
278
|
+
|
|
270
279
|
export declare class Controller {
|
|
271
|
-
wall:
|
|
280
|
+
wall: IWall;
|
|
272
281
|
playerIDs: string[];
|
|
273
282
|
actor: Actor<StateMachine< {
|
|
274
283
|
currentWind: Wind;
|
|
@@ -307,6 +316,12 @@ export declare class Controller {
|
|
|
307
316
|
tile: Tile;
|
|
308
317
|
iam: Wind;
|
|
309
318
|
} | {
|
|
319
|
+
type: "REACH_ACCEPT";
|
|
320
|
+
reacherInfo: {
|
|
321
|
+
tile: Tile;
|
|
322
|
+
wind: Wind;
|
|
323
|
+
};
|
|
324
|
+
} | {
|
|
310
325
|
type: "DISCARD";
|
|
311
326
|
tile: Tile;
|
|
312
327
|
iam: Wind;
|
|
@@ -323,7 +338,7 @@ export declare class Controller {
|
|
|
323
338
|
block: BlockDaiKan;
|
|
324
339
|
iam: Wind;
|
|
325
340
|
} | {
|
|
326
|
-
type: "
|
|
341
|
+
type: "DRAWN_GAME_BY_NINE_ORPHANS";
|
|
327
342
|
iam: Wind;
|
|
328
343
|
}, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>>;
|
|
329
344
|
observer: Observer;
|
|
@@ -335,15 +350,15 @@ export declare class Controller {
|
|
|
335
350
|
};
|
|
336
351
|
histories: History_2[];
|
|
337
352
|
debugMode: boolean;
|
|
338
|
-
|
|
339
|
-
constructor(players: PlayerProps[], params?: {
|
|
353
|
+
constructor(players: PlayerConnection[], params?: {
|
|
340
354
|
debug?: boolean;
|
|
355
|
+
shuffle?: boolean;
|
|
341
356
|
});
|
|
342
357
|
boardParams(w: Wind): BoardContext;
|
|
343
358
|
hand(w: Wind): ActorHand;
|
|
344
359
|
get placeManager(): PlaceManager;
|
|
345
360
|
get scoreManager(): ScoreManager;
|
|
346
|
-
get river():
|
|
361
|
+
get river(): IRiver;
|
|
347
362
|
next(force?: boolean): void;
|
|
348
363
|
emit(e: PlayerEvent): void;
|
|
349
364
|
enqueue(event: PlayerEvent): void;
|
|
@@ -358,17 +373,17 @@ export declare class Controller {
|
|
|
358
373
|
replacementWin?: boolean;
|
|
359
374
|
oneShot?: boolean;
|
|
360
375
|
missingRon?: boolean;
|
|
361
|
-
|
|
376
|
+
discardedBy?: Wind;
|
|
362
377
|
}): WinResult | false;
|
|
363
|
-
doPon(w: Wind,
|
|
364
|
-
doChi(w: Wind,
|
|
365
|
-
redPattern(blocks: BlockChi[]
|
|
378
|
+
doPon(w: Wind, discardedBy: Wind, t?: Tile): BlockPon[] | false;
|
|
379
|
+
doChi(w: Wind, discardedBy: Wind, t?: Tile): BlockChi[] | false;
|
|
380
|
+
redPattern(blocks: BlockChi[]): BlockChi[];
|
|
366
381
|
doReach(w: Wind): Candidate[] | false;
|
|
367
382
|
doDiscard(w: Wind, called?: BlockChi | BlockPon): Tile[];
|
|
368
|
-
cannotDiscardTile(
|
|
383
|
+
cannotDiscardTile(b: BlockChi): Tile[];
|
|
369
384
|
doAnKan(w: Wind): BlockAnKan[] | false;
|
|
370
385
|
doShoKan(w: Wind): BlockShoKan[] | false;
|
|
371
|
-
doDaiKan(w: Wind,
|
|
386
|
+
doDaiKan(w: Wind, discardedBy: Wind, t: Tile): BlockDaiKan | false;
|
|
372
387
|
canDrawnGame(w: Wind): boolean;
|
|
373
388
|
initialHands(): {
|
|
374
389
|
"1w": string;
|
|
@@ -453,6 +468,12 @@ type: "REACH";
|
|
|
453
468
|
tile: Tile;
|
|
454
469
|
iam: Wind;
|
|
455
470
|
} | {
|
|
471
|
+
type: "REACH_ACCEPT";
|
|
472
|
+
reacherInfo: {
|
|
473
|
+
tile: Tile;
|
|
474
|
+
wind: Wind;
|
|
475
|
+
};
|
|
476
|
+
} | {
|
|
456
477
|
type: "DISCARD";
|
|
457
478
|
tile: Tile;
|
|
458
479
|
iam: Wind;
|
|
@@ -469,7 +490,7 @@ type: "DAI_KAN";
|
|
|
469
490
|
block: BlockDaiKan;
|
|
470
491
|
iam: Wind;
|
|
471
492
|
} | {
|
|
472
|
-
type: "
|
|
493
|
+
type: "DRAWN_GAME_BY_NINE_ORPHANS";
|
|
473
494
|
iam: Wind;
|
|
474
495
|
}, Record<string, AnyActorRef>, ProvidedActor, ParameterizedObject, ParameterizedObject, never, StateValue, string, unknown, NonReducibleUnknown, EventObject, MetaObject, any>;
|
|
475
496
|
|
|
@@ -487,9 +508,21 @@ export declare const createHand: (helper: ImageHelper, blocks: Block[]) => {
|
|
|
487
508
|
};
|
|
488
509
|
|
|
489
510
|
export declare const createLocalGame: (params?: {
|
|
490
|
-
playerIDs?: string[];
|
|
491
511
|
debug?: boolean;
|
|
492
|
-
|
|
512
|
+
shuffle?: boolean;
|
|
513
|
+
playerInjection?: {
|
|
514
|
+
p1?: new (id: string, e: EventHandler) => Player;
|
|
515
|
+
p2?: new (id: string, e: EventHandler) => Player;
|
|
516
|
+
p3?: new (id: string, e: EventHandler) => Player;
|
|
517
|
+
p4?: new (id: string, e: EventHandler) => Player;
|
|
518
|
+
};
|
|
519
|
+
}) => {
|
|
520
|
+
c: Controller;
|
|
521
|
+
p1: Player;
|
|
522
|
+
p2: Player;
|
|
523
|
+
p3: Player;
|
|
524
|
+
p4: Player;
|
|
525
|
+
};
|
|
493
526
|
|
|
494
527
|
export declare const createTable: (helper: ImageHelper, fontCtx: FontContext, handsProps: HandsInput, discardsProps: DiscardsInput, scoreBoardProps: ScoreBoardInput) => {
|
|
495
528
|
e: G;
|
|
@@ -553,8 +586,8 @@ export declare interface DistributeEvent {
|
|
|
553
586
|
export declare class DoubleCalculator {
|
|
554
587
|
hand: Hand;
|
|
555
588
|
cfg: {
|
|
556
|
-
doras: Tile[];
|
|
557
|
-
blindDoras: Tile[];
|
|
589
|
+
doras: readonly Tile[];
|
|
590
|
+
blindDoras: readonly Tile[];
|
|
558
591
|
roundWind: Tile;
|
|
559
592
|
myWind: Tile;
|
|
560
593
|
reached: 0 | 1 | 2;
|
|
@@ -570,8 +603,8 @@ export declare class DoubleCalculator {
|
|
|
570
603
|
orig: BoardContext;
|
|
571
604
|
};
|
|
572
605
|
constructor(hand: Hand, params: BoardContext);
|
|
573
|
-
calc(hands: Block[][]): WinResult | false;
|
|
574
|
-
calcPatterns(hands: Block[][]): {
|
|
606
|
+
calc(hands: readonly Block[][]): WinResult | false;
|
|
607
|
+
calcPatterns(hands: readonly Block[][]): {
|
|
575
608
|
points: {
|
|
576
609
|
name: string;
|
|
577
610
|
double: number;
|
|
@@ -580,149 +613,149 @@ export declare class DoubleCalculator {
|
|
|
580
613
|
hand: Block[];
|
|
581
614
|
}[];
|
|
582
615
|
private minus;
|
|
583
|
-
dA1(h: Block[]): {
|
|
616
|
+
dA1(h: readonly Block[]): {
|
|
584
617
|
name: string;
|
|
585
618
|
double: number;
|
|
586
619
|
}[];
|
|
587
|
-
dB1(h: Block[]): {
|
|
620
|
+
dB1(h: readonly Block[]): {
|
|
588
621
|
name: string;
|
|
589
622
|
double: number;
|
|
590
623
|
}[];
|
|
591
|
-
dC1(h: Block[]): {
|
|
624
|
+
dC1(h: readonly Block[]): {
|
|
592
625
|
name: string;
|
|
593
626
|
double: number;
|
|
594
627
|
}[];
|
|
595
|
-
dD1(h: Block[]): {
|
|
628
|
+
dD1(h: readonly Block[]): {
|
|
596
629
|
name: string;
|
|
597
630
|
double: number;
|
|
598
631
|
}[];
|
|
599
|
-
dE1(h: Block[]): {
|
|
632
|
+
dE1(h: readonly Block[]): {
|
|
600
633
|
name: string;
|
|
601
634
|
double: number;
|
|
602
635
|
}[];
|
|
603
|
-
dF1(h: Block[]): {
|
|
636
|
+
dF1(h: readonly Block[]): {
|
|
604
637
|
name: string;
|
|
605
638
|
double: number;
|
|
606
639
|
}[];
|
|
607
|
-
dG1(h: Block[]): {
|
|
640
|
+
dG1(h: readonly Block[]): {
|
|
608
641
|
name: string;
|
|
609
642
|
double: number;
|
|
610
643
|
}[];
|
|
611
|
-
dH1(h: Block[]): {
|
|
644
|
+
dH1(h: readonly Block[]): {
|
|
612
645
|
name: string;
|
|
613
646
|
double: number;
|
|
614
647
|
}[];
|
|
615
|
-
dI1(h: Block[]): {
|
|
648
|
+
dI1(h: readonly Block[]): {
|
|
616
649
|
name: string;
|
|
617
650
|
double: number;
|
|
618
651
|
}[];
|
|
619
|
-
dJ1(h: Block[]): {
|
|
652
|
+
dJ1(h: readonly Block[]): {
|
|
620
653
|
name: string;
|
|
621
654
|
double: number;
|
|
622
655
|
}[];
|
|
623
|
-
dK1(h: Block[]): {
|
|
656
|
+
dK1(h: readonly Block[]): {
|
|
624
657
|
name: string;
|
|
625
658
|
double: number;
|
|
626
659
|
}[];
|
|
627
|
-
dX1(h: Block[]): {
|
|
660
|
+
dX1(h: readonly Block[]): {
|
|
628
661
|
name: string;
|
|
629
662
|
double: number;
|
|
630
663
|
}[];
|
|
631
|
-
dA2(h: Block[]): {
|
|
664
|
+
dA2(h: readonly Block[]): {
|
|
632
665
|
name: string;
|
|
633
666
|
double: number;
|
|
634
667
|
}[];
|
|
635
|
-
dB2(h: Block[]): {
|
|
668
|
+
dB2(h: readonly Block[]): {
|
|
636
669
|
name: string;
|
|
637
670
|
double: number;
|
|
638
671
|
}[];
|
|
639
|
-
dC2(h: Block[]): {
|
|
672
|
+
dC2(h: readonly Block[]): {
|
|
640
673
|
name: string;
|
|
641
674
|
double: number;
|
|
642
675
|
}[];
|
|
643
|
-
dD2(h: Block[]): {
|
|
676
|
+
dD2(h: readonly Block[]): {
|
|
644
677
|
name: string;
|
|
645
678
|
double: number;
|
|
646
679
|
}[];
|
|
647
|
-
dE2(h: Block[]): {
|
|
680
|
+
dE2(h: readonly Block[]): {
|
|
648
681
|
name: string;
|
|
649
682
|
double: number;
|
|
650
683
|
}[];
|
|
651
|
-
dF2(h: Block[]): {
|
|
684
|
+
dF2(h: readonly Block[]): {
|
|
652
685
|
name: string;
|
|
653
686
|
double: number;
|
|
654
687
|
}[];
|
|
655
|
-
dG2(h: Block[]): {
|
|
688
|
+
dG2(h: readonly Block[]): {
|
|
656
689
|
name: string;
|
|
657
690
|
double: number;
|
|
658
691
|
}[];
|
|
659
|
-
dH2(h: Block[]): {
|
|
692
|
+
dH2(h: readonly Block[]): {
|
|
660
693
|
name: string;
|
|
661
694
|
double: number;
|
|
662
695
|
}[];
|
|
663
|
-
dI2(h: Block[]): {
|
|
696
|
+
dI2(h: readonly Block[]): {
|
|
664
697
|
name: string;
|
|
665
698
|
double: number;
|
|
666
699
|
}[];
|
|
667
|
-
dJ2(h: Block[]): {
|
|
700
|
+
dJ2(h: readonly Block[]): {
|
|
668
701
|
name: string;
|
|
669
702
|
double: number;
|
|
670
703
|
}[];
|
|
671
|
-
dA3(h: Block[]): {
|
|
704
|
+
dA3(h: readonly Block[]): {
|
|
672
705
|
name: string;
|
|
673
706
|
double: number;
|
|
674
707
|
}[];
|
|
675
|
-
dB3(h: Block[]): {
|
|
708
|
+
dB3(h: readonly Block[]): {
|
|
676
709
|
name: string;
|
|
677
710
|
double: number;
|
|
678
711
|
}[];
|
|
679
|
-
dC3(h: Block[]): {
|
|
712
|
+
dC3(h: readonly Block[]): {
|
|
680
713
|
name: string;
|
|
681
714
|
double: number;
|
|
682
715
|
}[];
|
|
683
|
-
dA6(h: Block[]): {
|
|
716
|
+
dA6(h: readonly Block[]): {
|
|
684
717
|
name: string;
|
|
685
718
|
double: number;
|
|
686
719
|
}[];
|
|
687
|
-
dA13(h: Block[]): {
|
|
720
|
+
dA13(h: readonly Block[]): {
|
|
688
721
|
name: string;
|
|
689
722
|
double: number;
|
|
690
723
|
}[];
|
|
691
|
-
dB13(h: Block[]): {
|
|
724
|
+
dB13(h: readonly Block[]): {
|
|
692
725
|
name: string;
|
|
693
726
|
double: number;
|
|
694
727
|
}[];
|
|
695
|
-
dC13(h: Block[]): {
|
|
728
|
+
dC13(h: readonly Block[]): {
|
|
696
729
|
name: string;
|
|
697
730
|
double: number;
|
|
698
731
|
}[];
|
|
699
|
-
dD13(h: Block[]): {
|
|
732
|
+
dD13(h: readonly Block[]): {
|
|
700
733
|
name: string;
|
|
701
734
|
double: number;
|
|
702
735
|
}[];
|
|
703
|
-
dE13(h: Block[]): {
|
|
736
|
+
dE13(h: readonly Block[]): {
|
|
704
737
|
name: string;
|
|
705
738
|
double: number;
|
|
706
739
|
}[];
|
|
707
|
-
dF13(h: Block[]): {
|
|
740
|
+
dF13(h: readonly Block[]): {
|
|
708
741
|
name: string;
|
|
709
742
|
double: number;
|
|
710
743
|
}[];
|
|
711
|
-
dG13(h: Block[]): {
|
|
744
|
+
dG13(h: readonly Block[]): {
|
|
712
745
|
name: string;
|
|
713
746
|
double: number;
|
|
714
747
|
}[];
|
|
715
|
-
dH13(h: Block[]): {
|
|
748
|
+
dH13(h: readonly Block[]): {
|
|
716
749
|
name: string;
|
|
717
750
|
double: number;
|
|
718
751
|
}[];
|
|
719
|
-
dI13(h: Block[]): {
|
|
752
|
+
dI13(h: readonly Block[]): {
|
|
720
753
|
name: string;
|
|
721
754
|
double: number;
|
|
722
755
|
}[];
|
|
723
|
-
dJ13(h: Block[]): never[];
|
|
724
|
-
dK13(h: Block[]): never[];
|
|
725
|
-
calcFu(h: Block[]): number;
|
|
756
|
+
dJ13(h: readonly Block[]): never[];
|
|
757
|
+
dK13(h: readonly Block[]): never[];
|
|
758
|
+
calcFu(h: readonly Block[]): number;
|
|
726
759
|
}
|
|
727
760
|
|
|
728
761
|
export declare const drawBlocks: (svg: Svg, blocks: Block[], config?: ImageHelperConfig, params?: {
|
|
@@ -744,7 +777,7 @@ declare interface DrawnChoice {
|
|
|
744
777
|
AN_KAN: false | SerializedBlock[];
|
|
745
778
|
SHO_KAN: false | SerializedBlock[];
|
|
746
779
|
DISCARD: false | string[];
|
|
747
|
-
|
|
780
|
+
DRAWN_GAME_BY_NINE_ORPHANS: boolean;
|
|
748
781
|
}
|
|
749
782
|
|
|
750
783
|
export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelperConfig | undefined, fontCtx: FontContext, params?: {
|
|
@@ -762,8 +795,8 @@ export declare class Efficiency {
|
|
|
762
795
|
shanten: number;
|
|
763
796
|
candidates: Tile[];
|
|
764
797
|
};
|
|
765
|
-
static partialCandidateTiles(input: string, options
|
|
766
|
-
fourSetsOnePair
|
|
798
|
+
static partialCandidateTiles(input: string, options?: {
|
|
799
|
+
fourSetsOnePair?: boolean;
|
|
767
800
|
}): {
|
|
768
801
|
shanten: number;
|
|
769
802
|
candidates: Tile[];
|
|
@@ -791,7 +824,7 @@ export declare interface EndEvent {
|
|
|
791
824
|
shouldContinue: boolean;
|
|
792
825
|
}
|
|
793
826
|
|
|
794
|
-
declare type Event_2 = CallEvent | "DRAW" | "CHOICE_AFTER_DRAWN" | "CHOICE_AFTER_DISCARDED" | "CHOICE_AFTER_CALLED" | "CHOICE_FOR_CHAN_KAN" | "DISTRIBUTE" | "NEW_DORA" | "END_GAME";
|
|
827
|
+
declare type Event_2 = CallEvent | "DRAW" | "CHOICE_AFTER_DRAWN" | "CHOICE_AFTER_DISCARDED" | "CHOICE_AFTER_CALLED" | "CHOICE_FOR_CHAN_KAN" | "CHOICE_FOR_REACH_ACCEPTANCE" | "REACH_ACCEPTED" | "DISTRIBUTE" | "NEW_DORA" | "END_GAME";
|
|
795
828
|
|
|
796
829
|
export declare interface EventHandler {
|
|
797
830
|
emit(e: PlayerEvent): void;
|
|
@@ -826,8 +859,8 @@ export declare class Hand {
|
|
|
826
859
|
getArrayLen(t: Type): 2 | 8 | 10;
|
|
827
860
|
sum(t: Type): number;
|
|
828
861
|
get(t: Type, n: number): number;
|
|
829
|
-
inc(tiles: readonly Tile[]): Tile[];
|
|
830
|
-
dec(tiles: readonly Tile[]): Tile[];
|
|
862
|
+
inc(tiles: readonly Tile[]): readonly Tile[];
|
|
863
|
+
dec(tiles: readonly Tile[]): readonly Tile[];
|
|
831
864
|
draw(t: Tile): void;
|
|
832
865
|
discard(t: Tile): void;
|
|
833
866
|
reach(): void;
|
|
@@ -891,11 +924,40 @@ export declare function incrementalIDGenerator(start?: number): () => string;
|
|
|
891
924
|
|
|
892
925
|
export declare const INPUT_SEPARATOR = ",";
|
|
893
926
|
|
|
894
|
-
export declare
|
|
927
|
+
export declare interface IRiver {
|
|
928
|
+
discard(t: Tile, w: Wind): void;
|
|
929
|
+
discards(w?: Wind): {
|
|
930
|
+
w: Wind;
|
|
931
|
+
t: Tile;
|
|
932
|
+
callMarker?: boolean;
|
|
933
|
+
}[];
|
|
934
|
+
lastTile: {
|
|
935
|
+
w: Wind;
|
|
936
|
+
t: Tile;
|
|
937
|
+
callMarker?: boolean;
|
|
938
|
+
};
|
|
939
|
+
markCalled(): void;
|
|
940
|
+
cannotContinue(): boolean;
|
|
941
|
+
}
|
|
895
942
|
|
|
896
943
|
export declare function isNum5(t: Tile): boolean;
|
|
897
944
|
|
|
898
|
-
export declare
|
|
945
|
+
export declare interface IWall {
|
|
946
|
+
kan(): Tile;
|
|
947
|
+
draw(): Tile;
|
|
948
|
+
openDoraMarker(): Tile;
|
|
949
|
+
doraMarkers: readonly Tile[];
|
|
950
|
+
blindDoraMarkers: readonly Tile[];
|
|
951
|
+
canKan: boolean;
|
|
952
|
+
canDraw: boolean;
|
|
953
|
+
export(): WallProps;
|
|
954
|
+
initialHands(): {
|
|
955
|
+
[WIND.E]: string;
|
|
956
|
+
[WIND.S]: string;
|
|
957
|
+
[WIND.W]: string;
|
|
958
|
+
[WIND.N]: string;
|
|
959
|
+
};
|
|
960
|
+
}
|
|
899
961
|
|
|
900
962
|
export declare class MeasureText {
|
|
901
963
|
ctx: CanvasRenderingContext2D | null;
|
|
@@ -1045,18 +1107,18 @@ export declare interface PlayerCandidate {
|
|
|
1045
1107
|
shanten: number;
|
|
1046
1108
|
}
|
|
1047
1109
|
|
|
1110
|
+
export declare interface PlayerConnection {
|
|
1111
|
+
id: string;
|
|
1112
|
+
handler: EventHandler;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1048
1115
|
export declare class PlayerEfficiency {
|
|
1049
1116
|
static calcPlayerCandidates(counter: Counter, candidates: Candidate[]): PlayerCandidate[];
|
|
1050
1117
|
static selectMinPriority(c: Counter, playerCandidates: PlayerCandidate[], doras: Tile[]): PlayerCandidate;
|
|
1051
1118
|
private static calcPriority;
|
|
1052
1119
|
}
|
|
1053
1120
|
|
|
1054
|
-
export declare type PlayerEvent = DistributeEvent | EndEvent | CallEvent | RonEvent | TsumoEvent | DiscardEvent | DrawEvent | ReachEvent | NewDoraEvent | ChoiceAfterDrawnEvent | ChoiceAfterDiscardedEvent | ChoiceAfterCalled | ChoiceForChanKan;
|
|
1055
|
-
|
|
1056
|
-
export declare interface PlayerProps {
|
|
1057
|
-
id: string;
|
|
1058
|
-
handler: EventHandler;
|
|
1059
|
-
}
|
|
1121
|
+
export declare type PlayerEvent = DistributeEvent | EndEvent | CallEvent | RonEvent | TsumoEvent | DiscardEvent | DrawEvent | ReachEvent | ReachAcceptedEvent | NewDoraEvent | ChoiceAfterDrawnEvent | ChoiceAfterDiscardedEvent | ChoiceAfterCalled | ChoiceForReachAcceptance | ChoiceForChanKan;
|
|
1060
1122
|
|
|
1061
1123
|
export declare const prevRound: (r: Round) => Round;
|
|
1062
1124
|
|
|
@@ -1072,6 +1134,16 @@ export declare function prioritizeDrawnEvents(events: ChoiceAfterDrawnEvent[]):
|
|
|
1072
1134
|
type: boolean | keyof DrawnChoice;
|
|
1073
1135
|
};
|
|
1074
1136
|
|
|
1137
|
+
export declare interface ReachAcceptedEvent {
|
|
1138
|
+
id: string;
|
|
1139
|
+
type: Extract<Event_2, "REACH_ACCEPTED">;
|
|
1140
|
+
wind: Wind;
|
|
1141
|
+
reacherInfo: {
|
|
1142
|
+
wind: Wind;
|
|
1143
|
+
tile: string;
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1075
1147
|
export declare interface ReachEvent {
|
|
1076
1148
|
id: string;
|
|
1077
1149
|
type: Extract<ChoiceEvent, "REACH">;
|
|
@@ -1101,16 +1173,16 @@ export declare class River {
|
|
|
1101
1173
|
private m;
|
|
1102
1174
|
constructor();
|
|
1103
1175
|
discard(t: Tile, w: Wind): void;
|
|
1104
|
-
|
|
1176
|
+
discards(w?: Wind): {
|
|
1105
1177
|
w: Wind;
|
|
1106
1178
|
t: Tile;
|
|
1107
1179
|
callMarker?: boolean;
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1180
|
+
}[];
|
|
1181
|
+
get lastTile(): {
|
|
1110
1182
|
w: Wind;
|
|
1111
1183
|
t: Tile;
|
|
1112
1184
|
callMarker?: boolean;
|
|
1113
|
-
}
|
|
1185
|
+
};
|
|
1114
1186
|
markCalled(): void;
|
|
1115
1187
|
cannotContinue(): boolean;
|
|
1116
1188
|
}
|
|
@@ -1125,7 +1197,6 @@ export declare interface RonEvent {
|
|
|
1125
1197
|
wind: Wind;
|
|
1126
1198
|
tile: string;
|
|
1127
1199
|
};
|
|
1128
|
-
pushBackReachStick: boolean;
|
|
1129
1200
|
}
|
|
1130
1201
|
|
|
1131
1202
|
export declare const ROUND: {
|
|
@@ -1239,6 +1310,8 @@ export declare class ShantenCalculator {
|
|
|
1239
1310
|
|
|
1240
1311
|
export declare function shuffle<T>(array: T[]): T[];
|
|
1241
1312
|
|
|
1313
|
+
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1314
|
+
|
|
1242
1315
|
export declare const TABLE_CONTEXT: {
|
|
1243
1316
|
readonly BASE: 40;
|
|
1244
1317
|
};
|
|
@@ -1321,13 +1394,7 @@ export declare class Tile {
|
|
|
1321
1394
|
}): Tile;
|
|
1322
1395
|
has(op: Operator): boolean;
|
|
1323
1396
|
isNum(): boolean;
|
|
1324
|
-
equals(t: Tile
|
|
1325
|
-
imageSize(scale: number): {
|
|
1326
|
-
width: number;
|
|
1327
|
-
height: number;
|
|
1328
|
-
baseWidth: number;
|
|
1329
|
-
baseHeight: number;
|
|
1330
|
-
};
|
|
1397
|
+
equals(t: Tile): boolean;
|
|
1331
1398
|
}
|
|
1332
1399
|
|
|
1333
1400
|
export declare const TILE_CONTEXT: {
|
|
@@ -1372,6 +1439,12 @@ export declare class Wall {
|
|
|
1372
1439
|
get blindDoraMarkers(): Tile[];
|
|
1373
1440
|
get canKan(): boolean;
|
|
1374
1441
|
get canDraw(): boolean;
|
|
1442
|
+
initialHands(): {
|
|
1443
|
+
"1w": string;
|
|
1444
|
+
"2w": string;
|
|
1445
|
+
"3w": string;
|
|
1446
|
+
"4w": string;
|
|
1447
|
+
};
|
|
1375
1448
|
private init;
|
|
1376
1449
|
export(): WallProps;
|
|
1377
1450
|
static clone(walls: WallProps): WallProps;
|