Merge branch 'PR-Branch' of https://github.com/mengxinzxz/noname into PR-Branch

This commit is contained in:
mengxinzxz 2024-04-14 11:57:26 +08:00
commit f67051dea1
68 changed files with 730 additions and 507 deletions

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card',function(){
return { return {
name:'extra', name:'extra',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'gujian', name:'gujian',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'guozhan', name:'guozhan',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'gwent', name:'gwent',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'hearth', name:'hearth',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'huanlekapai', name:'huanlekapai',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'mtg', name:'mtg',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'sp', name:'sp',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'standard', name:'standard',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'swd', name:'swd',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'yingbian', name:'yingbian',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'yongjian', name:'yongjian',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'yunchou', name:'yunchou',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'zhenfa', name:'zhenfa',
card:{ card:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('card',function(lib,game,ui,get,ai,_status){ game.import('card', function () {
return { return {
name:'zhulu', name:'zhulu',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character',function(){
return { return {
//clan n.宗派;(尤指苏格兰的)宗族,氏族,家族;庞大的家族;帮派;小集团 //clan n.宗派;(尤指苏格兰的)宗族,氏族,家族;庞大的家族;帮派;小集团
name:'clan', name:'clan',

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'collab', name:'collab',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'ddd', name:'ddd',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'diy', name:'diy',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'extra', name:'extra',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'gujian', name:'gujian',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'gwent', name:'gwent',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'hearth', name:'hearth',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'huicui', name:'huicui',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'jiange', name:'jiange',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'jsrg', name:'jsrg',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'mobile', name:'mobile',
//connectBanned:['miheng'], //connectBanned:['miheng'],

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'mtg', name:'mtg',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'offline', name:'offline',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'old', name:'old',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'onlyOL', name:'onlyOL',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'ow', name:'ow',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'refresh', name:'refresh',
characterSort:{ characterSort:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
//strategy and battle, "sb" in short //strategy and battle, "sb" in short
name:'sb', name:'sb',

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'shenhua', name:'shenhua',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'shiji', name:'shiji',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'sp', name:'sp',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'sp2', name:'sp2',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'standard', name:'standard',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'swd', name:'swd',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'tw', name:'tw',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'xiake', name:'xiake',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'xianding', name:'xianding',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'xianjian', name:'xianjian',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'xinghuoliaoyuan', name:'xinghuoliaoyuan',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'yijiang', name:'yijiang',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'yingbian', name:'yingbian',
connect:true, connect:true,

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'yxs', name:'yxs',
character:{ character:{

View File

@ -1,5 +1,5 @@
import { game } from '../noname.js'; import { lib, game, ui, get, ai, _status } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character', function () {
return { return {
name:'zhuogui', name:'zhuogui',
character:{ character:{

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../../noname.js';
game.import('play',function(lib,game,ui,get,ai,_status){ game.import('play', function () {
return { return {
name:'boss', name:'boss',
init:function(){ init:function(){

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../../noname.js';
game.import('play',function(lib,game,ui,get,ai,_status){ game.import('play', function () {
return { return {
name:'cardpile', name:'cardpile',
arenaReady:function(){ arenaReady:function(){

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../../noname.js';
game.import('play',function(lib,game,ui,get,ai,_status){ game.import('play', function () {
return { return {
name:'coin', name:'coin',
init:function(){ init:function(){

View File

@ -1,5 +1,5 @@
'use strict'; import { lib, game, ui, get, ai, _status } from '../../noname.js';
game.import('play',function(lib,game,ui,get,ai,_status){ game.import('play', function () {
return { return {
name:'wuxing', name:'wuxing',
arenaReady:function(){ arenaReady:function(){

View File

@ -1011,8 +1011,9 @@ declare interface Skill {
* @param event event._trigger,trigger时机event为触发该技能时机时的事件 * @param event event._trigger,trigger时机event为触发该技能时机时的事件
* @param player * @param player
* @param name event.triggernamelib.filter.filterTrigger中才传该值 * @param name event.triggernamelib.filter.filterTrigger中才传该值
* @param target v1.10.11
*/ */
filter?(event: GameEventPromise, player: Player, name?: string): boolean | void | null; filter?(event: GameEventPromise, player: Player, name?: string, target?: Player): boolean | void | null;
/** /**
* *
* *
@ -1281,9 +1282,11 @@ declare interface Skill {
* , * ,
* *
* prompt * prompt
*
* @param target v1.10.11
*/ */
logTarget?: string | TwoParmFun<GameEventPromise, Player, string | Player | Player[] | null>; logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null);
/** /**
* logTarget显示触发者的目标日志 * logTarget显示触发者的目标日志
* *
* createTriggerstep3中使用false使logTargetlogSkill; * createTriggerstep3中使用false使logTargetlogSkill;
@ -1365,7 +1368,9 @@ declare interface Skill {
* *
* *
*/ */
check?: ((card: Card) => number | boolean | void) | ((event: GameEventPromise, player: Player) => number | boolean | void) | (() => number | boolean | void); check?: ((card: Card) => number | boolean | void) |
((event: GameEventPromise, player: Player, triggername?: string, target?: Player) => number | boolean | void) |
(() => number | boolean | void);
// check?(...any:any):number|boolean; // check?(...any:any):number|boolean;
// /** ai用于检测的方法用于主动使用触发技能 */ // /** ai用于检测的方法用于主动使用触发技能 */
// check?(card:Card):number|boolean; // check?(card:Card):number|boolean;
@ -1388,7 +1393,30 @@ declare interface Skill {
* *
*/ */
categories?: (skill: string, player: Player) => string[]; categories?: (skill: string, player: Player) => string[];
/**
* v1.10.11
*
* cost选择和content执行分离
*
* 对于原本使用direct:true取消logSkilllogSkill的情况而言
*
* cost和content分离使
*/
cost?: (event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>;
/**
* v1.10.11
*
*
*
* OL线上一样
*
*
*
*
*
*
*/
getIndex?: (event, player, triggername) => number | Player[];
//日后还有很多属性要添加的 //日后还有很多属性要添加的
[key: string]: any; [key: string]: any;
} }
@ -1881,7 +1909,7 @@ interface ChooseButtonConfigData {
* player.chooseButton的ai * player.chooseButton的ai
* @param button * @param button
*/ */
check?(button: Button): number; check?(button: Button): number | void;
/** /**
* 1 * 1
* *

View File

@ -60,7 +60,7 @@ export class Game {
/** /**
* *
*/ */
washCard(): any; washCard(): false | never[] | (import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise);
/** /**
* *
*/ */
@ -77,7 +77,7 @@ export class Game {
* @param {Parameters<HookType[Name]>} args * @param {Parameters<HookType[Name]>} args
*/ */
callHook<HookType extends import("../library/hooks/interface.js").NonameHookType, Name extends keyof HookType>(name: Name, args: Parameters<HookType[Name]>): void; callHook<HookType extends import("../library/hooks/interface.js").NonameHookType, Name extends keyof HookType>(name: Name, args: Parameters<HookType[Name]>): void;
yingbianEffect(event: any, content: any, ...args: any[]): any; yingbianEffect(event: any, content: any, ...args: any[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
setYingbianConditionColor(yingbianCondition: any, color: any): void; setYingbianConditionColor(yingbianCondition: any, color: any): void;
setComplexYingbianCondition(yingbianCondition: any, condition: any): void; setComplexYingbianCondition(yingbianCondition: any, condition: any): void;
setSimpleYingbianCondition(yingbianCondition: any, condition: any): void; setSimpleYingbianCondition(yingbianCondition: any, condition: any): void;
@ -164,7 +164,7 @@ export class Game {
*/ */
loseAsync(arg?: { loseAsync(arg?: {
[key: string]: any; [key: string]: any;
} | undefined): any; } | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
callFuncUseStepCache(prefix: any, func: any, params: any): any; callFuncUseStepCache(prefix: any, func: any, params: any): any;
/** /**
* @param {string} name * @param {string} name
@ -173,19 +173,19 @@ export class Game {
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean } * @returns { boolean }
*/ */
hasGlobalHistory<T extends keyof GameHistory>(key: T, filter: (event: any) => boolean, last?: any): boolean; hasGlobalHistory<T extends keyof GameHistory>(key: T, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean;
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void } * @returns { void }
*/ */
checkGlobalHistory<T_1 extends keyof GameHistory>(key: T_1, filter: (event: any) => boolean, last?: any): void; checkGlobalHistory<T_1 extends keyof GameHistory>(key: T_1, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void;
/** /**
* @overload * @overload
* @returns { GameHistory } * @returns { GameHistory }
@ -195,27 +195,27 @@ export class Game {
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] } * @returns { GameHistory[T] }
*/ */
getGlobalHistory<T_2 extends keyof GameHistory>(key: T_2, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_2]; getGlobalHistory<T_2 extends keyof GameHistory>(key: T_2, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_2];
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean } * @returns { boolean }
*/ */
hasAllGlobalHistory<T_3 extends keyof GameHistory>(key: T_3, filter: (event: any) => boolean, last?: any): boolean; hasAllGlobalHistory<T_3 extends keyof GameHistory>(key: T_3, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean;
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void } * @returns { void }
*/ */
checkAllGlobalHistory<T_4 extends keyof GameHistory>(key: T_4, filter: (event: any) => boolean, last?: any): void; checkAllGlobalHistory<T_4 extends keyof GameHistory>(key: T_4, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void;
/** /**
* @overload * @overload
* @returns { GameHistory[] } * @returns { GameHistory[] }
@ -225,11 +225,11 @@ export class Game {
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] } * @returns { GameHistory[T] }
*/ */
getAllGlobalHistory<T_5 extends keyof GameHistory>(key: T_5, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_5]; getAllGlobalHistory<T_5 extends keyof GameHistory>(key: T_5, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_5];
/** /**
* @overload * @overload
* @returns { void } * @returns { void }
@ -238,15 +238,15 @@ export class Game {
/** /**
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsDiscard(cards: any): any; cardsDiscard(cards: any): import('../library/index.js').GameEventPromise;
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsDiscard(cards: Card[]): any; cardsDiscard(cards: Card[]): import('../library/index.js').GameEventPromise;
/** /**
* @overload * @overload
* @returns { void } * @returns { void }
@ -255,15 +255,15 @@ export class Game {
/** /**
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoOrdering(cards: any): any; cardsGotoOrdering(cards: any): import('../library/index.js').GameEventPromise;
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoOrdering(cards: Card[]): any; cardsGotoOrdering(cards: Card[]): import('../library/index.js').GameEventPromise;
/** /**
* @overload * @overload
* @returns { void } * @returns { void }
@ -273,16 +273,16 @@ export class Game {
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku' * @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku'
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): any; cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise;
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku' * @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku'
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): any; cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise;
/** /**
* *
* @param {...( * @param {...(
@ -297,11 +297,11 @@ export class Game {
cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [ cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [
string, string,
any any
])[]): any; ])[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/** /**
* @param { GameEventPromise } event * @param { import('../library/index.js').GameEventPromise } event
*/ */
$cardsGotoPile(event: any): void; $cardsGotoPile(event: import('../library/index.js').GameEventPromise): void;
/** /**
* @param { false } [pause] * @param { false } [pause]
*/ */
@ -517,72 +517,86 @@ export class Game {
* @overload * @overload
* @param { 'character' } type * @param { 'character' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCharacterConfig } content * ) => importCharacterConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
import(type: 'character', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCharacterConfig, url?: any): any; import(type: 'character', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importCharacterConfig, url?: any): any;
/** /**
* @overload * @overload
* @param { 'card' } type * @param { 'card' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCardConfig } content * ) => importCardConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
import(type: 'card', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCardConfig, url?: any): any; import(type: 'card', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importCardConfig, url?: any): any;
/** /**
* @overload * @overload
* @param { 'mode' } type * @param { 'mode' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importModeConfig } content * ) => importModeConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
import(type: 'mode', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importModeConfig, url?: any): any; import(type: 'mode', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importModeConfig, url?: any): any;
/** /**
* @overload * @overload
* @param { 'player' } type * @param { 'player' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayerConfig } content * ) => importPlayerConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
import(type: 'player', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importPlayerConfig, url?: any): any; import(type: 'player', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importPlayerConfig, url?: any): any;
/** /**
* @overload * @overload
* @param { 'extension' } type * @param { 'extension' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importExtensionConfig } content * ) => importExtensionConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
import(type: 'extension', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importExtensionConfig, url?: any): any; import(type: 'extension', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importExtensionConfig, url?: any): any;
/**
* @overload
* @param { 'play' } type
* @param {(
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayConfig } content
* @param {*} [url]
*/
import(type: 'play', content: (lib: InstanceType<typeof import('../library/index.js').Library>, game: InstanceType<typeof Game>, ui: InstanceType<typeof import('../ui/index.js').UI>, get: InstanceType<typeof import('../get/index.js').Get>, ai: InstanceType<typeof import('../ai/index.js').AI>, _status: InstanceType<typeof import('../status/index.js').status>) => importPlayConfig, url?: any): any;
loadExtension(object: any): Promise<any>; loadExtension(object: any): Promise<any>;
/** /**
* *
@ -611,9 +625,9 @@ export class Game {
removeFile: ((filename: string, callback?: ((e: Error) => void) | undefined) => void) | undefined; removeFile: ((filename: string, callback?: ((e: Error) => void) | undefined) => void) | undefined;
/** /**
* *
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (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) | undefined; getFileList: ((dir: string, success: (folders: string[], files: string[]) => any, failure?: ((e: Error) => void) | undefined) => void) | undefined;
/** /**
* *
* @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) } * @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) }
@ -862,18 +876,18 @@ export class Game {
* @param { string } name * @param { string } name
* @param { string } skill * @param { string } skill
* @param { Player } player * @param { Player } player
* @param { GameEventPromise } event * @param { import('../library/index.js').GameEventPromise } event
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
createTrigger(name: string, skill: string, player: any, event: any, indexedData: any): any; createTrigger(name: string, skill: string, player: any, event: import('../library/index.js').GameEventPromise, indexedData: any): import('../library/index.js').GameEventPromise;
/** /**
* @legacy Use {@link lib.element.GameEvent.constructor} instead. * @legacy Use {@link lib.element.GameEvent.constructor} instead.
* *
* @param { string } name * @param { string } name
* @param { false } [trigger] * @param { false } [trigger]
* @param { GameEventPromise } [triggerEvent] * @param { import('../library/index.js').GameEventPromise } [triggerEvent]
*/ */
createEvent(name: string, trigger?: false | undefined, triggerEvent?: any): any; createEvent(name: string, trigger?: false | undefined, triggerEvent?: import("../library/index.js").GameEventPromise | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/** /**
* @param { string } name * @param { string } name
* @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
@ -959,8 +973,9 @@ export class Game {
addGlobalSkill(skill: string, player?: any): boolean; addGlobalSkill(skill: string, player?: any): boolean;
/** /**
* @param { string } skill * @param { string } skill
* @param { lib.element.Player } player
*/ */
removeGlobalSkill(skill: string): void; removeGlobalSkill(skill: string, player: lib.element.Player): void;
resetSkills(): void; resetSkills(): void;
/** /**
* @param { string } extensionName * @param { string } extensionName
@ -1031,23 +1046,23 @@ export class Game {
*/ */
executingAsyncEventMap: Map<GameEvent, Promise<any>>; executingAsyncEventMap: Map<GameEvent, Promise<any>>;
/** /**
* @type { GameEventPromise[] } * @type { import('../library/index.js').GameEventPromise[] }
*/ */
belongAsyncEventList: GameEventPromise[]; belongAsyncEventList: import('../library/index.js').GameEventPromise[];
/** /**
* @param { GameEventPromise } [belongAsyncEvent] * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/ */
loop(belongAsyncEvent?: any): Promise<void>; loop(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise<void>;
/** /**
* @param { GameEventPromise } [belongAsyncEvent] * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/ */
runContent(belongAsyncEvent?: any): Promise<any>; runContent(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise<any>;
pause(): void; pause(): void;
pause2(): void; pause2(): void;
resume(): void; resume(): void;
resume2(): void; resume2(): void;
delaye(...args: any[]): any; delaye(...args: any[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
delayex(...args: any[]): any; delayex(...args: any[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/** /**
* @param { number } [time] * @param { number } [time]
* @param { number } [time2] * @param { number } [time2]
@ -1077,9 +1092,9 @@ export class Game {
*/ */
asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise<void>; asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise<void>;
/** /**
* @param { GameEventPromise } [event] * @param { import('../library/index.js').GameEventPromise } [event]
*/ */
check(event?: any): boolean; check(event?: import("../library/index.js").GameEventPromise | undefined): boolean;
Check: Check; Check: Check;
uncheck(...args: any[]): void; uncheck(...args: any[]): void;
/** /**
@ -1129,7 +1144,7 @@ export class Game {
/** /**
* @param { Player } [player] * @param { Player } [player]
*/ */
gameDraw(player?: any, num?: number): any; gameDraw(player?: any, num?: number): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
chooseCharacterDouble(...args: any[]): void; chooseCharacterDouble(...args: any[]): void;
updateRoundNumber(): void; updateRoundNumber(): void;
/** /**
@ -1166,11 +1181,11 @@ export class Game {
* @param { Player } player * @param { Player } player
* @param { string | Card[] } card * @param { string | Card[] } card
* @param { Player[] } [targets] * @param { Player[] } [targets]
* @param { GameEventPromise } [event] * @param { import('../library/index.js').GameEventPromise } [event]
* @param { boolean } [forced] * @param { boolean } [forced]
* @param { string } [logvid] * @param { string } [logvid]
*/ */
logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: any, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined; logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: import("../library/index.js").GameEventPromise | undefined, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined;
/** /**
* @param { string } storeName * @param { string } storeName
* @param { string } idbValidKey * @param { string } idbValidKey
@ -1252,7 +1267,7 @@ export class Game {
/** /**
* @param { Player } player * @param { Player } player
*/ */
triggerEnter(player: any): any; triggerEnter(player: any): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/** /**
* @param { Player } player * @param { Player } player
*/ */
@ -1371,6 +1386,7 @@ export type GameHistory = {
everything: GameEventPromise[]; everything: GameEventPromise[];
}; };
export type Video = { export type Video = {
name?: string;
type: string; type: string;
player?: string; player?: string;
content?: string | any[]; content?: string | any[];

View File

@ -1,5 +1,5 @@
export class GameEvent { export class GameEvent {
static initialGameEvent(): any; static initialGameEvent(): GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param {string | GameEvent} [name] * @param {string | GameEvent} [name]
* @param {false} [trigger] * @param {false} [trigger]
@ -203,7 +203,7 @@ export class GameEvent {
putTempCache(key1: any, key2: any, value: any): any; putTempCache(key1: any, key2: any, value: any): any;
_tempCache: {} | undefined; _tempCache: {} | undefined;
getTempCache(key1: any, key2: any): any; getTempCache(key1: any, key2: any): any;
cancel(arg1: any, arg2: any, notrigger: any): any; cancel(arg1: any, arg2: any, notrigger: any): (GameEvent & import("./gameEventPromise.js").GameEventPromise) | null | undefined;
neutralize(event: any): this; neutralize(event: any): this;
_neutralized: boolean | undefined; _neutralized: boolean | undefined;
_neutralize_event: any; _neutralize_event: any;
@ -242,8 +242,8 @@ export class GameEvent {
getRand(name: any): any; getRand(name: any): any;
_rand_map: {} | undefined; _rand_map: {} | undefined;
_rand: number | undefined; _rand: number | undefined;
insert(content: any, map: any): any; insert(content: any, map: any): GameEvent & import("./gameEventPromise.js").GameEventPromise;
insertAfter(content: any, map: any): any; insertAfter(content: any, map: any): GameEvent & import("./gameEventPromise.js").GameEventPromise;
backup(skill: any): this; backup(skill: any): this;
_backup: any; _backup: any;
filterButton: any; filterButton: any;
@ -273,14 +273,12 @@ export class GameEvent {
isPhaseUsing(player: any): boolean; isPhaseUsing(player: any): boolean;
addTrigger(skills: any, player: any): this; addTrigger(skills: any, player: any): this;
removeTrigger(skills: any, player: any): this; removeTrigger(skills: any, player: any): this;
trigger(name: any): any; trigger(name: any): (GameEvent & import("./gameEventPromise.js").GameEventPromise) | null | undefined;
untrigger(all: boolean | undefined, player: any): this; untrigger(all: boolean | undefined, player: any): this;
/** /**
* Promise化 * Promise化
*
* @returns { GameEventPromise }
*/ */
toPromise(): any; toPromise(): this & import("./gameEventPromise.js").GameEventPromise;
#private; #private;
} }
import { lib } from "../index.js"; import { lib } from "../index.js";

View File

@ -23,11 +23,11 @@
*/ */
export class GameEventPromise extends Promise<any> { export class GameEventPromise extends Promise<any> {
/** /**
* @param { GameEvent | GameEventPromise } arg * @param { import('./gameEvent.js').GameEvent } arg
*/ */
constructor(arg: GameEvent | GameEventPromise); constructor(arg: import('./gameEvent.js').GameEvent);
/** 获取原事件对象 */ /** 获取原事件对象 */
toEvent(): any; toEvent(): import("./gameEvent.js").GameEvent;
/** /**
* *
* *
@ -45,46 +45,117 @@ export class GameEventPromise extends Promise<any> {
*/ */
debugger(): Promise<any>; debugger(): Promise<any>;
/** /**
* * Result
* result中的信息
*
*
* @example * @example
* * ```js
* let chooseCardResult = await player.chooseCard().forResult(); // 示例 1
* chooseCardResult.cards const chooseCardResult = await player.chooseCard().forResult();
* // 获取整个结果对象,然后访问如 chooseCardResult.cards 等属性
* let cards = await player.chooseCard().forResult('cards');
* cards // 示例 2
* const cards = await player.chooseCard().forResult('cards');
* let [success,cards,targets] = await player.chooseCardTarget().forResult('bool','cards','targets'); // 获取结果对象中 'cards' 属性的值
* success:是否做出选择
* cards:选择的牌 // 示例 3
* targets:选择的目标 const [success, cards, targets] = await player.chooseCardTarget().forResult('bool', 'cards', 'targets');
// 获取结果对象中多个属性的值
// - success 表示是否成功
// - cards 表示选择的卡片
// - targets 表示选择的目标
```
* @template {keyof Result} T
* @overload
* @returns {Promise<Result>}
* *
* @returns {Promise} * @overload
* @param {T} param0
* @returns {Promise<Exclude<Result[T], undefined>>}
*
* @overload
* @param { T[] } params
* @returns { Promise<Exclude<Result[T], undefined>[]> }
*/ */
forResult(...args: any[]): Promise<any>; forResult<T extends keyof Result>(): Promise<Result>;
/** /**
* result中的bool项 * Result
* @example
* ```js
// 示例 1
const chooseCardResult = await player.chooseCard().forResult();
// 获取整个结果对象,然后访问如 chooseCardResult.cards 等属性
// 示例 2
const cards = await player.chooseCard().forResult('cards');
// 获取结果对象中 'cards' 属性的值
// 示例 3
const [success, cards, targets] = await player.chooseCardTarget().forResult('bool', 'cards', 'targets');
// 获取结果对象中多个属性的值
// - success 表示是否成功
// - cards 表示选择的卡片
// - targets 表示选择的目标
```
* @template {keyof Result} T
* @overload
* @returns {Promise<Result>}
* *
* @returns {Promise<boolean>} bool项 * @overload
* @param {T} param0
* @returns {Promise<Exclude<Result[T], undefined>>}
*
* @overload
* @param { T[] } params
* @returns { Promise<Exclude<Result[T], undefined>[]> }
*/
forResult<T extends keyof Result>(param0: T): Promise<Exclude<Result[T], undefined>>;
/**
* Result
* @example
* ```js
// 示例 1
const chooseCardResult = await player.chooseCard().forResult();
// 获取整个结果对象,然后访问如 chooseCardResult.cards 等属性
// 示例 2
const cards = await player.chooseCard().forResult('cards');
// 获取结果对象中 'cards' 属性的值
// 示例 3
const [success, cards, targets] = await player.chooseCardTarget().forResult('bool', 'cards', 'targets');
// 获取结果对象中多个属性的值
// - success 表示是否成功
// - cards 表示选择的卡片
// - targets 表示选择的目标
```
* @template {keyof Result} T
* @overload
* @returns {Promise<Result>}
*
* @overload
* @param {T} param0
* @returns {Promise<Exclude<Result[T], undefined>>}
*
* @overload
* @param { T[] } params
* @returns { Promise<Exclude<Result[T], undefined>[]> }
*/
forResult<T extends keyof Result>(params: T[]): Promise<Exclude<Result[T], undefined>[]>;
/**
* result中的bool项
*/
forResultTest(): Promise<(boolean | any[])[]>;
/**
* result中的bool项
*/ */
forResultBool(): Promise<boolean>; forResultBool(): Promise<boolean>;
/** /**
* result中的targets项 * result中的targets项
*
* @returns {Promise<Player[]>} targets项
*
*/ */
forResultTargets(): Promise<Player[]>; forResultTargets(): Promise<any[]>;
/** /**
* result中的cards项 * result中的cards项
*
* @returns {Promise<Card[]>} cards项
*
*/ */
forResultCards(): Promise<Card[]>; forResultCards(): Promise<any[]>;
/** /**
* result中的card项 * result中的card项
* *
@ -94,15 +165,11 @@ export class GameEventPromise extends Promise<any> {
forResultCard(): Promise<VCard> | Promise<Card>; forResultCard(): Promise<VCard> | Promise<Card>;
/** /**
* result中的control项 * result中的control项
*
* @returns {Promise<string>} control项
*/ */
forResultControl(): Promise<string>; forResultControl(): Promise<string>;
/** /**
* result中的links项 * result中的links项
*
* @returns {Promise<Array<any>>} links项
*/ */
forResultLinks(): Promise<Array<any>>; forResultLinks(): Promise<any[]>;
#private; #private;
} }

View File

@ -290,8 +290,8 @@ export class Player extends HTMLDivElement {
/** /**
* *
*/ */
addShownCards(...args: any[]): any; addShownCards(...args: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
hideShownCards(...args: any[]): any; hideShownCards(...args: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
/** /**
* *
*/ */
@ -329,7 +329,7 @@ export class Player extends HTMLDivElement {
* @param {*} judge2 * @param {*} judge2
* @returns * @returns
*/ */
executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): any; executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* Check if the card does not count toward hand limit * Check if the card does not count toward hand limit
* *
@ -344,7 +344,7 @@ export class Player extends HTMLDivElement {
* @param { Card | Card[] } cards * @param { Card | Card[] } cards
* @param { Player } target * @param { Player } target
*/ */
gift(cards: Card | Card[], target: Player, ...args: any[]): any; gift(cards: Card | Card[], target: Player, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* Check if the player can gift the card * Check if the player can gift the card
* *
@ -381,7 +381,7 @@ export class Player extends HTMLDivElement {
* @param { (player: Player, cards: Card[]) => any } [recastingLose] * @param { (player: Player, cards: Card[]) => any } [recastingLose]
* @param { (player: Player, cards: Card[]) => any } [recastingGain] * @param { (player: Player, cards: Card[]) => any } [recastingGain]
*/ */
recast(cards: Card | Card[], recastingLose?: ((player: Player, cards: Card[]) => any) | undefined, recastingGain?: ((player: Player, cards: Card[]) => any) | undefined, ...args: any[]): any; recast(cards: Card | Card[], recastingLose?: ((player: Player, cards: Card[]) => any) | undefined, recastingGain?: ((player: Player, cards: Card[]) => any) | undefined, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* Check if the player can recast the card * Check if the player can recast the card
* *
@ -459,19 +459,19 @@ export class Player extends HTMLDivElement {
* *
* // * //
*/ */
disableEquip(...args: any[]): any; disableEquip(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* *
* *
* // * //
*/ */
enableEquip(...args: any[]): any; enableEquip(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* *
* *
* // * //
*/ */
expandEquip(...args: any[]): any; expandEquip(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* *
*/ */
@ -512,7 +512,7 @@ export class Player extends HTMLDivElement {
* @deprecated * @deprecated
*/ */
$enableEquip(): void; $enableEquip(): void;
chooseToDebate(...args: any[]): any; chooseToDebate(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* target发起协力 * target发起协力
* @param { Player } target * @param { Player } target
@ -520,7 +520,7 @@ export class Player extends HTMLDivElement {
* @param {*} reason * @param {*} reason
*/ */
cooperationWith(target: Player, type: any, reason: any): void; cooperationWith(target: Player, type: any, reason: any): void;
chooseCooperationFor(...args: any[]): any; chooseCooperationFor(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
checkCooperationStatus(target: any, reason: any): boolean; checkCooperationStatus(target: any, reason: any): boolean;
removeCooperation(info: any): void; removeCooperation(info: any): void;
/** /**
@ -564,7 +564,7 @@ export class Player extends HTMLDivElement {
* @param { string } skill * @param { string } skill
*/ */
removeSkillBlocker(skill: string): void; removeSkillBlocker(skill: string): void;
loseToSpecial(cards: any, tag: any, target: any): any; loseToSpecial(cards: any, tag: any, target: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { Card | Card[] } cards * @param { Card | Card[] } cards
* @param { string } tag * @param { string } tag
@ -599,15 +599,15 @@ export class Player extends HTMLDivElement {
* @param { 0 | 1 | 2 } num * @param { 0 | 1 | 2 } num
* @param { false } [log] * @param { false } [log]
*/ */
showCharacter(num: 0 | 1 | 2, log?: false | undefined, ...args: any[]): any; showCharacter(num: 0 | 1 | 2, log?: false | undefined, ...args: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
/** /**
* @param { 0 | 1 | 2 } num * @param { 0 | 1 | 2 } num
* @param { false } [log] * @param { false } [log]
*/ */
$showCharacter(num: 0 | 1 | 2, log?: false | undefined): void; $showCharacter(num: 0 | 1 | 2, log?: false | undefined): void;
chooseToPlayBeatmap(beatmap: any, ...args: any[]): any; chooseToPlayBeatmap(beatmap: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToMove(...args: any[]): any; chooseToMove(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToGuanxing(num: any): any; chooseToGuanxing(num: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { Player } target * @param { Player } target
* @param { string } name * @param { string } name
@ -664,17 +664,17 @@ export class Player extends HTMLDivElement {
/** /**
* @param { string } group * @param { string } group
*/ */
changeGroup(group: string, log: any, broadcast: any, ...args: any[]): any; changeGroup(group: string, log: any, broadcast: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { Player } target * @param { Player } target
*/ */
chooseToDuiben(target: Player): any; chooseToDuiben(target: Player): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { Player } target * @param { Player } target
*/ */
chooseToPSS(target: Player): any; chooseToPSS(target: Player): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToEnable(...args: any[]): any; chooseToEnable(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToDisable(...args: any[]): any; chooseToDisable(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { boolean } [notmeisok] * @param { boolean } [notmeisok]
*/ */
@ -682,7 +682,7 @@ export class Player extends HTMLDivElement {
/** /**
* @param { Player } target * @param { Player } target
*/ */
swapEquip(target: Player): any; swapEquip(target: Player): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @param { Player } target * @param { Player } target
* @param { boolean } [goon] * @param { boolean } [goon]
@ -691,8 +691,8 @@ export class Player extends HTMLDivElement {
canCompare(target: Player, goon?: boolean | undefined, bool?: boolean | undefined): boolean; canCompare(target: Player, goon?: boolean | undefined, bool?: boolean | undefined): boolean;
$disableJudge(): void; $disableJudge(): void;
$enableJudge(): void; $enableJudge(): void;
disableJudge(): any; disableJudge(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
enableJudge(): any; enableJudge(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
init(character: any, character2: any, skill: any, update: any): this | undefined; init(character: any, character2: any, skill: any, update: any): this | undefined;
skin: { skin: {
name: any; name: any;
@ -836,95 +836,96 @@ export class Player extends HTMLDivElement {
syncSkills(): void; syncSkills(): void;
playerfocus(time: any): this; playerfocus(time: any): this;
setIdentity(identity: any, nature: any): this; setIdentity(identity: any, nature: any): this;
insertPhase(skill: any, insert: any): any; insertPhase(skill: any, insert: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
insertEvent(name: any, content: any, arg: any): any; insertEvent(name: any, content: any, arg: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phase(skill: any): any; phase(skill: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseZhunbei(): any; phaseZhunbei(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseJudge(): any; phaseJudge(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseDraw(): any; phaseDraw(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseUse(): any; phaseUse(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseDiscard(): any; phaseDiscard(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
phaseJieshu(): any; phaseJieshu(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToUse(use: any, ...args: any[]): any; chooseToUse(use: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToRespond(...args: any[]): any; chooseToRespond(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToGive(...args: any[]): any; chooseToGive(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToDiscard(...args: any[]): any; chooseToDiscard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseToCompare(target: any, check: any, ...args: any[]): any; chooseToCompare(target: any, check: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseSkill(target: any, ...args: any[]): void; chooseSkill(target: any, ...args: any[]): void;
discoverCard(list: any, ...args: any[]): any; discoverCard(list: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseCardButton(...args: any[]): any; chooseCardButton(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseVCardButton(...args: any[]): any; chooseVCardButton(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseButton(...args: any[]): any; chooseButton(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): any; chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseCardOL(...args: any[]): any; chooseCardOL(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseCard(choose: any, ...args: any[]): any; chooseCard(choose: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseUseTarget(...args: any[]): any; chooseUseTarget(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseTarget(...args: any[]): any; chooseTarget(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseCardTarget(choose: any, ...args: any[]): any; chooseCardTarget(choose: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseControlList(...args: any[]): any; chooseControlList(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseControl(...args: any[]): any; chooseControl(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseBool(...args: any[]): any; chooseBool(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
chooseDrawRecover(...args: any[]): any; chooseDrawRecover(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
choosePlayerCard(...args: any[]): any; choosePlayerCard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
discardPlayerCard(...args: any[]): any; discardPlayerCard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
gainPlayerCard(...args: any[]): any; gainPlayerCard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
showHandcards(str: any, ...args: any[]): any; showHandcards(str: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
showCards(cards: any, str: any, ...args: any[]): any; showCards(cards: any, str: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
viewCards(str: any, cards: any, ...args: any[]): any; viewCards(str: any, cards: any, ...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
viewHandcards(target: any): any; viewHandcards(target: any): false | (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise);
canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean; canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean;
moveCard(...args: any[]): any; moveCard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
useResult(result: any, event: any): any; useResult(result: any, event: any): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
useCard(...args: any[]): any; useCard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
useSkill(...args: any[]): any; useSkill(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
drawTo(num: any, args: any): any; drawTo(num: any, args: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
draw(...args: any[]): any; draw(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
randomDiscard(...args: any[]): any[]; randomDiscard(...args: any[]): any[];
randomGain(...args: any[]): any; randomGain(...args: any[]): any;
discard(...args: any[]): any; discard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseToDiscardpile(...args: any[]): any; loseToDiscardpile(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
respond(...args: any[]): any; respond(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
swapHandcards(target: any, cards1: any, cards2: any): any; swapHandcards(target: any, cards1: any, cards2: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
directequip(cards: any): void; directequip(cards: any): void;
$addToExpansion(cards: any, broadcast: any, gaintag: any): this; $addToExpansion(cards: any, broadcast: any, gaintag: any): this;
directgain(cards: any, broadcast: any, gaintag: any): this; directgain(cards: any, broadcast: any, gaintag: any): this;
directgains(cards: any, broadcast: any, gaintag: any): this; directgains(cards: any, broadcast: any, gaintag: any): this;
gainMultiple(targets: any, position: any): any; gainMultiple(targets: any, position: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
gain(...args: any[]): any; gain(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addToExpansion(...args: any[]): any; addToExpansion(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
give(cards: any, target: any, visible: any): any; give(cards: any, target: any, visible: any): any;
lose(...args: any[]): any; lose(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
damage(...args: any[]): any; damage(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
recover(...args: any[]): any; recover(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
doubleDraw(): any; recoverTo(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseHp(num: any): any; doubleDraw(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseMaxHp(...args: any[]): any; loseHp(num: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
gainMaxHp(...args: any[]): any; loseMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
changeHp(num: any, popup: any): any; gainMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
changeHujia(num: any, type: any, limit: any): any; changeHp(num: any, popup: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
changeHujia(num: any, type: any, limit: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
getBuff(...args: any[]): this; getBuff(...args: any[]): this;
getDebuff(...args: any[]): this; getDebuff(...args: any[]): this;
dying(reason: any): any; dying(reason: any): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
die(reason: any): any; die(reason: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
revive(hp: any, log: any): void; revive(hp: any, log: any): void;
isMad(): boolean; isMad(): boolean;
goMad(end: any): void; goMad(end: any): void;
unMad(): void; unMad(): void;
tempHide(): void; tempHide(): void;
addExpose(num: any): this; addExpose(num: any): this;
equip(card: any, draw: any): any; equip(card: any, draw: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addJudge(card: any, cards: any): any; addJudge(card: any, cards: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/** /**
* @returns { boolean } * @returns { boolean }
*/ */
canAddJudge(card: any): boolean; canAddJudge(card: any): boolean;
addJudgeNext(card: any, unlimited: any): void; addJudgeNext(card: any, unlimited: any): void;
judge(...args: any[]): any; judge(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
turnOver(bool: any): any; turnOver(bool: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
out(skill: any): void; out(skill: any): void;
outSkills: any[] | undefined; outSkills: any[] | undefined;
in(skill: any): void; in(skill: any): void;
link(bool: any): any; link(bool: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
skip(name: any): void; skip(name: any): void;
wait(callback: any): void; wait(callback: any): void;
unwait(result: any): void; unwait(result: any): void;
@ -966,9 +967,9 @@ export class Player extends HTMLDivElement {
getUseValue(card: any, distance: any, includecard: any): number; getUseValue(card: any, distance: any, includecard: any): number;
addSubPlayer(cfg: any): string; addSubPlayer(cfg: any): string;
removeSubPlayer(name: any): void; removeSubPlayer(name: any): void;
callSubPlayer(...args: any[]): any; callSubPlayer(...args: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
toggleSubPlayer(...args: any[]): any; toggleSubPlayer(...args: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
exitSubPlayer(remove: any): any; exitSubPlayer(remove: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
getSubPlayers(tag: any): any[]; getSubPlayers(tag: any): any[];
addSkillTrigger(skills: any, hidden: any, triggeronly: any): this; addSkillTrigger(skills: any, hidden: any, triggeronly: any): this;
_hookTrigger: any[] | undefined; _hookTrigger: any[] | undefined;
@ -976,16 +977,16 @@ export class Player extends HTMLDivElement {
removeSkillLog(skill: any, popup: any): this | undefined; removeSkillLog(skill: any, popup: any): this | undefined;
addInvisibleSkill(skill: any): void; addInvisibleSkill(skill: any): void;
removeInvisibleSkill(skill: any, ...args: any[]): any; removeInvisibleSkill(skill: any, ...args: any[]): any;
addSkills(skill: any): any; addSkills(skill: any): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
removeSkills(skill: any): any; removeSkills(skill: any): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
changeSkills(addSkill?: any[], removeSkill?: any[]): any; changeSkills(addSkill?: any[], removeSkill?: any[]): (import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise) | undefined;
addSkill(skill: any, checkConflict: any, nobroadcast: any, addToSkills: any): any; addSkill(skill: any, checkConflict: any, nobroadcast: any, addToSkills: any): any;
addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): any; addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addAdditionalSkill(skill: any, skillsToAdd: any, keep: any): this; addAdditionalSkill(skill: any, skillsToAdd: any, keep: any): this;
$removeAdditionalSkills(skill: any, target: any): void; $removeAdditionalSkills(skill: any, target: any): void;
getRemovableAdditionalSkills(skill: any, target: any): string[]; getRemovableAdditionalSkills(skill: any, target: any): string[];
removeAdditionalSkill(skill: any, target: any): this; removeAdditionalSkill(skill: any, target: any): this;
removeAdditionalSkills(skill: any, target: any): any; removeAdditionalSkills(skill: any, target: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
awakenSkill(skill: any, nounmark: any): this; awakenSkill(skill: any, nounmark: any): this;
restoreSkill(skill: any, nomark: any): this; restoreSkill(skill: any, nomark: any): this;
disableSkill(skill: any, skills: any): this; disableSkill(skill: any, skills: any): this;
@ -995,7 +996,7 @@ export class Player extends HTMLDivElement {
removeEquipTrigger(card: any): this; removeEquipTrigger(card: any): this;
removeSkillTrigger(skills: any, triggeronly: any): this; removeSkillTrigger(skills: any, triggeronly: any): this;
removeSkill(skill: any, ...args: any[]): any; removeSkill(skill: any, ...args: any[]): any;
addTempSkills(skillsToAdd: any, expire: any): any; addTempSkills(skillsToAdd: any, expire: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addTempSkill(skill: any, expire: any, checkConflict: any): any; addTempSkill(skill: any, expire: any, checkConflict: any): any;
tempBanSkill(skill: any, expire: any, log: any): any; tempBanSkill(skill: any, expire: any, log: any): any;
isTempBanned(skill: any): boolean; isTempBanned(skill: any): boolean;

View File

@ -227,7 +227,7 @@ export class Library {
yingbian: { yingbian: {
condition: { condition: {
color: Map<string, string>; color: Map<string, string>;
complex: Map<string, (event: any, ...args: any[]) => any>; complex: Map<string, (event: any, ...args: any[]) => Element.GameEvent & Element.GameEventPromise>;
simple: Map<string, (event: any) => any>; simple: Map<string, (event: any) => any>;
}; };
effect: Map<string, () => void>; effect: Map<string, () => void>;
@ -4043,7 +4043,10 @@ export class Library {
readonly nodews: Element.NodeWS; readonly nodews: Element.NodeWS;
}; };
card: { card: {
list: never[]; /**
* @type { [CardBaseUIData['suit'], CardBaseUIData['number'], string][] }
*/
list: [CardBaseUIData['suit'], CardBaseUIData['number'], string][];
cooperation_damage: { cooperation_damage: {
fullskin: boolean; fullskin: boolean;
}; };
@ -4438,7 +4441,7 @@ export type VCard = InstanceType<typeof lib.element.VCard>;
export type Button = InstanceType<typeof lib.element.Button>; export type Button = InstanceType<typeof lib.element.Button>;
export type Dialog = InstanceType<typeof lib.element.Dialog>; export type Dialog = InstanceType<typeof lib.element.Dialog>;
export type GameEvent = InstanceType<typeof lib.element.GameEvent>; export type GameEvent = InstanceType<typeof lib.element.GameEvent>;
export type GameEventPromise = InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise>; export type GameEventPromise = GameEvent & InstanceType<typeof lib.element.GameEventPromise>;
export type NodeWS = InstanceType<typeof lib.element.NodeWS>; export type NodeWS = InstanceType<typeof lib.element.NodeWS>;
export type Control = InstanceType<typeof lib.element.Control>; export type Control = InstanceType<typeof lib.element.Control>;
import * as Element from "./element/index.js"; import * as Element from "./element/index.js";

View File

@ -45,6 +45,24 @@ export class status {
* @type { boolean | void } * @type { boolean | void }
*/ */
connectMode: boolean | void; connectMode: boolean | void;
/**
* @type { boolean | void }
*/
importingExtension: boolean | void;
/**
* @type { Promise<any>[] | void }
*/
extensionLoaded: Promise<any>[] | void;
/**
* @type { Promise<any>[] | void }
*/
extensionLoading: Promise<any>[] | void;
/**
* @type { { [key: string]: Promise<any>[] } | void }
*/
importing: void | {
[key: string]: Promise<any>[];
};
} }
export let _status: status; export let _status: status;
export function setStatus(instance?: status | undefined): void; export function setStatus(instance?: status | undefined): void;

View File

@ -59,12 +59,12 @@ declare type GeneratorContentFuncByAll = (event: GameEventPromise, map: {
declare type OldContentFuncByAll = () => void declare type OldContentFuncByAll = () => void
declare type Game = typeof import('./nonameModules/noname.d.ts').game; declare type Game = typeof import('noname-typings/nonameModules/noname.js').game;
declare type Library = typeof import('./nonameModules/noname.d.ts').lib; declare type Library = typeof import('noname-typings/nonameModules/noname.js').lib;
declare type Status = typeof import('./nonameModules/noname.d.ts')._status; declare type Status = typeof import('noname-typings/nonameModules/noname.js')._status;
declare type UI = typeof import('./nonameModules/noname.d.ts').ui; declare type UI = typeof import('noname-typings/nonameModules/noname.js').ui;
declare type Get = typeof import('./nonameModules/noname.d.ts').get; declare type Get = typeof import('noname-typings/nonameModules/noname.js').get;
declare type AI = typeof import('./nonameModules/noname.d.ts').ai; declare type AI = typeof import('noname-typings/nonameModules/noname.js').ai;
declare type Button = import('./nonameModules/noname/library/index.js').Button; declare type Button = import('./nonameModules/noname/library/index.js').Button;
declare type Card = import('./nonameModules/noname/library/index.js').Card; declare type Card = import('./nonameModules/noname/library/index.js').Card;
@ -195,7 +195,6 @@ declare interface importCharacterConfig {
* *
*/ */
game?: SMap<any>; game?: SMap<any>;
/** /**
* *
* *
@ -538,6 +537,80 @@ declare interface importExtensionConfig {
[key: string]: any; [key: string]: any;
} }
/**
*
*/
declare interface importPlayConfig {
/** 扩展名 */
name: string;
arenaReady?: Function;
/**
*
*/
video?: Function;
/**
*
* */
skill?: SMap<Skill>;
/**
*
*
* */
card?: SMap<any>;
translate?: SMap<string>;
/**
* lib.element
*
*
*/
element?: SMap<any>;
/**
* ai
*
*
*/
ai?: SMap<any>;
/**
* ui
*
*
*/
ui?: SMap<any>;
/**
* game
*
*
*/
game?: SMap<any>;
/**
*
*
* get
*
*/
get?: SMap<any>;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
[key: string]: any;
}
/** /**
* *
* *

View File

@ -1,12 +1,12 @@
/** /**
* @typedef {{ * @typedef {{
* cardMove:GameEventPromise[], * cardMove: GameEventPromise[],
* custom: GameEventPromise[], * custom: GameEventPromise[],
* useCard: GameEventPromise[], * useCard: GameEventPromise[],
* changeHp: GameEventPromise[], * changeHp: GameEventPromise[],
* everything: GameEventPromise[] * everything: GameEventPromise[]
* }} GameHistory * }} GameHistory
* @typedef { { type: string, player?: string, content?: string | any[], delay: number } } Video * @typedef { { name?: string, type: string, player?: string, content?: string | any[], delay: number } } Video
* @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos * @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos
*/ */
@ -495,8 +495,8 @@ export class Game {
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean } * @returns { boolean }
*/ */
hasGlobalHistory(key, filter, last) { hasGlobalHistory(key, filter, last) {
@ -519,8 +519,8 @@ export class Game {
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void } * @returns { void }
*/ */
checkGlobalHistory(key, filter, last) { checkGlobalHistory(key, filter, last) {
@ -548,8 +548,8 @@ export class Game {
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] } * @returns { GameHistory[T] }
*/ */
getGlobalHistory(key, filter, last) { getGlobalHistory(key, filter, last) {
@ -570,8 +570,8 @@ export class Game {
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean } * @returns { boolean }
*/ */
hasAllGlobalHistory(key, filter, last) { hasAllGlobalHistory(key, filter, last) {
@ -594,8 +594,8 @@ export class Game {
/** /**
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } filter * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void } * @returns { void }
*/ */
checkAllGlobalHistory(key, filter, last) { checkAllGlobalHistory(key, filter, last) {
@ -625,8 +625,8 @@ export class Game {
* @template { keyof GameHistory } T * @template { keyof GameHistory } T
* @overload * @overload
* @param { T } key * @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter] * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last] * @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] } * @returns { GameHistory[T] }
*/ */
getAllGlobalHistory(key, filter, last) { getAllGlobalHistory(key, filter, last) {
@ -658,12 +658,12 @@ export class Game {
/** /**
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsDiscard(cards) { cardsDiscard(cards) {
/** @type { 'cards' | 'card' | void } */ /** @type { 'cards' | 'card' | void } */
@ -686,12 +686,12 @@ export class Game {
/** /**
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoOrdering(cards) { cardsGotoOrdering(cards) {
/** @type { 'cards' | 'card' | void } */ /** @type { 'cards' | 'card' | void } */
@ -711,13 +711,13 @@ export class Game {
* @overload * @overload
* @param { Card } cards * @param { Card } cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库 * @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
/** /**
* @overload * @overload
* @param {Card[]} cards * @param {Card[]} cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库 * @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
cardsGotoSpecial(cards, bool) { cardsGotoSpecial(cards, bool) {
/** @type { 'cards' | 'card' | void } */ /** @type { 'cards' | 'card' | void } */
@ -780,7 +780,7 @@ export class Game {
return next; return next;
} }
/** /**
* @param { GameEventPromise } event * @param { import('../library/index.js').GameEventPromise } event
*/ */
$cardsGotoPile(event) { $cardsGotoPile(event) {
const cards = event.cards; const cards = event.cards;
@ -890,56 +890,40 @@ export class Game {
* @param { Function } proceed * @param { Function } proceed
*/ */
checkFileList(updates, proceed) { checkFileList(updates, proceed) {
if (!Array.isArray(updates) || !updates.length) proceed();
let n = updates.length; let n = updates.length;
if (!n) {
proceed(n);
}
for (let i = 0; i < updates.length; i++) { for (let i = 0; i < updates.length; i++) {
if (lib.node && lib.node.fs) { if (lib.node && lib.node.fs) {
lib.node.fs.access(__dirname + '/' + updates[i], (function (entry) { lib.node.fs.access(__dirname + '/' + updates[i], err => {
return function (err) { if (!err) {
if (!err) { let stat = lib.node.fs.statSync(__dirname + '/' + updates[i]);
let stat = lib.node.fs.statSync(__dirname + '/' + entry); // @ts-ignore
if (stat.size == 0) { if (stat.size == 0) err = true;
err = true;
}
}
if (err) {
n--;
if (n == 0) {
proceed();
}
}
else {
n--;
updates.remove(entry);
if (n == 0) {
proceed();
}
}
} }
}(updates[i]))); n--;
if (!err) updates.remove(updates[i]);
if (n == 0) proceed();
});
} }
else { else {
resolveLocalFileSystemURL(lib.assetURL + updates[i], (function (name) { window.resolveLocalFileSystemURL(nonameInitialized + updates[i], () => {
return function (entry) {
n--;
updates.remove(name);
if (n == 0) {
proceed();
}
}
}(updates[i])), function () {
n--; n--;
if (n == 0) { updates.remove(updates[i]);
proceed(); if (n == 0) proceed();
} }, () => {
n--;
if (n == 0) proceed();
}); });
} }
} }
} }
/** /**
* @param {...(Player[] | Player)} args * @overload
* @param {[Player[]]} args
*/
/**
* @overload
* @param {Player[]} args
*/ */
replaceHandcards(...args) { replaceHandcards(...args) {
var next = game.createEvent('replaceHandcards'); var next = game.createEvent('replaceHandcards');
@ -1701,12 +1685,12 @@ export class Game {
* @overload * @overload
* @param { 'character' } type * @param { 'character' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCharacterConfig } content * ) => importCharacterConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
@ -1714,12 +1698,12 @@ export class Game {
* @overload * @overload
* @param { 'card' } type * @param { 'card' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importCardConfig } content * ) => importCardConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
@ -1727,12 +1711,12 @@ export class Game {
* @overload * @overload
* @param { 'mode' } type * @param { 'mode' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importModeConfig } content * ) => importModeConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
@ -1740,12 +1724,12 @@ export class Game {
* @overload * @overload
* @param { 'player' } type * @param { 'player' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayerConfig } content * ) => importPlayerConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
@ -1753,15 +1737,28 @@ export class Game {
* @overload * @overload
* @param { 'extension' } type * @param { 'extension' } type
* @param {( * @param {(
* lib: Library, * lib: InstanceType<typeof import('../library/index.js').Library>,
* game: typeof Game, * game: InstanceType<typeof Game>,
* ui: UI, * ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: Get, * get: InstanceType<typeof import('../get/index.js').Get>,
* ai: AI, * ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: Status * _status: InstanceType<typeof import('../status/index.js').status>
* ) => importExtensionConfig } content * ) => importExtensionConfig } content
* @param {*} [url] * @param {*} [url]
*/ */
/**
* @overload
* @param { 'play' } type
* @param {(
* lib: InstanceType<typeof import('../library/index.js').Library>,
* game: InstanceType<typeof Game>,
* ui: InstanceType<typeof import('../ui/index.js').UI>,
* get: InstanceType<typeof import('../get/index.js').Get>,
* ai: InstanceType<typeof import('../ai/index.js').AI>,
* _status: InstanceType<typeof import('../status/index.js').status>
* ) => importPlayConfig } content
* @param {*} [url]
*/
import(type, content, url) { import(type, content, url) {
if (type == 'extension') { if (type == 'extension') {
const promise = game.loadExtension(content).then((name) => { const promise = game.loadExtension(content).then((name) => {
@ -1939,7 +1936,7 @@ export class Game {
removeFile; removeFile;
/** /**
* 获取文件列表 * 获取文件列表
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) } * @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void) }
*/ */
getFileList; getFileList;
/** /**
@ -2017,7 +2014,17 @@ export class Game {
return; return;
} }
//导入 //导入
const UHP = error => alert(`导入失败:\n${JSON.stringify(error, null, '\t')}`); const UHP = error => {
if (!(error instanceof Error)) error = new Error(error);
for (const [key, value] of Object.entries(Object.getOwnPropertyDescriptors(error))) {
if (value.configurable === true) {
Reflect.defineProperty(error, key, Object.assign(value, {
enumerable: true
}));
}
}
alert(`导入失败:\n${JSON.stringify(error, null, '\t')}`)
};
try { try {
zip.load(data); zip.load(data);
// alert(zip.file('文件夹/加扩展.js').asText()) // alert(zip.file('文件夹/加扩展.js').asText())
@ -4328,8 +4335,8 @@ export class Game {
* @param { string } name * @param { string } name
* @param { string } skill * @param { string } skill
* @param { Player } player * @param { Player } player
* @param { GameEventPromise } event * @param { import('../library/index.js').GameEventPromise } event
* @returns { GameEventPromise } * @returns { import('../library/index.js').GameEventPromise }
*/ */
createTrigger(name, skill, player, event, indexedData) { createTrigger(name, skill, player, event, indexedData) {
let info = get.info(skill); let info = get.info(skill);
@ -4352,7 +4359,7 @@ export class Game {
* *
* @param { string } name * @param { string } name
* @param { false } [trigger] * @param { false } [trigger]
* @param { GameEventPromise } [triggerEvent] * @param { import('../library/index.js').GameEventPromise } [triggerEvent]
*/ */
createEvent(name, trigger, triggerEvent) { createEvent(name, trigger, triggerEvent) {
const next = (new lib.element.GameEvent(name, trigger)).toPromise(); const next = (new lib.element.GameEvent(name, trigger)).toPromise();
@ -5495,11 +5502,11 @@ export class Game {
*/ */
executingAsyncEventMap = new Map(); executingAsyncEventMap = new Map();
/** /**
* @type { GameEventPromise[] } * @type { import('../library/index.js').GameEventPromise[] }
*/ */
belongAsyncEventList = []; belongAsyncEventList = [];
/** /**
* @param { GameEventPromise } [belongAsyncEvent] * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/ */
async loop(belongAsyncEvent) { async loop(belongAsyncEvent) {
if (belongAsyncEvent) { if (belongAsyncEvent) {
@ -5665,7 +5672,7 @@ export class Game {
} }
} }
/** /**
* @param { GameEventPromise } [belongAsyncEvent] * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/ */
runContent(belongAsyncEvent) { runContent(belongAsyncEvent) {
return new Promise(resolve => { return new Promise(resolve => {
@ -5892,7 +5899,7 @@ export class Game {
return game.asyncDelay(time, time2); return game.asyncDelay(time, time2);
} }
/** /**
* @param { GameEventPromise } [event] * @param { import('../library/index.js').GameEventPromise } [event]
*/ */
check(event = _status.event) { check(event = _status.event) {
game.callHook("checkBegin", [event]); game.callHook("checkBegin", [event]);
@ -7413,7 +7420,7 @@ export class Game {
* @param { Player } player * @param { Player } player
* @param { string | Card[] } card * @param { string | Card[] } card
* @param { Player[] } [targets] * @param { Player[] } [targets]
* @param { GameEventPromise } [event] * @param { import('../library/index.js').GameEventPromise } [event]
* @param { boolean } [forced] * @param { boolean } [forced]
* @param { string } [logvid] * @param { string } [logvid]
*/ */

View File

@ -6,7 +6,7 @@ import { ui } from '../../ui/index.js';
import { AsyncFunction } from '../../util/index.js'; import { AsyncFunction } from '../../util/index.js';
export class GameEvent { export class GameEvent {
/** @type { GameEventPromise } */ /** @type { this & import('./gameEventPromise.js').GameEventPromise } */
#promise; #promise;
/** /**
* @param {string | GameEvent} [name] * @param {string | GameEvent} [name]
@ -74,6 +74,11 @@ export class GameEvent {
*/ */
// @ts-ignore // @ts-ignore
player; player;
/**
* @type { Player[] }
*/
// @ts-ignore
players;
/** /**
* @type { Player } * @type { Player }
*/ */
@ -477,7 +482,7 @@ export class GameEvent {
* 获取事件的父节点 * 获取事件的父节点
* 获取事件链上的指定事件 * 获取事件链上的指定事件
* 默认获取上一个父节点核心 * 默认获取上一个父节点核心
* @param {number|string|(evt:gameEvent)=>boolean} [level=1] 获取深度number/指定名字string/指定特征function * @param {number|string|((evt:GameEvent)=>boolean)} [level=1] 获取深度number/指定名字string/指定特征function
* @param {boolean} [forced] 若获取不到节点默认返回{}若forced为true则返回null * @param {boolean} [forced] 若获取不到节点默认返回{}若forced为true则返回null
* @param {boolean} [includeSelf] 若level不是数字指定搜索时是否包含事件本身 * @param {boolean} [includeSelf] 若level不是数字指定搜索时是否包含事件本身
* @returns {GameEvent|{}|null} * @returns {GameEvent|{}|null}
@ -903,11 +908,10 @@ export class GameEvent {
} }
/** /**
* 事件转为Promise化 * 事件转为Promise化
*
* @returns { GameEventPromise }
*/ */
toPromise() { toPromise() {
if (!this.#promise) { if (!this.#promise) {
// @ts-ignore
this.#promise = new lib.element.GameEventPromise(this); this.#promise = new lib.element.GameEventPromise(this);
} }
return this.#promise; return this.#promise;

View File

@ -35,14 +35,11 @@ export class GameEventPromise extends Promise {
} }
#event; #event;
/** /**
* @param { GameEvent | GameEventPromise } arg * @param { import('./gameEvent.js').GameEvent } arg
*/ */
constructor(arg) { constructor(arg) {
if (arg instanceof GameEventPromise) if (arg instanceof GameEventPromise)
throw new Error("GameEventPromise cannot copy.") throw new Error("GameEventPromise cannot copy.")
/**
* @type {GameEvent}
*/
const event = arg; const event = arg;
super(resolve => { super(resolve => {
// 设置为异步事件 // 设置为异步事件
@ -165,45 +162,47 @@ export class GameEventPromise extends Promise {
} }
/** /**
* 获取 Result 对象中的信息
* @example
* ```js
// 示例 1
const chooseCardResult = await player.chooseCard().forResult();
// 获取整个结果对象,然后访问如 chooseCardResult.cards 等属性
// 示例 2
const cards = await player.chooseCard().forResult('cards');
// 获取结果对象中 'cards' 属性的值
// 示例 3
const [success, cards, targets] = await player.chooseCardTarget().forResult('bool', 'cards', 'targets');
// 获取结果对象中多个属性的值
// - success 表示是否成功
// - cards 表示选择的卡片
// - targets 表示选择的目标
```
* @template {keyof Result} T
* @overload
* @returns {Promise<Result>}
* *
* 直接获得result中的信息 * @overload
* @param {T} param0
* @returns {Promise<Exclude<Result[T], undefined>>}
* *
* * @overload
* @example * @param { T[] } params
* * @returns { Promise<Exclude<Result[T], undefined>[]> }
* let chooseCardResult = await player.chooseCard().forResult();
* 选择的卡牌chooseCardResult.cards
*
* let cards = await player.chooseCard().forResult('cards');
* 选择的卡牌cards
*
* let [success,cards,targets] = await player.chooseCardTarget().forResult('bool','cards','targets');
* success:是否做出选择
* cards:选择的牌
* targets:选择的目标
*
* @returns {Promise} 返回的结果
*/ */
forResult(){ forResult(...params){
if(arguments.length == 0){ if (params.length == 0) {
return this.then(event=>{ return this.then(({ result }) => result);
return Promise.resolve(event.result); } else if (params.length == 1) {
}); return this.then(event => event.result[params[0]]);
}else if(arguments.length == 1){ } else {
return this.then(event=>{ return this.then(event => Array.from(params).map(key => event.result[key]));
return Promise.resolve(event.result[arguments[0]]);
});
}else{
return this.then(event=>{
return Promise.resolve(Array.from(arguments).map(key=>event.result[key]));
});
} }
} }
/** /**
* 返回result中的bool项 * 返回result中的bool项
*
* @returns {Promise<boolean>} 返回的bool项
*/ */
forResultBool(){ forResultBool(){
return this.forResult('bool'); return this.forResult('bool');
@ -211,9 +210,6 @@ export class GameEventPromise extends Promise {
/** /**
* 返回result中的targets项 * 返回result中的targets项
*
* @returns {Promise<Player[]>} 返回的targets项
*
*/ */
forResultTargets(){ forResultTargets(){
return this.forResult('targets'); return this.forResult('targets');
@ -221,9 +217,6 @@ export class GameEventPromise extends Promise {
/** /**
* 返回result中的cards项 * 返回result中的cards项
*
* @returns {Promise<Card[]>} 返回的cards项
*
*/ */
forResultCards(){ forResultCards(){
return this.forResult('cards'); return this.forResult('cards');
@ -241,8 +234,6 @@ export class GameEventPromise extends Promise {
/** /**
* 返回result中的control项 * 返回result中的control项
*
* @returns {Promise<string>} 返回的control项
*/ */
forResultControl(){ forResultControl(){
return this.forResult('control'); return this.forResult('control');
@ -250,8 +241,6 @@ export class GameEventPromise extends Promise {
/** /**
* 返回result中的links项 * 返回result中的links项
*
* @returns {Promise<Array<any>>} 返回的links项
*/ */
forResultLinks(){ forResultLinks(){
return this.forResult('links'); return this.forResult('links');

View File

@ -5,7 +5,7 @@
* @typedef { InstanceType<typeof lib.element.Button> } Button * @typedef { InstanceType<typeof lib.element.Button> } Button
* @typedef { InstanceType<typeof lib.element.Dialog> } Dialog * @typedef { InstanceType<typeof lib.element.Dialog> } Dialog
* @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent * @typedef { InstanceType<typeof lib.element.GameEvent> } GameEvent
* @typedef { InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise> } GameEventPromise * @typedef { GameEvent & InstanceType<typeof lib.element.GameEventPromise> } GameEventPromise
* @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS * @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS
* @typedef { InstanceType<typeof lib.element.Control> } Control * @typedef { InstanceType<typeof lib.element.Control> } Control
*/ */
@ -9448,6 +9448,9 @@ export class Library {
} }
}; };
card = { card = {
/**
* @type { [CardBaseUIData['suit'], CardBaseUIData['number'], string][] }
*/
list: [], list: [],
cooperation_damage: { cooperation_damage: {
fullskin: true, fullskin: true,

View File

@ -54,6 +54,22 @@ export class status {
* @type { boolean | void } * @type { boolean | void }
*/ */
connectMode = undefined connectMode = undefined
/**
* @type { boolean | void }
*/
importingExtension = undefined
/**
* @type { Promise<any>[] | void }
*/
extensionLoaded = undefined
/**
* @type { Promise<any>[] | void }
*/
extensionLoading = undefined
/**
* @type { { [key: string]: Promise<any>[] } | void }
*/
importing = undefined
}; };
export let _status = new status(); export let _status = new status();

View File

@ -419,7 +419,7 @@ export const extensionMenu = function (connectMenu) {
} }
str += ',files:' + JSON.stringify(files); str += ',files:' + JSON.stringify(files);
str += '}'; str += '}';
var extension = { 'extension.js': 'game.import("extension",function(lib,game,ui,get,ai,_status){return ' + str + '})' }; var extension = { 'extension.js': 'import { lib, game, ui, get, ai, _status } from "../../noname.js";\ngame.import("extension",function(){\n\treturn ' + str + '\n});' };
for (var i in dash1.content.image) { for (var i in dash1.content.image) {
extension[i] = dash1.content.image[i]; extension[i] = dash1.content.image[i];
} }

View File

@ -81,7 +81,7 @@
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
"strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */ "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ "strictPropertyInitialization": false, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */ // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */ // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */