修正game.import的类型,删除character下的clan,collab,ddd,diy的function写法

This commit is contained in:
nonameShijian 2024-01-23 17:10:35 +08:00
parent f714945d5d
commit 0bda9fec34
41 changed files with 2808 additions and 2123 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -93,9 +93,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ganning:['lingtong','xf_sufei'], ganning:['lingtong','xf_sufei'],
guanyu:['zhangfei','liaohua'], guanyu:['zhangfei','liaohua'],
}, },
/**
* @type { { [key: string]: Skill } }
*/
skill:{ skill:{
//标准版甘夫人 //标准版甘夫人
stdshushen:{ stdshushen:{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
'use strict'; import { game } from '../noname.js';
game.import('character',function(lib,game,ui,get,ai,_status){ game.import('character',function(lib,game,ui,get,ai,_status){
return { return {
name:'yijiang', name:'yijiang',
@ -8106,7 +8106,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.$throw(cardx,1000,'nobroadcast'); player.$throw(cardx,1000,'nobroadcast');
},target); },target);
if(player == game.me){ if(player == game.me){
game.delay(0.5); await game.asyncDelay(0.5);
} }
} }
}; };

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@
}); });
*/ */
import { game, get, lib, boot } from "../noname.js" import { game, get, lib, boot } from "../noname.js";
import { userAgent } from "../noname/util/index.js"; import { userAgent } from "../noname/util/index.js";
const coreAndVersion = get.coreInfo(); const coreAndVersion = get.coreInfo();

View File

