@konoui/mjimage 0.0.41 → 0.0.43
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 +181 -103
- package/dist/index.d.ts +181 -103
- package/dist/index.js +2587 -2435
- package/package.json +1 -1
package/dist/index.d.ts
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
|
|
|
@@ -480,16 +501,28 @@ export declare const createEventEmitter: () => {
|
|
|
480
501
|
|
|
481
502
|
export declare const createEventPipe: () => [EventHandler, EventHandler];
|
|
482
503
|
|
|
483
|
-
export declare const createHand: (helper: ImageHelper, blocks: Block[]) => {
|
|
504
|
+
export declare const createHand: (helper: ImageHelper, blocks: Block[], options?: DrawnOptions) => {
|
|
484
505
|
e: G;
|
|
485
506
|
width: number;
|
|
486
507
|
height: number;
|
|
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,154 +613,154 @@ 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
|
-
export declare const drawBlocks: (svg: Svg, blocks: Block[], config?: ImageHelperConfig,
|
|
729
|
-
responsive
|
|
730
|
-
}) => void;
|
|
761
|
+
export declare const drawBlocks: (svg: Svg, blocks: Block[], config?: ImageHelperConfig, options?: {
|
|
762
|
+
responsive?: boolean;
|
|
763
|
+
} & DrawnOptions) => void;
|
|
731
764
|
|
|
732
765
|
export declare interface DrawEvent {
|
|
733
766
|
id: string;
|
|
@@ -744,7 +777,12 @@ 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;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
export declare interface DrawnOptions {
|
|
784
|
+
doraText?: boolean;
|
|
785
|
+
tsumoText?: boolean;
|
|
748
786
|
}
|
|
749
787
|
|
|
750
788
|
export declare const drawTable: (svg: Svg, tableInput: string, config: ImageHelperConfig | undefined, fontCtx: FontContext, params?: {
|
|
@@ -791,7 +829,7 @@ export declare interface EndEvent {
|
|
|
791
829
|
shouldContinue: boolean;
|
|
792
830
|
}
|
|
793
831
|
|
|
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";
|
|
832
|
+
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
833
|
|
|
796
834
|
export declare interface EventHandler {
|
|
797
835
|
emit(e: PlayerEvent): void;
|
|
@@ -826,8 +864,8 @@ export declare class Hand {
|
|
|
826
864
|
getArrayLen(t: Type): 2 | 8 | 10;
|
|
827
865
|
sum(t: Type): number;
|
|
828
866
|
get(t: Type, n: number): number;
|
|
829
|
-
inc(tiles: readonly Tile[]): Tile[];
|
|
830
|
-
dec(tiles: readonly Tile[]): Tile[];
|
|
867
|
+
inc(tiles: readonly Tile[]): readonly Tile[];
|
|
868
|
+
dec(tiles: readonly Tile[]): readonly Tile[];
|
|
831
869
|
draw(t: Tile): void;
|
|
832
870
|
discard(t: Tile): void;
|
|
833
871
|
reach(): void;
|
|
@@ -891,11 +929,40 @@ export declare function incrementalIDGenerator(start?: number): () => string;
|
|
|
891
929
|
|
|
892
930
|
export declare const INPUT_SEPARATOR = ",";
|
|
893
931
|
|
|
894
|
-
export declare
|
|
932
|
+
export declare interface IRiver {
|
|
933
|
+
discard(t: Tile, w: Wind): void;
|
|
934
|
+
discards(w?: Wind): {
|
|
935
|
+
w: Wind;
|
|
936
|
+
t: Tile;
|
|
937
|
+
callMarker?: boolean;
|
|
938
|
+
}[];
|
|
939
|
+
lastTile: {
|
|
940
|
+
w: Wind;
|
|
941
|
+
t: Tile;
|
|
942
|
+
callMarker?: boolean;
|
|
943
|
+
};
|
|
944
|
+
markCalled(): void;
|
|
945
|
+
cannotContinue(): boolean;
|
|
946
|
+
}
|
|
895
947
|
|
|
896
948
|
export declare function isNum5(t: Tile): boolean;
|
|
897
949
|
|
|
898
|
-
export declare
|
|
950
|
+
export declare interface IWall {
|
|
951
|
+
kan(): Tile;
|
|
952
|
+
draw(): Tile;
|
|
953
|
+
openDoraMarker(): Tile;
|
|
954
|
+
doraMarkers: readonly Tile[];
|
|
955
|
+
blindDoraMarkers: readonly Tile[];
|
|
956
|
+
canKan: boolean;
|
|
957
|
+
canDraw: boolean;
|
|
958
|
+
export(): WallProps;
|
|
959
|
+
initialHands(): {
|
|
960
|
+
[WIND.E]: string;
|
|
961
|
+
[WIND.S]: string;
|
|
962
|
+
[WIND.W]: string;
|
|
963
|
+
[WIND.N]: string;
|
|
964
|
+
};
|
|
965
|
+
}
|
|
899
966
|
|
|
900
967
|
export declare class MeasureText {
|
|
901
968
|
ctx: CanvasRenderingContext2D | null;
|
|
@@ -1045,18 +1112,18 @@ export declare interface PlayerCandidate {
|
|
|
1045
1112
|
shanten: number;
|
|
1046
1113
|
}
|
|
1047
1114
|
|
|
1115
|
+
export declare interface PlayerConnection {
|
|
1116
|
+
id: string;
|
|
1117
|
+
handler: EventHandler;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1048
1120
|
export declare class PlayerEfficiency {
|
|
1049
1121
|
static calcPlayerCandidates(counter: Counter, candidates: Candidate[]): PlayerCandidate[];
|
|
1050
1122
|
static selectMinPriority(c: Counter, playerCandidates: PlayerCandidate[], doras: Tile[]): PlayerCandidate;
|
|
1051
1123
|
private static calcPriority;
|
|
1052
1124
|
}
|
|
1053
1125
|
|
|
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
|
-
}
|
|
1126
|
+
export declare type PlayerEvent = DistributeEvent | EndEvent | CallEvent | RonEvent | TsumoEvent | DiscardEvent | DrawEvent | ReachEvent | ReachAcceptedEvent | NewDoraEvent | ChoiceAfterDrawnEvent | ChoiceAfterDiscardedEvent | ChoiceAfterCalled | ChoiceForReachAcceptance | ChoiceForChanKan;
|
|
1060
1127
|
|
|
1061
1128
|
export declare const prevRound: (r: Round) => Round;
|
|
1062
1129
|
|
|
@@ -1072,6 +1139,16 @@ export declare function prioritizeDrawnEvents(events: ChoiceAfterDrawnEvent[]):
|
|
|
1072
1139
|
type: boolean | keyof DrawnChoice;
|
|
1073
1140
|
};
|
|
1074
1141
|
|
|
1142
|
+
export declare interface ReachAcceptedEvent {
|
|
1143
|
+
id: string;
|
|
1144
|
+
type: Extract<Event_2, "REACH_ACCEPTED">;
|
|
1145
|
+
wind: Wind;
|
|
1146
|
+
reacherInfo: {
|
|
1147
|
+
wind: Wind;
|
|
1148
|
+
tile: string;
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1075
1152
|
export declare interface ReachEvent {
|
|
1076
1153
|
id: string;
|
|
1077
1154
|
type: Extract<ChoiceEvent, "REACH">;
|
|
@@ -1101,16 +1178,16 @@ export declare class River {
|
|
|
1101
1178
|
private m;
|
|
1102
1179
|
constructor();
|
|
1103
1180
|
discard(t: Tile, w: Wind): void;
|
|
1104
|
-
|
|
1181
|
+
discards(w?: Wind): {
|
|
1105
1182
|
w: Wind;
|
|
1106
1183
|
t: Tile;
|
|
1107
1184
|
callMarker?: boolean;
|
|
1108
|
-
};
|
|
1109
|
-
|
|
1185
|
+
}[];
|
|
1186
|
+
get lastTile(): {
|
|
1110
1187
|
w: Wind;
|
|
1111
1188
|
t: Tile;
|
|
1112
1189
|
callMarker?: boolean;
|
|
1113
|
-
}
|
|
1190
|
+
};
|
|
1114
1191
|
markCalled(): void;
|
|
1115
1192
|
cannotContinue(): boolean;
|
|
1116
1193
|
}
|
|
@@ -1125,7 +1202,6 @@ export declare interface RonEvent {
|
|
|
1125
1202
|
wind: Wind;
|
|
1126
1203
|
tile: string;
|
|
1127
1204
|
};
|
|
1128
|
-
pushBackReachStick: boolean;
|
|
1129
1205
|
}
|
|
1130
1206
|
|
|
1131
1207
|
export declare const ROUND: {
|
|
@@ -1239,6 +1315,8 @@ export declare class ShantenCalculator {
|
|
|
1239
1315
|
|
|
1240
1316
|
export declare function shuffle<T>(array: T[]): T[];
|
|
1241
1317
|
|
|
1318
|
+
export declare const sortCalledTiles: (arr: readonly Tile[]) => Tile[];
|
|
1319
|
+
|
|
1242
1320
|
export declare const TABLE_CONTEXT: {
|
|
1243
1321
|
readonly BASE: 40;
|
|
1244
1322
|
};
|
|
@@ -1321,13 +1399,7 @@ export declare class Tile {
|
|
|
1321
1399
|
}): Tile;
|
|
1322
1400
|
has(op: Operator): boolean;
|
|
1323
1401
|
isNum(): boolean;
|
|
1324
|
-
equals(t: Tile
|
|
1325
|
-
imageSize(scale: number): {
|
|
1326
|
-
width: number;
|
|
1327
|
-
height: number;
|
|
1328
|
-
baseWidth: number;
|
|
1329
|
-
baseHeight: number;
|
|
1330
|
-
};
|
|
1402
|
+
equals(t: Tile): boolean;
|
|
1331
1403
|
}
|
|
1332
1404
|
|
|
1333
1405
|
export declare const TILE_CONTEXT: {
|
|
@@ -1372,6 +1444,12 @@ export declare class Wall {
|
|
|
1372
1444
|
get blindDoraMarkers(): Tile[];
|
|
1373
1445
|
get canKan(): boolean;
|
|
1374
1446
|
get canDraw(): boolean;
|
|
1447
|
+
initialHands(): {
|
|
1448
|
+
"1w": string;
|
|
1449
|
+
"2w": string;
|
|
1450
|
+
"3w": string;
|
|
1451
|
+
"4w": string;
|
|
1452
|
+
};
|
|
1375
1453
|
private init;
|
|
1376
1454
|
export(): WallProps;
|
|
1377
1455
|
static clone(walls: WallProps): WallProps;
|