diff --git a/card/extra.js b/card/extra.js index 519ada0a6..81fbc562b 100644 --- a/card/extra.js +++ b/card/extra.js @@ -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, diff --git a/card/gujian.js b/card/gujian.js index 9b27de9f1..7d8619763 100644 --- a/card/gujian.js +++ b/card/gujian.js @@ -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:{ diff --git a/card/guozhan.js b/card/guozhan.js index 7af2dbe16..da23d2cde 100644 --- a/card/guozhan.js +++ b/card/guozhan.js @@ -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, diff --git a/card/gwent.js b/card/gwent.js index 560b18cb5..351be5068 100644 --- a/card/gwent.js +++ b/card/gwent.js @@ -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:{ diff --git a/card/hearth.js b/card/hearth.js index 1482e6e43..18d8c7cae 100644 --- a/card/hearth.js +++ b/card/hearth.js @@ -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:{ diff --git a/card/huanlekapai.js b/card/huanlekapai.js index 5ace59494..212e84865 100644 --- a/card/huanlekapai.js +++ b/card/huanlekapai.js @@ -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, diff --git a/card/mtg.js b/card/mtg.js index a3965aab6..f655faf8c 100644 --- a/card/mtg.js +++ b/card/mtg.js @@ -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:{ diff --git a/card/sp.js b/card/sp.js index ea1dbd73b..ed5698744 100644 --- a/card/sp.js +++ b/card/sp.js @@ -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, diff --git a/card/standard.js b/card/standard.js index c8c5e83ec..cced65d7a 100644 --- a/card/standard.js +++ b/card/standard.js @@ -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, diff --git a/card/swd.js b/card/swd.js index bb5764f0b..e98bbe7ca 100644 --- a/card/swd.js +++ b/card/swd.js @@ -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:{ diff --git a/card/yingbian.js b/card/yingbian.js index f17f12c54..89678ca9b 100644 --- a/card/yingbian.js +++ b/card/yingbian.js @@ -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, diff --git a/card/yongjian.js b/card/yongjian.js index c9c5dc9dd..84c9050cc 100644 --- a/card/yongjian.js +++ b/card/yongjian.js @@ -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, diff --git a/card/yunchou.js b/card/yunchou.js index 72027ab01..caebac9b3 100644 --- a/card/yunchou.js +++ b/card/yunchou.js @@ -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:{ diff --git a/card/zhenfa.js b/card/zhenfa.js index ec6eadc28..7bd4fc059 100644 --- a/card/zhenfa.js +++ b/card/zhenfa.js @@ -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:{ diff --git a/card/zhulu.js b/card/zhulu.js index 9aa9a9231..6865a722d 100644 --- a/card/zhulu.js +++ b/card/zhulu.js @@ -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, diff --git a/character/clan.js b/character/clan.js index 162d0e1f1..2390589fa 100644 --- a/character/clan.js +++ b/character/clan.js @@ -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', diff --git a/character/collab.js b/character/collab.js index daca94166..4284aa35b 100644 --- a/character/collab.js +++ b/character/collab.js @@ -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, diff --git a/character/ddd.js b/character/ddd.js index 493032017..057d52aca 100644 --- a/character/ddd.js +++ b/character/ddd.js @@ -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, diff --git a/character/diy.js b/character/diy.js index c9cd5422f..a9a333ed9 100755 --- a/character/diy.js +++ b/character/diy.js @@ -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, diff --git a/character/extra.js b/character/extra.js index 5aef112a9..7d45ed433 100755 --- a/character/extra.js +++ b/character/extra.js @@ -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, diff --git a/character/gujian.js b/character/gujian.js index e066e6d8a..3f0733d05 100644 --- a/character/gujian.js +++ b/character/gujian.js @@ -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:{ diff --git a/character/gwent.js b/character/gwent.js index c4bfeeee0..7f14182ad 100644 --- a/character/gwent.js +++ b/character/gwent.js @@ -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:{ diff --git a/character/hearth.js b/character/hearth.js index 1a73ca43d..69ed13d90 100644 --- a/character/hearth.js +++ b/character/hearth.js @@ -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:{ diff --git a/character/huicui.js b/character/huicui.js index 994302655..d6cef9104 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -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, diff --git a/character/jiange.js b/character/jiange.js index 11b6e25cb..3efb2a006 100644 --- a/character/jiange.js +++ b/character/jiange.js @@ -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:{ diff --git a/character/jsrg.js b/character/jsrg.js index 984c4a4b4..a9d1495a8 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -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, diff --git a/character/mobile.js b/character/mobile.js index 9a67a51a4..502296c4d 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -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'], diff --git a/character/mtg.js b/character/mtg.js index 8502b8ac5..4a66add3a 100644 --- a/character/mtg.js +++ b/character/mtg.js @@ -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:{ diff --git a/character/offline.js b/character/offline.js index 9161ca01d..149c06db2 100644 --- a/character/offline.js +++ b/character/offline.js @@ -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, diff --git a/character/old.js b/character/old.js index 3da5443ee..1e0886310 100755 --- a/character/old.js +++ b/character/old.js @@ -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, diff --git a/character/onlyOL.js b/character/onlyOL.js index f5f2e18d4..79c15ebde 100644 --- a/character/onlyOL.js +++ b/character/onlyOL.js @@ -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, diff --git a/character/ow.js b/character/ow.js index daf18f2a7..f3a30e768 100644 --- a/character/ow.js +++ b/character/ow.js @@ -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:{ diff --git a/character/refresh.js b/character/refresh.js index d27297616..1b4f3bb6b 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -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:{ diff --git a/character/sb.js b/character/sb.js index 4694db8ba..7aca127ff 100644 --- a/character/sb.js +++ b/character/sb.js @@ -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', diff --git a/character/shenhua.js b/character/shenhua.js index 7a04f3e48..7f3bbf8c1 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -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, diff --git a/character/shiji.js b/character/shiji.js index 1a0f5c79f..eb27816b9 100644 --- a/character/shiji.js +++ b/character/shiji.js @@ -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, diff --git a/character/sp.js b/character/sp.js index 1eb0433f8..9dd15c6dd 100755 --- a/character/sp.js +++ b/character/sp.js @@ -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, diff --git a/character/sp2.js b/character/sp2.js index facc0b211..3dfc5136b 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -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, diff --git a/character/standard.js b/character/standard.js index 7b312ba4a..3b872c7be 100755 --- a/character/standard.js +++ b/character/standard.js @@ -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, diff --git a/character/swd.js b/character/swd.js index ff0ae770b..36d497d68 100644 --- a/character/swd.js +++ b/character/swd.js @@ -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:{ diff --git a/character/tw.js b/character/tw.js index 95e1368af..ea24cffca 100644 --- a/character/tw.js +++ b/character/tw.js @@ -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, diff --git a/character/xiake.js b/character/xiake.js index 4875b6b7d..5436d1a3a 100644 --- a/character/xiake.js +++ b/character/xiake.js @@ -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:{ diff --git a/character/xianding.js b/character/xianding.js index 2b9929e88..a9132ae38 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -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, diff --git a/character/xianjian.js b/character/xianjian.js index e4aca3408..20c028da2 100644 --- a/character/xianjian.js +++ b/character/xianjian.js @@ -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:{ diff --git a/character/xinghuoliaoyuan.js b/character/xinghuoliaoyuan.js index 2ba3a9168..f60fa3fad 100755 --- a/character/xinghuoliaoyuan.js +++ b/character/xinghuoliaoyuan.js @@ -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, diff --git a/character/yijiang.js b/character/yijiang.js index 2a3e9df98..1a9d29b20 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -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, diff --git a/character/yingbian.js b/character/yingbian.js index a403db602..c5e917fd6 100644 --- a/character/yingbian.js +++ b/character/yingbian.js @@ -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, diff --git a/character/yxs.js b/character/yxs.js index 7af6f3ee5..39e66b44a 100644 --- a/character/yxs.js +++ b/character/yxs.js @@ -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:{ diff --git a/character/zhuogui.js b/character/zhuogui.js index e9f0cedc5..a338621ec 100644 --- a/character/zhuogui.js +++ b/character/zhuogui.js @@ -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:{ diff --git a/extension/boss/extension.js b/extension/boss/extension.js index 6dad31016..3c9e80721 100644 --- a/extension/boss/extension.js +++ b/extension/boss/extension.js @@ -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(){ diff --git a/extension/cardpile/extension.js b/extension/cardpile/extension.js index 9590a4988..91df778d6 100644 --- a/extension/cardpile/extension.js +++ b/extension/cardpile/extension.js @@ -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(){ diff --git a/extension/coin/extension.js b/extension/coin/extension.js index e7d840d01..f2f2ca365 100644 --- a/extension/coin/extension.js +++ b/extension/coin/extension.js @@ -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(){ diff --git a/extension/wuxing/extension.js b/extension/wuxing/extension.js index f398a3685..20bcac180 100644 --- a/extension/wuxing/extension.js +++ b/extension/wuxing/extension.js @@ -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(){ diff --git a/node_modules/@types/noname-typings/Skill.d.ts b/node_modules/@types/noname-typings/Skill.d.ts index 17e8884da..cbc602a8a 100644 --- a/node_modules/@types/noname-typings/Skill.d.ts +++ b/node_modules/@types/noname-typings/Skill.d.ts @@ -1011,8 +1011,9 @@ declare interface Skill { * @param event 事件,即event._trigger,相当于trigger时机(此时的event为触发该技能时机时的事件) * @param player * @param name 触发名,为event.triggername,目前只有在lib.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,显示该配置的提示 + * + * @param target v1.10.11 触发的目标 */ - logTarget?: string | TwoParmFun; - /** + logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null); + /** * 是否通过logTarget显示触发者的目标日志; * * 目的:应该是为了细节化显示日志;在createTrigger,step3中使用,取值false,不使用logTarget,显示logSkill; @@ -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取消logSkill,然后在技能内部选择消耗,再logSkill的情况而言,虽然有效,但是难以区分“技能选择消耗的过程”和“技能本身的效果”,不是一件好事。 + * + * 因此,我们决定将技能的cost和content分离(旧的写法仍然有效,不受影响)。使用例见张辽【突袭】 + */ + cost?: (event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise; + /** + * 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 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts index 1b1d03e9b..ce8f14d61 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts @@ -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} args */ callHook(name: Name, args: Parameters): 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(key: T, filter: (event: any) => boolean, last?: any): boolean; + hasGlobalHistory(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(key: T_1, filter: (event: any) => boolean, last?: any): void; + checkGlobalHistory(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(key: T_2, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_2]; + getGlobalHistory(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(key: T_3, filter: (event: any) => boolean, last?: any): boolean; + hasAllGlobalHistory(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(key: T_4, filter: (event: any) => boolean, last?: any): void; + checkAllGlobalHistory(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(key: T_5, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_5]; + getAllGlobalHistory(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] */ @@ -517,72 +517,86 @@ export class Game { * @overload * @param { 'character' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importCharacterConfig } content * @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, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importCharacterConfig, url?: any): any; /** * @overload * @param { 'card' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importCardConfig } content * @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, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importCardConfig, url?: any): any; /** * @overload * @param { 'mode' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importModeConfig } content * @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, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importModeConfig, url?: any): any; /** * @overload * @param { 'player' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importPlayerConfig } content * @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, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importPlayerConfig, url?: any): any; /** * @overload * @param { 'extension' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importExtensionConfig } content * @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, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importExtensionConfig, url?: any): any; + /** + * @overload + * @param { 'play' } type + * @param {( + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType + * ) => importPlayConfig } content + * @param {*} [url] + */ + import(type: 'play', content: (lib: InstanceType, game: InstanceType, ui: InstanceType, get: InstanceType, ai: InstanceType, _status: InstanceType) => importPlayConfig, url?: any): any; loadExtension(object: any): Promise; /** * 下载文件 @@ -611,9 +625,9 @@ export class Game { 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) } @@ -862,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 @@ -959,8 +973,9 @@ export class Game { addGlobalSkill(skill: string, player?: any): boolean; /** * @param { string } skill + * @param { lib.element.Player } player */ - removeGlobalSkill(skill: string): void; + removeGlobalSkill(skill: string, player: lib.element.Player): void; resetSkills(): void; /** * @param { string } extensionName @@ -1031,23 +1046,23 @@ export class Game { */ executingAsyncEventMap: Map>; /** - * @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; + loop(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise; /** - * @param { GameEventPromise } [belongAsyncEvent] + * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] */ - runContent(belongAsyncEvent?: any): Promise; + runContent(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise; 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] @@ -1077,9 +1092,9 @@ export class Game { */ asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise; /** - * @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; /** @@ -1129,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; /** @@ -1166,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 @@ -1252,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 */ @@ -1371,6 +1386,7 @@ export type GameHistory = { everything: GameEventPromise[]; }; export type Video = { + name?: string; type: string; player?: string; content?: string | any[]; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts index 7e08ad170..efa0b6699 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts @@ -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"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts index 1283b9270..eb2481761 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts @@ -23,11 +23,11 @@ */ export class GameEventPromise extends Promise { /** - * @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 { */ debugger(): 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:选择的目标。 + * ```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} * - * @returns {Promise} 返回的结果 + * @overload + * @param {T} param0 + * @returns {Promise>} + * + * @overload + * @param { T[] } params + * @returns { Promise[]> } */ - forResult(...args: any[]): Promise; + forResult(): Promise; /** - * 返回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} * - * @returns {Promise} 返回的bool项 + * @overload + * @param {T} param0 + * @returns {Promise>} + * + * @overload + * @param { T[] } params + * @returns { Promise[]> } + */ + forResult(param0: T): 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} + * + * @overload + * @param {T} param0 + * @returns {Promise>} + * + * @overload + * @param { T[] } params + * @returns { Promise[]> } + */ + forResult(params: T[]): Promise[]>; + /** + * 返回result中的bool项 + */ + forResultTest(): Promise<(boolean | any[])[]>; + /** + * 返回result中的bool项 */ forResultBool(): Promise; /** * 返回result中的targets项。 - * - * @returns {Promise} 返回的targets项。 - * */ - forResultTargets(): Promise; + forResultTargets(): Promise; /** * 返回result中的cards项 - * - * @returns {Promise} 返回的cards项。 - * */ - forResultCards(): Promise; + forResultCards(): Promise; /** * 返回result中的card项 * @@ -94,15 +165,11 @@ export class GameEventPromise extends Promise { forResultCard(): Promise | Promise; /** * 返回result中的control项。 - * - * @returns {Promise} 返回的control项。 */ forResultControl(): Promise; /** * 返回result中的links项。 - * - * @returns {Promise>} 返回的links项。 */ - forResultLinks(): Promise>; + forResultLinks(): Promise; #private; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts index 3564435b7..34afa35d4 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts @@ -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,95 +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; - 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; @@ -966,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; @@ -976,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; @@ -995,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; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts index c78f21927..9f5125615 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts @@ -227,7 +227,7 @@ export class Library { yingbian: { condition: { color: Map; - complex: Map any>; + complex: Map Element.GameEvent & Element.GameEventPromise>; simple: Map any>; }; effect: Map void>; @@ -4043,7 +4043,10 @@ export class Library { readonly nodews: Element.NodeWS; }; card: { - list: never[]; + /** + * @type { [CardBaseUIData['suit'], CardBaseUIData['number'], string][] } + */ + list: [CardBaseUIData['suit'], CardBaseUIData['number'], string][]; cooperation_damage: { fullskin: boolean; }; @@ -4438,7 +4441,7 @@ export type VCard = InstanceType; export type Button = InstanceType; export type Dialog = InstanceType; export type GameEvent = InstanceType; -export type GameEventPromise = InstanceType & InstanceType; +export type GameEventPromise = GameEvent & InstanceType; export type NodeWS = InstanceType; export type Control = InstanceType; import * as Element from "./element/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts index 37bbedeb7..74198ffa9 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts @@ -45,6 +45,24 @@ export class status { * @type { boolean | void } */ connectMode: boolean | void; + /** + * @type { boolean | void } + */ + importingExtension: boolean | void; + /** + * @type { Promise[] | void } + */ + extensionLoaded: Promise[] | void; + /** + * @type { Promise[] | void } + */ + extensionLoading: Promise[] | void; + /** + * @type { { [key: string]: Promise[] } | void } + */ + importing: void | { + [key: string]: Promise[]; + }; } export let _status: status; export function setStatus(instance?: status | undefined): void; diff --git a/node_modules/@types/noname-typings/type.d.ts b/node_modules/@types/noname-typings/type.d.ts index 6929b2406..4875a9af2 100644 --- a/node_modules/@types/noname-typings/type.d.ts +++ b/node_modules/@types/noname-typings/type.d.ts @@ -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; @@ -195,7 +195,6 @@ declare interface importCharacterConfig { * 若里面是项目内的同名字段,将覆盖原方法 */ game?: SMap; - /** * 类型:键值对 * @@ -538,6 +537,80 @@ declare interface importExtensionConfig { [key: string]: any; } +/** + * 导入玩法的配置 + */ +declare interface importPlayConfig { + /** 扩展名 */ + name: string; + arenaReady?: Function; + /** + * 设置播放录像 + */ + video?: Function; + /** + * 设置技能 + * */ + skill?: SMap; + /** + * 设置该武将包独有的卡牌(或者是特殊卡牌) + * + * */ + card?: SMap; + translate?: SMap; + /** + * 对应lib.element + * + * 若里面是项目内的同名字段,将覆盖原方法 + */ + element?: SMap; + /** + * 对应ai + * + * 若里面是项目内的同名字段,将覆盖原方法 + */ + ai?: SMap; + /** + * 对应ui + * + * 若里面是项目内的同名字段,将覆盖原方法 + */ + ui?: SMap; + /** + * 对应game + * + * 若里面是项目内的同名字段,将覆盖原方法 + */ + game?: SMap; + /** + * 类型:键值对 + * + * 作用:对应get + * 若里面是项目内的同名字段,将覆盖原方法 + */ + get?: SMap; + /** + * 帮助内容将显示在菜单-选项-帮助中 + * + * 游戏编辑器的帮助代码基本示例结构: + * + * "帮助条目": + * ```jsx + *
    + *
  • 列表1-条目1 + *
  • 列表1-条目2 + *
+ *
    + *
  1. 列表2-条目1 + *
  2. 列表2-条目2 + * + * ``` + * (目前可显示帮助信息:mode,extension,card卡包,character武将包) + */ + help?: SMap; + [key: string]: any; +} + /** * 菜单的选项的配置 * diff --git a/noname/game/index.js b/noname/game/index.js index e0b77255c..c606e1b76 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -1,12 +1,12 @@ /** * @typedef {{ - * cardMove:GameEventPromise[], + * cardMove: GameEventPromise[], * custom: GameEventPromise[], * useCard: GameEventPromise[], * 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; @@ -890,56 +890,40 @@ export class Game { * @param { Function } proceed */ checkFileList(updates, proceed) { + if (!Array.isArray(updates) || !updates.length) proceed(); let n = updates.length; - if (!n) { - proceed(n); - } for (let i = 0; i < updates.length; i++) { if (lib.node && lib.node.fs) { - lib.node.fs.access(__dirname + '/' + updates[i], (function (entry) { - return function (err) { - if (!err) { - let stat = lib.node.fs.statSync(__dirname + '/' + entry); - if (stat.size == 0) { - err = true; - } - } - if (err) { - n--; - if (n == 0) { - proceed(); - } - } - else { - n--; - updates.remove(entry); - if (n == 0) { - proceed(); - } - } + lib.node.fs.access(__dirname + '/' + updates[i], err => { + if (!err) { + let stat = lib.node.fs.statSync(__dirname + '/' + updates[i]); + // @ts-ignore + if (stat.size == 0) err = true; } - }(updates[i]))); + n--; + if (!err) updates.remove(updates[i]); + if (n == 0) proceed(); + }); } else { - resolveLocalFileSystemURL(lib.assetURL + updates[i], (function (name) { - return function (entry) { - n--; - updates.remove(name); - if (n == 0) { - proceed(); - } - } - }(updates[i])), function () { + window.resolveLocalFileSystemURL(nonameInitialized + updates[i], () => { n--; - if (n == 0) { - proceed(); - } + updates.remove(updates[i]); + if (n == 0) proceed(); + }, () => { + n--; + if (n == 0) proceed(); }); } } } /** - * @param {...(Player[] | Player)} args + * @overload + * @param {[Player[]]} args + */ + /** + * @overload + * @param {Player[]} args */ replaceHandcards(...args) { var next = game.createEvent('replaceHandcards'); @@ -1701,12 +1685,12 @@ export class Game { * @overload * @param { 'character' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importCharacterConfig } content * @param {*} [url] */ @@ -1714,12 +1698,12 @@ export class Game { * @overload * @param { 'card' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importCardConfig } content * @param {*} [url] */ @@ -1727,12 +1711,12 @@ export class Game { * @overload * @param { 'mode' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importModeConfig } content * @param {*} [url] */ @@ -1740,12 +1724,12 @@ export class Game { * @overload * @param { 'player' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importPlayerConfig } content * @param {*} [url] */ @@ -1753,15 +1737,28 @@ export class Game { * @overload * @param { 'extension' } type * @param {( - * lib: Library, - * game: typeof Game, - * ui: UI, - * get: Get, - * ai: AI, - * _status: Status + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType * ) => importExtensionConfig } content * @param {*} [url] */ + /** + * @overload + * @param { 'play' } type + * @param {( + * lib: InstanceType, + * game: InstanceType, + * ui: InstanceType, + * get: InstanceType, + * ai: InstanceType, + * _status: InstanceType + * ) => importPlayConfig } content + * @param {*} [url] + */ import(type, content, url) { if (type == 'extension') { const promise = game.loadExtension(content).then((name) => { @@ -1939,7 +1936,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 +2014,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 +4335,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 +4359,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 +5502,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 +5672,7 @@ export class Game { } } /** - * @param { GameEventPromise } [belongAsyncEvent] + * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] */ runContent(belongAsyncEvent) { return new Promise(resolve => { @@ -5892,7 +5899,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 +7420,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] */ diff --git a/noname/library/element/gameEvent.js b/noname/library/element/gameEvent.js index c0100ca19..74ebe0815 100644 --- a/noname/library/element/gameEvent.js +++ b/noname/library/element/gameEvent.js @@ -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] @@ -74,6 +74,11 @@ export class GameEvent { */ // @ts-ignore player; + /** + * @type { Player[] } + */ + // @ts-ignore + players; /** * @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} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身 * @returns {GameEvent|{}|null} @@ -903,11 +908,10 @@ export class GameEvent { } /** * 事件转为Promise化 - * - * @returns { GameEventPromise } */ toPromise() { if (!this.#promise) { + // @ts-ignore this.#promise = new lib.element.GameEventPromise(this); } return this.#promise; diff --git a/noname/library/element/gameEventPromise.js b/noname/library/element/gameEventPromise.js index 4b9523fa8..addcd4552 100644 --- a/noname/library/element/gameEventPromise.js +++ b/noname/library/element/gameEventPromise.js @@ -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 对象中的信息。 + * @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>} * - * - * @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} 返回的结果 + * @overload + * @param { T[] } params + * @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])); - }); + 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项。 - * - * @returns {Promise} 返回的bool项 + * 返回result中的bool项 */ forResultBool(){ return this.forResult('bool'); @@ -211,9 +210,6 @@ export class GameEventPromise extends Promise { /** * 返回result中的targets项。 - * - * @returns {Promise} 返回的targets项。 - * */ forResultTargets(){ return this.forResult('targets'); @@ -221,9 +217,6 @@ export class GameEventPromise extends Promise { /** * 返回result中的cards项 - * - * @returns {Promise} 返回的cards项。 - * */ forResultCards(){ return this.forResult('cards'); @@ -241,8 +234,6 @@ export class GameEventPromise extends Promise { /** * 返回result中的control项。 - * - * @returns {Promise} 返回的control项。 */ forResultControl(){ return this.forResult('control'); @@ -250,8 +241,6 @@ export class GameEventPromise extends Promise { /** * 返回result中的links项。 - * - * @returns {Promise>} 返回的links项。 */ forResultLinks(){ return this.forResult('links'); diff --git a/noname/library/index.js b/noname/library/index.js index b45f51de9..dfff085e1 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -5,7 +5,7 @@ * @typedef { InstanceType } Button * @typedef { InstanceType } Dialog * @typedef { InstanceType } GameEvent - * @typedef { InstanceType & InstanceType } GameEventPromise + * @typedef { GameEvent & InstanceType } GameEventPromise * @typedef { InstanceType } NodeWS * @typedef { InstanceType } Control */ @@ -9448,6 +9448,9 @@ export class Library { } }; card = { + /** + * @type { [CardBaseUIData['suit'], CardBaseUIData['number'], string][] } + */ list: [], cooperation_damage: { fullskin: true, diff --git a/noname/status/index.js b/noname/status/index.js index e874627a7..4a7d07913 100644 --- a/noname/status/index.js +++ b/noname/status/index.js @@ -54,6 +54,22 @@ export class status { * @type { boolean | void } */ connectMode = undefined + /** + * @type { boolean | void } + */ + importingExtension = undefined + /** + * @type { Promise[] | void } + */ + extensionLoaded = undefined + /** + * @type { Promise[] | void } + */ + extensionLoading = undefined + /** + * @type { { [key: string]: Promise[] } | void } + */ + importing = undefined }; export let _status = new status(); diff --git a/noname/ui/create/menu/pages/exetensionMenu.js b/noname/ui/create/menu/pages/exetensionMenu.js index 83f734c3a..eb34e43b3 100644 --- a/noname/ui/create/menu/pages/exetensionMenu.js +++ b/noname/ui/create/menu/pages/exetensionMenu.js @@ -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]; } diff --git a/tsconfig.json b/tsconfig.json index 297fdb201..8ae43aff5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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. */