@ -1,7 +1,7 @@
"use strict"; "use strict";
new Promise(resolve => { new Promise(resolve => {
// 客户端自带core.js的请注意跟进 // 客户端自带core.js的请注意跟进core.js版本
if ('__core-js_shared__' in window) resolve(null); if ('__core-js_shared__' in window) resolve(null);
else { else {
const nonameInitialized = localStorage.getItem('noname_inited'); const nonameInitialized = localStorage.getItem('noname_inited');
@ -88,15 +88,15 @@ new Promise(resolve => {
else { else {
const script = document.createElement('script') const script = document.createElement('script')
script.type = "module"; script.type = "module";
script.src = `${assetURL}game/entry.js` script.src = `${assetURL}game/entry.js`;
script.async = true script.async = true;
script.onerror = (event) => { script.onerror = event => {
console.error(event) console.error(event);
const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n目前使用的浏览器UA信息为\n${userAgent}\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》请尝试更新手机的WebView内核或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏请改为运行文件夹内的“noname-server.exe”或使用VSCode等工具启动Live Server以动态服务器的方式启动《无名杀》`; const message = `您使用的浏览器或《无名杀》客户端加载内容失败!\n目前使用的浏览器UA信息为\n${userAgent}\n若您使用的客户端为自带内核的旧版“兼容版”,请及时更新客户端版本!\n若您使用的客户端为手机端的非兼容版《无名杀》请尝试更新手机的WebView内核或者更换为1.8.2版本及以上的兼容版!\n若您是直接使用浏览器加载index.html进行游戏请改为运行文件夹内的“noname-server.exe”或使用VSCode等工具启动Live Server以动态服务器的方式启动《无名杀》`;
console.error(message); console.error(message);
alert(message); alert(message);
exit() exit();
} }
document.head.appendChild(script) document.head.appendChild(script);
} }
}); });

View File

@ -207,7 +207,7 @@ declare interface Mod {
canBeDiscarded?(card: Card, player: Player, target: Player, eventName: string): boolean | void; canBeDiscarded?(card: Card, player: Player, target: Player, eventName: string): boolean | void;
/** 过滤可以获得的牌 */ /** 过滤可以获得的牌 */
canBeGained?(card: Card, player: Player, target: Player, eventName: string): boolean | void; canBeGained?(card: Card, player: Player, target: Player, eventName: string): boolean | void;
canBeReplaced?(card: Card, source: Player, player: Player): boolean | void;
/** /**
* *
*/ */
@ -237,7 +237,7 @@ declare interface Mod {
* *
* callback就是作为以上事件的content使用 * callback就是作为以上事件的content使用
*/ */
callback?: ContentFuncByAll; callback?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
//无懈相关主要在_wuxie中此时应时无懈询问阶段检测触发卡牌以下对应mod //无懈相关主要在_wuxie中此时应时无懈询问阶段检测触发卡牌以下对应mod
/* /*
@ -265,7 +265,7 @@ declare interface Mod {
/** 改变卡牌名字 用于get.name*/ /** 改变卡牌名字 用于get.name*/
cardname?(card: Card, player: Player): string | void; cardname?(card: Card, player: Player): string | void;
/** 改变卡牌伤害属性 用于get.nature*/ /** 改变卡牌伤害属性 用于get.nature*/
cardnature?(card: Card, player: Player): string | void; cardnature?(card: Card, player: Player): string | void | boolean;
/** 对特定角色使用牌的次数限制用于优化【对特定角色使用牌无次数限制】的机制【v1.9.105】 */ /** 对特定角色使用牌的次数限制用于优化【对特定角色使用牌无次数限制】的机制【v1.9.105】 */
cardUsableTarget?(card: Card, player: Player, target: Player): boolean | void; cardUsableTarget?(card: Card, player: Player, target: Player): boolean | void;
@ -281,6 +281,8 @@ declare interface Mod {
/** 在目标范围内,即player是否在source的攻击范围内 */ /** 在目标范围内,即player是否在source的攻击范围内 */
inRangeOf?(from: Player, to: Player): boolean | void; inRangeOf?(from: Player, to: Player): boolean | void;
maxHandcardBase?(player: Player, num: number): number | void;
/** /**
* *
* v1.9.108.6~ * v1.9.108.6~
@ -509,13 +511,13 @@ declare interface Skill {
* chooseButton一致chooseButton不存在时且game.online为false * chooseButton一致chooseButton不存在时且game.online为false
* @param config * @param config
*/ */
precontent?: ContentFuncByAll; precontent?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
/** /**
* content之前触发内容 * content之前触发内容
* *
* useSkill中使用content之前 * useSkill中使用content之前
*/ */
contentBefore?: ContentFuncByAll; contentBefore?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
/** /**
* *
* *
@ -529,13 +531,13 @@ declare interface Skill {
* contentevent一般是不具备 * contentevent一般是不具备
* trigger触发事件中获取 * trigger触发事件中获取
*/ */
content?: ContentFuncByAll; content?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
/** /**
* content之后触发内容 * content之后触发内容
* *
* useSkill中使用content之后 * useSkill中使用content之后
*/ */
contentAfter?: ContentFuncByAll; contentAfter?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
//技能初始化与移除: //技能初始化与移除:
/** /**
@ -651,7 +653,7 @@ declare interface Skill {
/** 增加显示的信息这部分时增加“n轮后”前面部分 */ /** 增加显示的信息这部分时增加“n轮后”前面部分 */
addintro?(storage: SMap<any>, player: Player): string; addintro?(storage: SMap<any>, player: Player): string;
/** 延迟的时间 */ /** 延迟的时间 */
delay?: number; delay?: number | boolean;
/** /**
* *
* *
@ -738,9 +740,10 @@ declare interface Skill {
/** 标记显示内容 */ /** 标记显示内容 */
intro?: { intro?: {
/** 自定义mark弹窗的显示内容 */ /** 自定义mark弹窗的显示内容 */
mark?: ThreeParmFun<Dialog, GameStorageItem, Player, string>; mark?: ThreeParmFun<Dialog, GameStorageItem, Player, string | void>;
/** 用于info.mark为“character”添加移除标记时log显示的标记名好像意义不大 */ /** 用于info.mark为“character”添加移除标记时log显示的标记名好像意义不大 */
name?: string | TwoParmFun<GameStorageItem, Player, string>; name?: string | TwoParmFun<GameStorageItem, Player, string>;
name2?: string | TwoParmFun<GameStorageItem, Player, string>;
/** /**
* *
* cards时显示标记内的牌. * cards时显示标记内的牌.
@ -793,7 +796,7 @@ declare interface Skill {
* *
* player.updateMark时使用this.storage[i+'_markcount'] * player.updateMark时使用this.storage[i+'_markcount']
*/ */
markcount?: number | TwoParmFun<GameStorageItem, Player, number> | string; markcount?: number | TwoParmFun<GameStorageItem, Player, number | string> | string;
/** 是否不启用技能标记计数 */ /** 是否不启用技能标记计数 */
nocount?: boolean; nocount?: boolean;
/** /**
@ -857,7 +860,7 @@ declare interface Skill {
* *
* v1.9.102使viewAs使backup,ok; * v1.9.102使viewAs使backup,ok;
*/ */
viewAs?: string | CardBaseUIData | TwoParmFun<Card[], Player, string>; viewAs?: string | CardBaseUIData | TwoParmFun<Card[], Player, string | VCard>;
/** /**
* *
* @param player * @param player
@ -1006,7 +1009,7 @@ declare interface Skill {
* @param player * @param player
* @param name event.triggernamelib.filter.filterTrigger中才传该值 * @param name event.triggernamelib.filter.filterTrigger中才传该值
*/ */
filter?(event: GameEventPromise, player: Player, name?: string): boolean | void; filter?(event: GameEventPromise, player: Player, name?: string): boolean | void | null;
/** /**
* *
* *
@ -1362,7 +1365,9 @@ declare interface Skill {
* *
* *
*/ */
check?: OneParmFun<Card, number | boolean> | TwoParmFun<GameEventPromise, Player, number | boolean> | NoneParmFum<number | boolean>; check?: OneParmFun<Card, number | boolean>;
check?: TwoParmFun<GameEventPromise, Player, number | boolean>;
check?: NoneParmFum<number | boolean>;
// check?(...any:any):number|boolean; // check?(...any:any):number|boolean;
// /** ai用于检测的方法用于主动使用触发技能 */ // /** ai用于检测的方法用于主动使用触发技能 */
// check?(card:Card):number|boolean; // check?(card:Card):number|boolean;
@ -1578,7 +1583,7 @@ declare interface SkillAI {
* ai发动技能的优先度 * ai发动技能的优先度
* 使 * 使
*/ */
order?: number | TwoParmFun<SkillOrCard, Player, number>; order?: number | TwoParmFun<SkillOrCard, Player, number | void>;
/** /**
* 0~1 * 0~1
* 0~1,AI判断身份,AI中未写expose其他AI将会无法判断其身份 * 0~1,AI判断身份,AI中未写expose其他AI将会无法判断其身份

623
node_modules/noname-typings/type.d.ts generated vendored
View File

@ -39,10 +39,25 @@ type SkillOrCard = string | NameType | Card;
type CCards = SAAType<Card>; type CCards = SAAType<Card>;
/** 技能content */ /** 技能content */
declare type ContentFuncByAll = { declare type ContentFuncByAll = (event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>;
// (event: GameEventPromise, step: number, source: Player, player: Player, target: Player, targets: Player[], card: Card, cards: Card[], skill: string, forced: boolean, num: number, trigger: GameEventPromise, result: Result): any,
(event: GameEventPromise, trigger: GameEventPromise, player: Player): Promise<any>; declare type GeneratorContentFuncByAll = (event: GameEventPromise, map: {
} event: GameEventPromise,
step: number,
source: Player,
player: Player,
target: Player,
targets: Player[],
card: Card,
cards: Card[],
skill: string,
forced: boolean,
num: number,
trigger: GameEventPromise,
result: Result
}) => Generator<any, void, unknown>;
declare type OldContentFuncByAll = () => void
declare type Game = typeof import('../../noname/game/index.js').Game; declare type Game = typeof import('../../noname/game/index.js').Game;
declare type Library = typeof import('../../noname/library/index.js').Library; declare type Library = typeof import('../../noname/library/index.js').Library;
@ -67,5 +82,601 @@ declare type GameHistory = import('../../noname/game/index.js').GameHistory;
declare type CodeMirror = typeof import('../../game/codemirror.js').default; declare type CodeMirror = typeof import('../../game/codemirror.js').default;
declare type Sex = 'male' | 'female' | 'dobule' | 'none'; declare type Sex = 'male' | 'female' | 'dobule' | 'none';
declare type Character = [Sex, string, number | string, string[], string[]]; declare type Character = [Sex, string, number | string, string[], string[]] | [Sex, string, number | string, string[]];
declare type Select = [number, number]; declare type Select = [number, number];
/**
*
*/
declare interface importCharacterConfig {
/** 武将包名 */
name: string;
/**
*
*/
connect?: boolean;
/**
*
* */
connectBanned?: string[];
/**
*
*/
character: SMap<Character>;
/**
*
* */
characterIntro?: SMap<string>;
/**
*
* */
characterTitle?: SMap<string>;
/**
*
* */
skill?: SMap<Skill>;
/**
*
* */
perfectPair?: SMap<string[]>;
/**
* mode
* */
characterFilter?: SMap<OneParmFun<string, boolean>>;
/**
*
*/
characterSort?: SMap<SMap<string[]>>;
/**
*
*
* */
card?: SMap<any>;
/**
*
* */
cardType?: SMap<number>;
/**
* v1.9.105
*
* lib.dynamicTranslate.xxx为一个函数 xxx显示的描述随玩家状态而变化
*
* Player:指技能拥有者
*/
dynamicTranslate?: SMap<OneParmFun<Player, string>>;
/**
* v1.9.106.3
*
* */
characterReplace?: SMap<string[]>;
translate?: SMap<string>;
/**
* lib.element
*
*
*/
element?: SMap<any>;
/**
* ai
*
*
*/
ai?: SMap<any>;
/**
* ui
*
*
*/
ui?: SMap<any>;
/**
* game
*
*
*/
game?: SMap<any>;
/**
*
*
* get
*
*/
get?: SMap<any>;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
[key: string]: any;
}
/**
*
*/
declare interface importCardConfig {
/** 卡牌包名 */
name: string;
/**
*
* */
connect?: boolean;
/**
*
* */
card: SMap<Card>;
/**
*
* */
skill: SMap<Skill>;
/**
*
* */
list: CardBaseUIData[];
/** 卡牌翻译 */
translate: SMap<string> | string;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
[key: string]: any;
}
/**
*
*/
declare interface importModeConfig {
/** 模式名 */
name: string;
/** 技能(主要是放些该模式下特有的技能) */
skill?: SMap<Skill>;
/**
*
*/
characterPack?: SMap<SMap<Character>>;
/**
*
*/
characterSort?: SMap<SMap<string[]>>;
/** 卡牌(主要是放些该模式下特有的卡牌) */
card?: SMap<ExCardData>;
/**
*
*/
cardPack?: SMap<SMap<string[]>>;
/**
* mode的init方法init是最早启动的方法
*/
init?(): void;
/**
* mode的start启动方法
*/
start(): void;
/**
* mode的start启动之前的处理方法
*/
startBefore?(): void;
/**
*
*
* lib.client.reinit中
*
* game.loadModeAsyncmode时启用这个初始化
*
*
*/
onreinit?(): void;
/**
* lib.element
*
*
*/
element?: SMap<any>;
/**
* ai
*
*
*/
ai?: SMap<any>;
/**
* ui
*
*
*/
ui?: SMap<any>;
/**
* game
*
*
*/
game?: SMap<any>;
/**
*
*
* get
*
*/
get?: SMap<any>;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
[key: string]: any;
}
/**
*
*/
declare interface importPlayerConfig {
/** 武将包名 */
name: string;
/** 禁用此扩展的模式 */
forbid: string[];
/** 可使用模式 */
mode: string[];
//自定义是实现核心初始化方法
init?(): void;
arenaReady?(): void;
/**
* lib.element
*
*
*/
element?: SMap<any>;
/**
* ai
*
*
*/
ai?: SMap<any>;
/**
* ui
*
*
*/
ui?: SMap<any>;
/**
* game
*
*
*/
game?: SMap<any>;
/**
*
*
* get
*
*/
get?: SMap<any>;
[key: string]: any;
}
/**
*
*/
declare interface importExtensionConfig {
/** 扩展名 */
name: string;
/** 用于解析用的key不直接参与游戏逻辑参与自己定义的解析流程统一该包的前缀 */
key?: string;
/**
*
*
*
*/
editable?: boolean;
/**
*
*
* "extension_" + key
*
* value
*
* ()
*/
config?: SMap<SelectConfigData>;
/**
*
*
* update
*/
connect?: SMap<SelectConfigData>;
/**
*
*
*
*/
package: PackageData;
/**
*
*
*
*
*
* @param config /
* @param pack
*/
content?(config: SMap<any>, pack: PackageData): void;
/**
*
*
*
*
* game.import添加扩展时就加载
*
* 2便
* @param data lib.config中extension_扩展名
*/
precontent?(data?: SMap<any>): void;
/** 删除该扩展后调用 */
onremove?(): void;
/**
*
*
*
*
* "帮助条目":
* ```jsx
* <ul>
* <li>1-1
* <li>1-2
* </ul>
* <ol>
* <li>2-1
* <li>2-2
* </ul>
* ```
* (modeextensioncard卡包character武将包)
*/
help?: SMap<string>;
/** 相关文件名 */
files?: {
character?: string[],
card?: string[],
skill?: string[]
};
/**
* game.addMode添加时
* iconimgsrc
*/
extension?: string;
/**
* lib.element,
*
*/
element?: SMap<any>;
/**
* ai
*/
ai?: SMap<any>;
/**
* ui
*/
ui?: SMap<any>;
/**
* game
*/
game?: SMap<any>;
/**
* get
*/
get?: SMap<any>;
/**
*
* lib中lib位置的对象
* translatehelpskill... ... ...
*/
[key: string]: any;
}
/**
*
*
* config的功能菜单的node._link.configconfig
* UI相关逻辑
*/
declare interface SelectConfigData {
/** 功能名 */
name: string;
/**
* //item的key
*/
init?: boolean | string;
/**
* (config内容的菜单)
*/
item?: SMap<string> | NoneParmFum<SMap<string>>;
/**
*
*
* + name
*/
intro?: string | NoneParmFum<string>;
/**
* bar(withbar,menu的头部或者尾部)
*
* @param node visualBar节点
* @param item item选项
* @param create createNode方法使item列表的方式
* @param switcher config的item的node节点
*/
visualBar?: (node: HTMLDivElement, item: SMap<string>, create: OneParmFun<string, void>, switcher?: HTMLDivElement) => void
/**
*
* 3
* @param node
* @param item node的node._link
* @param name item选项
* @param config config
*/
visualMenu?: (node: HTMLDivElement, link: any, name: string, config: SelectConfigData) => void;
/**
*
* visualMenu的话item列表节点
* @param node
* @param link
*/
textMenu?(node: HTMLDivElement, link: string, config: SelectConfigData): void;
/**
* false(undefined)<--
*
* nopointer配置false/undefined,pointerspan
*
* click,node都可以点击<--
*/
clear?: boolean;
/** 指定该项没有功能,仅展示,项目内多用于描述上 */
nopointer?: boolean;
/**
*
*
* falsetoggle切换无效
*/
onclick?(item: any): void | boolean;
onclick?(link: any, node: HTMLDivElement): void | boolean;
/** 当前没有onclick方法时除了默认game.saveConfig保存数据配置key的数据可以使用该方法进行数据处理啊 */
onsave?(reslut: any): void;
/**
*
*
* init属性
*/
input?: boolean;
/** 取值true若没有设置可以进行input输入 */
fixed?: boolean;
/** 设置input节点的onblur事件的回调焦点离开输出框 */
onblur?(): void;
/**
* lib.extensionMenu中(使)
*/
onswitch?(bool: boolean): void;
/** 核心,更新方法 */
update?(config: SMap<any>, map: SMap<HTMLDivElement>): any;
/**
*
* trueglowing
*
* ui选项
*/
restart?: boolean | NoneParmFum<boolean>;
/** 应该与unfrequent功能时一致的相反判断直接显示出来的功能项 */
frequent?: boolean,
/** 加入更多中(随着下拉出现),用得较多 */
unfrequent?: boolean;
/** 不明,用得很少 */
content?(bool: boolean): void;
/** 内部属性记录当前配置的key */
_name?: string;
}
/**
*
*
*
*/
declare interface PackageData {
/** 扩展制作作者名 */
author?: string,
/** 扩展描述 */
intro?: string,
/** 讨论地址 */
diskURL?: string,
/** 网盘地址 */
forumURL?: string,
/** 扩展版本 */
version?: string,
/** 武将导入信息 */
character?: {
character: SMap<Character>;
translate: SMap<string>;
};
/** 卡牌导入信息 */
card?: {
card: SMap<Card>;
translate: SMap<string>;
list: CardBaseUIData[];
};
/** 技能导入信息 */
skill?: {
skill: SMap<Skill>;
translate: SMap<string>;
};
/** 相关文件名(扩展所使用的一些图片) */
files?: {
character: string[];
card: string[];
skill: string[];
}
/** 主代码中pack.code包括以下属性 */
code?: {
/** 扩展的config配置信息 */
config?: SMap<SelectConfigData>;
/** 扩展主代码 */
content?: (config: SMap<any>, pack: PackageData) => void;
/** 扩展帮助信息 */
help?: SMap<string>;
/** 扩展启动代码 */
precontent?: (data?: SMap<any>) => void;
}
}

View File

@ -1674,7 +1674,8 @@ export class Game extends Uninstantable {
// 某种意义上,改不了,得重写 // 某种意义上,改不了,得重写
// 等正式用import导入再说 // 等正式用import导入再说
/** /**
* @param { string } type * @overload
* @param { 'character' } type
* @param {( * @param {(
* lib: Library, * lib: Library,
* game: typeof Game, * game: typeof Game,
@ -1682,9 +1683,60 @@ export class Game extends Uninstantable {
* get: Get, * get: Get,
* ai: AI, * ai: AI,
* _status: Status * _status: Status
* ) => any } content * ) => importCharacterConfig } content
* @param {*} [url]
*/
/**
* @overload
* @param { 'card' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* ) => importCardConfig } content
* @param {*} [url]
*/
/**
* @overload
* @param { 'mode' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* ) => importModeConfig } content
* @param {*} [url]
*/
/**
* @overload
* @param { 'player' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* ) => importPlayerConfig } content
* @param {*} [url]
*/
/**
* @overload
* @param { 'extension' } type
* @param {(
* lib: Library,
* game: typeof Game,
* ui: UI,
* get: Get,
* ai: AI,
* _status: Status
* ) => importExtensionConfig } content
* @param {*} [url] * @param {*} [url]
* @returns
*/ */
static import(type, content, url) { static import(type, content, url) {
if (type == 'extension') { if (type == 'extension') {
@ -8438,11 +8490,11 @@ export class Game extends Uninstantable {
* 此方法用于对所有targets按顺序执行一个async函数 * 此方法用于对所有targets按顺序执行一个async函数
* *
* @param { Player[] } targets 需要执行async方法的目标 * @param { Player[] } targets 需要执行async方法的目标
* @param { AsyncFunction } asyncFunc 需要执行的async方法 * @param { (player: Player, i: number) => Promise<any | void> } asyncFunc 需要执行的async方法
* @param { sort } function 排序器默认为lib.sort.seat * @param { (a: Player, b: Player) => number } sort 排序器默认为lib.sort.seat
*/ */
static async doAsyncInOrder(targets,asyncFunc,sort){ static async doAsyncInOrder(targets,asyncFunc,sort){
if(!sort)sort = lib.sort.seat; if(!sort) sort = lib.sort.seat;
let sortedTargets = targets.sort(sort); let sortedTargets = targets.sort(sort);
for(let i=0;i<sortedTargets.length;i++){ for(let i=0;i<sortedTargets.length;i++){
let target = sortedTargets[i]; let target = sortedTargets[i];

View File

@ -8,8 +8,6 @@ import { UI as ui } from '../../ui/index.js';
export class Card extends HTMLDivElement { export class Card extends HTMLDivElement {
/** /**
* @param {HTMLDivElement|DocumentFragment} [position] * @param {HTMLDivElement|DocumentFragment} [position]
* @param {'noclick'} [info]
* @param {true} [noclick]
*/ */
// @ts-ignore // @ts-ignore
constructor(position) { constructor(position) {
@ -28,6 +26,10 @@ export class Card extends HTMLDivElement {
card._args = [position]; card._args = [position];
return card; return card;
} }
/**
* @param {'noclick'} [info]
* @param {true} [noclick]
*/
build(info, noclick) { build(info, noclick) {
let card = this; let card = this;
card.buildNode(); card.buildNode();

View File

@ -171,6 +171,16 @@ export class Player extends HTMLDivElement {
*/ */
// @ts-ignore // @ts-ignore
this.outCount; this.outCount;
/**
* @type { number }
*/
// @ts-ignore
this.maxHp;
/**
* @type { number }
*/
// @ts-ignore
this.hp;
throw new Error('Do not call this method'); throw new Error('Do not call this method');
} }
build(noclick) { build(noclick) {
@ -2662,6 +2672,10 @@ export class Player extends HTMLDivElement {
if (count > num) this.removeMark(name, count - num, log); if (count > num) this.removeMark(name, count - num, log);
else if (count < num) this.addMark(name, num - count, log); else if (count < num) this.addMark(name, num - count, log);
} }
/**
* @param {*} i
* @returns { number }
*/
countMark(i) { countMark(i) {
if (this.storage[i] == undefined) return 0; if (this.storage[i] == undefined) return 0;
if (typeof this.storage[i] == 'number') return this.storage[i]; if (typeof this.storage[i] == 'number') return this.storage[i];
@ -5652,6 +5666,9 @@ export class Player extends HTMLDivElement {
}; };
return next; return next;
} }
/**
* @returns { boolean }
*/
canAddJudge(card) { canAddJudge(card) {
if (this.isDisabledJudge()) return false; if (this.isDisabledJudge()) return false;
let name; let name;
@ -6544,7 +6561,7 @@ export class Player extends HTMLDivElement {
var range; var range;
var select = get.copy(info.selectTarget); var select = get.copy(info.selectTarget);
if (select == undefined) { if (select == undefined) {
if (info.filterTarget == undefined) return true; if (info.filterTarget == undefined) return 1;
range = [1, 1]; range = [1, 1];
} }
else if (typeof select == 'number') range = [select, select]; else if (typeof select == 'number') range = [select, select];