修正game.import的类型,删除character下的clan,collab,ddd,diy的function写法
This commit is contained in:
parent
f714945d5d
commit
0bda9fec34
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
623
character/ddd.js
623
character/ddd.js
File diff suppressed because it is too large
Load Diff
2842
character/diy.js
2842
character/diy.js
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'extra',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'gujian',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'gwent',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'hearth',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'huicui',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'jiange',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'jsrg',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'mobile',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'mtg',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'offline',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'old',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'onlyOL',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'ow',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'refresh',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
//strategy and battle, "sb" in short
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'shenhua',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'shiji',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'sp',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'sp2',
|
||||
|
|
|
@ -93,9 +93,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
ganning:['lingtong','xf_sufei'],
|
||||
guanyu:['zhangfei','liaohua'],
|
||||
},
|
||||
/**
|
||||
* @type { { [key: string]: Skill } }
|
||||
*/
|
||||
skill:{
|
||||
//标准版甘夫人
|
||||
stdshushen:{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'swd',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'tw',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'xiake',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'xianding',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'xianjian',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'xinghuoliaoyuan',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'yijiang',
|
||||
|
@ -8106,7 +8106,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
player.$throw(cardx,1000,'nobroadcast');
|
||||
},target);
|
||||
if(player == game.me){
|
||||
game.delay(0.5);
|
||||
await game.asyncDelay(0.5);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'yingbian',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'yxs',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
'use strict';
|
||||
import { game } from '../noname.js';
|
||||
game.import('character',function(lib,game,ui,get,ai,_status){
|
||||
return {
|
||||
name:'zhuogui',
|
||||
|
|
|
@ -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";
|
||||
|
||||
const coreAndVersion = get.coreInfo();
|
||||
|
|
14
game/game.js
14
game/game.js
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
new Promise(resolve => {
|
||||
// 客户端自带core.js的请注意跟进
|
||||
// 客户端自带core.js的请注意跟进core.js版本
|
||||
if ('__core-js_shared__' in window) resolve(null);
|
||||
else {
|
||||
const nonameInitialized = localStorage.getItem('noname_inited');
|
||||
|
@ -88,15 +88,15 @@ new Promise(resolve => {
|
|||
else {
|
||||
const script = document.createElement('script')
|
||||
script.type = "module";
|
||||
script.src = `${assetURL}game/entry.js`
|
||||
script.async = true
|
||||
script.onerror = (event) => {
|
||||
console.error(event)
|
||||
script.src = `${assetURL}game/entry.js`;
|
||||
script.async = true;
|
||||
script.onerror = 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),以动态服务器的方式启动《无名杀》!`;
|
||||
console.error(message);
|
||||
alert(message);
|
||||
exit()
|
||||
exit();
|
||||
}
|
||||
document.head.appendChild(script)
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -207,7 +207,7 @@ declare interface Mod {
|
|||
canBeDiscarded?(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?: ContentFuncByAll;
|
||||
callback?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
|
||||
|
||||
//无懈相关:主要在_wuxie中,(此时应时无懈询问阶段),检测触发卡牌以下对应mod
|
||||
/*
|
||||
|
@ -265,7 +265,7 @@ declare interface Mod {
|
|||
/** 改变卡牌名字 用于get.name*/
|
||||
cardname?(card: Card, player: Player): string | void;
|
||||
/** 改变卡牌伤害属性 用于get.nature*/
|
||||
cardnature?(card: Card, player: Player): string | void;
|
||||
cardnature?(card: Card, player: Player): string | void | boolean;
|
||||
|
||||
/** 对特定角色使用牌的次数限制(用于优化【对特定角色使用牌无次数限制】的机制)【v1.9.105】 */
|
||||
cardUsableTarget?(card: Card, player: Player, target: Player): boolean | void;
|
||||
|
@ -281,6 +281,8 @@ declare interface Mod {
|
|||
/** 在目标范围内,即player是否在source的攻击范围内 */
|
||||
inRangeOf?(from: Player, to: Player): boolean | void;
|
||||
|
||||
maxHandcardBase?(player: Player, num: number): number | void;
|
||||
|
||||
/**
|
||||
* 强制判断卡牌能否重铸
|
||||
* 【v1.9.108.6~】
|
||||
|
@ -509,13 +511,13 @@ declare interface Skill {
|
|||
* 其执行时机和chooseButton一致,当chooseButton不存在时且game.online为false,则会执行这个
|
||||
* @param config
|
||||
*/
|
||||
precontent?: ContentFuncByAll;
|
||||
precontent?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
|
||||
/**
|
||||
* 在content之前触发内容
|
||||
*
|
||||
* 在useSkill中使用,主动触发技能content之前
|
||||
*/
|
||||
contentBefore?: ContentFuncByAll;
|
||||
contentBefore?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
|
||||
/**
|
||||
* 触发内容(技能内容)
|
||||
*
|
||||
|
@ -529,13 +531,13 @@ declare interface Skill {
|
|||
* 注:此时的content,已经为触发该技能的效果而创建的,该技能执行中的事件,此时的event一般是不具备
|
||||
* 触发信息,触发的信息,主要在trigger触发事件中获取。
|
||||
*/
|
||||
content?: ContentFuncByAll;
|
||||
content?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
|
||||
/**
|
||||
* 在content之后触发内容
|
||||
*
|
||||
* 在useSkill中使用,主动触发技能content之后
|
||||
*/
|
||||
contentAfter?: ContentFuncByAll;
|
||||
contentAfter?: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
|
||||
|
||||
//技能初始化与移除:
|
||||
/**
|
||||
|
@ -651,7 +653,7 @@ declare interface Skill {
|
|||
/** 增加显示的信息,这部分时增加,“n轮后”前面部分 */
|
||||
addintro?(storage: SMap<any>, player: Player): string;
|
||||
/** 延迟的时间 */
|
||||
delay?: number;
|
||||
delay?: number | boolean;
|
||||
/**
|
||||
* 锁定技
|
||||
*
|
||||
|
@ -738,9 +740,10 @@ declare interface Skill {
|
|||
/** 标记显示内容 */
|
||||
intro?: {
|
||||
/** 自定义mark弹窗的显示内容 */
|
||||
mark?: ThreeParmFun<Dialog, GameStorageItem, Player, string>;
|
||||
mark?: ThreeParmFun<Dialog, GameStorageItem, Player, string | void>;
|
||||
/** 用于info.mark为“character”,添加,移除标记时,log显示的标记名(好像意义不大) */
|
||||
name?: string | TwoParmFun<GameStorageItem, Player, string>;
|
||||
name2?: string | TwoParmFun<GameStorageItem, Player, string>;
|
||||
/**
|
||||
* 标记显示内容?
|
||||
* 为cards时显示标记内的牌.
|
||||
|
@ -793,7 +796,7 @@ declare interface Skill {
|
|||
*
|
||||
* 主要在player.updateMark时使用,实际顶替this.storage[i+'_markcount']获取标记数
|
||||
*/
|
||||
markcount?: number | TwoParmFun<GameStorageItem, Player, number> | string;
|
||||
markcount?: number | TwoParmFun<GameStorageItem, Player, number | string> | string;
|
||||
/** 是否不启用技能标记计数 */
|
||||
nocount?: boolean;
|
||||
/**
|
||||
|
@ -857,7 +860,7 @@ declare interface Skill {
|
|||
*
|
||||
* 【v1.9.102】扩展:可以使用函数式viewAs,目前核心支持使用地方:backup,ok;
|
||||
*/
|
||||
viewAs?: string | CardBaseUIData | TwoParmFun<Card[], Player, string>;
|
||||
viewAs?: string | CardBaseUIData | TwoParmFun<Card[], Player, string | VCard>;
|
||||
/**
|
||||
* 视为技按钮出现条件(即发动条件)
|
||||
* @param player
|
||||
|
@ -1006,7 +1009,7 @@ declare interface Skill {
|
|||
* @param player
|
||||
* @param name 触发名,为event.triggername,目前只有在lib.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;
|
||||
// /** ai用于检测的方法:用于主动使用触发技能 */
|
||||
// check?(card:Card):number|boolean;
|
||||
|
@ -1578,7 +1583,7 @@ declare interface SkillAI {
|
|||
* ai发动技能的优先度 【也用于卡牌的优先度】
|
||||
* 要具体比什么先发发动,可以使用函数返回结果
|
||||
*/
|
||||
order?: number | TwoParmFun<SkillOrCard, Player, number>;
|
||||
order?: number | TwoParmFun<SkillOrCard, Player, number | void>;
|
||||
/**
|
||||
* 发动技能是身份暴露度(0~1,相当于概率)
|
||||
* 取值范围为0~1,用于帮助AI判断身份,AI中未写expose其他AI将会无法判断其身份
|
||||
|
|
|
@ -39,10 +39,25 @@ type SkillOrCard = string | NameType | Card;
|
|||
type CCards = SAAType<Card>;
|
||||
|
||||
/** 技能content */
|
||||
declare type ContentFuncByAll = {
|
||||
// (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 ContentFuncByAll = (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 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 Sex = 'male' | 'female' | 'dobule' | 'none';
|
||||
declare type Character = [Sex, string, number | string, string[], string[]];
|
||||
declare type Select = [number, number];
|
||||
declare type Character = [Sex, string, number | string, string[], string[]] | [Sex, string, number | string, string[]];
|
||||
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>
|
||||
* ```
|
||||
* (目前可显示帮助信息:mode,extension,card卡包,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>
|
||||
* ```
|
||||
* (目前可显示帮助信息:mode,extension,card卡包,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.loadModeAsync,读取mode时启用这个初始化。
|
||||
*
|
||||
* 具体作用:有待考究
|
||||
*/
|
||||
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>
|
||||
* ```
|
||||
* (目前可显示帮助信息:mode,extension,card卡包,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>
|
||||
* ```
|
||||
* (目前可显示帮助信息:mode,extension,card卡包,character武将包)
|
||||
*/
|
||||
help?: SMap<string>;
|
||||
/** 相关文件名 */
|
||||
files?: {
|
||||
character?: string[],
|
||||
card?: string[],
|
||||
skill?: string[]
|
||||
};
|
||||
/**
|
||||
* 【特殊】用于game.addMode添加时,
|
||||
* 用于显示模式icon,所有的图片路径的imgsrc,指定外层扩展文件名;
|
||||
*/
|
||||
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位置的对象:
|
||||
* 例如:translate,help,skill... ... 或者其他自定义的...
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单的选项的配置
|
||||
*
|
||||
* config的功能菜单的node._link.config,就是该config
|
||||
* 内部代码略复杂,太多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;
|
||||
/**
|
||||
* 点击触发事件
|
||||
*
|
||||
* 若有返回值false,则当前点击事件的toggle切换无效
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* 在玩法模式选择中:
|
||||
* 是否需要“重启”游戏,若为true,则“启”按钮会高亮(添加“glowing”)
|
||||
* 在选项中:
|
||||
* 每次改变该选项,都会重置当前的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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1674,7 +1674,8 @@ export class Game extends Uninstantable {
|
|||
// 某种意义上,改不了,得重写
|
||||
// 等正式用import导入再说
|
||||
/**
|
||||
* @param { string } type
|
||||
* @overload
|
||||
* @param { 'character' } type
|
||||
* @param {(
|
||||
* lib: Library,
|
||||
* game: typeof Game,
|
||||
|
@ -1682,9 +1683,60 @@ export class Game extends Uninstantable {
|
|||
* get: Get,
|
||||
* ai: AI,
|
||||
* _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]
|
||||
* @returns
|
||||
*/
|
||||
static import(type, content, url) {
|
||||
if (type == 'extension') {
|
||||
|
@ -8438,11 +8490,11 @@ export class Game extends Uninstantable {
|
|||
* 此方法用于对所有targets按顺序执行一个async函数。
|
||||
*
|
||||
* @param { Player[] } targets 需要执行async方法的目标
|
||||
* @param { AsyncFunction } asyncFunc 需要执行的async方法
|
||||
* @param { sort } function 排序器,默认为lib.sort.seat
|
||||
* @param { (player: Player, i: number) => Promise<any | void> } asyncFunc 需要执行的async方法
|
||||
* @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat
|
||||
*/
|
||||
static async doAsyncInOrder(targets,asyncFunc,sort){
|
||||
if(!sort)sort = lib.sort.seat;
|
||||
if(!sort) sort = lib.sort.seat;
|
||||
let sortedTargets = targets.sort(sort);
|
||||
for(let i=0;i<sortedTargets.length;i++){
|
||||
let target = sortedTargets[i];
|
||||
|
|
|
@ -8,8 +8,6 @@ import { UI as ui } from '../../ui/index.js';
|
|||
export class Card extends HTMLDivElement {
|
||||
/**
|
||||
* @param {HTMLDivElement|DocumentFragment} [position]
|
||||
* @param {'noclick'} [info]
|
||||
* @param {true} [noclick]
|
||||
*/
|
||||
// @ts-ignore
|
||||
constructor(position) {
|
||||
|
@ -28,6 +26,10 @@ export class Card extends HTMLDivElement {
|
|||
card._args = [position];
|
||||
return card;
|
||||
}
|
||||
/**
|
||||
* @param {'noclick'} [info]
|
||||
* @param {true} [noclick]
|
||||
*/
|
||||
build(info, noclick) {
|
||||
let card = this;
|
||||
card.buildNode();
|
||||
|
|
|
@ -171,6 +171,16 @@ export class Player extends HTMLDivElement {
|
|||
*/
|
||||
// @ts-ignore
|
||||
this.outCount;
|
||||
/**
|
||||
* @type { number }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.maxHp;
|
||||
/**
|
||||
* @type { number }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.hp;
|
||||
throw new Error('Do not call this method');
|
||||
}
|
||||
build(noclick) {
|
||||
|
@ -2662,6 +2672,10 @@ export class Player extends HTMLDivElement {
|
|||
if (count > num) this.removeMark(name, count - num, log);
|
||||
else if (count < num) this.addMark(name, num - count, log);
|
||||
}
|
||||
/**
|
||||
* @param {*} i
|
||||
* @returns { number }
|
||||
*/
|
||||
countMark(i) {
|
||||
if (this.storage[i] == undefined) return 0;
|
||||
if (typeof this.storage[i] == 'number') return this.storage[i];
|
||||
|
@ -5652,6 +5666,9 @@ export class Player extends HTMLDivElement {
|
|||
};
|
||||
return next;
|
||||
}
|
||||
/**
|
||||
* @returns { boolean }
|
||||
*/
|
||||
canAddJudge(card) {
|
||||
if (this.isDisabledJudge()) return false;
|
||||
let name;
|
||||
|
@ -6544,7 +6561,7 @@ export class Player extends HTMLDivElement {
|
|||
var range;
|
||||
var select = get.copy(info.selectTarget);
|
||||
if (select == undefined) {
|
||||
if (info.filterTarget == undefined) return true;
|
||||
if (info.filterTarget == undefined) return 1;
|
||||
range = [1, 1];
|
||||
}
|
||||
else if (typeof select == 'number') range = [select, select];
|
||||
|
|
Loading…
Reference in New Issue