修改扩展导入失败提示,修改扩展模板为esm,添加cost和getIndex的类型注释,跟进并修复其他类型注释

This commit is contained in:
nonameShijian 2024-04-14 01:11:10 +08:00
parent 6bb7e44704
commit fe0a8a7e62
67 changed files with 553 additions and 430 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1011,8 +1011,9 @@ declare interface Skill {
* @param event event._trigger,trigger时机event为触发该技能时机时的事件
* @param player
* @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,8 +1282,10 @@ declare interface Skill {
* ,
*
* 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显示触发者的目标日志
*
@ -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;
// /** ai用于检测的方法用于主动使用触发技能 */
// check?(card:Card):number|boolean;
@ -1388,7 +1393,30 @@ declare interface Skill {
*
*/
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;
}
@ -1881,7 +1909,7 @@ interface ChooseButtonConfigData {
* player.chooseButton的ai
* @param button
*/
check?(button: Button): number;
check?(button: Button): number | void;
/**
* 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
*/
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;
setComplexYingbianCondition(yingbianCondition: any, condition: any): void;
setSimpleYingbianCondition(yingbianCondition: any, condition: any): void;
@ -164,7 +164,7 @@ export class Game {
*/
loseAsync(arg?: {
[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;
/**
* @param {string} name
@ -173,19 +173,19 @@ export class Game {
/**
* @template { keyof GameHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @returns { GameHistory }
@ -195,27 +195,27 @@ export class Game {
* @template { keyof GameHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @returns { GameHistory[] }
@ -225,11 +225,11 @@ export class Game {
* @template { keyof GameHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { import('../library/index.js').GameEventPromise } [last]
* @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
* @returns { void }
@ -238,15 +238,15 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsDiscard(cards: any): any;
cardsDiscard(cards: any): import('../library/index.js').GameEventPromise;
/**
* @overload
* @param {Card[]} cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsDiscard(cards: Card[]): any;
cardsDiscard(cards: Card[]): import('../library/index.js').GameEventPromise;
/**
* @overload
* @returns { void }
@ -255,15 +255,15 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsGotoOrdering(cards: any): any;
cardsGotoOrdering(cards: any): import('../library/index.js').GameEventPromise;
/**
* @overload
* @param {Card[]} cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsGotoOrdering(cards: Card[]): any;
cardsGotoOrdering(cards: Card[]): import('../library/index.js').GameEventPromise;
/**
* @overload
* @returns { void }
@ -273,16 +273,16 @@ export class Game {
* @overload
* @param { Card } cards
* @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
* @param {Card[]} cards
* @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 {...(
@ -297,11 +297,11 @@ export class Game {
cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [
string,
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]
*/
@ -876,18 +876,18 @@ export class Game {
* @param { string } name
* @param { string } skill
* @param { Player } player
* @param { GameEventPromise } event
* @returns { GameEventPromise }
* @param { import('../library/index.js').GameEventPromise } event
* @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.
*
* @param { string } name
* @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 { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
@ -1046,23 +1046,23 @@ export class Game {
*/
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;
pause2(): void;
resume(): void;
resume2(): void;
delaye(...args: any[]): any;
delayex(...args: any[]): any;
delaye(...args: any[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
delayex(...args: any[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/**
* @param { number } [time]
* @param { number } [time2]
@ -1092,9 +1092,9 @@ export class Game {
*/
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;
uncheck(...args: any[]): void;
/**
@ -1144,7 +1144,7 @@ export class Game {
/**
* @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;
updateRoundNumber(): void;
/**
@ -1181,11 +1181,11 @@ export class Game {
* @param { Player } player
* @param { string | Card[] } card
* @param { Player[] } [targets]
* @param { GameEventPromise } [event]
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { boolean } [forced]
* @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 } idbValidKey
@ -1267,7 +1267,7 @@ export class Game {
/**
* @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
*/

View File

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

View File

@ -23,11 +23,11 @@
*/
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>;
/**
*
* result中的信息
*
*
* Result
* @example
*
* 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:选择的目标
* ```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}
* @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>;
/**
* result中的targets项
*
* @returns {Promise<Player[]>} targets项
*
*/
forResultTargets(): Promise<Player[]>;
forResultTargets(): Promise<any[]>;
/**
* result中的cards项
*
* @returns {Promise<Card[]>} cards项
*
*/
forResultCards(): Promise<Card[]>;
forResultCards(): Promise<any[]>;
/**
* result中的card项
*
@ -94,15 +165,11 @@ export class GameEventPromise extends Promise<any> {
forResultCard(): Promise<VCard> | Promise<Card>;
/**
* result中的control项
*
* @returns {Promise<string>} control项
*/
forResultControl(): Promise<string>;
/**
* result中的links项
*
* @returns {Promise<Array<any>>} links项
*/
forResultLinks(): Promise<Array<any>>;
forResultLinks(): Promise<any[]>;
#private;
}

View File

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

View File

@ -227,7 +227,7 @@ export class Library {
yingbian: {
condition: {
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>;
};
effect: Map<string, () => void>;
@ -4441,7 +4441,7 @@ export type VCard = InstanceType<typeof lib.element.VCard>;
export type Button = InstanceType<typeof lib.element.Button>;
export type Dialog = InstanceType<typeof lib.element.Dialog>;
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 Control = InstanceType<typeof lib.element.Control>;
import * as Element from "./element/index.js";

View File

@ -59,12 +59,12 @@ declare type GeneratorContentFuncByAll = (event: GameEventPromise, map: {
declare type OldContentFuncByAll = () => void
declare type Game = typeof import('./nonameModules/noname.d.ts').game;
declare type Library = typeof import('./nonameModules/noname.d.ts').lib;
declare type Status = typeof import('./nonameModules/noname.d.ts')._status;
declare type UI = typeof import('./nonameModules/noname.d.ts').ui;
declare type Get = typeof import('./nonameModules/noname.d.ts').get;
declare type AI = typeof import('./nonameModules/noname.d.ts').ai;
declare type Game = typeof import('noname-typings/nonameModules/noname.js').game;
declare type Library = typeof import('noname-typings/nonameModules/noname.js').lib;
declare type Status = typeof import('noname-typings/nonameModules/noname.js')._status;
declare type UI = typeof import('noname-typings/nonameModules/noname.js').ui;
declare type Get = typeof import('noname-typings/nonameModules/noname.js').get;
declare type AI = typeof import('noname-typings/nonameModules/noname.js').ai;
declare type Button = import('./nonameModules/noname/library/index.js').Button;
declare type Card = import('./nonameModules/noname/library/index.js').Card;

View File

@ -6,7 +6,7 @@
* changeHp: GameEventPromise[],
* everything: GameEventPromise[]
* }} 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
*/
@ -495,8 +495,8 @@ export class Game {
/**
* @template { keyof GameHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean }
*/
hasGlobalHistory(key, filter, last) {
@ -519,8 +519,8 @@ export class Game {
/**
* @template { keyof GameHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void }
*/
checkGlobalHistory(key, filter, last) {
@ -548,8 +548,8 @@ export class Game {
* @template { keyof GameHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] }
*/
getGlobalHistory(key, filter, last) {
@ -570,8 +570,8 @@ export class Game {
/**
* @template { keyof GameHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { boolean }
*/
hasAllGlobalHistory(key, filter, last) {
@ -594,8 +594,8 @@ export class Game {
/**
* @template { keyof GameHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { void }
*/
checkAllGlobalHistory(key, filter, last) {
@ -625,8 +625,8 @@ export class Game {
* @template { keyof GameHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
* @param { import('../library/index.js').GameEventPromise } [last]
* @returns { GameHistory[T] }
*/
getAllGlobalHistory(key, filter, last) {
@ -658,12 +658,12 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsDiscard(cards) {
/** @type { 'cards' | 'card' | void } */
@ -686,12 +686,12 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsGotoOrdering(cards) {
/** @type { 'cards' | 'card' | void } */
@ -711,13 +711,13 @@ export class Game {
* @overload
* @param { Card } cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { GameEventPromise }
* @returns { import('../library/index.js').GameEventPromise }
*/
cardsGotoSpecial(cards, bool) {
/** @type { 'cards' | 'card' | void } */
@ -780,7 +780,7 @@ export class Game {
return next;
}
/**
* @param { GameEventPromise } event
* @param { import('../library/index.js').GameEventPromise } event
*/
$cardsGotoPile(event) {
const cards = event.cards;
@ -1701,12 +1701,12 @@ export class Game {
* @overload
* @param { 'character' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* 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 } content
* @param {*} [url]
*/
@ -1714,12 +1714,12 @@ export class Game {
* @overload
* @param { 'card' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* 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 } content
* @param {*} [url]
*/
@ -1727,12 +1727,12 @@ export class Game {
* @overload
* @param { 'mode' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* 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 } content
* @param {*} [url]
*/
@ -1740,12 +1740,12 @@ export class Game {
* @overload
* @param { 'player' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* 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 } content
* @param {*} [url]
*/
@ -1753,15 +1753,28 @@ export class Game {
* @overload
* @param { 'extension' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* 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 } content
* @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) {
if (type == 'extension') {
const promise = game.loadExtension(content).then((name) => {
@ -1939,7 +1952,7 @@ export class Game {
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;
/**
@ -2017,7 +2030,17 @@ export class Game {
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 {
zip.load(data);
// alert(zip.file('文件夹/加扩展.js').asText())
@ -4328,8 +4351,8 @@ export class Game {
* @param { string } name
* @param { string } skill
* @param { Player } player
* @param { GameEventPromise } event
* @returns { GameEventPromise }
* @param { import('../library/index.js').GameEventPromise } event
* @returns { import('../library/index.js').GameEventPromise }
*/
createTrigger(name, skill, player, event, indexedData) {
let info = get.info(skill);
@ -4352,7 +4375,7 @@ export class Game {
*
* @param { string } name
* @param { false } [trigger]
* @param { GameEventPromise } [triggerEvent]
* @param { import('../library/index.js').GameEventPromise } [triggerEvent]
*/
createEvent(name, trigger, triggerEvent) {
const next = (new lib.element.GameEvent(name, trigger)).toPromise();
@ -5495,11 +5518,11 @@ export class Game {
*/
executingAsyncEventMap = new Map();
/**
* @type { GameEventPromise[] }
* @type { import('../library/index.js').GameEventPromise[] }
*/
belongAsyncEventList = [];
/**
* @param { GameEventPromise } [belongAsyncEvent]
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/
async loop(belongAsyncEvent) {
if (belongAsyncEvent) {
@ -5665,7 +5688,7 @@ export class Game {
}
}
/**
* @param { GameEventPromise } [belongAsyncEvent]
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
*/
runContent(belongAsyncEvent) {
return new Promise(resolve => {
@ -5892,7 +5915,7 @@ export class Game {
return game.asyncDelay(time, time2);
}
/**
* @param { GameEventPromise } [event]
* @param { import('../library/index.js').GameEventPromise } [event]
*/
check(event = _status.event) {
game.callHook("checkBegin", [event]);
@ -7413,7 +7436,7 @@ export class Game {
* @param { Player } player
* @param { string | Card[] } card
* @param { Player[] } [targets]
* @param { GameEventPromise } [event]
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { boolean } [forced]
* @param { string } [logvid]
*/

View File

@ -6,7 +6,7 @@ import { ui } from '../../ui/index.js';
import { AsyncFunction } from '../../util/index.js';
export class GameEvent {
/** @type { GameEventPromise } */
/** @type { this & import('./gameEventPromise.js').GameEventPromise } */
#promise;
/**
* @param {string | GameEvent} [name]
@ -477,7 +477,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} [includeSelf] 若level不是数字指定搜索时是否包含事件本身
* @returns {GameEvent|{}|null}
@ -903,11 +903,10 @@ export class GameEvent {
}
/**
* 事件转为Promise化
*
* @returns { GameEventPromise }
*/
toPromise() {
if (!this.#promise) {
// @ts-ignore
this.#promise = new lib.element.GameEventPromise(this);
}
return this.#promise;

View File

@ -35,14 +35,11 @@ export class GameEventPromise extends Promise {
}
#event;
/**
* @param { GameEvent | GameEventPromise } arg
* @param { import('./gameEvent.js').GameEvent } arg
*/
constructor(arg) {
if (arg instanceof GameEventPromise)
throw new Error("GameEventPromise cannot copy.")
/**
* @type {GameEvent}
*/
const event = arg;
super(resolve => {
// 设置为异步事件
@ -165,45 +162,47 @@ export class GameEventPromise extends Promise {
}
/**
*
* 直接获得result中的信息
*
*
* 获取 Result 对象中的信息
* @example
*
* 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(){
if(arguments.length == 0){
return this.then(event=>{
return Promise.resolve(event.result);
});
}else if(arguments.length == 1){
return this.then(event=>{
return Promise.resolve(event.result[arguments[0]]);
});
}else{
return this.then(event=>{
return Promise.resolve(Array.from(arguments).map(key=>event.result[key]));
});
}
}
* ```js
// 示例 1
const chooseCardResult = await player.chooseCard().forResult();
// 获取整个结果对象,然后访问如 chooseCardResult.cards 等属性
/**
* 返回result中的bool项
// 示例 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(...params){
if (params.length == 0) {
return this.then(({ result }) => result);
} else if (params.length == 1) {
return this.then(event => event.result[params[0]]);
} else {
return this.then(event => Array.from(params).map(key => event.result[key]));
}
}
/**
* 返回result中的bool项
*/
forResultBool(){
return this.forResult('bool');
@ -211,9 +210,6 @@ export class GameEventPromise extends Promise {
/**
* 返回result中的targets项
*
* @returns {Promise<Player[]>} 返回的targets项
*
*/
forResultTargets(){
return this.forResult('targets');
@ -221,9 +217,6 @@ export class GameEventPromise extends Promise {
/**
* 返回result中的cards项
*
* @returns {Promise<Card[]>} 返回的cards项
*
*/
forResultCards(){
return this.forResult('cards');
@ -241,8 +234,6 @@ export class GameEventPromise extends Promise {
/**
* 返回result中的control项
*
* @returns {Promise<string>} 返回的control项
*/
forResultControl(){
return this.forResult('control');
@ -250,8 +241,6 @@ export class GameEventPromise extends Promise {
/**
* 返回result中的links项
*
* @returns {Promise<Array<any>>} 返回的links项
*/
forResultLinks(){
return this.forResult('links');

View File

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

View File

@ -54,6 +54,22 @@ export class status {
* @type { boolean | void }
*/
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();

View File

@ -419,7 +419,7 @@ export const extensionMenu = function (connectMenu) {
}
str += ',files:' + JSON.stringify(files);
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) {
extension[i] = dash1.content.image[i];
}

View File

@ -81,7 +81,7 @@
// "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. */
"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`. */
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */