优化代码提示,codeMirror修改为esmodule

This commit is contained in:
shijian 2023-12-31 23:26:10 +08:00
parent 26cd6fae95
commit 9fdf573bc7
15 changed files with 10354 additions and 10324 deletions

View File

@ -1,68 +1,67 @@
(() => {
function getDocumentZoom() {
function getDocumentZoom() {
//一般body的缩放是xy同步的
var transform = getComputedStyle(document.body).transform;
// @ts-ignore
if (transform == 'none') transform = 1;
// @ts-ignore
else transform = +transform.slice(7, -1).split(',')[0];
return +transform;
}
}
// BROWSER SNIFFING
// BROWSER SNIFFING
// Kludges for bugs and behavior differences that can't be feature
// detected are enabled based on userAgent etc sniffing.
var userAgent = navigator.userAgent;
var platform = navigator.platform;
// Kludges for bugs and behavior differences that can't be feature
// detected are enabled based on userAgent etc sniffing.
var userAgent = navigator.userAgent;
var platform = navigator.platform;
var gecko = /gecko\/\d/i.test(userAgent);
var ie_upto10 = /MSIE \d/.test(userAgent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
var ie = ie_upto10 || ie_11up;
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);
var webkit = /WebKit\//.test(userAgent);
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
var chrome = /Chrome\//.test(userAgent);
var presto = /Opera\//.test(userAgent);
var safari = /Apple Computer/.test(navigator.vendor);
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
var phantom = /PhantomJS/.test(userAgent);
var gecko = /gecko\/\d/i.test(userAgent);
var ie_upto10 = /MSIE \d/.test(userAgent);
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
var ie = ie_upto10 || ie_11up;
// @ts-ignore
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : ie_11up[1]);
var webkit = /WebKit\//.test(userAgent);
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
var chrome = /Chrome\//.test(userAgent);
var presto = /Opera\//.test(userAgent);
var safari = /Apple Computer/.test(navigator.vendor);
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
var phantom = /PhantomJS/.test(userAgent);
var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
// This is woefully incomplete. Suggestions for alternative methods welcome.
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
var mac = ios || /Mac/.test(platform);
var chromeOS = /\bCrOS\b/.test(userAgent);
var windows = /win/i.test(platform);
var ios = /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
// This is woefully incomplete. Suggestions for alternative methods welcome.
var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
var mac = ios || /Mac/.test(platform);
var chromeOS = /\bCrOS\b/.test(userAgent);
var windows = /win/i.test(platform);
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
if (presto_version) presto_version = Number(presto_version[1]);
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
var captureRightClick = gecko || (ie && ie_version >= 9);
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
// @ts-ignore
if (presto_version) presto_version = Number(presto_version[1]);
// @ts-ignore
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
// @ts-ignore
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
var captureRightClick = gecko || (ie && ie_version >= 9);
// Optimize some code when these features are not used.
var sawReadOnlySpans = false, sawCollapsedSpans = false;
// Optimize some code when these features are not used.
var sawReadOnlySpans = false, sawCollapsedSpans = false;
// EDITOR CONSTRUCTOR
// EDITOR CONSTRUCTOR
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// This is CodeMirror (http://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.
//
// You can find some technical background for some of the code below
// at http://marijnhaverbeke.nl/blog/#cm-internals .
// This is CodeMirror (http://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.
//
// You can find some technical background for some of the code below
// at http://marijnhaverbeke.nl/blog/#cm-internals .
(function (mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
module.exports = mod();
else if (typeof define == "function" && define.amd) // AMD
return define([], mod);
else // Plain browser env
(this || window).CodeMirror = mod();
})(function () {
var CodeMirror = (function () {
// A CodeMirror instance represents an editor. This is the object
// that user code is usually dealing with.
@ -8984,19 +8983,17 @@
CodeMirror.version = "5.17.0";
return CodeMirror;
});
})();
// @ts-ignore
window.CodeMirror = CodeMirror;
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// TODO actually recognize syntax of TypeScript constructs
// TODO actually recognize syntax of TypeScript constructs
(function (mod) {
// Plain browser env
mod(CodeMirror);
})(function (CodeMirror) {
(function () {
"use strict";
function expressionAllowed(stream, state, backUp) {
@ -9726,15 +9723,12 @@
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
});
})();
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function (mod) {
// Plain browser env
mod(CodeMirror);
})(function (CodeMirror) {
(function () {
var defaults = {
pairs: "()[]{}''\"\"",
triples: "",
@ -9920,17 +9914,14 @@
stream.start = stream.pos;
}
}
});
})();
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
// declare global: DOMRect
// declare global: DOMRect
(function (mod) {
// Plain browser env
mod(CodeMirror);
})(function (CodeMirror) {
(function () {
"use strict";
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
@ -10458,5 +10449,6 @@
};
CodeMirror.defineOption("hintOptions", null);
});
})();
export default CodeMirror;

View File

@ -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",

View File

@ -31,3 +31,9 @@ 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 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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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 = [];

View File

@ -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'))

View File

@ -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;

View File

@ -37,7 +37,7 @@ export class GameEventPromise extends Promise {
}
#event;
/**
* @param { import('./gameEvent.js').GameEvent } event
* @param { GameEvent } event
*/
constructor(event) {
super(resolve => {

View File

@ -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') {

View File

@ -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);

View File

@ -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)) {

View File

@ -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;

View File

@ -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 {