优化代码提示,codeMirror修改为esmodule
This commit is contained in:
parent
26cd6fae95
commit
9fdf573bc7
20216
game/codemirror.js
20216
game/codemirror.js
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "noname-typings",
|
||||
"version": "2023.12.30",
|
||||
"version": "2023.12.31",
|
||||
"description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -30,4 +30,10 @@ declare type Dialog = import('../../noname/library/index.js').Dialog;
|
|||
declare type GameEvent = import('../../noname/library/index.js').GameEvent;
|
||||
declare type GameEventPromise = import('../../noname/library/index.js').GameEventPromise;
|
||||
declare type Player = import('../../noname/library/index.js').Player;
|
||||
declare type VCard = import('../../noname/library/index.js').VCard;
|
||||
declare type VCard = import('../../noname/library/index.js').VCard;
|
||||
|
||||
declare type Video = import('../../noname/game/index.js').Video;
|
||||
declare type Videos = import('../../noname/game/index.js').Videos;
|
||||
declare type History = import('../../noname/game/index.js').History;
|
||||
|
||||
declare type CodeMirror = typeof import('../../game/codemirror.js').default;
|
|
@ -7,7 +7,9 @@ declare interface Window {
|
|||
version: string,
|
||||
update: string,
|
||||
changeLog: string[],
|
||||
files: string[]
|
||||
files: string[],
|
||||
players?: string[],
|
||||
cards?: string[],
|
||||
}
|
||||
|
||||
/** 游戏配置 */
|
||||
|
@ -25,7 +27,7 @@ declare interface Window {
|
|||
noname_skin_list?: SMap<number>;
|
||||
|
||||
/** codeMirror,一个代码编辑器库 */
|
||||
CodeMirror: any;
|
||||
CodeMirror: CodeMirror;
|
||||
|
||||
resetGameTimeout: number;
|
||||
|
||||
|
@ -66,4 +68,15 @@ declare interface Window {
|
|||
get: Get;
|
||||
ai: AI;
|
||||
}
|
||||
|
||||
initReadWriteFunction?(game = ({
|
||||
download: () => any,
|
||||
readFile: () => any,
|
||||
readFileAsText: () => any,
|
||||
writeFile: () => any,
|
||||
removeFile: () => any,
|
||||
getFileList: () => any,
|
||||
ensureDirectory: () => any,
|
||||
createDir: () => any,
|
||||
})): void;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import { Uninstantable } from "../util/index.js";
|
|||
export class Basic extends Uninstantable {
|
||||
/**
|
||||
* @param { (
|
||||
* button: import('../library/index.js').Button,
|
||||
* buttons?: import('../library/index.js').Button[]
|
||||
* button: Button,
|
||||
* buttons?: Button[]
|
||||
* ) => number } check
|
||||
*/
|
||||
static chooseButton(check) {
|
||||
|
@ -65,8 +65,8 @@ export class Basic extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { (
|
||||
* card?: import('../library/index.js').Card,
|
||||
* cards?: import('../library/index.js').Card[]
|
||||
* card?: Card,
|
||||
* cards?: Card[]
|
||||
* ) => number } check
|
||||
* @returns { boolean | undefined }
|
||||
*/
|
||||
|
@ -143,8 +143,8 @@ export class Basic extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { (
|
||||
* target?: import('../library/index.js').Player,
|
||||
* targets?: import('../library/index.js').Player[]
|
||||
* target?: Player,
|
||||
* targets?: Player[]
|
||||
* ) => number } check
|
||||
*/
|
||||
static chooseTarget(check) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/**
|
||||
* @typedef {{
|
||||
* cardMove:(import('../library/index.js').GameEventPromise)[],
|
||||
* custom: (import('../library/index.js').GameEventPromise)[],
|
||||
* useCard: (import('../library/index.js').GameEventPromise)[],
|
||||
* changeHp: (import('../library/index.js').GameEventPromise)[],
|
||||
* everything: (import('../library/index.js').GameEventPromise)[]
|
||||
* cardMove:GameEventPromise[],
|
||||
* custom: GameEventPromise[],
|
||||
* useCard: GameEventPromise[],
|
||||
* changeHp: GameEventPromise[],
|
||||
* everything: GameEventPromise[]
|
||||
* }} History
|
||||
* @typedef { { 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
|
||||
|
@ -23,16 +23,16 @@ export class Game extends Uninstantable {
|
|||
static onlineID = null;
|
||||
static onlineKey = null;
|
||||
/**
|
||||
* @type {import('../library/index.js').Player[]}
|
||||
* @type {Player[]}
|
||||
*/
|
||||
static players = [];
|
||||
/**
|
||||
* @type {import('../library/index.js').Player[]}
|
||||
* @type {Player[]}
|
||||
*/
|
||||
static dead = [];
|
||||
static imported = [];
|
||||
/**
|
||||
* @type { { [key: string]: import('../library/index.js').Player } }
|
||||
* @type { { [key: string]: Player } }
|
||||
*/
|
||||
static playerMap = {};
|
||||
static phaseNumber = 0;
|
||||
|
@ -664,8 +664,8 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* 为牌添加知情者
|
||||
* @param { import('../library/index.js').Card[] | import('../library/index.js').Card } cards
|
||||
* @param { import('../library/index.js').Player[] } players
|
||||
* @param { Card[] | Card } cards
|
||||
* @param { Player[] } players
|
||||
*/
|
||||
static addCardKnower(cards, players) {
|
||||
if (get.itemtype(cards) == 'card') {
|
||||
|
@ -677,7 +677,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* 移除牌的所有知情者。
|
||||
* @param { import('../library/index.js').Card[] | import('../library/index.js').Card } cards
|
||||
* @param { Card[] | Card } cards
|
||||
*/
|
||||
static clearCardKnowers(cards) {
|
||||
// @ts-ignore
|
||||
|
@ -775,8 +775,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @template { keyof History } T
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } filter
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { boolean }
|
||||
*/
|
||||
static hasGlobalHistory(key, filter, last) {
|
||||
|
@ -799,8 +799,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @template { keyof History } T
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } filter
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { void }
|
||||
*/
|
||||
static checkGlobalHistory(key, filter, last) {
|
||||
|
@ -828,8 +828,8 @@ export class Game extends Uninstantable {
|
|||
* @template { keyof History } T
|
||||
* @overload
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } [filter]
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { History[T] }
|
||||
*/
|
||||
static getGlobalHistory(key, filter, last) {
|
||||
|
@ -850,8 +850,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @template { keyof History } T
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } filter
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { boolean }
|
||||
*/
|
||||
static hasAllGlobalHistory(key, filter, last) {
|
||||
|
@ -874,8 +874,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @template { keyof History } T
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } filter
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { void }
|
||||
*/
|
||||
static checkAllGlobalHistory(key, filter, last) {
|
||||
|
@ -905,8 +905,8 @@ export class Game extends Uninstantable {
|
|||
* @template { keyof History } T
|
||||
* @overload
|
||||
* @param { T } key
|
||||
* @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter]
|
||||
* @param { import('../library/index.js').GameEventPromise } [last]
|
||||
* @param { (event: GameEventPromise) => boolean } [filter]
|
||||
* @param { GameEventPromise } [last]
|
||||
* @returns { History[T] }
|
||||
*/
|
||||
static getAllGlobalHistory(key, filter, last) {
|
||||
|
@ -937,13 +937,13 @@ export class Game extends Uninstantable {
|
|||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card } cards
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @param { Card } cards
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {import('../library/index.js').Card[]} cards
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @param {Card[]} cards
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
static cardsDiscard(cards) {
|
||||
/** @type { 'cards' | 'card' | void } */
|
||||
|
@ -965,13 +965,13 @@ export class Game extends Uninstantable {
|
|||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card } cards
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @param { Card } cards
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {import('../library/index.js').Card[]} cards
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @param {Card[]} cards
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
static cardsGotoOrdering(cards) {
|
||||
/** @type { 'cards' | 'card' | void } */
|
||||
|
@ -989,15 +989,15 @@ export class Game extends Uninstantable {
|
|||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card } cards
|
||||
* @param { Card } cards
|
||||
* @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param {import('../library/index.js').Card[]} cards
|
||||
* @param {Card[]} cards
|
||||
* @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库
|
||||
* @returns { import('../library/index.js').GameEventPromise }
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
static cardsGotoSpecial(cards, bool) {
|
||||
/** @type { 'cards' | 'card' | void } */
|
||||
|
@ -1014,8 +1014,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
*
|
||||
* @param {...(
|
||||
* import('../library/index.js').Card[] |
|
||||
* import('../library/index.js').Card |
|
||||
* Card[] |
|
||||
* Card |
|
||||
* Function |
|
||||
* 'insert' | 'washCard' | 'triggeronly' |
|
||||
* [string, any]
|
||||
|
@ -1024,7 +1024,7 @@ export class Game extends Uninstantable {
|
|||
*/
|
||||
static cardsGotoPile(...args) {
|
||||
/**
|
||||
* @type { import('../library/index.js').Card[] }
|
||||
* @type { Card[] }
|
||||
*/
|
||||
const cards = [];
|
||||
const next = game.createEvent('cardsGotoPile');
|
||||
|
@ -1060,7 +1060,7 @@ export class Game extends Uninstantable {
|
|||
return next;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').GameEventPromise } event
|
||||
* @param { GameEventPromise } event
|
||||
*/
|
||||
static $cardsGotoPile(event) {
|
||||
const cards = event.cards;
|
||||
|
@ -1115,7 +1115,7 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
*
|
||||
* @param { string } url
|
||||
* @param { import('../library/index.js').Player } [player]
|
||||
* @param { Player } [player]
|
||||
*/
|
||||
static changeLand(url, player) {
|
||||
game.addVideo('changeLand', player, url);
|
||||
|
@ -1219,7 +1219,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param {...(import('../library/index.js').Player[] | import('../library/index.js').Player)} args
|
||||
* @param {...(Player[] | Player)} args
|
||||
*/
|
||||
static replaceHandcards(...args) {
|
||||
var next = game.createEvent('replaceHandcards');
|
||||
|
@ -1696,7 +1696,7 @@ export class Game extends Uninstantable {
|
|||
* @typedef {[string,number]|string|number|boolean} audioInfo
|
||||
* @typedef {{audio: audioInfo, audioname?:string[], audioname2?:{[playerName: string]: audioInfo}}} skillInfo
|
||||
* @param { string } skill 技能名
|
||||
* @param { import('../library/index.js').Player | string } [player] 角色/角色名
|
||||
* @param { Player | string } [player] 角色/角色名
|
||||
* @param { skillInfo | audioInfo } [skillInfo] 预设的skillInfo/audioInfo(转为skillInfo),覆盖lib.skill[skill]
|
||||
* @returns { string[] } 语音地址列表
|
||||
* @example
|
||||
|
@ -1829,10 +1829,10 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
*
|
||||
* @param { string } skill
|
||||
* @param { import('../library/index.js').Player | string } player
|
||||
* @param { Player | string } player
|
||||
* @param { boolean } [directaudio]
|
||||
* @param { boolean } [nobroadcast]
|
||||
* @param { import('../library/index.js').['lib']['skill'] } [skillInfo]
|
||||
* @param { ['lib']['skill'] } [skillInfo]
|
||||
* @returns
|
||||
*/
|
||||
static trySkillAudio(skill, player, directaudio, nobroadcast, skillInfo) {
|
||||
|
@ -1907,8 +1907,8 @@ export class Game extends Uninstantable {
|
|||
ui.window.appendChild(audio);
|
||||
}
|
||||
/**
|
||||
* @param { string | import('../library/index.js').Card } card
|
||||
* @param { import('../library/index.js').Player | import('../library/index.js').Sex } sex
|
||||
* @param { string | Card } card
|
||||
* @param { Player | Sex } sex
|
||||
*/
|
||||
static playCardAudio(card, sex) {
|
||||
if (typeof card === 'string') {
|
||||
|
@ -1978,12 +1978,12 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @param { string } type
|
||||
* @param {(
|
||||
* lib: import('../library/index.js')['Library'],
|
||||
* lib: Library,
|
||||
* game: typeof Game,
|
||||
* ui: import('../ui/index.js')['UI'],
|
||||
* get: import('../get/index.js')['Get'],
|
||||
* ai: import('../ai/index.js')['AI'],
|
||||
* _status: import('../status/index.js')['_status']
|
||||
* ui: UI,
|
||||
* get: Get,
|
||||
* ai: AI,
|
||||
* _status: Status
|
||||
* ) => any } content
|
||||
* @param {*} [url]
|
||||
* @returns
|
||||
|
@ -4515,8 +4515,8 @@ export class Game extends Uninstantable {
|
|||
/**
|
||||
* @param { string } name
|
||||
* @param { string } skill
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { import('../library/index.js').GameEventPromise } event
|
||||
* @param { Player } player
|
||||
* @param { GameEventPromise } event
|
||||
*/
|
||||
static createTrigger(name, skill, player, event) {
|
||||
let info = get.info(skill);
|
||||
|
@ -4537,7 +4537,7 @@ export class Game extends Uninstantable {
|
|||
*
|
||||
* @param { string } name
|
||||
* @param { false } [trigger]
|
||||
* @param { import('../library/index.js').GameEventPromise } [triggerEvent]
|
||||
* @param { GameEventPromise } [triggerEvent]
|
||||
*/
|
||||
static createEvent(name, trigger, triggerEvent) {
|
||||
const next = (new lib.element.GameEvent(name, trigger)).toPromise();
|
||||
|
@ -4546,7 +4546,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { string } name
|
||||
* @param { { extension: string, sex: import('../library/index.js').Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
|
||||
* @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
|
||||
*/
|
||||
static addCharacter(name, information) {
|
||||
const extensionName = _status.extension || information.extension, character = [
|
||||
|
@ -4568,7 +4568,7 @@ export class Game extends Uninstantable {
|
|||
lib.translate[`${packName}_character_config`] = extensionName;
|
||||
}
|
||||
/**
|
||||
* @param { { mode?: string, forbid?: any, character: { [key: string]: import('../library/index.js').Character }, skill: { [key: string]: object }, [key: string]: any } } pack
|
||||
* @param { { mode?: string, forbid?: any, character: { [key: string]: Character }, skill: { [key: string]: object }, [key: string]: any } } pack
|
||||
* @param { string } [packagename]
|
||||
*/
|
||||
static addCharacterPack(pack, packagename) {
|
||||
|
@ -4624,7 +4624,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { string } name
|
||||
* @param { import('../library/index.js').Card } info
|
||||
* @param { Card } info
|
||||
* @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2
|
||||
*/
|
||||
static addCard(name, info, info2) {
|
||||
|
@ -4671,7 +4671,7 @@ export class Game extends Uninstantable {
|
|||
lib.cardPack[packname].push(name);
|
||||
}
|
||||
/**
|
||||
* @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: import('../library/index.js').Card}, skill: { [key: string]: object } } } pack
|
||||
* @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: Card}, skill: { [key: string]: object } } } pack
|
||||
* @param { string } [packagename]
|
||||
*/
|
||||
static addCardPack(pack, packagename) {
|
||||
|
@ -4783,7 +4783,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { string } skill
|
||||
* @param { import('../library/index.js').Player } [player]
|
||||
* @param { Player } [player]
|
||||
*/
|
||||
static addGlobalSkill(skill, player) {
|
||||
let info = lib.skill[skill];
|
||||
|
@ -4930,11 +4930,11 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @overload
|
||||
* @returns { import('../library/index.js').Card }
|
||||
* @returns { Card }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card | string } name
|
||||
* @param { Card | string } name
|
||||
* @param { string } suit
|
||||
* @param { number } number
|
||||
* @param { string } nature
|
||||
|
@ -4984,11 +4984,11 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @overload
|
||||
* @returns { import('../library/index.js').Card }
|
||||
* @returns { Card }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card | string } name
|
||||
* @param { Card | string } name
|
||||
* @param { string } suit
|
||||
* @param { number } number
|
||||
* @param { string } nature
|
||||
|
@ -5655,7 +5655,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @type { Map<import('../library/index.js').GameEvent, Promise<any>> }
|
||||
* @type { Map<GameEvent, Promise<any>> }
|
||||
*
|
||||
* 以Promise储存异步事件的执行链,使async content调用事件时无需必须使用await
|
||||
*
|
||||
|
@ -5663,7 +5663,7 @@ export class Game extends Uninstantable {
|
|||
*/
|
||||
static executingAsyncEventMap = new Map();
|
||||
/**
|
||||
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
|
||||
* @param { GameEventPromise } [belongAsyncEvent]
|
||||
*/
|
||||
static async loop(belongAsyncEvent) {
|
||||
if (belongAsyncEvent) {
|
||||
|
@ -5828,7 +5828,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
|
||||
* @param { GameEventPromise } [belongAsyncEvent]
|
||||
*/
|
||||
static runContent(belongAsyncEvent) {
|
||||
return new Promise(resolve => {
|
||||
|
@ -6033,7 +6033,7 @@ export class Game extends Uninstantable {
|
|||
return game.asyncDelay(time, time2);
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').GameEventPromise } event
|
||||
* @param { GameEventPromise } [event]
|
||||
*/
|
||||
static check(event) {
|
||||
let i, j, range;
|
||||
|
@ -6520,8 +6520,8 @@ export class Game extends Uninstantable {
|
|||
_status.dragline.length = 0;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player1
|
||||
* @param { import('../library/index.js').Player } player2
|
||||
* @param { Player } player1
|
||||
* @param { Player } player2
|
||||
* @param { boolean } [prompt]
|
||||
* @param { boolean } [behind]
|
||||
* @param { boolean } [noanimate]
|
||||
|
@ -6585,8 +6585,8 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player1
|
||||
* @param { import('../library/index.js').Player } [player2]
|
||||
* @param { Player } player1
|
||||
* @param { Player } [player2]
|
||||
*/
|
||||
static swapPlayer(player, player2) {
|
||||
let players = game.players.concat(game.dead)
|
||||
|
@ -6655,7 +6655,7 @@ export class Game extends Uninstantable {
|
|||
}, 100, players);
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static swapControl(player) {
|
||||
if (player == game.me) return;
|
||||
|
@ -6701,7 +6701,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static findNext(player) {
|
||||
let players = get.players(lib.sort.position);
|
||||
|
@ -6943,7 +6943,7 @@ export class Game extends Uninstantable {
|
|||
next.setContent('loadPackage');
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static phaseLoop(player) {
|
||||
let next = game.createEvent('phaseLoop');
|
||||
|
@ -6952,7 +6952,7 @@ export class Game extends Uninstantable {
|
|||
next.setContent('phaseLoop');
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } [player]
|
||||
* @param { Player } [player]
|
||||
*/
|
||||
static gameDraw(player, num = 4) {
|
||||
let next = game.createEvent('gameDraw');
|
||||
|
@ -7488,8 +7488,8 @@ export class Game extends Uninstantable {
|
|||
}, game.roundNumber, ui.cardPile.firstChild, ui.cardPile.childElementCount);
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player[] } players
|
||||
* @param { number | number[] | (player: import('../library/index.js').Player) => number } num
|
||||
* @param { Player[] } players
|
||||
* @param { number | number[] | (player: Player) => number } num
|
||||
* @param { { drawDeck: boolean } } [drawDeck]
|
||||
* @param { boolean } [bottom]
|
||||
*/
|
||||
|
@ -7505,8 +7505,8 @@ export class Game extends Uninstantable {
|
|||
})
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player[] } players
|
||||
* @param { number | number[] | (player: import('../library/index.js').Player) => number } num
|
||||
* @param { Player[] } players
|
||||
* @param { number | number[] | (player: Player) => number } num
|
||||
* @param { { drawDeck: boolean } } [drawDeck]
|
||||
*/
|
||||
static asyncDrawAuto(players, num, drawDeck) {
|
||||
|
@ -7889,10 +7889,10 @@ export class Game extends Uninstantable {
|
|||
});
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { string | import('../library/index.js').Card[] } card
|
||||
* @param { import('../library/index.js').Player[] } [targets]
|
||||
* @param { import('../library/index.js').GameEventPromise } [event]
|
||||
* @param { Player } player
|
||||
* @param { string | Card[] } card
|
||||
* @param { Player[] } [targets]
|
||||
* @param { GameEventPromise } [event]
|
||||
* @param { boolean } [forced]
|
||||
* @param { string } [logvid]
|
||||
*/
|
||||
|
@ -8454,7 +8454,7 @@ export class Game extends Uninstantable {
|
|||
return player;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static triggerEnter(player) {
|
||||
const next = game.createEvent('enterGame', false);
|
||||
|
@ -8465,7 +8465,7 @@ export class Game extends Uninstantable {
|
|||
return next;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static restorePlayer(player) {
|
||||
if (game.players.includes(player) || game.dead.includes(player)) return;
|
||||
|
@ -8485,7 +8485,7 @@ export class Game extends Uninstantable {
|
|||
return player;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
static removePlayer(player) {
|
||||
if (_status.roundStart == player) _status.roundStart = player.next || player.getNext() || game.players[0];
|
||||
|
@ -8517,7 +8517,7 @@ export class Game extends Uninstantable {
|
|||
return player;
|
||||
}
|
||||
/**
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
* @param { string } [character]
|
||||
* @param { string } [character2]
|
||||
*/
|
||||
|
@ -8587,7 +8587,7 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @param { string[] } skills
|
||||
* @param { import('../library/index.js').Player } player
|
||||
* @param { Player } player
|
||||
* @param { string[] } exclude
|
||||
*/
|
||||
static filterSkills(skills, player, exclude) {
|
||||
|
@ -8623,17 +8623,17 @@ export class Game extends Uninstantable {
|
|||
})
|
||||
}
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static hasPlayer(func, includeOut) { return game.players.some(value => (includeOut || !value.isOut()) && func(value)) }
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static hasPlayer2(func, includeOut) { return game.players.concat(game.dead).some(value => (includeOut || !value.isOut()) && func(value)) }
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static countPlayer(func, includeOut) {
|
||||
|
@ -8647,7 +8647,7 @@ export class Game extends Uninstantable {
|
|||
}, 0);
|
||||
}
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static countPlayer2(func, includeOut) {
|
||||
|
@ -8662,14 +8662,14 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @overload
|
||||
* @returns { import('../library/index.js').Player[] }
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { import('../library/index.js').Player[] } [list]
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { Player[] } [list]
|
||||
* @param { boolean } [includeOut]
|
||||
* @returns { import('../library/index.js').Player[] }
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
static filterPlayer(func, list, includeOut) {
|
||||
if (!Array.isArray(list)) list = [];
|
||||
|
@ -8678,14 +8678,14 @@ export class Game extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* @overload
|
||||
* @returns { import('../library/index.js').Player[] }
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { import('../library/index.js').Player[] } [list]
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { Player[] } [list]
|
||||
* @param { boolean } [includeOut]
|
||||
* @returns { import('../library/index.js').Player[] }
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
static filterPlayer2(func, list, includeOut) {
|
||||
if (!Array.isArray(list)) list = [];
|
||||
|
@ -8693,17 +8693,17 @@ export class Game extends Uninstantable {
|
|||
return list.addArray(game.players.concat(game.dead).filter(value => (includeOut || !value.isOut()) && func(value)));
|
||||
}
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static findPlayer(func, includeOut) { return game.players.find(value => (includeOut || !value.isOut()) && func(value)) || null }
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [includeOut]
|
||||
*/
|
||||
static findPlayer2(func, includeOut) { return game.players.concat(game.dead).find(value => (includeOut || !value.isOut()) && func(value)) || null }
|
||||
/**
|
||||
* @param { (player: import('../library/index.js').Player) => boolean } func
|
||||
* @param { (player: Player) => boolean } func
|
||||
* @param { boolean } [all]
|
||||
*/
|
||||
static findCards(func, all) {
|
||||
|
|
|
@ -9,8 +9,8 @@ import { GNC as gnc } from '../gnc/index.js';
|
|||
export class Is extends Uninstantable {
|
||||
/**
|
||||
* 判断是否为进攻坐骑
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static attackingMount(card, player) {
|
||||
|
@ -25,8 +25,8 @@ export class Is extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* 判断是否为防御坐骑
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static defendingMount(card, player) {
|
||||
|
@ -1833,12 +1833,12 @@ export class Get extends Uninstantable {
|
|||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Player[] } obj
|
||||
* @param { Player[] } obj
|
||||
* @returns { 'players' }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card[] } obj
|
||||
* @param { Card[] } obj
|
||||
* @returns { 'cards' }
|
||||
*/
|
||||
/**
|
||||
|
@ -1853,27 +1853,27 @@ export class Get extends Uninstantable {
|
|||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Button } obj
|
||||
* @param { Button } obj
|
||||
* @returns { 'button' }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Card } obj
|
||||
* @param { Card } obj
|
||||
* @returns { 'card' }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Player } obj
|
||||
* @param { Player } obj
|
||||
* @returns { 'player' }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').Dialog } obj
|
||||
* @param { Dialog } obj
|
||||
* @returns { 'dialog' }
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @param { import('../library/index.js').GameEvent | import('../library/index.js').GameEventPromise } obj
|
||||
* @param { GameEvent | GameEventPromise } obj
|
||||
* @returns { 'event' }
|
||||
*/
|
||||
static itemtype(obj) {
|
||||
|
@ -1954,8 +1954,8 @@ export class Get extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
*
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {string}
|
||||
*/
|
||||
static name(card, player) {
|
||||
|
@ -1968,8 +1968,8 @@ export class Get extends Uninstantable {
|
|||
return card.name;
|
||||
}
|
||||
/**
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard | Card[] | VCard[]} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard | Card[] | VCard[]} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {string}
|
||||
*/
|
||||
static suit(card, player) {
|
||||
|
@ -1993,8 +1993,8 @@ export class Get extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard | Card[] | VCard[]} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard | Card[] | VCard[]} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {string}
|
||||
*/
|
||||
static color(card, player) {
|
||||
|
@ -2022,8 +2022,8 @@ export class Get extends Uninstantable {
|
|||
}
|
||||
}
|
||||
/**
|
||||
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {Card | VCard} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {number}
|
||||
*/
|
||||
static number(card, player) {
|
||||
|
@ -2047,8 +2047,8 @@ export class Get extends Uninstantable {
|
|||
}
|
||||
/**
|
||||
* 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder`
|
||||
* @param {string | string[] | import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {string | string[] | Card | VCard} card
|
||||
* @param {false | Player} [player]
|
||||
* @returns {string}
|
||||
*/
|
||||
static nature(card, player) {
|
||||
|
@ -2066,7 +2066,7 @@ export class Get extends Uninstantable {
|
|||
/**
|
||||
* 返回包含所有属性的数组
|
||||
* @param {string[] | string} card
|
||||
* @param {false | import("../library/index.js").Player} [player]
|
||||
* @param {false | Player} [player]
|
||||
* @returns {string[]}
|
||||
*/
|
||||
static natureList(card, player) {
|
||||
|
@ -2231,11 +2231,11 @@ export class Get extends Uninstantable {
|
|||
* @template T
|
||||
* @overload
|
||||
* @param {T} key
|
||||
* @returns {import("../library/index.js").GameEvent[T]}
|
||||
* @returns {GameEvent[T]}
|
||||
*/
|
||||
/**
|
||||
* @overload
|
||||
* @returns {import("../library/index.js").GameEvent}
|
||||
* @returns {GameEvent}
|
||||
*/
|
||||
static event(key) { return key ? _status.event[key] : _status.event }
|
||||
static player() { return _status.event.player }
|
||||
|
@ -2463,8 +2463,8 @@ export class Get extends Uninstantable {
|
|||
return result;
|
||||
}
|
||||
/**
|
||||
* @param {((a: import('../library/index.js').Button, b: import('../library/index.js').Button) => number)} [sort] 排序函数
|
||||
* @returns { import('../library/index.js').Button[] }
|
||||
* @param {((a: Button, b: Button) => number)} [sort] 排序函数
|
||||
* @returns { Button[] }
|
||||
*/
|
||||
static selectableButtons(sort) {
|
||||
if (!_status.event.player) return [];
|
||||
|
@ -2482,8 +2482,8 @@ export class Get extends Uninstantable {
|
|||
return selectable;
|
||||
}
|
||||
/**
|
||||
* @param {((a: import('../library/index.js').Card, b: import('../library/index.js').Card) => number)} [sort] 排序函数
|
||||
* @returns { import('../library/index.js').Card[] }
|
||||
* @param {((a: Card, b: Card) => number)} [sort] 排序函数
|
||||
* @returns { Card[] }
|
||||
*/
|
||||
static selectableCards(sort) {
|
||||
if (!_status.event.player) return [];
|
||||
|
@ -2578,8 +2578,8 @@ export class Get extends Uninstantable {
|
|||
return list;
|
||||
}
|
||||
/**
|
||||
* @param {((a: import('../library/index.js').Player, b: import('../library/index.js').Player) => number)} [sort] 排序函数
|
||||
* @returns { import('../library/index.js').Player[] }
|
||||
* @param {((a: Player, b: Player) => number)} [sort] 排序函数
|
||||
* @returns { Player[] }
|
||||
*/
|
||||
static selectableTargets(sort) {
|
||||
var selectable = [];
|
||||
|
|
|
@ -59,16 +59,16 @@ export async function boot() {
|
|||
setWindowListener();
|
||||
|
||||
// 无名杀更新日志
|
||||
if (Reflect.has(window, 'noname_update')) {
|
||||
Reflect.set(lib, 'version', Reflect.get(window, 'noname_update').version);
|
||||
lib.changeLog = Reflect.get(window, 'noname_update').changeLog;
|
||||
if (Reflect.get(window, 'noname_update').players) {
|
||||
lib.changeLog.push('players://' + JSON.stringify(Reflect.get(window, 'noname_update').players));
|
||||
if (window.noname_update) {
|
||||
Reflect.set(lib, 'version', window.noname_update.version);
|
||||
lib.changeLog = window.noname_update.changeLog;
|
||||
if (window.noname_update.players) {
|
||||
lib.changeLog.push('players://' + JSON.stringify(window.noname_update.players));
|
||||
}
|
||||
if (Reflect.get(window, 'noname_update').cards) {
|
||||
lib.changeLog.push('cards://' + JSON.stringify(Reflect.get(window, 'noname_update').cards));
|
||||
if (window.noname_update.cards) {
|
||||
lib.changeLog.push('cards://' + JSON.stringify(window.noname_update.cards));
|
||||
}
|
||||
Reflect.deleteProperty(window, 'noname_update');
|
||||
delete window.noname_update;
|
||||
}
|
||||
// 确认手机端平台
|
||||
const noname_inited = localStorage.getItem('noname_inited');
|
||||
|
@ -105,7 +105,7 @@ export async function boot() {
|
|||
Reflect.set(lib, 'path', (await import('../library/path.js')).default);
|
||||
//为其他自定义平台提供文件读写函数赋值的一种方式。
|
||||
//但这种方式只能修改game的文件读写函数。
|
||||
if (Reflect.has(window, 'initReadWriteFunction')) {
|
||||
if (typeof window.initReadWriteFunction == 'function') {
|
||||
const g = {};
|
||||
const ReadWriteFunctionName = ['download', 'readFile', 'readFileAsText', 'writeFile', 'removeFile', 'getFileList', 'ensureDirectory', 'createDir'];
|
||||
ReadWriteFunctionName.forEach(prop => {
|
||||
|
@ -120,7 +120,8 @@ export async function boot() {
|
|||
}
|
||||
});
|
||||
});
|
||||
Reflect.get(window, 'initReadWriteFunction')(g);
|
||||
// @ts-ignore
|
||||
window.initReadWriteFunction(g);
|
||||
}
|
||||
window.onbeforeunload = function () {
|
||||
if (config.get('confirm_exit') && !_status.reloading) {
|
||||
|
@ -177,9 +178,11 @@ export async function boot() {
|
|||
|
||||
if (config.get('debug')) {
|
||||
await lib.init.promises.js(`${lib.assetURL}game`, 'asset');
|
||||
lib.skin = Reflect.get(window, 'noname_skin_list');
|
||||
Reflect.deleteProperty(window, 'noname_skin_list');
|
||||
Reflect.deleteProperty(window, 'noname_asset_list');
|
||||
if (window.noname_skin_list) {
|
||||
lib.skin = window.noname_skin_list;
|
||||
delete window.noname_skin_list;
|
||||
delete window.noname_asset_list;
|
||||
}
|
||||
}
|
||||
|
||||
if (Reflect.get(window, 'isNonameServer'))
|
||||
|
|
|
@ -7,7 +7,7 @@ import { UI as ui } from '../../ui/index.js';
|
|||
import { AsyncFunction } from '../../util/index.js';
|
||||
|
||||
export class GameEvent {
|
||||
/** @type { import('../index.js').GameEventPromise } */
|
||||
/** @type { GameEventPromise } */
|
||||
#promise;
|
||||
/**
|
||||
* @param {string} [name]
|
||||
|
@ -26,11 +26,11 @@ export class GameEvent {
|
|||
this.step = 0;
|
||||
this.finished = false;
|
||||
/**
|
||||
* @type {(import('../index.js').GameEventPromise)[]}
|
||||
* @type {GameEventPromise[]}
|
||||
*/
|
||||
this.next = [];
|
||||
/**
|
||||
* @type {(import('../index.js').GameEventPromise)[]}
|
||||
* @type {GameEventPromise[]}
|
||||
*/
|
||||
this.after = [];
|
||||
this.custom = {
|
||||
|
@ -301,7 +301,7 @@ export class GameEvent {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {import("../util/index.js").AsyncFunction[] | keyof typeof lib.element.contents} contents
|
||||
* @param {Function | keyof typeof lib.element.contents} contents
|
||||
* @returns {GameEvent}
|
||||
*/
|
||||
setContents(contents) {
|
||||
|
@ -747,7 +747,7 @@ export class GameEvent {
|
|||
/**
|
||||
* 事件转为Promise化
|
||||
*
|
||||
* @returns { import('../index.js').GameEventPromise }
|
||||
* @returns { GameEventPromise }
|
||||
*/
|
||||
toPromise() {
|
||||
if (!this.#promise) {
|
||||
|
@ -760,93 +760,93 @@ export class GameEvent {
|
|||
*/
|
||||
typeAnnotation() {
|
||||
/**
|
||||
* @type {import('../index.js').Player}
|
||||
* @type { Player }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.source;
|
||||
/**
|
||||
* @type {import('../index.js').Player}
|
||||
* @type { Player }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.player;
|
||||
/**
|
||||
* @type {import('../index.js').Player}
|
||||
* @type { Player }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.target;
|
||||
/**
|
||||
* @type {import('../index.js').Player[]}
|
||||
* @type { Player[] }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.targets;
|
||||
/**
|
||||
* @type {import('../index.js').Card}
|
||||
* @type { Card }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.card;
|
||||
/**
|
||||
* @type {import('../index.js').Card[]}
|
||||
* @type { Card[] }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.cards;
|
||||
/**
|
||||
* @type {string}
|
||||
* @type { string }
|
||||
*/
|
||||
this.skill;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @type { boolean }
|
||||
*/
|
||||
this.forced;
|
||||
/**
|
||||
* @type {number}
|
||||
* @type { number }
|
||||
*/
|
||||
this.num;
|
||||
/**
|
||||
* @type {GameEvent}
|
||||
* @type { GameEvent }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this._trigger;
|
||||
/**
|
||||
* @type {Record<string, any>}
|
||||
* @type { Record<string, any> }
|
||||
*/
|
||||
this._result;
|
||||
/**
|
||||
* @type {number}
|
||||
* @type { number }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.baseDamage;
|
||||
/**
|
||||
* @type {import('../index.js').Player}
|
||||
* @type { Player }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.customSource;
|
||||
/**
|
||||
* @type {number}
|
||||
* @type { number }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.extraDamage;
|
||||
/**
|
||||
* @type {string}
|
||||
* @type { string }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.nature;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @type { boolean }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.notrigger;
|
||||
/**
|
||||
* @type {number}
|
||||
* @type { number }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.original_num;
|
||||
/**
|
||||
* @type {boolean}
|
||||
* @type { boolean }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.unreal;
|
||||
/**
|
||||
* @type { import('../index.js').Button[] }
|
||||
* @type { Button[] }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.excludeButton;
|
||||
|
|
|
@ -37,7 +37,7 @@ export class GameEventPromise extends Promise {
|
|||
}
|
||||
#event;
|
||||
/**
|
||||
* @param { import('./gameEvent.js').GameEvent } event
|
||||
* @param { GameEvent } event
|
||||
*/
|
||||
constructor(event) {
|
||||
super(resolve => {
|
||||
|
|
|
@ -2706,9 +2706,9 @@ export class Player extends HTMLDivElement {
|
|||
return list;
|
||||
}
|
||||
/**
|
||||
* @param {string} [arg1='h']
|
||||
* @param {string | Record<string, any> | ((card: import('../index.js').Card) => boolean)} [arg2]
|
||||
* @returns {import('../index.js').Card[]}
|
||||
* @param { string } [arg1='h']
|
||||
* @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2]
|
||||
* @returns { Card[] }
|
||||
*/
|
||||
getCards(arg1, arg2) {
|
||||
if (typeof arg1 != 'string') {
|
||||
|
|
|
@ -7,10 +7,10 @@ import { UI as ui } from '../../ui/index.js';
|
|||
|
||||
export class VCard {
|
||||
/**
|
||||
* @param {any} [suitOrCard]
|
||||
* @param {number | import('./card.js').Card[]} [numberOrCards]
|
||||
* @param {string} [name]
|
||||
* @param {string} [nature]
|
||||
* @param { any } [suitOrCard]
|
||||
* @param { number | Card[] } [numberOrCards]
|
||||
* @param { string } [name]
|
||||
* @param { string } [nature]
|
||||
*/
|
||||
constructor(suitOrCard, numberOrCards, name, nature) {
|
||||
if (Array.isArray(suitOrCard)) {
|
||||
|
@ -66,7 +66,7 @@ export class VCard {
|
|||
if (Array.isArray(numberOrCards)) {
|
||||
const noCards = !this.cards;
|
||||
/**
|
||||
* @type {import('./card.js').Card[]}
|
||||
* @type { Card[] }
|
||||
*/
|
||||
this.cards = numberOrCards.slice();
|
||||
if (noCards) {
|
||||
|
@ -108,7 +108,7 @@ export class VCard {
|
|||
return get.name(this) != get.name(card);
|
||||
}
|
||||
/**
|
||||
* @param {Player} player
|
||||
* @param { Player } player
|
||||
*/
|
||||
hasNature(nature, player) {
|
||||
const natures = get.natureList(this, player);
|
||||
|
|
|
@ -40,7 +40,7 @@ export class Library extends Uninstantable {
|
|||
static updates = [];
|
||||
static canvasUpdates = [];
|
||||
/**
|
||||
* @type { import('../game/index.js').Video[] }
|
||||
* @type { Video[] }
|
||||
*/
|
||||
static video = [];
|
||||
static skilllist = [];
|
||||
|
@ -54,6 +54,9 @@ export class Library extends Uninstantable {
|
|||
static characterGuozhanFilter = ["mode_guozhan"];
|
||||
static dynamicTranslate = {};
|
||||
static cardPack = {};
|
||||
/**
|
||||
* @type { SMap<number> }
|
||||
*/
|
||||
static skin = {};
|
||||
static onresize = [];
|
||||
static onphase = [];
|
||||
|
@ -88,11 +91,11 @@ export class Library extends Uninstantable {
|
|||
static cardType = {};
|
||||
static hook = { globalskill: {} };
|
||||
/**
|
||||
* @returns {never}
|
||||
* @returns { never }
|
||||
*/
|
||||
static typeAnnotation() {
|
||||
/**
|
||||
* @type { import('../game/index.js').Videos[] }
|
||||
* @type { Videos[] }
|
||||
*/
|
||||
// @ts-ignore
|
||||
this.videos;
|
||||
|
@ -6550,7 +6553,9 @@ export class Library extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
@ -6642,7 +6647,9 @@ export class Library extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
@ -7102,7 +7109,9 @@ export class Library extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
@ -8632,16 +8641,16 @@ export class Library extends Uninstantable {
|
|||
/**
|
||||
* @overload
|
||||
* @description 指定的玩家或自己装备指定的牌
|
||||
* @param {...Element.Player | string} args 玩家或卡牌名
|
||||
* @param {...Player | string} args 玩家或卡牌名
|
||||
* @returns { void }
|
||||
*/
|
||||
e(...args) {
|
||||
/**
|
||||
* @type { Element.Card[] }
|
||||
* @type { Card[] }
|
||||
*/
|
||||
let cards = [];
|
||||
/**
|
||||
* @type { Element.Player }
|
||||
* @type { Player }
|
||||
*/
|
||||
let target;
|
||||
for (let i = 0; i < arguments.length; i++) {
|
||||
|
@ -8889,7 +8898,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 下家对你使用一张牌
|
||||
* @param {...Element.Player | Element.Player[] | string | Element.VCard } args
|
||||
* @param {...Player | Player[] | string | VCard } args
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
|
@ -8973,7 +8982,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 打印目标玩家的手牌
|
||||
* @param { Element.Player } player
|
||||
* @param { Player } player
|
||||
*/
|
||||
h(player) {
|
||||
console.log(get.translation(player.getCards('h')));
|
||||
|
@ -9032,7 +9041,7 @@ export class Library extends Uninstantable {
|
|||
/**
|
||||
* 给目标立即添加一张手牌
|
||||
* @param { string } name
|
||||
* @param { Element.Player } target
|
||||
* @param { Player } target
|
||||
*/
|
||||
gx(name, target = game.me) {
|
||||
const card = lib.cheat.gn(name);
|
||||
|
@ -9051,7 +9060,7 @@ export class Library extends Uninstantable {
|
|||
* 如果lib.card里没有对应卡牌名返回null
|
||||
*
|
||||
* @param { string } name
|
||||
* @returns { Element.Card }
|
||||
* @returns { Card }
|
||||
* @example
|
||||
* ```js
|
||||
* // 创建一个梅花杀
|
||||
|
@ -9102,7 +9111,7 @@ export class Library extends Uninstantable {
|
|||
},
|
||||
/**
|
||||
* 指定的玩家或自己立即获得诸葛连弩,青龙刀,八卦阵,的卢,赤兔,木牛
|
||||
* @param {Element.Player} [target]
|
||||
* @param { Player } [target]
|
||||
*/
|
||||
ge(target) {
|
||||
if (target) {
|
||||
|
@ -9146,7 +9155,7 @@ export class Library extends Uninstantable {
|
|||
/**
|
||||
* 自己立刻获取牌堆顶num张牌
|
||||
* @param { number } [num]
|
||||
* @param { Element.Player } [target]
|
||||
* @param { Player } [target]
|
||||
*/
|
||||
d(num = 1, target) {
|
||||
const cards = get.cards(num);
|
||||
|
@ -9179,7 +9188,7 @@ export class Library extends Uninstantable {
|
|||
*
|
||||
* 不传入num默认为弃置所有玩家的所有牌
|
||||
*
|
||||
* @param { number | Element.Player } [num]
|
||||
* @param { number | Player } [num]
|
||||
*/
|
||||
t(num) {
|
||||
if (game.players.includes(num)) {
|
||||
|
|
|
@ -6,7 +6,7 @@ export const status = {
|
|||
clicked: false,
|
||||
auto: false,
|
||||
/**
|
||||
* @type {import('../library/index.js').GameEventPromise}
|
||||
* @type { GameEventPromise }
|
||||
*/
|
||||
// @ts-ignore
|
||||
event: null,
|
||||
|
@ -17,9 +17,10 @@ export const status = {
|
|||
dragline: [],
|
||||
dying: [],
|
||||
/**
|
||||
* @type { import('../game/index.js').History[] }
|
||||
* @type { History[] }
|
||||
*/
|
||||
globalHistory: [{
|
||||
// @ts-ignore
|
||||
cardMove: [],
|
||||
custom: [],
|
||||
useCard: [],
|
||||
|
@ -39,7 +40,7 @@ export const status = {
|
|||
/**
|
||||
* @type { string | void }
|
||||
*/
|
||||
extension:undefined,
|
||||
extension: undefined,
|
||||
};
|
||||
|
||||
export const _status = status;
|
|
@ -5081,7 +5081,9 @@ class Create extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
@ -5517,7 +5519,9 @@ class Create extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
@ -5895,7 +5899,9 @@ class Create extends Uninstantable {
|
|||
}
|
||||
else {
|
||||
if (!window.CodeMirror) {
|
||||
lib.init.js(lib.assetURL + 'game', 'codemirror', () => lib.codeMirrorReady(node, this.editor));
|
||||
import('../../game/codemirror.js').then(() => {
|
||||
lib.codeMirrorReady(node, editor);
|
||||
});
|
||||
lib.init.css(lib.assetURL + 'layout/default', 'codemirror');
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue