打断async function, event.forceFinish
This commit is contained in:
parent
91edb35780
commit
7a88752da4
|
@ -15,7 +15,7 @@ export class Game {
|
|||
* @type { { [key: string]: Player } }
|
||||
*/
|
||||
playerMap: {
|
||||
[key: string]: import("noname-typings/nonameModules/noname/library/element/player.js").Player;
|
||||
[key: string]: Player;
|
||||
};
|
||||
phaseNumber: number;
|
||||
roundNumber: number;
|
||||
|
@ -354,7 +354,7 @@ export class Game {
|
|||
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
||||
* @returns { void }
|
||||
*/
|
||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
|
||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
|
||||
log: (arr: any) => void;
|
||||
opened: () => void;
|
||||
onconnection: (id: any) => void;
|
||||
|
@ -386,7 +386,7 @@ export class Game {
|
|||
* @param { ...T } args
|
||||
* @returns { void }
|
||||
*/
|
||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6): void;
|
||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6): void;
|
||||
/**
|
||||
* @template { keyof typeof lib.message.client } T
|
||||
* @overload
|
||||
|
@ -394,7 +394,7 @@ export class Game {
|
|||
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
||||
* @returns { void }
|
||||
*/
|
||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
|
||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
|
||||
log: (arr: any) => void;
|
||||
opened: () => void;
|
||||
onconnection: (id: any) => void;
|
||||
|
@ -426,7 +426,7 @@ export class Game {
|
|||
* @param { ...T } args
|
||||
* @returns { void }
|
||||
*/
|
||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7): void;
|
||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7): void;
|
||||
syncState(): void;
|
||||
updateWaiting(): void;
|
||||
/**
|
||||
|
@ -652,47 +652,47 @@ export class Game {
|
|||
* 下载文件
|
||||
* @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) }
|
||||
*/
|
||||
download: (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void;
|
||||
download: undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void);
|
||||
/**
|
||||
* 读取文件为arraybuffer
|
||||
* @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) }
|
||||
*/
|
||||
readFile: (filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void;
|
||||
readFile: undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void);
|
||||
/**
|
||||
* 读取文件为文本
|
||||
* @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) }
|
||||
*/
|
||||
readFileAsText: (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void;
|
||||
readFileAsText: undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void);
|
||||
/**
|
||||
* 将数据写入文件
|
||||
* @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) }
|
||||
*/
|
||||
writeFile: (data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void;
|
||||
writeFile: undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void);
|
||||
/**
|
||||
* 移除文件
|
||||
* @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) }
|
||||
*/
|
||||
removeFile: (filename: string, callback?: (e: Error) => void) => void;
|
||||
removeFile: undefined | ((filename: string, callback?: (e: Error) => void) => void);
|
||||
/**
|
||||
* 获取文件列表
|
||||
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void) }
|
||||
*/
|
||||
getFileList: (dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void;
|
||||
getFileList: undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void);
|
||||
/**
|
||||
* 按路径依次创建文件夹
|
||||
* @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) }
|
||||
*/
|
||||
ensureDirectory: (list: string | string[], callback: Function, file?: boolean) => void;
|
||||
ensureDirectory: undefined | ((list: string | string[], callback: Function, file?: boolean) => void);
|
||||
/**
|
||||
* 创建文件夹
|
||||
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
||||
*/
|
||||
createDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void;
|
||||
createDir: undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void);
|
||||
/**
|
||||
* 删除文件夹
|
||||
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
||||
*/
|
||||
removeDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void;
|
||||
removeDir: undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void);
|
||||
/**
|
||||
* @type { (forcecheck?: boolean | null, dev?: boolean) => Promise<any> }
|
||||
*/
|
||||
|
@ -908,21 +908,21 @@ export class Game {
|
|||
/**
|
||||
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
||||
*/
|
||||
linexy(path: [number, string | number | {
|
||||
linexy(path: [number, number | {
|
||||
opacity: any;
|
||||
color: any;
|
||||
dashed: any;
|
||||
duration: any;
|
||||
}, number, number], ...args: any[]): any;
|
||||
} | string, number, number], ...args: any[]): any;
|
||||
/**
|
||||
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
||||
*/
|
||||
_linexy(path: [number, string | number | {
|
||||
_linexy(path: [number, number | {
|
||||
opacity: any;
|
||||
color: any;
|
||||
dashed: any;
|
||||
duration: any;
|
||||
}, number, number], ...args: any[]): void;
|
||||
} | string, number, number], ...args: any[]): void;
|
||||
/**
|
||||
* @param { string } name
|
||||
* @param { string } skill
|
||||
|
@ -957,15 +957,15 @@ export class Game {
|
|||
* @param { string } [packagename]
|
||||
*/
|
||||
addCharacterPack(pack: {
|
||||
[key: string]: any;
|
||||
mode?: string;
|
||||
forbid?: any;
|
||||
character: {
|
||||
[key: string]: Character;
|
||||
};
|
||||
skill: {
|
||||
[key: string]: any;
|
||||
[key: string]: object;
|
||||
};
|
||||
[key: string]: any;
|
||||
}, packagename?: string): void;
|
||||
/**
|
||||
* @param { string } name
|
||||
|
@ -989,10 +989,10 @@ export class Game {
|
|||
forbid?: string[];
|
||||
list: any[];
|
||||
card: {
|
||||
[key: string]: import("noname-typings/nonameModules/noname/library/element/card.js").Card;
|
||||
[key: string]: Card;
|
||||
};
|
||||
skill: {
|
||||
[key: string]: any;
|
||||
[key: string]: object;
|
||||
};
|
||||
}, packagename?: string): void;
|
||||
/**
|
||||
|
@ -1004,7 +1004,7 @@ export class Game {
|
|||
* @param { string } [abInfo]
|
||||
*/
|
||||
addSkill(name: string, info: {
|
||||
[key: string]: any;
|
||||
[key: string]: object;
|
||||
}, translate?: string, description?: string, appendInfo?: string, abInfo?: string): boolean;
|
||||
/**
|
||||
* @param { string } name
|
||||
|
@ -1014,7 +1014,7 @@ export class Game {
|
|||
addMode(name: string, info: any, info2: {
|
||||
translate: string;
|
||||
config: {
|
||||
[key: string]: any;
|
||||
[key: string]: object;
|
||||
};
|
||||
}): void;
|
||||
/**
|
||||
|
@ -1456,4 +1456,3 @@ import { GamePromises } from "./promises.js";
|
|||
import { DynamicStyle } from "./dynamic-style/index.js";
|
||||
import { lib } from "../library/index.js";
|
||||
import { Check } from "./check.js";
|
||||
import { delay } from "../util/index.js";
|
||||
|
|
|
@ -211,7 +211,7 @@ export class Get {
|
|||
zhu(player: any, skill: any, group: any): any;
|
||||
config(item: any, mode: any): any;
|
||||
coinCoeff(list: any): number;
|
||||
rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
|
||||
rank(name: any, num: any): number | "s" | "x" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
|
||||
skillRank(skill: any, type: any, grouped: any): number;
|
||||
targetsInfo(targets: any): any[];
|
||||
infoTargets(infos: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
||||
|
@ -408,7 +408,7 @@ export class Get {
|
|||
event<T_2 extends keyof import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent>(key: T_2): import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent[T_2];
|
||||
player(): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
|
||||
players(sort: any, dead: any, out: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
||||
position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o";
|
||||
position(card: any, ordering: any): number | "h" | "e" | "j" | "s" | "x" | "c" | "d" | "o";
|
||||
skillTranslation(str: any, player: any): string;
|
||||
skillInfoTranslation(name: any, player: any): any;
|
||||
/**
|
||||
|
@ -428,12 +428,12 @@ export class Get {
|
|||
* @param {((a: Button, b: Button) => number)} [sort] 排序函数
|
||||
* @returns { Button[] }
|
||||
*/
|
||||
selectableButtons(sort?: (a: Button, b: Button) => number): Button[];
|
||||
selectableButtons(sort?: ((a: Button, b: Button) => number)): Button[];
|
||||
/**
|
||||
* @param {((a: Card, b: Card) => number)} [sort] 排序函数
|
||||
* @returns { Card[] }
|
||||
*/
|
||||
selectableCards(sort?: (a: Card, b: Card) => number): Card[];
|
||||
selectableCards(sort?: ((a: Card, b: Card) => number)): Card[];
|
||||
/**
|
||||
* @returns { string[] } 技能名数组
|
||||
*/
|
||||
|
@ -445,7 +445,7 @@ export class Get {
|
|||
* @param {((a: Player, b: Player) => number)} [sort] 排序函数
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
selectableTargets(sort?: (a: Player, b: Player) => number): Player[];
|
||||
selectableTargets(sort?: ((a: Player, b: Player) => number)): Player[];
|
||||
filter(filter: any, i: any): any;
|
||||
cardCount(card: any, player: any): any;
|
||||
skillCount(skill: any, player: any): any;
|
||||
|
|
|
@ -8,5 +8,4 @@ export class GNC {
|
|||
}
|
||||
export let gnc: GNC;
|
||||
export function setGNC(instance?: InstanceType<typeof GNC>): void;
|
||||
import { GeneratorFunction } from "../util/index.js";
|
||||
import { Is } from "./is.js";
|
||||
|
|
2
node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts
generated
vendored
2
node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts
generated
vendored
|
@ -6,7 +6,7 @@ export class Button extends HTMLDivElement {
|
|||
* @param {true} [noClick]
|
||||
* @param { Button } [button]
|
||||
*/
|
||||
constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button);
|
||||
constructor(item: {}, type: keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button);
|
||||
/**
|
||||
* @type { string | undefined }
|
||||
*/
|
||||
|
|
13
node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts
generated
vendored
13
node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts
generated
vendored
|
@ -37,7 +37,11 @@ export class GameEvent {
|
|||
/**
|
||||
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
||||
**/
|
||||
resolve: (event: GameEvent | PromiseLike<GameEvent>) => void;
|
||||
resolve: null | ((event: GameEvent | PromiseLike<GameEvent>) => void);
|
||||
/**
|
||||
* @type {null|((value: any) => void)} 另一种结束event.content的resolve形式
|
||||
**/
|
||||
resolveContent: null | ((value?: any) => void);
|
||||
_triggered: number;
|
||||
__args: any;
|
||||
/**
|
||||
|
@ -212,7 +216,7 @@ export class GameEvent {
|
|||
*/
|
||||
pushHandler(...handlers: ((event: GameEvent, option: {
|
||||
state?: 'begin' | 'end';
|
||||
}) => void)[]): number;
|
||||
}) => void)[][]): number;
|
||||
/**
|
||||
* @overload
|
||||
* @param {Parameters<typeof this.hasHandler>[0]} type
|
||||
|
@ -223,9 +227,10 @@ export class GameEvent {
|
|||
*/
|
||||
pushHandler(type: Parameters<typeof this.hasHandler>[0], ...handlers: ((event: GameEvent, option: {
|
||||
state?: 'begin' | 'end';
|
||||
}) => void)[]): number;
|
||||
}) => void)[][]): number;
|
||||
changeToZero(): this;
|
||||
numFixed: boolean;
|
||||
forceFinish(): this;
|
||||
finish(): this;
|
||||
putStepCache(key: any, value: any): this;
|
||||
_stepCache: {};
|
||||
|
@ -269,7 +274,7 @@ export class GameEvent {
|
|||
* @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身
|
||||
* @returns {GameEvent|{}|null}
|
||||
*/
|
||||
getParent(level?: string | number | ((evt: GameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null;
|
||||
getParent(level?: number | string | ((evt: GameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null;
|
||||
getTrigger(): any;
|
||||
getRand(name: any): any;
|
||||
_rand_map: {};
|
||||
|
|
8
node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts
generated
vendored
8
node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts
generated
vendored
|
@ -330,7 +330,7 @@ export class Player extends HTMLDivElement {
|
|||
* 检测此牌是否不计入手牌上限
|
||||
* @param { Card } card
|
||||
*/
|
||||
canIgnoreHandcard(card: Card): boolean;
|
||||
canIgnoreHandcard(card: Card): any;
|
||||
/**
|
||||
* Gift
|
||||
*
|
||||
|
@ -347,7 +347,7 @@ export class Player extends HTMLDivElement {
|
|||
* @param { Player } target
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
canGift(card: Card, target: Player, strict?: boolean): boolean;
|
||||
canGift(card: Card, target: Player, strict?: boolean): any;
|
||||
/**
|
||||
* Check if the player refuses gifts
|
||||
*
|
||||
|
@ -384,7 +384,7 @@ export class Player extends HTMLDivElement {
|
|||
* @param { Player } [source]
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
canRecast(card: Card, source?: Player, strict?: boolean): boolean;
|
||||
canRecast(card: Card, source?: Player, strict?: boolean): any;
|
||||
/**
|
||||
* 判断一名角色的某个区域是否被废除
|
||||
*
|
||||
|
@ -833,7 +833,7 @@ export class Player extends HTMLDivElement {
|
|||
* @param {Parameters<this['iterableGetCards']>[0]} arg1
|
||||
* @param {Parameters<this['iterableGetCards']>[1]} arg2
|
||||
*/
|
||||
iterableGetGainableCards(player: [card?: any, player?: any, target?: any, event?: any][1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<any, void, unknown>;
|
||||
iterableGetGainableCards(player: Parameters<import("../index.js").Library['filter']['canBeGained']>[1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<any, void, unknown>;
|
||||
/**
|
||||
*
|
||||
* @param {Parameters<this['iterableGetGainableCards']>[0]} player
|
||||
|
|
|
@ -4185,94 +4185,7 @@ export class Library {
|
|||
fullimage: boolean;
|
||||
};
|
||||
};
|
||||
filter: {
|
||||
all: () => boolean;
|
||||
none: () => boolean;
|
||||
/**
|
||||
* Check if the card does not count toward the player's hand limit
|
||||
*
|
||||
* 检测此牌是否不计入此角色的手牌上限
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @returns { boolean }
|
||||
*/
|
||||
ignoredHandcard: (card: Card, player: Player) => boolean;
|
||||
/**
|
||||
* Check if the card is giftable
|
||||
*
|
||||
* 检测此牌是否可赠予
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } target
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean) => boolean;
|
||||
/**
|
||||
* Check if the card is recastable
|
||||
*
|
||||
* 检查此牌是否可重铸
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @param { Player } [source]
|
||||
* @param { boolean } [strict]
|
||||
*/
|
||||
cardRecastable: (card: Card, player?: Player, source?: Player, strict?: boolean) => boolean;
|
||||
/**
|
||||
* @param { Card } card
|
||||
* @param { Player } player
|
||||
* @returns { boolean }
|
||||
*/
|
||||
canBeReplaced: (card: Card, player: Player) => boolean;
|
||||
buttonIncluded: (button: any) => boolean;
|
||||
filterButton: (button: any) => boolean;
|
||||
cardSavable: (card: any, player: any, target: any) => any;
|
||||
/**
|
||||
*
|
||||
* @param {GameEvent} event
|
||||
* @param {Player} player
|
||||
* @param {string} triggername
|
||||
* @param {string} skill
|
||||
* @returns {boolean}
|
||||
*/
|
||||
filterTrigger: (event: GameEvent, player: Player, triggername: string, skill: string, indexedData: any) => boolean;
|
||||
/**
|
||||
*
|
||||
* @param {GameEvent} event
|
||||
* @param {Player} player
|
||||
* @param {string} skill
|
||||
* @returns {boolean}
|
||||
*/
|
||||
filterEnable: (event: GameEvent, player: Player, skill: string) => boolean;
|
||||
characterDisabled: (i: any, libCharacter: any) => boolean;
|
||||
characterDisabled2: (i: any) => boolean;
|
||||
skillDisabled: (skill: any) => boolean;
|
||||
cardEnabled: (card: any, player: any, event: any) => any;
|
||||
cardRespondable: (card: any, player: any, event: any) => any;
|
||||
cardUsable2: (card: any, player: any, event: any) => boolean;
|
||||
cardUsable: (card: any, player: any, event: any) => boolean;
|
||||
cardDiscardable: (card: any, player: any, event: any) => any;
|
||||
canBeDiscarded: (card: any, player: any, target: any, event: any) => any;
|
||||
canBeGained: (card: any, player: any, target: any, event: any) => any;
|
||||
cardAiIncluded: (card: any) => boolean;
|
||||
filterCard: (card: any, player: any, event: any) => boolean;
|
||||
targetEnabledx: (card: any, player: any, target: any, ...args: any[]) => any;
|
||||
targetEnabled: (card: any, player: any, target: any) => any;
|
||||
targetEnabled2: (card: any, player: any, target: any) => boolean;
|
||||
targetEnabled3: (card: any, player: any, target: any) => boolean;
|
||||
targetInRange: (card: any, player: any, target: any) => any;
|
||||
filterTarget: (card: any, player: any, target: any) => any;
|
||||
filterTarget2: (card: any, player: any, target: any) => any;
|
||||
notMe: (card: any, player: any, target: any) => boolean;
|
||||
isMe: (card: any, player: any, target: any) => boolean;
|
||||
attackFrom: (card: any, player: any, target: any) => boolean;
|
||||
globalFrom: (card: any, player: any, target: any) => boolean;
|
||||
selectCard: () => number[];
|
||||
selectTarget: (card: any, player: any) => number | number[] | (() => number | Select);
|
||||
judge: (card: any, player: any, target: any) => any;
|
||||
autoRespondSha: () => boolean;
|
||||
autoRespondShan: () => boolean;
|
||||
wuxieSwap: (event: any) => boolean;
|
||||
};
|
||||
filter: any;
|
||||
sort: {
|
||||
nature: (a: any, b: any) => number;
|
||||
group: (a: any, b: any) => number;
|
||||
|
@ -4301,7 +4214,6 @@ export class Library {
|
|||
* }}
|
||||
*/
|
||||
skill: {
|
||||
[key: string]: Skill;
|
||||
global: string[];
|
||||
globalmap: SMap<Player[]>;
|
||||
storage: SMap<any>;
|
||||
|
@ -4310,6 +4222,7 @@ export class Library {
|
|||
zhu: SMap<any>;
|
||||
zhuSkill: SMap<any>;
|
||||
land_used: SMap<any>;
|
||||
[key: string]: Skill;
|
||||
};
|
||||
character: {};
|
||||
perfectPair: {};
|
||||
|
|
2
node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts
generated
vendored
2
node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts
generated
vendored
|
@ -55,6 +55,6 @@ export class LibInit {
|
|||
* @param {boolean} [dbNow] - 此刻是否在解析数据库中的内容,请勿直接使用
|
||||
* @returns {URL}
|
||||
*/
|
||||
parseResourceAddress(link: string | URL, defaultHandle?: (item: string) => string, loadAsDataUrlCallback?: (item: URL) => unknown, dbNow?: boolean): URL;
|
||||
parseResourceAddress(link: string | URL, defaultHandle?: ((item: string) => string) | null, loadAsDataUrlCallback?: ((item: URL) => unknown) | null, dbNow?: boolean): URL;
|
||||
}
|
||||
import { LibInitPromises } from "./promises.js";
|
||||
|
|
4
node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts
generated
vendored
4
node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts
generated
vendored
|
@ -45,12 +45,12 @@ export class LibInitPromises {
|
|||
* @param {boolean} [forceLoadAsDataUrl] - 是否将资源加载为[Data URL](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URLs),默认为`false`
|
||||
* @returns {Promise<URL>}
|
||||
*/
|
||||
parseResourceAddress(link: string | URL, defaultHandle?: (item: string) => string, forceLoadAsDataUrl?: boolean): Promise<URL>;
|
||||
parseResourceAddress(link: string | URL, defaultHandle?: ((item: string) => string) | null, forceLoadAsDataUrl?: boolean): Promise<URL>;
|
||||
/**
|
||||
* @async
|
||||
* @param {string | URL} link - 需要解析的路径
|
||||
* @param {((item: string) => string) | null} [defaultHandle] - 在给定路径不符合可用情况(或基于无名杀相关默认情况)时,处理路径的函数,返回的路径应是相对于根目录的相对路径,默认为`null`,当且仅当无法解析成`URL`时会调用该回调
|
||||
* @returns {Promise<[origin: URL, data: URL]>}
|
||||
*/
|
||||
parseResourceAddressExt(link: string | URL, defaultHandle?: (item: string) => string): Promise<[origin: URL, data: URL]>;
|
||||
parseResourceAddressExt(link: string | URL, defaultHandle?: ((item: string) => string) | null): Promise<[origin: URL, data: URL]>;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ export class status {
|
|||
*/
|
||||
importing: {
|
||||
[key: string]: Promise<any>[];
|
||||
};
|
||||
} | undefined;
|
||||
/**
|
||||
* @type { Function | boolean | undefined }
|
||||
*/
|
||||
|
|
|
@ -7,4 +7,3 @@
|
|||
*/
|
||||
export const promiseErrorHandlerMap: Record<"firefox" | "chrome" | "safari" | "other", new () => PromiseErrorHandler>;
|
||||
export type PromiseErrorHandler = import('./struct/interface/promise-error-handler.js').PromiseErrorHandler;
|
||||
import { PromiseErrorHandler } from "./struct/index.js";
|
||||
|
|
|
@ -5996,14 +5996,15 @@ export class Game {
|
|||
resolve();
|
||||
} else if (event.content instanceof AsyncFunction) {
|
||||
// _status,lib,game,ui,get,ai六个变量由game.import提供
|
||||
event.content(event, trigger, player).then(() => {
|
||||
// 使用另一种方式来停止event.content
|
||||
const { promise, resolve: resolveContent } = Promise.withResolvers();
|
||||
promise.then(() => {
|
||||
// 其实这个if几乎一定执行了
|
||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||
if (!game.executingAsyncEventMap.get(_status.event.toEvent())) {
|
||||
console.warn(`game.executingAsyncEventMap中包括了event,但不包括_status.event!`);
|
||||
console.log("event :>> ", event.toEvent());
|
||||
console.log("_status.event :>> ", _status.event.toEvent());
|
||||
// debugger;
|
||||
game.executingAsyncEventMap.set(
|
||||
event.toEvent(),
|
||||
game.executingAsyncEventMap.get(event.toEvent()).then(() => {
|
||||
|
@ -6025,6 +6026,16 @@ export class Game {
|
|||
resolve();
|
||||
}
|
||||
});
|
||||
event.resolveContent = resolveContent;
|
||||
event.content(event, trigger, player)
|
||||
.then(() => resolveContent())
|
||||
.catch((error) => {
|
||||
resolveContent();
|
||||
//再抛出异常
|
||||
if (error !== "event_finish") {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
event.content(event, step, source, player, target, targets, card, cards, skill, forced, num, trigger, result, _status, lib, game, ui, get, ai);
|
||||
resolve();
|
||||
|
|
|
@ -5,7 +5,7 @@ import { game } from "../game/index.js";
|
|||
import { _status } from "../status/index.js";
|
||||
import { ui } from "../ui/index.js";
|
||||
import { gnc } from "../gnc/index.js";
|
||||
import { userAgent, nonameInitialized } from "../util/index.js";
|
||||
import { userAgent, nonameInitialized, AsyncFunction } from "../util/index.js";
|
||||
import * as config from "../util/config.js";
|
||||
import { promiseErrorHandlerMap } from "../util/browser.js";
|
||||
import { importCardPack, importCharacterPack, importExtension, importMode } from "./import.js";
|
||||
|
@ -1140,7 +1140,7 @@ async function setOnError() {
|
|||
game.print(str);
|
||||
if (promiseErrorHandler.onErrorFinish) promiseErrorHandler.onErrorFinish();
|
||||
// @ts-ignore
|
||||
if (!lib.config.errstop) {
|
||||
if (!lib.config.errstop && (_status && _status.event && !(_status.event.content instanceof AsyncFunction))) {
|
||||
_status.withError = true;
|
||||
game.loop();
|
||||
}
|
||||
|
|
|
@ -58,6 +58,10 @@ export class GameEvent {
|
|||
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
||||
**/
|
||||
this.resolve = null;
|
||||
/**
|
||||
* @type {null|((value?: any) => void)} 另一种结束event.content的resolve形式
|
||||
**/
|
||||
this.resolveContent = null;
|
||||
if (trigger !== false && !game.online) this._triggered = 0;
|
||||
this.__args = [name, trigger];
|
||||
}
|
||||
|
@ -298,6 +302,15 @@ export class GameEvent {
|
|||
this.numFixed = true;
|
||||
return this;
|
||||
}
|
||||
forceFinish() {
|
||||
if (!this.finished) {
|
||||
this.finished = true;
|
||||
if (this.content instanceof AsyncFunction) {
|
||||
throw "event_finish";
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
finish() {
|
||||
this.finished = true;
|
||||
return this;
|
||||
|
@ -352,7 +365,7 @@ export class GameEvent {
|
|||
}
|
||||
cancel(arg1, arg2, notrigger) {
|
||||
this.untrigger(arg1, arg2);
|
||||
this.finish();
|
||||
this.forceFinish();
|
||||
if (notrigger != "notrigger") {
|
||||
if (this.player && lib.phaseName.includes(this.name))
|
||||
this.player.getHistory("skipped").add(this.name);
|
||||
|
|
|
@ -78,16 +78,39 @@ export class GameEventPromise extends Promise {
|
|||
resolve();
|
||||
return eventPromise;
|
||||
}
|
||||
|
||||
const oldEvent = _status.event;
|
||||
if (_status.event != eventPromise) {
|
||||
eventPromise.parent = _status.event;
|
||||
_status.event = eventPromise;
|
||||
game.getGlobalHistory("everything").push(eventPromise);
|
||||
}
|
||||
return game.loop(eventPromise).then(() => {
|
||||
// 有时候event.finished还是false
|
||||
return eventPromise;
|
||||
});
|
||||
|
||||
// 处理eventNeutralized反复横跳
|
||||
if (!oldEvent.finished) {
|
||||
return game.loop(eventPromise).then(() => {
|
||||
// 有时候event.finished还是false
|
||||
return eventPromise;
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (eventPromise.name == "arrangeTrigger" &&
|
||||
eventPromise.triggername == "eventNeutralized") {
|
||||
return game.loop(eventPromise).then(() => {
|
||||
// 有时候event.finished还是false
|
||||
return eventPromise;
|
||||
}).then(() => {
|
||||
// 如果它终于不给我跳了
|
||||
// 就给老子停
|
||||
if (oldEvent.finished === true && oldEvent.resolveContent) {
|
||||
oldEvent.resolveContent();
|
||||
}
|
||||
return eventPromise;
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('不继续执行event', eventPromise.toEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue