koishi-plugin-satori-ai 1.2.11 → 1.3.1

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.
@@ -5,6 +5,7 @@ declare module 'koishi' {
5
5
  }
6
6
  }
7
7
  export interface gameResult {
8
+ playerID: string;
8
9
  message: string;
9
10
  gameName: string;
10
11
  }
@@ -14,12 +15,16 @@ export interface gameResult {
14
15
  export declare abstract class abstractGameSingleGame {
15
16
  protected session: Session;
16
17
  protected disposeListener: () => boolean;
18
+ protected lastActionTime: number;
17
19
  constructor(disposeListener: () => boolean, session: Session);
18
- startGame(): string;
19
- endGame(): {
20
+ startGame(): Promise<string>;
21
+ endGame(): Promise<{
20
22
  message: string;
21
23
  gameName: string;
22
- };
24
+ playerID: string;
25
+ }>;
26
+ getPlayerID(): string;
27
+ getLastActionTime(): number;
23
28
  processInput(str: string): Promise<string>;
24
29
  }
25
30
  type Constructor<T> = new (...args: any[]) => T;
@@ -43,10 +48,10 @@ export declare abstract class abstractGame<T extends abstractGameSingleGame> {
43
48
  * @param ctx Koishi 上下文
44
49
  * @param args 启动参数(如难度等级)
45
50
  */
46
- startGame(session: Session, ctx: Context, args: string[]): abstractGameSingleGame | null;
51
+ startGame(session: Session, ctx: Context, args: string[]): Promise<abstractGameSingleGame | null>;
47
52
  /**
48
53
  * 结束游戏实例,触发结果事件
49
54
  */
50
- endGame(session: Session, ctx: Context): string;
55
+ endGame(session: Session, ctx: Context): Promise<boolean>;
51
56
  }
52
57
  export {};
package/lib/game.d.ts CHANGED
@@ -13,8 +13,7 @@ export declare class Game {
13
13
  private sat;
14
14
  constructor(ctx: Context, cfg: Sat.Config, sat: SAT);
15
15
  private registerCommands;
16
- startGame(session: Session, gameName: string, args: string[]): Promise<"当前频道已经有游戏在进行中" | "没有这个游戏哦">;
16
+ startGame(session: Session, gameName: string, args: string[]): Promise<string>;
17
17
  endGame(session: Session): Promise<string>;
18
- private selectGame;
19
18
  private chat;
20
19
  }
@@ -1 +1,37 @@
1
+ import { Session } from 'koishi';
2
+ import { abstractGame, abstractGameSingleGame, gameResult } from './abstractGame';
3
+ export declare enum winFlag {
4
+ win = 1,
5
+ lose = 2,
6
+ draw = 3,
7
+ pending = 4
8
+ }
9
+ export interface fencingGameResult extends gameResult {
10
+ win: winFlag;
11
+ }
12
+ declare enum fencingAction {
13
+ attack = 1,
14
+ defence = 2
15
+ }
16
+ declare class fencingSingleGame extends abstractGameSingleGame {
17
+ private winningFlag;
18
+ private playerPosition;
19
+ private enemyPosition;
20
+ private availablePlayerActions;
21
+ static fencingActionHint: Map<fencingAction, string>;
22
+ constructor(disposeListener: () => boolean, session: Session);
23
+ private render;
24
+ startGame: () => Promise<string>;
25
+ endGame: () => Promise<{
26
+ message: string;
27
+ win: winFlag;
28
+ gameName: string;
29
+ playerID: string;
30
+ }>;
31
+ private enemyDecision;
32
+ processInput(str: string): Promise<string>;
33
+ }
34
+ export declare class fencing extends abstractGame<fencingSingleGame> {
35
+ constructor();
36
+ }
1
37
  export {};
@@ -8,7 +8,7 @@ export declare enum winFlag {
8
8
  }
9
9
  export interface goBangGameResult extends gameResult {
10
10
  win: winFlag;
11
- level: number;
11
+ message: string;
12
12
  }
13
13
  /**
14
14
  * 五子棋单局实现类,继承自 abstractGameSingleGame
@@ -18,27 +18,33 @@ declare class goBangSingleGame extends abstractGameSingleGame {
18
18
  private winningFlag;
19
19
  level: number;
20
20
  private board;
21
+ private lastScore;
22
+ private turnsCount;
21
23
  constructor(disposeListener: () => boolean, session: Session);
22
- startGame: () => string;
23
- endGame: () => {
24
+ startGame: () => Promise<string>;
25
+ endGame: () => Promise<{
24
26
  message: string;
25
27
  win: winFlag;
26
28
  gameName: string;
27
- };
29
+ playerID: string;
30
+ }>;
28
31
  /**
29
32
  * 处理玩家输入(落子坐标)
30
33
  * @param str 输入内容,格式为 "x y"
31
34
  */
32
35
  processInput(str: string): Promise<string>;
36
+ private getAIMove;
33
37
  private checkWin;
34
38
  private checkDirection;
39
+ private place;
35
40
  private printBoard;
41
+ private generateChat;
36
42
  }
37
43
  /**
38
44
  * 五子棋管理类,继承自 abstractGame
39
45
  */
40
46
  export declare class goBang extends abstractGame<goBangSingleGame> {
41
47
  constructor();
42
- startGame(session: Session, ctx: Context, args: string[]): goBangSingleGame;
48
+ startGame(session: Session, ctx: Context, args: string[]): Promise<goBangSingleGame>;
43
49
  }
44
50
  export {};