Merge branch 'PR-Branch' of https://github.com/PZ157/noname into PR-Branch

This commit is contained in:
157 2024-04-20 22:33:52 +08:00
commit 63939bb8a8
50 changed files with 2949 additions and 1672 deletions

BIN
audio/effect/coin.mp3 Normal file

Binary file not shown.

BIN
audio/effect/coin_cost.mp3 Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -129,6 +129,7 @@ game.import("character", function () {
ganning: ["lingtong", "xf_sufei"],
guanyu: ["zhangfei", "liaohua"],
},
/** @type { importCharacterConfig['skill'] } */
skill: {
//标准版甘夫人
stdshushen: {
@ -578,7 +579,7 @@ game.import("character", function () {
async cost(event, trigger, player) {
let num = game.countPlayer(
(current) =>
current != player && current.countCards("h") && get.attitude(player, current) <= 0
current != player && current.countCards("h") > 0 && get.attitude(player, current) <= 0
);
let check = num >= 2;
const { result } = await player
@ -2611,7 +2612,7 @@ game.import("character", function () {
global: ["dying", "gainAfter", "loseAsyncAfter"],
},
audio: 2,
getIndex: function (event, player) {
getIndex(event, player) {
if (event.name !== "loseAsync") return [event.player];
else
return game

View File

@ -131,8 +131,21 @@ game.import("play", function () {
}
},
game: {
changeCoin: function (num) {
changeCoin: function (num, toast, audio) {
if (typeof num == "number" && ui.coin) {
if (num != 0 && toast !== false) {
ui.create.toast(
`${num > 0 ? "获得" : "花费"}&nbsp;${Math.abs(
num
)}&nbsp;金币`
);
}
if (audio !== false) {
game.playAudio(
"effect",
num > 0 ? "coin" : "coin_cost"
);
}
game.saveConfig("coin", lib.config.coin + num);
var str;
if (lib.config.coin_display_playpackconfig == "text") {

43
layout/default/toast.css Normal file
View File

@ -0,0 +1,43 @@
.toast-container {
display: block;
position: absolute;
top: 15%;
left: 50%;
transform: translateX(-50%);
z-index: 9999;
}
.toast {
display: block;
position: absolute;
left: 50%;
transform: translateX(-50%);
background-color: rgba(255, 165, 0, 0.7);
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
color: white;
font-weight: bold;
padding: 10px 20px;
text-align: center;
white-space: nowrap;
width: max-content;
animation: fadeInOut 1500ms ease-in-out forwards;
}
@keyframes fadeInOut {
0% {
opacity: 0;
}
20% {
opacity: 1;
}
80% {
opacity: 1;
}
100% {
opacity: 0;
}
}

View File

@ -1718,7 +1718,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -3420,7 +3420,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -4306,7 +4306,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -1094,7 +1094,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -22429,7 +22429,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -2303,7 +2303,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -2486,7 +2486,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -841,7 +841,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;
@ -1115,7 +1115,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;
@ -1446,7 +1446,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;
@ -1637,7 +1637,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.cheat2 = ui.create.control("自由选将", function () {
if (this.dialog == _status.event.dialog) {
if (game.changeCoin) {
game.changeCoin(50);
game.changeCoin(10);
}
this.dialog.close();
_status.event.dialog = this.backup;

View File

@ -37,7 +37,12 @@ declare interface Result {
* card参数特供给视为牌cards[0]
* card.isCardfalse为视为牌
*/
card: Card;
card: Card | CardBaseUIData;
cost_data: {
[key: string]: any;
};
[key: string]: any;
}

View File

@ -442,7 +442,7 @@ declare interface Skill {
*
* checkcheck方法检测
*/
frequent?: boolean | string | TwoParmFun<SkillTrigger, Player, number | boolean>;
frequent?: boolean | string | TwoParmFun<GameEventPromise, Player, number | boolean>;
/**
* 2
*
@ -1285,7 +1285,7 @@ declare interface Skill {
*
* @param target v1.10.11
*/
logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null);
logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null | undefined);
/**
* logTarget显示触发者的目标日志
*

View File

@ -1,8 +1,8 @@
export { GNC, gnc, setGNC } from './noname/gnc/index.js';
export { AI, ai, setAI } from './noname/ai/index.js';
export { Game, game, setGame } from './noname/game/index.js';
export { Get, get, setGet } from './noname/get/index.js';
export { Library, lib, setLibrary } from './noname/library/index.js';
export { status, _status, setStatus } from './noname/status/index.js';
export { UI, ui, setUI } from './noname/ui/index.js';
export { boot } from './noname/init/index.js';
export { boot } from "./noname/init/index.js";
export { GNC, gnc, setGNC } from "./noname/gnc/index.js";
export { AI, ai, setAI } from "./noname/ai/index.js";
export { Game, game, setGame } from "./noname/game/index.js";
export { Get, get, setGet } from "./noname/get/index.js";
export { Library, lib, setLibrary } from "./noname/library/index.js";
export { status, _status, setStatus } from "./noname/status/index.js";
export { UI, ui, setUI } from "./noname/ui/index.js";

View File

@ -5,7 +5,7 @@ export class Basic {
* buttons?: Button[]
* ) => number } check
*/
chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined;
chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean | undefined;
/**
* @param { (
* card?: Card,
@ -13,12 +13,12 @@ export class Basic {
* ) => number } check
* @returns { boolean | undefined }
*/
chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined;
chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined;
/**
* @param { (
* target?: Player,
* targets?: Player[]
* ) => number } check
*/
chooseTarget(check: (target?: any, targets?: Player[]) => number): boolean | undefined;
chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean | undefined;
}

View File

@ -5,4 +5,4 @@ export class AI {
export let ai: AI;
export function setAI(instance?: AI | undefined): void;
export { Basic };
import { Basic } from './basic.js';
import { Basic } from "./basic.js";

View File

@ -15,7 +15,7 @@ export class Game {
* @type { { [key: string]: Player } }
*/
playerMap: {
[key: string]: any;
[key: string]: import("noname-typings/nonameModules/noname/library/element/player.js").Player;
};
phaseNumber: number;
roundNumber: number;
@ -28,11 +28,15 @@ export class Game {
/**
* @type { Player }
*/
me: any;
me: Player;
/**
* @type { boolean }
*/
chess: boolean;
/**
* @type { Player }
*/
zhu: Player;
globalEventHandlers: {
_handlers: {};
getHandler(name: any, type: any): any;
@ -173,19 +177,19 @@ export class Game {
/**
* @template { keyof GameHistory } 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 }
*/
hasGlobalHistory<T extends keyof GameHistory>(key: T, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean;
hasGlobalHistory<T extends keyof GameHistory>(key: T, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
/**
* @template { keyof GameHistory } 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 }
*/
checkGlobalHistory<T_1 extends keyof GameHistory>(key: T_1, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void;
checkGlobalHistory<T_1 extends keyof GameHistory>(key: T_1, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void;
/**
* @overload
* @returns { GameHistory }
@ -195,27 +199,27 @@ export class Game {
* @template { keyof GameHistory } 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 { GameHistory[T] }
*/
getGlobalHistory<T_2 extends keyof GameHistory>(key: T_2, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_2];
getGlobalHistory<T_2 extends keyof GameHistory>(key: T_2, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): GameHistory[T_2];
/**
* @template { keyof GameHistory } 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 }
*/
hasAllGlobalHistory<T_3 extends keyof GameHistory>(key: T_3, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean;
hasAllGlobalHistory<T_3 extends keyof GameHistory>(key: T_3, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
/**
* @template { keyof GameHistory } 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 }
*/
checkAllGlobalHistory<T_4 extends keyof GameHistory>(key: T_4, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void;
checkAllGlobalHistory<T_4 extends keyof GameHistory>(key: T_4, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void;
/**
* @overload
* @returns { GameHistory[] }
@ -225,11 +229,11 @@ export class Game {
* @template { keyof GameHistory } 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 { GameHistory[T] }
*/
getAllGlobalHistory<T_5 extends keyof GameHistory>(key: T_5, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_5];
getAllGlobalHistory<T_5 extends keyof GameHistory>(key: T_5, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): GameHistory[T_5];
/**
* @overload
* @returns { void }
@ -238,15 +242,15 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsDiscard(cards: any): import('../library/index.js').GameEventPromise;
cardsDiscard(cards: Card): GameEventPromise;
/**
* @overload
* @param {Card[]} cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsDiscard(cards: Card[]): import('../library/index.js').GameEventPromise;
cardsDiscard(cards: Card[]): GameEventPromise;
/**
* @overload
* @returns { void }
@ -255,15 +259,15 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoOrdering(cards: any): import('../library/index.js').GameEventPromise;
cardsGotoOrdering(cards: Card): GameEventPromise;
/**
* @overload
* @param {Card[]} cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoOrdering(cards: Card[]): import('../library/index.js').GameEventPromise;
cardsGotoOrdering(cards: Card[]): GameEventPromise;
/**
* @overload
* @returns { void }
@ -273,16 +277,16 @@ export class Game {
* @overload
* @param { Card } cards
* @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku'
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise;
cardsGotoSpecial(cards: Card, bool?: false | "toRenku" | undefined): GameEventPromise;
/**
* @overload
* @param {Card[]} cards
* @param { 'toRenku' | false } [bool] false时不触发trigger'toRenku'
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise;
cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): GameEventPromise;
/**
*
* @param {...(
@ -299,9 +303,9 @@ export class Game {
any
])[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/**
* @param { import('../library/index.js').GameEventPromise } event
* @param { GameEventPromise } event
*/
$cardsGotoPile(event: import('../library/index.js').GameEventPromise): void;
$cardsGotoPile(event: GameEventPromise): void;
/**
* @param { false } [pause]
*/
@ -316,16 +320,22 @@ export class Game {
* @param { string } url
* @param { Player } [player]
*/
changeLand(url: string, player?: any): void;
changeLand(url: string, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): void;
/**
* @param { string[] } updates
* @param { Function } proceed
*/
checkFileList(updates: string[], proceed: Function): void;
/**
* @param {...(Player[] | Player)} args
* @overload
* @param {[Player[]]} args
*/
replaceHandcards(...args: (Player[] | Player)[]): void;
replaceHandcards(args: [Player[]]): any;
/**
* @overload
* @param {Player[]} args
*/
replaceHandcards(args: Player[]): any;
/**
* @param { string } name
*/
@ -344,7 +354,7 @@ export class Game {
* @param { ...Parameters<typeof lib.message.client[T]> } args
* @returns { void }
*/
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "reinit" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
log: (arr: any) => void;
opened: () => void;
onconnection: (id: any) => void;
@ -376,7 +386,7 @@ export class Game {
* @param { ...T } args
* @returns { void }
*/
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "reinit" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6 | undefined): void;
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6 | undefined): void;
/**
* @template { keyof typeof lib.message.client } T
* @overload
@ -384,7 +394,7 @@ export class Game {
* @param { ...Parameters<typeof lib.message.client[T]> } args
* @returns { void }
*/
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "reinit" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
log: (arr: any) => void;
opened: () => void;
onconnection: (id: any) => void;
@ -416,7 +426,7 @@ export class Game {
* @param { ...T } args
* @returns { void }
*/
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "reinit" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7 | undefined): void;
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7 | undefined): void;
syncState(): void;
updateWaiting(): void;
/**
@ -447,44 +457,44 @@ export class Game {
*/
playAudio(...args: any[]): HTMLAudioElement;
/**
* skill中的audio,audioname,audioname2和player来获取音频地址列表
* @typedef {[string,number]|string|number|boolean} audioInfo
* @typedef {{audio: audioInfo, audioname?:string[], audioname2?:{[playerName: string]: audioInfo}}} skillInfo
* @param { string } skill
* @param { Player | string } [player] /
* @param { skillInfo | audioInfo } [skillInfo] skillInfo/audioInfo(skillInfo)lib.skill[skill]
* @returns { string[] }
* @example
* ```js
* const info=lib.skill['skillname'];
* info.audio=undefined //默认值[true,2]
* info.audio=false // 不播放语音
* info.audio=true // [skill/skillname.mp3]
* info.audio=3 // [skill/skillname1.mp3,skill/skillname2.mp3,skill/skillname3.mp3](项数为数字大小)
* info.audio="(ext:extName|db:extension-extName)(/anyPath):true|number(:format)" //间接路径
* // 同上,只是将目录改为(ext:extName|db:extension-extName)(/anyPath),且可以指定格式(默认mp3)
* info.audio="(ext:extName|db:extension-extName/)(anyPath/)filename(.format)" //直接路径
* //path和format至少有一个否则会识别为引用技能
* //起始位置为audio/(若无anyPath则为audio/skill/)若没有format默认mp3
* info.audio="otherSkillname" //引用技能
* //引用一个其他技能的语音若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为默认值[true,2]
* info.audio=["otherSkillname", number] //带fixedNum的引用技能
* //同样引用一个其他技能的语音若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为number
* //若"otherSkillname"的语音数超过number则只取前number个
* info.audio=[true,2,"otherSkillname1",["otherSkillname2",2]] //任意元素拼接
* //数组里可以放任何以上的格式,结果为分析完的结果合并
*
* info.audioname=['player1','player2']
* //audioname里可以放任意角色名。
* //如果其中包含发动技能的角色名"player"且info.audio不是直接路径"(anyPath/)filename(.format)"的形式
* //则在"skill"和number中插入"_player",形如
*
* info.audioname2={'player1':audioInfo1,'player2':audioInfo2}
* //audioname2是一个对象其中key为角色名value的类型和info.audio一样
* //如果key中包含发动技能的角色名player则直接改用info.audioname2[player]来播放语音
* ```
*/
parseSkillAudio(skill: string, player?: Player | string, skillInfo?: {
* skill中的audio,audioname,audioname2和player来获取音频地址列表
* @typedef {[string,number]|string|number|boolean} audioInfo
* @typedef {{audio: audioInfo, audioname?:string[], audioname2?:{[playerName: string]: audioInfo}}} skillInfo
* @param { string } skill
* @param { Player | string } [player] /
* @param { skillInfo | audioInfo } [skillInfo] skillInfo/audioInfo(skillInfo)lib.skill[skill]
* @returns { string[] }
* @example
* ```js
* const info=lib.skill['skillname'];
* info.audio=undefined //默认值[true,2]
* info.audio=false // 不播放语音
* info.audio=true // [skill/skillname.mp3]
* info.audio=3 // [skill/skillname1.mp3,skill/skillname2.mp3,skill/skillname3.mp3](项数为数字大小)
* info.audio="(ext:extName|db:extension-extName)(/anyPath):true|number(:format)" //间接路径
* // 同上,只是将目录改为(ext:extName|db:extension-extName)(/anyPath),且可以指定格式(默认mp3)
* info.audio="(ext:extName|db:extension-extName/)(anyPath/)filename(.format)" //直接路径
* //path和format至少有一个否则会识别为引用技能
* //起始位置为audio/(若无anyPath则为audio/skill/)若没有format默认mp3
* info.audio="otherSkillname" //引用技能
* //引用一个其他技能的语音若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为默认值[true,2]
* info.audio=["otherSkillname", number] //带fixedNum的引用技能
* //同样引用一个其他技能的语音若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为number
* //若"otherSkillname"的语音数超过number则只取前number个
* info.audio=[true,2,"otherSkillname1",["otherSkillname2",2]] //任意元素拼接
* //数组里可以放任何以上的格式,结果为分析完的结果合并
*
* info.audioname=['player1','player2']
* //audioname里可以放任意角色名。
* //如果其中包含发动技能的角色名"player"且info.audio不是直接路径"(anyPath/)filename(.format)"的形式
* //则在"skill"和number中插入"_player",形如
*
* info.audioname2={'player1':audioInfo1,'player2':audioInfo2}
* //audioname2是一个对象其中key为角色名value的类型和info.audio一样
* //如果key中包含发动技能的角色名player则直接改用info.audioname2[player]来播放语音
* ```
*/
parseSkillAudio(skill: string, player?: string | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined, skillInfo?: {
audio: string | number | boolean | [string, number];
audioname?: string[] | undefined;
audioname2?: {
@ -838,7 +848,7 @@ export class Game {
* @param { any } [content]
* @returns
*/
addVideo(type: string, player: any, content?: any): void;
addVideo(type: string, player: Player, content?: any): void;
/**
* @param { Function } func
*/
@ -876,18 +886,18 @@ export class Game {
* @param { string } name
* @param { string } skill
* @param { Player } player
* @param { import('../library/index.js').GameEventPromise } event
* @returns { import('../library/index.js').GameEventPromise }
* @param { GameEventPromise } event
* @returns { GameEventPromise }
*/
createTrigger(name: string, skill: string, player: any, event: import('../library/index.js').GameEventPromise, indexedData: any): import('../library/index.js').GameEventPromise;
createTrigger(name: string, skill: string, player: Player, event: GameEventPromise, indexedData: any): GameEventPromise;
/**
* @legacy Use {@link lib.element.GameEvent.constructor} instead.
*
* @param { string } name
* @param { false } [trigger]
* @param { import('../library/index.js').GameEventPromise } [triggerEvent]
* @param { GameEventPromise } [triggerEvent]
*/
createEvent(name: string, trigger?: false | undefined, triggerEvent?: import("../library/index.js").GameEventPromise | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
createEvent(name: string, trigger?: false | undefined, triggerEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/**
* @param { string } name
* @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
@ -921,7 +931,7 @@ export class Game {
* @param { Card } info
* @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2
*/
addCard(name: string, info: any, info2: {
addCard(name: string, info: Card, info2: {
extension: string;
translate: string;
description: string;
@ -938,7 +948,7 @@ export class Game {
forbid?: string[] | undefined;
list: any[];
card: {
[key: string]: any;
[key: string]: import("noname-typings/nonameModules/noname/library/element/card.js").Card;
};
skill: {
[key: string]: any;
@ -970,7 +980,7 @@ export class Game {
* @param { string } skill
* @param { Player } [player]
*/
addGlobalSkill(skill: string, player?: any): boolean;
addGlobalSkill(skill: string, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean;
/**
* @param { string } skill
* @param { lib.element.Player } player
@ -980,7 +990,7 @@ export class Game {
/**
* @param { string } extensionName
*/
hasExtension(extensionName: string): any;
hasExtension(extensionName: string): boolean;
/**
* @param { string } extensionName
*/
@ -988,7 +998,7 @@ export class Game {
/**
* @param { string } extensionName
*/
hasExtensionLoaded(extensionName: string): any;
hasExtensionLoaded(extensionName: string): boolean;
/**
* @param { string } extensionName
* @param { Function } runnable
@ -1004,7 +1014,7 @@ export class Game {
* @overload
* @returns { Card }
*/
createCard(): any;
createCard(): Card;
/**
* @overload
* @param { Card | string } name
@ -1017,7 +1027,7 @@ export class Game {
* @overload
* @returns { Card }
*/
createCard2(): any;
createCard2(): Card;
/**
* @overload
* @param { Card | string } name
@ -1046,17 +1056,17 @@ export class Game {
*/
executingAsyncEventMap: Map<GameEvent, Promise<any>>;
/**
* @type { import('../library/index.js').GameEventPromise[] }
* @type { GameEventPromise[] }
*/
belongAsyncEventList: import('../library/index.js').GameEventPromise[];
belongAsyncEventList: GameEventPromise[];
/**
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
* @param { GameEventPromise } [belongAsyncEvent]
*/
loop(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise<void>;
loop(belongAsyncEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): Promise<void>;
/**
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
* @param { GameEventPromise } [belongAsyncEvent]
*/
runContent(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise<any>;
runContent(belongAsyncEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): Promise<any>;
pause(): void;
pause2(): void;
resume(): void;
@ -1092,9 +1102,9 @@ export class Game {
*/
asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise<void>;
/**
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { GameEventPromise } [event]
*/
check(event?: import("../library/index.js").GameEventPromise | undefined): boolean;
check(event?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
Check: Check;
uncheck(...args: any[]): void;
/**
@ -1104,21 +1114,21 @@ export class Game {
* @param { boolean } [behind]
* @param { boolean } [noanimate]
*/
swapSeat(player1: any, player2: any, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void;
swapSeat(player1: Player, player2: Player, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void;
/**
* @param { Player } player1
* @param { Player } [player2]
*/
swapPlayer(player: any, player2?: any): void;
swapPlayer(player: any, player2?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): void;
/**
* @param { Player } player
*/
swapControl(player: any): void;
swapControl(player: Player): void;
swapPlayerAuto(player: any): void;
/**
* @param { Player } player
*/
findNext(player: any): any;
findNext(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
/**
* @param { string } name
* @param { Function } callback
@ -1140,20 +1150,20 @@ export class Game {
/**
* @param { Player } player
*/
phaseLoop(player: any): void;
phaseLoop(player: Player): void;
/**
* @param { Player } [player]
*/
gameDraw(player?: any, num?: number): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
gameDraw(player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined, num?: number): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
chooseCharacterDouble(...args: any[]): void;
updateRoundNumber(): void;
/**
* @param { Player[] } players
* @param { number | number[] | (player: Player) => number } num
* @param { number | number[] | (player: Player) => number } [num]
* @param { { drawDeck: boolean } } [drawDeck]
* @param { boolean } [bottom]
*/
asyncDraw(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: {
asyncDraw(players: Player[], num?: number | number[] | ((player: Player) => number) | undefined, drawDeck?: {
drawDeck: boolean;
} | undefined, bottom?: boolean | undefined): void;
/**
@ -1161,7 +1171,7 @@ export class Game {
* @param { number | number[] | (player: Player) => number } num
* @param { { drawDeck: boolean } } [drawDeck]
*/
asyncDrawAuto(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: {
asyncDrawAuto(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: {
drawDeck: boolean;
} | undefined, ...args: any[]): void;
finishSkill(i: any, sub: any): void;
@ -1181,11 +1191,11 @@ export class Game {
* @param { Player } player
* @param { string | Card[] } card
* @param { Player[] } [targets]
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { GameEventPromise } [event]
* @param { boolean } [forced]
* @param { string } [logvid]
*/
logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: import("../library/index.js").GameEventPromise | undefined, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined;
logv(player: Player, card: string | Card[], targets?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, event?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined;
/**
* @param { string } storeName
* @param { string } idbValidKey
@ -1267,28 +1277,28 @@ export class Game {
/**
* @param { Player } player
*/
triggerEnter(player: any): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
triggerEnter(player: Player): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise;
/**
* @param { Player } player
*/
restorePlayer(player: any): any;
restorePlayer(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined;
/**
* @param { Player } player
*/
removePlayer(player: any): any;
removePlayer(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
/**
* @param { Player } player
* @param { string } [character]
* @param { string } [character2]
*/
replacePlayer(player: any, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player;
replacePlayer(player: Player, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player;
arrangePlayers(): void;
/**
* @param { string[] } skills
* @param { Player } player
* @param { string[] } exclude
*/
filterSkills(skills: string[], player: any, exclude: string[]): string[];
filterSkills(skills: string[], player: Player, exclude: string[]): string[];
/**
* @param { string[] } skills
*/
@ -1303,22 +1313,22 @@ export class Game {
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
hasPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean;
hasPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): boolean;
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
hasPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean;
hasPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): boolean;
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
countPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any;
countPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): number;
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
countPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any;
countPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): number;
/**
* @overload
* @returns { Player[] }
@ -1331,7 +1341,7 @@ export class Game {
* @param { boolean } [includeOut]
* @returns { Player[] }
*/
filterPlayer(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[];
filterPlayer(func: (player: Player) => boolean, list?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, includeOut?: boolean | undefined): Player[];
/**
* @overload
* @returns { Player[] }
@ -1344,23 +1354,23 @@ export class Game {
* @param { boolean } [includeOut]
* @returns { Player[] }
*/
filterPlayer2(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[];
filterPlayer2(func: (player: Player) => boolean, list?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, includeOut?: boolean | undefined): Player[];
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
findPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any;
findPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): import("noname-typings/nonameModules/noname/library/element/player.js").Player | null;
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [includeOut]
*/
findPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any;
findPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): import("noname-typings/nonameModules/noname/library/element/player.js").Player | null;
/**
* @param { (player: Player) => boolean } func
* @param { boolean } [all]
*/
findCards(func: (player: any) => boolean, all?: boolean | undefined): string[];
countGroup(): any;
findCards(func: (player: Player) => boolean, all?: boolean | undefined): string[];
countGroup(): number;
/**
*
* @param {function}
@ -1374,7 +1384,7 @@ export class Game {
* @param { (player: Player, i: number) => Promise<any | void> } asyncFunc async方法
* @param { (a: Player, b: Player) => number } sort lib.sort.seat
*/
doAsyncInOrder(targets: Player[], asyncFunc: (player: any, i: number) => Promise<any | void>, sort: (a: any, b: any) => number): Promise<void>;
doAsyncInOrder(targets: Player[], asyncFunc: (player: Player, i: number) => Promise<any | void>, sort: (a: Player, b: Player) => number): Promise<void>;
}
export let game: Game;
export function setGame(instance?: Game | undefined): void;
@ -1403,6 +1413,6 @@ export type Videos = {
};
import { GamePromises } from "./promises.js";
import { DynamicStyle } from "./dynamic-style/index.js";
import { lib } from '../library/index.js';
import { lib } from "../library/index.js";
import { Check } from "./check.js";
import { delay } from "../util/index.js";

View File

@ -25,7 +25,11 @@ export class GamePromises {
*/
alert(title: string): Promise<true>;
download(url: any, folder: any, dev: any, onprogress: any): Promise<any>;
readFile(filename: any): Promise<any>;
/**
* @param {string} filename
* @returns {Promise<ArrayBuffer | Buffer>}
*/
readFile(filename: string): Promise<ArrayBuffer | Buffer>;
readFileAsText(filename: any): Promise<any>;
writeFile(data: any, path: any, name: any): Promise<any>;
ensureDirectory(list: any, callback: any, file: any): Promise<any>;

View File

@ -74,7 +74,7 @@ export class Get {
* @param { false | Player } [player]
* @returns { string[] }
*/
subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[];
subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string[];
/**
* @returns { string[] }
*/
@ -90,7 +90,7 @@ export class Get {
* @param { Player } player
* @returns { string[] }
*/
skillCategoriesOf(skill: string, player: any): string[];
skillCategoriesOf(skill: string, player: Player): string[];
numOf(obj: any, item: any): any;
connectNickname(): any;
zhinangs(filter: any): any;
@ -99,7 +99,7 @@ export class Get {
infoHp(hp: any): number;
infoMaxHp(hp: any): number;
infoHujia(hp: any): number;
bottomCards(num: any, putBack: any): any;
bottomCards(num: any, putBack: any): Node | Node[];
discarded(): any;
cardOffset(): number;
colorspan(str: any): any;
@ -175,7 +175,7 @@ export class Get {
charactersOL(func: any): number[];
trimip(str: any): any;
mode(): any;
idDialog(id: any): any;
idDialog(id: any): import("noname-typings/nonameModules/noname/library/element/dialog.js").Dialog | null;
arenaState(): {
number: string | undefined;
players: {};
@ -198,7 +198,7 @@ export class Get {
rank(name: any, num: any): number | "x" | "s" | "c" | "d" | "b" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
skillRank(skill: any, type: any, grouped: any): number;
targetsInfo(targets: any): any[];
infoTargets(infos: any): any[];
infoTargets(infos: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
cardInfo(card: any): any[];
cardsInfo(cards?: any[]): any[][];
infoCard(info: any): import("../library/element/card.js").Card;
@ -279,25 +279,25 @@ export class Get {
* @param { Button } obj
* @returns { 'button' }
*/
itemtype(obj: any): 'button';
itemtype(obj: Button): 'button';
/**
* @overload
* @param { Card } obj
* @returns { 'card' }
*/
itemtype(obj: any): 'card';
itemtype(obj: Card): 'card';
/**
* @overload
* @param { Player } obj
* @returns { 'player' }
*/
itemtype(obj: any): 'player';
itemtype(obj: Player): 'player';
/**
* @overload
* @param { Dialog } obj
* @returns { 'dialog' }
*/
itemtype(obj: any): 'dialog';
itemtype(obj: Dialog): 'dialog';
/**
* @overload
* @param { GameEvent | GameEventPromise } obj
@ -314,7 +314,7 @@ export class Get {
* @param { false | Player } [player]
* @returns { string }
*/
subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string;
subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string;
equiptype(card: any, player: any): number;
/**
*
@ -322,40 +322,40 @@ export class Get {
* @param { false | Player } [player]
* @returns { string }
*/
name(card: Card | VCard | CardBaseUIData, player?: false | Player): string;
name(card: Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string;
/**
* @param {Card | VCard | Card[] | VCard[]} card
* @param {false | Player} [player]
* @returns {string}
*/
suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string;
suit(card: Card | VCard | Card[] | VCard[], player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string;
/**
* @param {Card | VCard | Card[] | VCard[]} card
* @param {false | Player} [player]
* @returns {string}
*/
color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string;
color(card: Card | VCard | Card[] | VCard[], player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string;
/**
* @param {Card | VCard} card
* @param {false | Player} [player]
* @returns {number}
*/
number(card: Card | VCard, player?: false | Player): number;
number(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): number;
/**
* `lib.natureSeparator``fire|thunder`
* @param {string | string[] | Card | VCard} card
* @param {false | Player} [player]
* @returns {string}
*/
nature(card: string | string[] | Card | VCard, player?: false | Player): string;
nature(card: string | string[] | Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string;
/**
*
* @param {string[] | string} card
* @param {false | Player} [player]
* @returns {string[]}
*/
natureList(card: string[] | string, player?: false | Player): string[];
cards(num: any, putBack: any): any;
natureList(card: string[] | string, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string[];
cards(num: any, putBack: any): Node | Node[];
judge(card: any): any;
judge2(card: any): any;
distance(from: any, to: any, method: any): number;
@ -371,7 +371,7 @@ export class Get {
* @param { Player | false } [player]
* @returns { any }
*/
info(item: Card | VCard | CardBaseUIData, player?: Player | false): any;
info(item: Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): any;
/**
* @param { number | Select | (()=>Select) } [select]
* @returns { Select }
@ -382,16 +382,16 @@ export class Get {
* @overload
* @returns {GameEvent}
*/
event(): any;
event(): GameEvent;
/**
* @template { keyof GameEvent } T
* @overload
* @param {T} key
* @returns {GameEvent[T]}
*/
event<T_2 extends string | number | symbol>(key: T_2): any;
player(): any;
players(sort: any, dead: any, out: any): any[];
event<T_2 extends keyof import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent>(key: T_2): import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent[T_2];
player(): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
players(sort: any, dead: any, out: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
position(card: any, ordering: any): number | "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o" | null | undefined;
skillTranslation(str: any, player: any): string;
skillInfoTranslation(name: any, player: any): any;
@ -412,12 +412,12 @@ export class Get {
* @param {((a: Button, b: Button) => number)} [sort]
* @returns { Button[] }
*/
selectableButtons(sort?: ((a: any, b: any) => number) | undefined): Button[];
selectableButtons(sort?: ((a: Button, b: Button) => number) | undefined): Button[];
/**
* @param {((a: Card, b: Card) => number)} [sort]
* @returns { Card[] }
*/
selectableCards(sort?: ((a: any, b: any) => number) | undefined): Card[];
selectableCards(sort?: ((a: Card, b: Card) => number) | undefined): Card[];
/**
* @returns { string[] }
*/
@ -429,11 +429,11 @@ export class Get {
* @param {((a: Player, b: Player) => number)} [sort]
* @returns { Player[] }
*/
selectableTargets(sort?: ((a: any, b: any) => number) | undefined): Player[];
selectableTargets(sort?: ((a: Player, b: Player) => number) | undefined): Player[];
filter(filter: any, i: any): any;
cardCount(card: any, player: any): any;
skillCount(skill: any, player: any): any;
owner(card: any, method: any): any;
owner(card: any, method: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined;
noSelected(): boolean;
population(identity: any): number;
totalPopulation(identity: any): number;
@ -467,8 +467,8 @@ export class Get {
unuseful3(card: any): number;
value(card: any, player: any, method: any): any;
equipResult(player: any, target: any, name: any): number;
equipValue(card: any, player: any): any;
equipValueNumber(card: any): any;
equipValue(card: any, player: any): number;
equipValueNumber(card: any): number;
disvalue(card: any, player: any): number;
disvalue2(card: any, player: any): number;
skillthreaten(skill: any, player: any, target: any): number | void;
@ -476,7 +476,7 @@ export class Get {
/**
* @returns { number }
*/
order(item: any, player?: any): number;
order(item: any, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player): number;
result(item: any, skill: any): any;
cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number;
effect_use(target: any, card: any, player: any, player2: any, isLink: any): number;

View File

@ -5,14 +5,14 @@ export class Is {
* @param { false | Player } [player]
* @returns { boolean }
*/
attackingMount(card: Card | VCard, player?: false | Player): boolean;
attackingMount(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean;
/**
*
* @param { Card | VCard } card
* @param { false | Player } [player]
* @returns { boolean }
*/
defendingMount(card: Card | VCard, player?: false | Player): boolean;
defendingMount(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean;
/**
*
* @returns { boolean }
@ -34,7 +34,7 @@ export class Is {
*
* @param { Card } card
*/
shownCard(card: any): boolean;
shownCard(card: Card): boolean;
/**
*
* @param { Card | VCard } card
@ -49,7 +49,7 @@ export class Is {
*
* @param { Card | VCard } card
*/
ordinaryCard(card: Card | VCard): any;
ordinaryCard(card: Card | VCard): boolean;
/**
*
* @param { string } str1
@ -61,7 +61,7 @@ export class Is {
* @param { Player } player
* @returns
*/
blocked(skill: string, player: any): boolean;
blocked(skill: string, player: Player): boolean;
/**
*
* @param { string } name
@ -107,7 +107,7 @@ export class Is {
/**
* @param { GameEventPromise } event
*/
converted(event: any): boolean;
converted(event: GameEventPromise): boolean;
safari(): boolean;
/**
* @param { (Card | VCard)[]} cards
@ -162,14 +162,14 @@ export class Is {
/**
* @param { Player } [player]
*/
mobileMe(player?: any): any;
mobileMe(player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean | undefined;
newLayout(): boolean;
phoneLayout(): boolean;
singleHandcard(): any;
/**
* @param { Player } player
*/
linked2(player: any): boolean;
linked2(player: Player): boolean;
/**
* @param { {} } obj
*/
@ -183,11 +183,11 @@ export class Is {
* @param { Player } player
* @returns
*/
locked(skill: string, player: any): any;
locked(skill: string, player: Player): any;
/**
* @param { string } skill
* @param { Player } player
* @returns
*/
zhuanhuanji(skill: string, player: any): boolean;
zhuanhuanji(skill: string, player: Player): boolean;
}

View File

@ -1,6 +1,6 @@
/**
* DOM对象的实时变化进行缓存
*/
* DOM对象的实时变化进行缓存
*/
export class ChildNodesWatcher {
constructor(dom: any);
dom: any;

View File

@ -14,4 +14,4 @@ export class Button extends HTMLDivElement {
exclude(): void;
get updateTransform(): (bool: any, delay: any) => void;
}
import { ui } from '../../ui/index.js';
import { ui } from "../../ui/index.js";

View File

@ -34,6 +34,10 @@ export class Card extends HTMLDivElement {
* @type { string }
*/
name: string;
/**
* @type { boolean }
*/
isCard: boolean;
selfDestroy(event: any): void;
willBeDestroyed(targetPosition: any, player: any, event: any): any;
hasNature(nature: any, player: any): boolean;
@ -63,7 +67,7 @@ export class Card extends HTMLDivElement {
cardid: string | undefined;
/**
* @param {[string, number, string, string]} card
*/
*/
$init(card: [string, number, string, string]): this;
updateTransform(bool: any, delay: any): void;
aiexclude(): void;

View File

@ -1,4 +1,4 @@
/**
* @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> }
*/
export const Contents: SMap<((event: any, trigger: any, player: any) => Promise<any>)[]>;
export const Contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]>;

View File

@ -22,14 +22,14 @@ export class Dialog extends HTMLDivElement {
* @param {*} [noclick]
* @param { boolean } [zoom]
*/
add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement;
add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | HTMLDivElement | import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
forcebutton: boolean | undefined;
/**
* @param { string } str
* @param { boolean } [center]
*/
addText(str: string, center?: boolean | undefined): this;
addSmall(item: any, noclick: any): string | any[] | HTMLDivElement;
addSmall(item: any, noclick: any): string | HTMLDivElement | import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
addAuto(content: any): void;
open(): this | undefined;
_dragtransform: any;

View File

@ -43,15 +43,19 @@ export class GameEvent {
/**
* @type { Player }
*/
source: any;
source: Player;
/**
* @type { Player }
*/
player: any;
player: Player;
/**
* @type { Player[] }
*/
players: Player[];
/**
* @type { Player }
*/
target: any;
target: Player;
/**
* @type { Player[] }
*/
@ -59,7 +63,7 @@ export class GameEvent {
/**
* @type { Card }
*/
card: any;
card: Card;
/**
* @type { Card[] }
*/
@ -87,7 +91,7 @@ export class GameEvent {
/**
* @type { Player }
*/
customSource: any;
customSource: Player;
/**
* @type { number }
*/
@ -121,9 +125,37 @@ export class GameEvent {
*/
parent: GameEventPromise | void | null;
/**
* @type { Function | void | null }
* @type { (this: GameEventPromise) => any | undefined | void | null }
*/
filterStop: Function | void | null;
filterStop: (this: GameEventPromise) => any | undefined | void | null;
/**
* @type { Result['cost_data'] }
*/
cost_data: Result['cost_data'];
/**
* @type { boolean }
*/
responded: boolean;
/**
* @type { string | undefined }
*/
judgestr: string | undefined;
/**
* @type { boolean }
*/
judging: boolean;
/**
* @type { Function | undefined }
*/
judge2: Function | undefined;
/**
* @type { Card[] }
*/
orderingCards: Card[];
/**
* @type { Function | undefined }
*/
ai: Function | undefined;
/**
* @param {keyof this} key
* @param {number} [value]
@ -232,12 +264,12 @@ export class GameEvent {
*
*
*
* @param {number|string|(evt:gameEvent)=>boolean} [level=1] number/string/function
* @param {number|string|((evt:GameEvent)=>boolean)} [level=1] number/string/function
* @param {boolean} [forced] {}forced为true则返回null
* @param {boolean} [includeSelf] level不是数字
* @returns {GameEvent|{}|null}
*/
getParent(level?: string | number | ((evt: gameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null;
getParent(level?: string | number | ((evt: GameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null;
getTrigger(): any;
getRand(name: any): any;
_rand_map: {} | undefined;
@ -267,8 +299,8 @@ export class GameEvent {
_cardChoice: any;
_targetChoice: any;
_skillChoice: any;
isMine(): any;
isOnline(): any;
isMine(): boolean;
isOnline(): boolean;
notLink(): boolean;
isPhaseUsing(player: any): boolean;
addTrigger(skills: any, player: any): this;

View File

@ -21,7 +21,7 @@
* game.log('等待', player, '摸牌完成执行log');
* ```
*/
export class GameEventPromise extends Promise<any> {
export class GameEventPromise extends Promise<import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent> {
/**
* @param { import('./gameEvent.js').GameEvent } arg
*/
@ -140,10 +140,6 @@ export class GameEventPromise extends Promise<any> {
* @returns { Promise<Exclude<Result[T], undefined>[]> }
*/
forResult<T extends keyof Result>(params: T[]): Promise<Exclude<Result[T], undefined>[]>;
/**
* result中的bool项
*/
forResultTest(): Promise<(boolean | any[])[]>;
/**
* result中的bool项
*/
@ -151,11 +147,11 @@ export class GameEventPromise extends Promise<any> {
/**
* result中的targets项
*/
forResultTargets(): Promise<any[]>;
forResultTargets(): Promise<import("noname-typings/nonameModules/noname/library/element/player.js").Player[]>;
/**
* result中的cards项
*/
forResultCards(): Promise<any[]>;
forResultCards(): Promise<import("noname-typings/nonameModules/noname/library/element/card.js").Card[]>;
/**
* result中的card项
*

View File

@ -69,29 +69,9 @@ export class Player extends HTMLDivElement {
skill: {};
}[];
/**
* @type { {
* useCard: GameEventPromise[],
* respond: GameEventPromise[],
* skipped: GameEventPromise[],
* lose: GameEventPromise[],
* gain: GameEventPromise[],
* sourceDamage: GameEventPromise[],
* damage: GameEventPromise[],
* custom: GameEventPromise[],
* useSkill: GameEventPromise[],
* }[] }
* @type { ActionHistory[] }
*/
actionHistory: {
useCard: GameEventPromise[];
respond: GameEventPromise[];
skipped: GameEventPromise[];
lose: GameEventPromise[];
gain: GameEventPromise[];
sourceDamage: GameEventPromise[];
damage: GameEventPromise[];
custom: GameEventPromise[];
useSkill: GameEventPromise[];
}[];
actionHistory: ActionHistory[];
/**
* @type { SMap<string[]> }
*/
@ -117,7 +97,8 @@ export class Player extends HTMLDivElement {
* friend: [],
* enemy: [],
* neutral: [],
* handcards: {
* shown?: number,
* handcards?: {
* global: [],
* source: [],
* viewed: []
@ -128,7 +109,8 @@ export class Player extends HTMLDivElement {
friend: [];
enemy: [];
neutral: [];
handcards: {
shown?: number;
handcards?: {
global: [];
source: [];
viewed: [];
@ -208,6 +190,18 @@ export class Player extends HTMLDivElement {
* @type { ((player: this) => any)[] }
*/
_inits: ((player: this) => any)[];
/**
* @type { boolean }
*/
isZhu: boolean;
/**
* @type { string }
*/
identity: string;
/**
* @type { boolean | undefined }
*/
identityShown: boolean | undefined;
/**
*
* @param { number } amount
@ -295,13 +289,13 @@ export class Player extends HTMLDivElement {
/**
*
*/
getShownCards(): any[];
getShownCards(): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
/**
* other所知的牌
* @param { Player } [other]
* @param { (card: Card) => boolean } [filter]
*/
getKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): any[];
getKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
/**
*
* @param { Player } [other]
@ -312,13 +306,13 @@ export class Player extends HTMLDivElement {
* @param { Player } [other]
* @param { (card: Card) => boolean } [filter]
*/
hasKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): boolean;
hasKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): boolean;
/**
*
* @param { Player } [other]
* @param { (card: Card) => boolean } [filter]
*/
countKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): number;
countKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): number;
/**
* Execute the delay card effect
*
@ -336,7 +330,7 @@ export class Player extends HTMLDivElement {
*
* @param { Card } card
*/
canIgnoreHandcard(card: any): boolean;
canIgnoreHandcard(card: Card): boolean;
/**
* Gift
*
@ -353,7 +347,7 @@ export class Player extends HTMLDivElement {
* @param { Player } target
* @param { boolean } [strict]
*/
canGift(card: any, target: Player, strict?: boolean | undefined): boolean;
canGift(card: Card, target: Player, strict?: boolean | undefined): boolean;
/**
* Check if the player refuses gifts
*
@ -361,7 +355,7 @@ export class Player extends HTMLDivElement {
* @param { Card } card
* @param { Player } player
*/
refuseGifts(card: any, player: Player): boolean;
refuseGifts(card: Card, player: Player): boolean;
/**
* Gift AI related
*
@ -369,12 +363,12 @@ export class Player extends HTMLDivElement {
* @param { Card } card
* @param { Player } target
*/
getGiftAIResultTarget(card: any, target: Player): number;
getGiftAIResultTarget(card: Card, target: Player): number;
/**
* @param { Card } card
* @param { Player } target
*/
getGiftEffect(card: any, target: Player): number;
getGiftEffect(card: Card, target: Player): number;
/**
*
* @param { Card | Card[] } cards
@ -390,7 +384,7 @@ export class Player extends HTMLDivElement {
* @param { Player } [source]
* @param { boolean } [strict]
*/
canRecast(card: any, source?: Player | undefined, strict?: boolean | undefined): boolean;
canRecast(card: Card, source?: Player | undefined, strict?: boolean | undefined): boolean;
/**
*
*
@ -516,10 +510,10 @@ export class Player extends HTMLDivElement {
/**
* target发起协力
* @param { Player } target
* @param {*} type
* @param { string } type
* @param {*} reason
*/
cooperationWith(target: Player, type: any, reason: any): void;
cooperationWith(target: Player, type: string, reason: any): void;
chooseCooperationFor(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
checkCooperationStatus(target: any, reason: any): boolean;
removeCooperation(info: any): void;
@ -574,7 +568,7 @@ export class Player extends HTMLDivElement {
* @param { string } tag
* @param { Card[] } [cards]
*/
removeGaintag(tag: string, cards?: any[] | undefined): void;
removeGaintag(tag: string, cards?: import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined): void;
/**
* @param { Player } target
*/
@ -583,18 +577,18 @@ export class Player extends HTMLDivElement {
* @param { Card } card
* @param { Player } target
*/
canSaveCard(card: any, target: Player): any;
canSaveCard(card: Card, target: Player): any;
/**
* @param { String } from
* @param { String } to
* @returns { GameEventPromise }
*/
reinitCharacter(from: string, to: string, log?: boolean): any;
reinitCharacter(from: string, to: string, log?: boolean): GameEventPromise;
/**
* @param { String[] } newPairs
* @returns { GameEventPromise }
*/
changeCharacter(newPairs: string[], log?: boolean): any;
changeCharacter(newPairs: string[], log?: boolean): GameEventPromise;
/**
* @param { 0 | 1 | 2 } num
* @param { false } [log]
@ -630,12 +624,13 @@ export class Player extends HTMLDivElement {
* @param { string } [nature]
* @param { string } [popname]
*/
tryCardAnimate(card: any, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void;
tryCardAnimate(card: Card, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void;
/**
* @param { string } name
* @param { string } type
* @returns { boolean }
*/
hasUsableCard(name: string, type: string): true | undefined;
hasUsableCard(name: string, type: string): boolean;
/**
* @param { Player } to
* @returns { boolean }
@ -754,12 +749,12 @@ export class Player extends HTMLDivElement {
name: string;
name1: string;
name2: string;
handcards: any[];
handcards: import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
gaintag: never[];
equips: any[];
judges: any[];
specials: any[];
expansions: any[];
equips: import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
judges: import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
specials: import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
expansions: import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
expansion_gaintag: never[];
disableJudge: boolean;
disabledSlots: SMap<number>;
@ -768,9 +763,9 @@ export class Player extends HTMLDivElement {
position: number;
hujia: number;
side: any;
identityShown: any;
identityShown: boolean | undefined;
identityNode: (string | undefined)[];
identity: any;
identity: string;
dead: boolean;
linked: boolean;
turnedover: boolean;
@ -806,31 +801,62 @@ export class Player extends HTMLDivElement {
countUsed(card: any, type: any): number;
getCacheKey(): string;
countSkill(skill: any): any;
getStockSkills(unowned: any, unique: any, hidden: any): any[];
/**
* @param {*} [unowned]
* @param {*} [unique]
* @param {*} [hidden]
* @returns { string[] }
*/
getStockSkills(unowned?: any, unique?: any, hidden?: any): string[];
/**
* @param { string } [arg1='h']
* @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2]
* @returns { Iterable<Card> }
*/
iterableGetCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: any) => boolean) | undefined): Iterable<Card>;
iterableGetCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: Card) => boolean) | undefined): Iterable<Card>;
/**
* @param { string } [arg1='h']
* @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2]
* @returns { Card[] }
*/
getCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: any) => boolean) | undefined): Card[];
iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>;
getDiscardableCards(player: any, arg1: any, arg2: any): any[];
iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>;
getGainableCards(player: any, arg1: any, arg2: any): any[];
getCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: Card) => boolean) | undefined): Card[];
iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator<import("noname-typings/nonameModules/noname/library/element/card.js").Card, void, unknown>;
getDiscardableCards(player: any, arg1: any, arg2: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
/**
* @param {Parameters<lib['filter']['canBeGained']>[1]} player
* @param {Parameters<this['iterableGetCards']>[0]} arg1
* @param {Parameters<this['iterableGetCards']>[1]} arg2
*/
iterableGetGainableCards(player: [card?: any, player?: any, target?: any, event?: any][1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<import("noname-typings/nonameModules/noname/library/element/card.js").Card, void, unknown>;
/**
*
* @param {Parameters<this['iterableGetGainableCards']>[0]} player
* @param {Parameters<this['iterableGetGainableCards']>[1]} [arg1]
* @param {Parameters<this['iterableGetGainableCards']>[2]} [arg2]
*/
getGainableCards(player: Parameters<this['iterableGetGainableCards']>[0], arg1?: Parameters<this["iterableGetGainableCards"]>[1] | undefined, arg2?: Parameters<this["iterableGetGainableCards"]>[2] | undefined): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
getGainableSkills(func: any): any[];
countCards(arg1: any, arg2: any): number;
/**
* @param { Parameters<typeof this['iterableGetCards']>[0] } [arg1]
* @param { Parameters<typeof this['iterableGetCards']>[1] } [arg2]
*/
countCards(arg1?: Parameters<this["iterableGetCards"]>[0] | undefined, arg2?: Parameters<this["iterableGetCards"]>[1] | undefined): number;
getCardIndex(arg1: any, name: any, card: any, max: any): number;
countDiscardableCards(player: any, arg1: any, arg2: any): number;
countGainableCards(player: any, arg1: any, arg2: any): number;
/**
* @param {Parameters<this['getGainableCards']>[0]} player
* @param {Parameters<this['getGainableCards']>[1]} [arg1]
* @param {Parameters<this['getGainableCards']>[2]} [arg2]
*/
countGainableCards(player: Parameters<this['getGainableCards']>[0], arg1?: Parameters<this["getGainableCards"]>[1] | undefined, arg2?: Parameters<this["getGainableCards"]>[2] | undefined): number;
getOriginalSkills(): any[];
getModableSkills(): any[];
getSkills(arg2: any, arg3: any, arg4: any): any[];
/**
* @param { string | boolean | null } [arg2]
* @param { boolean | null} [arg3]
* @param {boolean} [arg4]
*/
getSkills(arg2?: string | boolean | null | undefined, arg3?: boolean | null | undefined, arg4?: boolean | undefined): any[];
get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode | undefined;
syncStorage(skill: any): void;
syncSkills(): void;
@ -879,7 +905,7 @@ export class Player extends HTMLDivElement {
useSkill(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
drawTo(num: any, args: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
draw(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
randomDiscard(...args: any[]): any[];
randomDiscard(...args: any[]): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
randomGain(...args: any[]): any;
discard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseToDiscardpile(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
@ -889,16 +915,30 @@ export class Player extends HTMLDivElement {
$addToExpansion(cards: any, broadcast: any, gaintag: any): this;
directgain(cards: any, broadcast: any, gaintag: any): this;
directgains(cards: any, broadcast: any, gaintag: any): this;
gainMultiple(targets: any, position: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/**
*
* @param { Player[] } targets
* @param { string } [position]
*/
gainMultiple(targets: Player[], position?: string | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
gain(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addToExpansion(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
give(cards: any, target: any, visible: any): any;
/**
*
* @param { Card | Card[] } cards
* @param { Player } target
* @param { boolean } [visible]
*/
give(cards: Card | Card[], target: Player, visible?: boolean | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
lose(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
damage(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
recover(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
recoverTo(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
doubleDraw(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseHp(num: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
/**
* @param { number } [num]
*/
loseHp(num?: number | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
loseMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
gainMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
changeHp(num: any, popup: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
@ -930,18 +970,30 @@ export class Player extends HTMLDivElement {
wait(callback: any): void;
unwait(result: any): void;
tempUnwait(result: any): void;
logSkill(name: any, targets: any, nature: any, logv: any): void;
/**
* @param { string | string[] } name
* @param { Player | Player[] } [targets]
* @param { boolean | string } [nature]
* @param { boolean } [logv]
*/
logSkill(name: string | string[], targets?: Player | Player[] | undefined, nature?: string | boolean | undefined, logv?: boolean | undefined): void;
unprompt(): void;
prompt(str: any, nature: any): void;
prompt_old(name2: any, className: any): void;
popup(name: any, className: any, nobroadcast: any): void;
/**
*
* @param { string } name
* @param { string } className
* @param { Parameters<this["damagepop"]>[3] } [nobroadcast]
*/
popup(name: string, className?: string, nobroadcast?: Parameters<this["damagepop"]>[3] | undefined): void;
popup_old(name: any, className: any): HTMLDivElement;
_popup(): void;
showTimer(time: any): void;
hideTimer(): void;
markAuto(name: any, info: any): void;
unmarkAuto(name: any, info: any): void;
getExpansions(tag: any): any[];
getExpansions(tag: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
countExpansions(tag: any): number;
hasExpansions(tag: any): boolean;
setStorage(name: any, value: any, mark: any): any;
@ -961,7 +1013,14 @@ export class Player extends HTMLDivElement {
unmark(name: any, info: any): void;
addLink(): void;
removeLink(): void;
canUse(card: any, target: any, distance: any, includecard: any): any;
/**
* @param { string | Card | VCard } card
* @param { Player } target
* @param { boolean } [distance]
* @param { GameEventPromise | boolean } [includecard]
* @returns { boolean }
*/
canUse(card: string | Card | VCard, target: Player, distance?: boolean | undefined, includecard?: boolean | import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
hasUseTarget(card: any, distance: any, includecard: any): boolean;
hasValueTarget(card: any, distance: any, includecard: any): boolean;
getUseValue(card: any, distance: any, includecard: any): number;
@ -997,7 +1056,20 @@ export class Player extends HTMLDivElement {
removeSkillTrigger(skills: any, triggeronly: any): this;
removeSkill(skill: any, ...args: any[]): any;
addTempSkills(skillsToAdd: any, expire: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise;
addTempSkill(skill: any, expire: any, checkConflict: any): any;
/**
* @overload
* @param { string } skill
* @param { SkillTrigger | string } [expire]
* @param { boolean } [checkConflict]
*/
addTempSkill(skill: string, expire?: string | SkillTrigger | undefined, checkConflict?: boolean | undefined): any;
/**
* @overload
* @param { string[] } skill
* @param { SkillTrigger } [expire]
* @param { boolean } [checkConflict]
*/
addTempSkill(skill: string[], expire?: SkillTrigger | undefined, checkConflict?: boolean | undefined): any;
tempBanSkill(skill: any, expire: any, log: any): any;
isTempBanned(skill: any): boolean;
attitudeTo(target: any): any;
@ -1019,14 +1091,68 @@ export class Player extends HTMLDivElement {
* @param { string | function | number | boolean | object } map
*/
getRoundHistory(key: any, filter: any, num: any, keep: any, last: any): any[];
getHistory(key: any, filter: any, last: any): any;
checkHistory(key: any, filter: any, last: any): void;
hasHistory(key: any, filter: any, last: any): any;
getLastHistory(key: any, filter: any, last: any): any;
checkAllHistory(key: any, filter: any, last: any): void;
getAllHistory(key: any, filter: any, last: any): any[];
hasAllHistory(key: any, filter: any, last: any): boolean;
getLastUsed(num: any): any;
/**
* @overload
* @returns { ActionHistory }
*/
getHistory(): ActionHistory;
/**
* @template { keyof ActionHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { ActionHistory[T] }
*/
getHistory<T extends keyof ActionHistory>(key: T, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): ActionHistory[T];
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
*/
checkHistory<T_1 extends keyof ActionHistory>(key: T_1, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void;
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { boolean }
*/
hasHistory<T_2 extends keyof ActionHistory>(key: T_2, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
/**
* @template { keyof ActionHistory } T
* @overload
* @param { T } [key]
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { null | ActionHistory[T] | boolean }
*/
getLastHistory<T_3 extends keyof ActionHistory>(key?: T_3 | undefined, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean | ActionHistory[T_3] | null;
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
*/
checkAllHistory<T_4 extends keyof ActionHistory>(key: T_4, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void;
/**
* @template { keyof ActionHistory } T
* @param { T } [key]
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { ActionHistory[T] }
*/
getAllHistory<T_5 extends keyof ActionHistory>(key?: T_5 | undefined, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): ActionHistory[T_5];
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @returns { boolean }
*/
hasAllHistory<T_6 extends keyof ActionHistory>(key: T_6, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean;
getLastUsed(num: any): import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | null;
getStat(key: any): any;
getLastStat(key: any): any;
queue(time: any): void;
@ -1037,7 +1163,7 @@ export class Player extends HTMLDivElement {
getGlobalFrom(): number;
getGlobalTo(): number;
getHandcardLimit(): number;
getEnemies(func: any): any[] | undefined;
getEnemies(func: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined;
getFriends(func: any): any[];
isEnemyOf(...args: any[]): boolean;
isFriendOf(player: any): boolean;
@ -1067,27 +1193,63 @@ export class Player extends HTMLDivElement {
isOnline2(): boolean;
isOffline(): boolean;
checkShow(skill: any, showonly: any): false | "main" | "vice";
needsToDiscard(add: any, filter: any, pure: any): number;
/**
*
* @param { number | Card[] | Card } [add]
* @param { (card?: Card, player?: Player) => boolean } [filter]
* @param { boolean } [pure]
*/
needsToDiscard(add?: number | import("noname-typings/nonameModules/noname/library/element/card.js").Card | import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined, filter?: ((card?: Card, player?: Player) => boolean) | undefined, pure?: boolean | undefined): number;
distanceTo(target: any, method: any): number;
distanceFrom(target: any, method: any): number;
hasSkill(skill: any, arg2: any, arg3: any, arg4: any): boolean;
hasStockSkill(skill: any, arg1: any, arg2: any, arg3: any): boolean;
/**
* @param { string } skill
* @param { Parameters<this['getSkills']>[0] } arg2
* @param { Parameters<this['getSkills']>[1] } arg3
* @param { Parameters<this['getSkills']>[2] } arg4
* @returns { boolean }
*/
hasSkill(skill: string, arg2: Parameters<this['getSkills']>[0], arg3: Parameters<this['getSkills']>[1], arg4: Parameters<this['getSkills']>[2]): boolean;
/**
* @param { string } skill
* @param { Parameters<this['getStockSkills']>[0] } arg1
* @param { Parameters<this['getStockSkills']>[1] } arg2
* @param { Parameters<this['getStockSkills']>[2] } arg3
* @returns { boolean }
*/
hasStockSkill(skill: string, arg1: Parameters<this['getStockSkills']>[0], arg2: Parameters<this['getStockSkills']>[1], arg3: Parameters<this['getStockSkills']>[2]): boolean;
isZhu2(): boolean;
isInitFilter(tag: any): boolean;
hasZhuSkill(skill: any, player: any): boolean;
/**
*
* @param {string} skill
* @param {Player} [player]
*/
hasZhuSkill(skill: string, player?: Player | undefined): boolean;
hasGlobalTag(tag: any, arg: any): boolean;
hasSkillTag(tag: any, hidden: any, arg: any, globalskill: any): boolean;
/**
* @param {string} tag
* @param {Parameters<this['getSkills']>[0]} hidden
* @param {Parameters<SkillAI['skillTagFilter']>[2]} arg
* @param {boolean} [globalskill]
*/
hasSkillTag(tag: string, hidden: Parameters<this['getSkills']>[0], arg: [player: import("noname-typings/nonameModules/noname/library/element/player.js").Player, tag: string, arg: any][2], globalskill?: boolean | undefined): boolean;
hasJudge(name: any): boolean;
hasFriend(): boolean;
hasUnknown(num: any): boolean;
isUnknown(player: any): boolean;
hasWuxie(info: any): boolean;
hasSha(respond: any, noauto: any): true | undefined;
hasShan(respond: any): true | undefined;
/**
*
* @param {string|boolean} [respond]
* @param {boolean} [noauto]
*/
hasSha(respond?: string | boolean | undefined, noauto?: boolean | undefined): boolean;
hasShan(respond: any): boolean;
mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean;
mayHaveShan(viewer: any, type: any, ignore: any, rvt: any): number | boolean;
hasCard(name: any, position: any): boolean;
getEquip(name: any): any;
getEquip(name: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card | null;
getJudge(name: any): ChildNode | null;
$drawAuto(cards: any, target: any): void;
$draw(num: any, init: any, config: any): void;
@ -1119,9 +1281,27 @@ export class Player extends HTMLDivElement {
$dust(): void;
$recover(): void;
$fullscreenpop(str: any, nature: any, avatar: any, broadcast: any): void;
$damagepop(num: any, nature: any, font: any, nobroadcast: any): void;
/**
*
* @param { number | string } num
* @param { string } [nature]
* @param { boolean } [font]
* @param { boolean } [nobroadcast]
*/
$damagepop(num: number | string, nature?: string | undefined, font?: boolean | undefined, nobroadcast?: boolean | undefined): void;
$damage(source: any, ...args: any[]): void;
$die(): void;
$dieflip(type: any): void;
$phaseJudge(card: any): void;
}
export type ActionHistory = {
useCard: GameEventPromise[];
respond: GameEventPromise[];
skipped: GameEventPromise[];
lose: GameEventPromise[];
gain: GameEventPromise[];
sourceDamage: GameEventPromise[];
damage: GameEventPromise[];
custom: GameEventPromise[];
useSkill: GameEventPromise[];
};

View File

@ -5,7 +5,7 @@ export class VCard {
* @param { string } [name]
* @param { string } [nature]
*/
constructor(suitOrCard?: any, numberOrCards?: number | any[] | undefined, name?: string | undefined, nature?: string | undefined);
constructor(suitOrCard?: any, numberOrCards?: number | import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined, name?: string | undefined, nature?: string | undefined);
/**
* @type {string}
*/
@ -43,7 +43,7 @@ export class VCard {
/**
* @param { Player } player
*/
hasNature(nature: any, player: any): boolean;
hasNature(nature: any, player: Player): boolean;
getCacheKey(): string;
hasGaintag(tag: any): any;
}

View File

@ -62,7 +62,10 @@ export class Library {
onload: any[];
onload2: any[];
onprepare: any[];
arenaReady: any[];
/**
* @type { Function[] | undefined }
*/
arenaReady: Function[] | undefined;
onfree: any[];
inpile: any[];
inpile_nature: any[];
@ -503,11 +506,11 @@ export class Library {
intro: string;
init: string;
item: {
'500': string;
'700': string;
'1000': string;
'1500': string;
'2500': string;
500: string;
700: string;
1000: string;
1500: string;
2500: string;
};
};
doubleclick_intro: {
@ -521,12 +524,12 @@ export class Library {
init: string;
intro: string;
item: {
'0': string;
'5': string;
'10': string;
'20': string;
'50': string;
'10000': string;
0: string;
5: string;
10: string;
20: string;
50: string;
10000: string;
};
unfrequent: boolean;
};
@ -719,10 +722,10 @@ export class Library {
init: string;
item: {
off: string;
'30000': string;
'60000': string;
'120000': string;
'300000': string;
30000: string;
60000: string;
120000: string;
300000: string;
};
intro: string;
onclick(item: any): void;
@ -889,17 +892,17 @@ export class Library {
name: string;
init: string;
item: {
'-5x': string;
'-4x': string;
'-3x': string;
'-2x': string;
'-1x': string;
'0x': string;
'1x': string;
'2x': string;
'3x': string;
'4x': string;
'5x': string;
"-5x": string;
"-4x": string;
"-3x": string;
"-2x": string;
"-1x": string;
"0x": string;
"1x": string;
"2x": string;
"3x": string;
"4x": string;
"5x": string;
};
unfrequent: boolean;
onclick(item: any): void;
@ -908,17 +911,17 @@ export class Library {
name: string;
init: string;
item: {
'-5x': string;
'-4x': string;
'-3x': string;
'-2x': string;
'-1x': string;
'0x': string;
'1x': string;
'2x': string;
'3x': string;
'4x': string;
'5x': string;
"-5x": string;
"-4x": string;
"-3x": string;
"-2x": string;
"-1x": string;
"0x": string;
"1x": string;
"2x": string;
"3x": string;
"4x": string;
"5x": string;
};
unfrequent: boolean;
onclick(item: any): void;
@ -927,17 +930,17 @@ export class Library {
name: string;
init: string;
item: {
'-5x': string;
'-4x': string;
'-3x': string;
'-2x': string;
'-1x': string;
'0x': string;
'1x': string;
'2x': string;
'3x': string;
'4x': string;
'5x': string;
"-5x": string;
"-4x": string;
"-3x": string;
"-2x": string;
"-1x": string;
"0x": string;
"1x": string;
"2x": string;
"3x": string;
"4x": string;
"5x": string;
};
unfrequent: boolean;
onclick(item: any): void;
@ -946,17 +949,17 @@ export class Library {
name: string;
init: string;
item: {
'-5x': string;
'-4x': string;
'-3x': string;
'-2x': string;
'-1x': string;
'0x': string;
'1x': string;
'2x': string;
'3x': string;
'4x': string;
'5x': string;
"-5x": string;
"-4x": string;
"-3x": string;
"-2x": string;
"-1x": string;
"0x": string;
"1x": string;
"2x": string;
"3x": string;
"4x": string;
"5x": string;
};
unfrequent: boolean;
onclick(item: any): void;
@ -1390,10 +1393,10 @@ export class Library {
intro: string;
init: string;
item: {
'6': string;
'12': string;
'20': string;
'30': string;
6: string;
12: string;
20: string;
30: string;
};
unfrequent: boolean;
};
@ -1624,15 +1627,15 @@ export class Library {
name: string;
init: number;
item: {
'0': string;
'1': string;
'2': string;
'3': string;
'4': string;
'5': string;
'6': string;
'7': string;
'8': string;
0: string;
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
};
onclick(volume: any): void;
};
@ -1640,15 +1643,15 @@ export class Library {
name: string;
init: number;
item: {
'0': string;
'1': string;
'2': string;
'3': string;
'4': string;
'5': string;
'6': string;
'7': string;
'8': string;
0: string;
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
};
onclick(volume: any): void;
};
@ -1722,108 +1725,108 @@ export class Library {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
huosha: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
leisha: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
shan: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
tao: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
jiu: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
wuxie: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
nanman: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
wanjian: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
guohe: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
shunshou: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
tiesuo: {
name: string;
init: string;
item: {
'1': string;
'0.5': string;
'0': string;
1: string;
0.5: string;
0: string;
};
};
hide: {
@ -1869,10 +1872,10 @@ export class Library {
name: string;
init: string;
item: {
'0.1': string;
'0.2': string;
'0.3': string;
'0.5': string;
0.1: string;
0.2: string;
0.3: string;
0.5: string;
};
};
hide: {
@ -1946,9 +1949,9 @@ export class Library {
item: {
off: string;
group: string;
'4': string;
'6': string;
'8': string;
4: string;
6: string;
8: string;
};
};
connect_zhong_card: {
@ -2221,12 +2224,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
limit_zhu: {
@ -2236,9 +2239,9 @@ export class Library {
item: {
off: string;
group: string;
'4': string;
'6': string;
'8': string;
4: string;
6: string;
8: string;
};
};
choice_zhong: {
@ -2246,12 +2249,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
choice_nei: {
@ -2259,12 +2262,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
choice_fan: {
@ -2272,12 +2275,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
enable_commoner: {
@ -2292,12 +2295,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
enable_year_limit: {
@ -2552,12 +2555,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'5': string;
'6': string;
'7': string;
'8': string;
'9': string;
'10': string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
};
};
};
@ -2570,10 +2573,10 @@ export class Library {
name: string;
init: string;
item: {
'1v1': string;
'2v2': string;
'3v3': string;
'4v4': string;
"1v1": string;
"2v2": string;
"3v3": string;
"4v4": string;
guandu: string;
};
frequent: boolean;
@ -2595,11 +2598,11 @@ export class Library {
init: string;
frequent: boolean;
item: {
'12': string;
'16': string;
'20': string;
'24': string;
'40': string;
12: string;
16: string;
20: string;
24: string;
40: string;
};
};
connect_replace_number: {
@ -2607,12 +2610,12 @@ export class Library {
init: string;
frequent: boolean;
item: {
'0': string;
'1': string;
'2': string;
'3': string;
'4': string;
'5': string;
0: string;
1: string;
2: string;
3: string;
4: string;
5: string;
};
};
};
@ -2949,12 +2952,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
choice_fan: {
@ -2962,12 +2965,12 @@ export class Library {
init: string;
restart: boolean;
item: {
'3': string;
'4': string;
'5': string;
'6': string;
'8': string;
'10': string;
3: string;
4: string;
5: string;
6: string;
8: string;
10: string;
};
};
edit_character: {
@ -3089,10 +3092,10 @@ export class Library {
name: string;
init: string;
item: {
'0': string;
'0.2': string;
'0.333': string;
'0.5': string;
0: string;
0.2: string;
0.333: string;
0.5: string;
};
frequent: boolean;
};
@ -3129,10 +3132,10 @@ export class Library {
init: string;
intro: string;
item: {
'0': string;
'10': string;
'20': string;
'30': string;
0: string;
10: string;
20: string;
30: string;
};
};
};
@ -3145,10 +3148,10 @@ export class Library {
init: string;
frequent: boolean;
item: {
'10': string;
'20': string;
'30': string;
'1000': string;
10: string;
20: string;
30: string;
1000: string;
};
};
tafang_difficulty: {
@ -3156,9 +3159,9 @@ export class Library {
init: string;
frequent: boolean;
item: {
'1': string;
'2': string;
'3': string;
1: string;
2: string;
3: string;
};
};
show_range: {
@ -3174,10 +3177,10 @@ export class Library {
intro: string;
init: string;
item: {
'0': string;
'10': string;
'20': string;
'30': string;
0: string;
10: string;
20: string;
30: string;
};
};
};
@ -3255,13 +3258,13 @@ export class Library {
init: string;
frequent: boolean;
item: {
'1': string;
'2': string;
'3': string;
'4': string;
'6': string;
'8': string;
'10': string;
1: string;
2: string;
3: string;
4: string;
6: string;
8: string;
10: string;
};
onclick(num: any): void;
};
@ -3992,7 +3995,7 @@ export class Library {
link: () => void;
chooseToGuanxing: () => void;
};
contents: SMap<((event: any, trigger: any, player: any) => Promise<any>)[]>;
contents: SMap<((event: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise, trigger: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise, player: import("noname-typings/nonameModules/noname/library/element/player.js").Player) => Promise<any>)[]>;
Player: typeof Element.Player;
Card: typeof Element.Card;
VCard: typeof Element.VCard;
@ -4243,7 +4246,7 @@ export class Library {
attackFrom: (card: any, player: any, target: any) => boolean;
globalFrom: (card: any, player: any, target: any) => boolean;
selectCard: () => number[];
selectTarget: (card: any, player: any) => any;
selectTarget: (card: any, player: any) => number | number[] | (() => number | Select) | undefined;
judge: (card: any, player: any, target: any) => any;
autoRespondSha: () => boolean;
autoRespondShan: () => boolean;

View File

@ -1,3 +1,6 @@
/**
* github授权的token
*/
export function gainAuthorization(): Promise<void>;
/**
*
@ -6,9 +9,10 @@ export function gainAuthorization(): Promise<void>;
export function parseSize(limit: number): string;
/**
*
* @param { string } ver1
* @param { string } ver2
* @returns { -1 | 0 | 1 }
* @param { string } ver1 1
* @param { string } ver2 2
* @returns { -1 | 0 | 1 } -1ver1 < ver2, 0ver1 == ver2, 1ver1 > ver2
* @throws {Error}
*/
export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1;
/**
@ -91,7 +95,7 @@ export function getRepoTagDescription(tagName: string, options?: {
}>;
/**
*
*
* ()
* @param { string } [path = ''] ()
* @param { string } [branch = '']
* @param { Object } options
@ -128,6 +132,9 @@ export function getRepoFilesList(path?: string | undefined, branch?: string | un
/**
*
* ()
*
* ** api可能会大幅度消耗请求次数使**
*
* @param { string } [path = ''] ()
* @param { string } [branch = '']
* @param { Object } options
@ -155,7 +162,7 @@ export function flattenRepositoryFiles(path?: string | undefined, branch?: strin
type: 'file';
}[]>;
/**
*
*
* @param { string } url
* @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress]
* @param { RequestInit } [options={}]
@ -174,3 +181,37 @@ export function request(url: string, onProgress?: ((receivedBytes: number, total
* @returns { progress }
*/
export function createProgress(title?: string | undefined, max?: string | number | undefined, fileName?: string | undefined, value?: string | number | undefined): progress;
/**
* GitHub存储库检索最新版本(tag)tag
*
* GitHub存储库中获取由所有者和存储库名称指定的tags列表v1998tag名称
* @param {string} owner GitHub上拥有存储库的用户名或组织名称
* @param {string} repo tag的存储库的名称
* @returns {Promise<string>} tag的名称解析的promise
* @throws {Error} tag
*/
export function getLatestVersionFromGitHub(owner?: string, repo?: string): Promise<string>;
/**
* GitHub存储库中获取树
* @param {string[]} directories
* @param {string} version
* @param {string} [owner = 'libccy'] GitHub上拥有存储库的用户名或组织名称
* @param {string} [repo = 'noname'] GitHub存储库的名称
* @returns {Promise<{
* path: string;
* mode: string;
* type: "blob" | "tree";
* sha: string;
* size: number;
* url: string;
* }[][]>} A promise that resolves with trees from the specified directories.
* @throws {Error} Will throw an error if unable to fetch the repository tree from GitHub.
*/
export function getTreesFromGithub(directories: string[], version: string, owner?: string | undefined, repo?: string | undefined): Promise<{
path: string;
mode: string;
type: "blob" | "tree";
sha: string;
size: number;
url: string;
}[][]>;

View File

@ -8,7 +8,7 @@ export class status {
/**
* @type { GameEventPromise }
*/
event: any;
event: GameEventPromise;
ai: {};
lastdragchange: any[];
skillaudio: any[];
@ -30,39 +30,43 @@ export class status {
prehidden_skills: any[];
postReconnect: {};
/**
* @type { string | void }
* @type { string | undefined }
*/
extension: string | void;
extension: string | undefined;
/**
* @type { boolean | void }
* @type { boolean | undefined }
*/
dragged: boolean | void;
dragged: boolean | undefined;
/**
* @type { boolean | void }
* @type { boolean | undefined }
*/
touchconfirmed: boolean | void;
touchconfirmed: boolean | undefined;
/**
* @type { boolean | void }
* @type { boolean | undefined }
*/
connectMode: boolean | void;
connectMode: boolean | undefined;
/**
* @type { boolean | void }
* @type { boolean | undefined }
*/
importingExtension: boolean | void;
importingExtension: boolean | undefined;
/**
* @type { Promise<any>[] | void }
* @type { Promise<any>[] | undefined }
*/
extensionLoaded: Promise<any>[] | void;
extensionLoaded: Promise<any>[] | undefined;
/**
* @type { Promise<any>[] | void }
* @type { Promise<any>[] | undefined }
*/
extensionLoading: Promise<any>[] | void;
extensionLoading: Promise<any>[] | undefined;
/**
* @type { { [key: string]: Promise<any>[] } | void }
* @type { { [key: string]: Promise<any>[] } | undefined }
*/
importing: void | {
importing: {
[key: string]: Promise<any>[];
};
} | undefined;
/**
* @type { Function | boolean | undefined }
*/
new_tutorial: Function | boolean | undefined;
}
export let _status: status;
export function setStatus(instance?: status | undefined): void;

View File

@ -7,6 +7,10 @@ export class Click {
* @type {(arg0: string) => void}
*/
menuTab: (arg0: string) => void;
/**
* @type {() => void}
*/
configMenu: () => void;
identitycircle(): void;
connectEvents(): void;
connectClients(): void;

View File

@ -2,7 +2,7 @@ export class Create {
/**
* @type {(video: Videos, before: boolean) => void}
*/
videoNode: (video: any, before: boolean) => void;
videoNode: (video: Videos, before: boolean) => void;
/**
*
*/
@ -62,9 +62,9 @@ export class Create {
caption(str: any, position: any): HTMLDivElement;
control(...args: any[]): import("../../library/element/control.js").Control;
confirm(str: any, func: any): void;
skills(skills: any): any;
skills2(skills: any): any;
skills3(skills: any): any;
skills(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined;
skills2(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined;
skills3(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined;
arena(): void;
system(str: any, func: any, right: any, before: any): HTMLDivElement;
pause(): HTMLDivElement | undefined;
@ -104,7 +104,7 @@ export class Create {
textbuttons(list: any, dialog: any, noclick: any): void;
player(position: any, noclick: any): import("../../library/element/player.js").Player;
connectPlayers(ip: any): void;
players(numberOfPlayers: any): any[] | undefined;
players(numberOfPlayers: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined;
me(hasme: any): void;
card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card;
cardsAsync(...args: any[]): void;

View File

@ -30,7 +30,7 @@ export class UI {
/**
* @type { Dialog }
*/
dialog: any;
dialog: Dialog;
/**
* @type { HTMLDivElement }
*/
@ -42,7 +42,7 @@ export class UI {
/**
* @type { Control }
*/
control: any;
control: Control;
/**
* @type { Control | undefined }
*/
@ -129,6 +129,10 @@ export class UI {
* @type {HTMLDivElement}
*/
tempnowuxie: HTMLDivElement;
/**
* @type {HTMLDivElement}
*/
cardPile: HTMLDivElement;
refresh(node: any): void;
clear(): void;
updatec(): void;

View File

@ -7,4 +7,4 @@
*/
export const promiseErrorHandlerMap: Record<"firefox" | "chrome" | "safari" | "other", new () => PromiseErrorHandler>;
export type PromiseErrorHandler = import('./struct/interface/promise-error-handler.js').PromiseErrorHandler;
import { PromiseErrorHandler } from './struct/index.js';
import { PromiseErrorHandler } from "./struct/index.js";

Binary file not shown.

View File

@ -53,18 +53,19 @@ export class Game {
/**
* @type { string }
*/
// @ts-ignore
layout;
/**
* @type { Player }
*/
// @ts-ignore
me;
/**
* @type { boolean }
*/
// @ts-ignore
chess;
/**
* @type { Player }
*/
zhu;
globalEventHandlers = new (class {
constructor() {
this._handlers = {};
@ -557,8 +558,8 @@ export class Game {
/**
* @template { keyof GameHistory } 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 }
*/
hasGlobalHistory(key, filter, last) {
@ -580,8 +581,8 @@ export class Game {
/**
* @template { keyof GameHistory } 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 }
*/
checkGlobalHistory(key, filter, last) {
@ -608,8 +609,8 @@ export class Game {
* @template { keyof GameHistory } 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 { GameHistory[T] }
*/
getGlobalHistory(key, filter, last) {
@ -630,8 +631,8 @@ export class Game {
/**
* @template { keyof GameHistory } 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 }
*/
hasAllGlobalHistory(key, filter, last) {
@ -656,8 +657,8 @@ export class Game {
/**
* @template { keyof GameHistory } 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 }
*/
checkAllGlobalHistory(key, filter, last) {
@ -686,8 +687,8 @@ export class Game {
* @template { keyof GameHistory } 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 { GameHistory[T] }
*/
getAllGlobalHistory(key, filter, last) {
@ -718,12 +719,12 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsDiscard(cards) {
/** @type { 'cards' | 'card' | void } */
@ -746,12 +747,12 @@ export class Game {
/**
* @overload
* @param { Card } cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoOrdering(cards) {
/** @type { 'cards' | 'card' | void } */
@ -771,13 +772,13 @@ export class Game {
* @overload
* @param { Card } cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
/**
* @overload
* @param {Card[]} cards
* @param { 'toRenku' | false } [bool] 为false时不触发trigger'toRenku'时牌放到仁库
* @returns { import('../library/index.js').GameEventPromise }
* @returns { GameEventPromise }
*/
cardsGotoSpecial(cards, bool) {
/** @type { 'cards' | 'card' | void } */
@ -836,7 +837,7 @@ export class Game {
return next;
}
/**
* @param { import('../library/index.js').GameEventPromise } event
* @param { GameEventPromise } event
*/
$cardsGotoPile(event) {
const cards = event.cards;
@ -4651,8 +4652,8 @@ export class Game {
* @param { string } name
* @param { string } skill
* @param { Player } player
* @param { import('../library/index.js').GameEventPromise } event
* @returns { import('../library/index.js').GameEventPromise }
* @param { GameEventPromise } event
* @returns { GameEventPromise }
*/
createTrigger(name, skill, player, event, indexedData) {
let info = get.info(skill);
@ -4675,7 +4676,7 @@ export class Game {
*
* @param { string } name
* @param { false } [trigger]
* @param { import('../library/index.js').GameEventPromise } [triggerEvent]
* @param { GameEventPromise } [triggerEvent]
*/
createEvent(name, trigger, triggerEvent) {
const next = new lib.element.GameEvent(name, trigger).toPromise();
@ -5832,11 +5833,11 @@ export class Game {
*/
executingAsyncEventMap = new Map();
/**
* @type { import('../library/index.js').GameEventPromise[] }
* @type { GameEventPromise[] }
*/
belongAsyncEventList = [];
/**
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
* @param { GameEventPromise } [belongAsyncEvent]
*/
async loop(belongAsyncEvent) {
if (belongAsyncEvent) {
@ -6017,7 +6018,7 @@ export class Game {
}
}
/**
* @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent]
* @param { GameEventPromise } [belongAsyncEvent]
*/
runContent(belongAsyncEvent) {
return new Promise((resolve) => {
@ -6331,7 +6332,7 @@ export class Game {
return game.asyncDelay(time, time2);
}
/**
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { GameEventPromise } [event]
*/
check(event = _status.event) {
game.callHook("checkBegin", [event]);
@ -7486,20 +7487,21 @@ export class Game {
}
/**
* @param { Player[] } players
* @param { number | number[] | (player: Player) => number } num
* @param { number | number[] | (player: Player) => number } [num]
* @param { { drawDeck: boolean } } [drawDeck]
* @param { boolean } [bottom]
*/
asyncDraw(players, num, drawDeck, bottom) {
return players.forEach((value, index) => {
async asyncDraw(players, num, drawDeck, bottom) {
for (let index = 0; index < players.length; index++) {
const value = players[index];
let num2 = 1;
if (typeof num == "number") num2 = num;
else if (Array.isArray(num)) num2 = num[index];
else if (typeof num == "function") num2 = num(value);
if (drawDeck && drawDeck.drawDeck) value.draw(num2, false, drawDeck);
else if (bottom) value.draw(num2, "nodelay", "bottom");
else value.draw(num2, "nodelay");
});
if (drawDeck && drawDeck.drawDeck) await value.draw(num2, false, drawDeck);
else if (bottom) await value.draw(num2, "nodelay", "bottom");
else await value.draw(num2, "nodelay");
}
}
/**
* @param { Player[] } players
@ -7936,7 +7938,7 @@ export class Game {
* @param { Player } player
* @param { string | Card[] } card
* @param { Player[] } [targets]
* @param { import('../library/index.js').GameEventPromise } [event]
* @param { GameEventPromise } [event]
* @param { boolean } [forced]
* @param { string } [logvid]
*/

View File

@ -916,23 +916,32 @@ export class Get {
"[object Date]": true,
};
if (typeof obj !== "object" || obj === null || !canTranverse[getType(obj)]) return obj;
if (
typeof obj !== "object" ||
obj === null ||
!canTranverse[getType(obj)]
)
return obj;
// @ts-ignore
if (map.has(obj)) return map.get(obj);
const constructor = obj.constructor;
// @ts-ignore
// 这四类数据处理单独处理
// 实际上需要处理的只有Map和Set
// 除此之外的就只能祝愿有拷贝构造函数了
const target = constructor
? // 这四类数据处理单独处理
// 实际上需要处理的只有Map和Set
// 除此之外的就只能祝愿有拷贝构造函数了
Array.isArray(obj) || obj instanceof Map || obj instanceof Set || constructor === Object
? Array.isArray(obj) ||
obj instanceof Map ||
obj instanceof Set ||
constructor === Object
? // @ts-ignore
new constructor()
: constructor.name in window && /\[native code\]/.test(constructor.toString())
new constructor()
: constructor.name in window &&
/\[native code\]/.test(constructor.toString())
? // @ts-ignore
new constructor(obj)
new constructor(obj)
: obj
: Object.create(null);
if (target === obj) return target;
@ -959,7 +968,11 @@ export class Get {
if (obj.hasOwnProperty(key)) {
const result = { enumerable, configurable };
if (descriptor.hasOwnProperty("value")) {
result.value = get.copy(descriptor.value, copyKeyDeep, map);
result.value = get.copy(
descriptor.value,
copyKeyDeep,
map
);
result.writable = descriptor.writable;
} else {
const { get, set } = descriptor;

View File

@ -6,6 +6,7 @@ export class Button extends HTMLDivElement {
/**
* @type { string | undefined }
*/
// eslint-disable-next-line no-unreachable
buttonid;
/**
* @param {{}} item
@ -21,13 +22,26 @@ export class Button extends HTMLDivElement {
// @ts-ignore
[item, type, position, noClick, button] = other._args;
}
if (typeof type == "function") button = type(item, type, position, noClick, button);
if (typeof type == "function")
button = type(item, type, position, noClick, button);
else if (ui.create.buttonPresets[type])
button = ui.create.buttonPresets[type](item, type, position, noClick, button);
button = ui.create.buttonPresets[type](
item,
type,
position,
noClick,
button
);
if (button) {
Object.setPrototypeOf(button, (lib.element.Button || Button).prototype);
Object.setPrototypeOf(
button,
(lib.element.Button || Button).prototype
);
if (!noClick)
button.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.button);
button.addEventListener(
lib.config.touchscreen ? "touchend" : "click",
ui.click.button
);
else {
button.classList.add("noclick");
const intro = button.querySelector(".intro");

View File

@ -40,7 +40,10 @@ export class Card extends HTMLDivElement {
buildEventListener(info) {
let card = this;
if (info != "noclick") {
card.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.card);
card.addEventListener(
lib.config.touchscreen ? "touchend" : "click",
ui.click.card
);
if (lib.config.touchscreen) {
card.addEventListener("touchstart", ui.click.cardtouchstart);
card.addEventListener("touchmove", ui.click.cardtouchmove);
@ -75,6 +78,7 @@ export class Card extends HTMLDivElement {
if (!noclick) lib.setIntro(this);
}
/** @type { SMap<HTMLDivElement> } */
// eslint-disable-next-line no-unreachable
node;
/**
* @type { string }
@ -96,6 +100,10 @@ export class Card extends HTMLDivElement {
* @type { any[] }
*/
_uncheck;
/**
* @type { boolean }
*/
isCard;
//执行销毁一张牌的钩子函数
selfDestroy(event) {
if (this._selfDestroyed) return;
@ -192,7 +200,10 @@ export class Card extends HTMLDivElement {
}
removeGaintag(tag) {
if (tag === true) {
if ((this.gaintag && this.gaintag.length) || this.node.gaintag.innerHTML.length)
if (
(this.gaintag && this.gaintag.length) ||
this.node.gaintag.innerHTML.length
)
this.addGaintag([]);
} else if (this.hasGaintag(tag)) {
this.gaintag.remove(tag);
@ -260,7 +271,11 @@ export class Card extends HTMLDivElement {
this.number = parseInt(card[1]) || 0;
this.name = card[2];
if (info.destroy && typeof info.destroy != "boolean" && !lib.skill[info.destroy]) {
if (
info.destroy &&
typeof info.destroy != "boolean" &&
!lib.skill[info.destroy]
) {
this.destroyed = info.destroy;
}
@ -291,7 +306,21 @@ export class Card extends HTMLDivElement {
var cardnum = card[1] || "";
if (parseInt(cardnum) == cardnum) cardnum = parseInt(cardnum);
if (cardnum > 0 && cardnum < 14) {
cardnum = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"][cardnum - 1];
cardnum = [
"A",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"J",
"Q",
"K",
][cardnum - 1];
}
if (this.name) {
this.classList.remove("epic");
@ -338,14 +367,20 @@ export class Card extends HTMLDivElement {
this.classList.add("fullskin");
if (img) {
if (img.startsWith("ext:")) {
this.node.image.setBackgroundImage(img.replace(/^ext:/, "extension/"));
this.node.image.setBackgroundImage(
img.replace(/^ext:/, "extension/")
);
} else {
this.node.image.setBackgroundDB(img);
}
} else {
if (lib.card[bg].modeimage) {
this.node.image.setBackgroundImage(
"image/mode/" + lib.card[bg].modeimage + "/card/" + bg + ".png"
"image/mode/" +
lib.card[bg].modeimage +
"/card/" +
bg +
".png"
);
} else {
do {
@ -353,18 +388,29 @@ export class Card extends HTMLDivElement {
if (bg == "sha" && typeof nature == "string") {
let natures = get.natureList(nature),
_bg;
for (const n of natures) if (lib.natureBg.has(n)) _bg = n;
for (const n of natures)
if (lib.natureBg.has(n)) _bg = n;
if (_bg) {
this.node.image.setBackgroundImage(lib.natureBg.get(_bg));
this.node.image.setBackgroundImage(
lib.natureBg.get(_bg)
);
break;
}
}
this.node.image.setBackgroundImage("image/card/" + bg + ".png");
this.node.image.setBackgroundImage(
"image/card/" + bg + ".png"
);
} while (0);
}
}
} else if (get.dynamicVariable(lib.card[bg].image, this) == "background") {
if (card[3]) this.node.background.setBackground(bg + "_" + get.natureList(card[3])[0], "card");
} else if (
get.dynamicVariable(lib.card[bg].image, this) == "background"
) {
if (card[3])
this.node.background.setBackground(
bg + "_" + get.natureList(card[3])[0],
"card"
);
else this.node.background.setBackground(bg, "card");
} else if (lib.card[bg].fullimage) {
this.classList.add("fullimage");
@ -376,10 +422,19 @@ export class Card extends HTMLDivElement {
this.setBackgroundDB(img);
}
} else if (get.dynamicVariable(lib.card[bg].image, this)) {
if (get.dynamicVariable(lib.card[bg].image, this).startsWith("character:")) {
this.setBackground(get.dynamicVariable(lib.card[bg].image, this).slice(10), "character");
if (
get
.dynamicVariable(lib.card[bg].image, this)
.startsWith("character:")
) {
this.setBackground(
get.dynamicVariable(lib.card[bg].image, this).slice(10),
"character"
);
} else {
this.setBackground(get.dynamicVariable(lib.card[bg].image, this));
this.setBackground(
get.dynamicVariable(lib.card[bg].image, this)
);
}
} else {
var cardPack = lib.cardPack["mode_" + get.mode()];
@ -407,30 +462,44 @@ export class Card extends HTMLDivElement {
}
if (img) {
if (img.startsWith("ext:")) {
this.node.avatar.setBackgroundImage(img.replace(/^ext:/, "extension/"));
this.node.avatar.setBackgroundImage(
img.replace(/^ext:/, "extension/")
);
this.node.avatar.style.backgroundSize = "cover";
} else {
this.node.avatar.setBackgroundDB(img);
}
} else if (get.dynamicVariable(lib.card[bg].image, this)) {
if (get.dynamicVariable(lib.card[bg].image, this).startsWith("character:")) {
if (
get
.dynamicVariable(lib.card[bg].image, this)
.startsWith("character:")
) {
this.node.avatar.setBackground(
get.dynamicVariable(lib.card[bg].image, this).slice(10),
"character"
);
} else {
this.node.avatar.setBackground(get.dynamicVariable(lib.card[bg].image, this));
this.node.avatar.setBackground(
get.dynamicVariable(lib.card[bg].image, this)
);
}
} else {
var cardPack = lib.cardPack["mode_" + get.mode()];
if (Array.isArray(cardPack) && cardPack.includes(bg)) {
this.node.avatar.setBackground("mode/" + get.mode() + "/card/" + bg);
this.node.avatar.setBackground(
"mode/" + get.mode() + "/card/" + bg
);
} else {
this.node.avatar.setBackground("card/" + bg);
}
}
} else if (get.dynamicVariable(lib.card[bg].image, this) == "card") {
if (card[3]) this.setBackground(bg + "_" + get.natureList(card[3])[0], "card");
if (card[3])
this.setBackground(
bg + "_" + get.natureList(card[3])[0],
"card"
);
else this.setBackground(bg, "card");
} else if (
typeof get.dynamicVariable(lib.card[bg].image, this) == "string" &&
@ -444,13 +513,18 @@ export class Card extends HTMLDivElement {
this.setBackgroundDB(img);
}
} else {
this.setBackground(get.dynamicVariable(lib.card[bg].image, this));
this.setBackground(
get.dynamicVariable(lib.card[bg].image, this)
);
}
} else {
this.node.background.innerHTML =
lib.translate[bg + "_cbg"] || lib.translate[bg + "_bg"] || get.translation(bg)[0];
lib.translate[bg + "_cbg"] ||
lib.translate[bg + "_bg"] ||
get.translation(bg)[0];
// this.node.background.style.fontFamily=lib.config.card_font;
if (this.node.background.innerHTML.length > 1) this.node.background.classList.add("tight");
if (this.node.background.innerHTML.length > 1)
this.node.background.classList.add("tight");
else this.node.background.classList.remove("tight");
}
if (!lib.card[bg].fullborder && this.node.avatar && this.node.framebg) {
@ -502,7 +576,10 @@ export class Card extends HTMLDivElement {
let natures = get.natureList(nature);
natures.sort(lib.sort.nature);
for (let nature of natures) {
name += lib.translate["nature_" + nature] || lib.translate[nature] || "";
name +=
lib.translate["nature_" + nature] ||
lib.translate[nature] ||
"";
if (nature != "stab") this.node.image.classList.add(nature);
}
}
@ -515,7 +592,8 @@ export class Card extends HTMLDivElement {
this.node.name.classList.add("longlong");
}
}
this.node.name2.innerHTML = get.translation(card[0]) + cardnum + " " + name;
this.node.name2.innerHTML =
get.translation(card[0]) + cardnum + " " + name;
this.classList.add("card");
if (card[3]) {
let natures = get.natureList(card[3]);
@ -539,7 +617,8 @@ export class Card extends HTMLDivElement {
var dist = lib.card[this.name].distance;
if (dist.attackFrom) {
added = true;
this.node.range.innerHTML = "范围: " + (-dist.attackFrom + 1);
this.node.range.innerHTML =
"范围: " + (-dist.attackFrom + 1);
}
}
if (!added) {
@ -548,13 +627,15 @@ export class Card extends HTMLDivElement {
break;
case "equip3":
if (info.distance && info.distance.globalTo) {
this.node.range.innerHTML = "防御: " + info.distance.globalTo;
this.node.range.innerHTML =
"防御: " + info.distance.globalTo;
this.node.name2.innerHTML += "+";
}
break;
case "equip4":
if (info.distance && info.distance.globalFrom) {
this.node.range.innerHTML = "进攻: " + -info.distance.globalFrom;
this.node.range.innerHTML =
"进攻: " + -info.distance.globalFrom;
this.node.name2.innerHTML += "-";
}
break;
@ -608,7 +689,8 @@ export class Card extends HTMLDivElement {
game.layout == "nova")
) {
if (bool) {
this.style.transform = this._transform + " translateY(-20px)";
this.style.transform =
this._transform + " translateY(-20px)";
} else {
this.style.transform = this._transform || "";
}
@ -659,12 +741,16 @@ export class Card extends HTMLDivElement {
let owner = get.owner(this);
if (owner) {
if (owner == player) return true; //是牌主,必知情。
if (player.hasSkillTag("viewHandcard", null, owner, true)) return true; //有viewHandcard标签必知情。
if (player.hasSkillTag("viewHandcard", null, owner, true))
return true; //有viewHandcard标签必知情。
if (owner.isUnderControl(true, player)) return true; //被操控,必知情。
}
if (get.is.shownCard(this)) return true; //此牌是明置牌,必知情。
if (this._knowers) {
return this._knowers.includes("everyone") || this._knowers.includes(player.playerid);
return (
this._knowers.includes("everyone") ||
this._knowers.includes(player.playerid)
);
}
return false;
}
@ -702,8 +788,13 @@ export class Card extends HTMLDivElement {
this.style.left = this.offsetLeft + "px";
this.style.top = this.offsetTop + "px";
dx = player.getLeft() + player.offsetWidth / 2 - 52 - this.offsetLeft;
dy = player.getTop() + player.offsetHeight / 2 - 52 - this.offsetTop;
dx =
player.getLeft() +
player.offsetWidth / 2 -
52 -
this.offsetLeft;
dy =
player.getTop() + player.offsetHeight / 2 - 52 - this.offsetTop;
}
if (get.is.mobileMe(player)) {
dx += get.cardOffset();
@ -753,8 +844,10 @@ export class Card extends HTMLDivElement {
var clone = true;
var position;
for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == "string") node.classList.add(arguments[i]);
else if (["div", "fragment"].includes(get.objtype(arguments[i]))) position = arguments[i];
if (typeof arguments[i] == "string")
node.classList.add(arguments[i]);
else if (["div", "fragment"].includes(get.objtype(arguments[i])))
position = arguments[i];
else if (typeof arguments[i] == "boolean") clone = arguments[i];
}
node.moveTo = lib.element.Card.prototype.moveTo;
@ -780,7 +873,9 @@ export class Card extends HTMLDivElement {
* @returns {boolean} 是否包含class
*/
classListContains(className) {
return Array.from(arguments).some((name) => this.classList.contains(className));
return Array.from(arguments).some((name) =>
this.classList.contains(className)
);
}
/**
* 判断此牌是否包含class样式参数有多个时需全部满足
@ -790,7 +885,9 @@ export class Card extends HTMLDivElement {
* @returns {boolean} 是否包含class
*/
classListContainsAll() {
return Array.from(arguments).every((name) => this.classList.contains(this.className));
return Array.from(arguments).every((name) =>
this.classList.contains(this.className)
);
}
/**
* 返回一个键值用于在缓存中作为键名
@ -809,7 +906,9 @@ export class Card extends HTMLDivElement {
if (bool === false) {
ui.cardPile.insertBefore(
this,
ui.cardPile.childNodes[Math.floor(Math.random() * ui.cardPile.childNodes.length)]
ui.cardPile.childNodes[
Math.floor(Math.random() * ui.cardPile.childNodes.length)
]
);
} else {
if (_status.discarded) {

View File

@ -5,6 +5,7 @@ import { ui } from "../../ui/index.js";
export class Dialog extends HTMLDivElement {
/** @type { HTMLDivElement } */
// eslint-disable-next-line no-unreachable
contentContainer;
/** @type { HTMLDivElement } */
content;
@ -51,7 +52,8 @@ export class Dialog extends HTMLDivElement {
else dialog.add(argument);
});
//if (!hidden) dialog.open();
if (!lib.config.touchscreen) dialog.contentContainer.onscroll = ui.update;
if (!lib.config.touchscreen)
dialog.contentContainer.onscroll = ui.update;
if (!noTouchScroll) {
dialog.contentContainer.ontouchstart = ui.click.dialogtouchStart;
dialog.contentContainer.ontouchmove = ui.click.touchScroll;
@ -98,21 +100,27 @@ export class Dialog extends HTMLDivElement {
const buttons = ui.create.div(".buttons", this.content);
if (zoom) buttons.classList.add("smallzoom");
// @ts-ignore
this.buttons = this.buttons.concat(ui.create.buttons(item, "card", buttons, noclick));
this.buttons = this.buttons.concat(
ui.create.buttons(item, "card", buttons, noclick)
);
}
// @ts-ignore
else if (get.itemtype(item) == "players") {
var buttons = ui.create.div(".buttons", this.content);
if (zoom) buttons.classList.add("smallzoom");
// @ts-ignore
this.buttons = this.buttons.concat(ui.create.buttons(item, "player", buttons, noclick));
this.buttons = this.buttons.concat(
ui.create.buttons(item, "player", buttons, noclick)
);
} else if (item[1] == "textbutton") {
ui.create.textbuttons(item[0], this, noclick);
} else {
var buttons = ui.create.div(".buttons", this.content);
if (zoom) buttons.classList.add("smallzoom");
// @ts-ignore
this.buttons = this.buttons.concat(ui.create.buttons(item[0], item[1], buttons, noclick));
this.buttons = this.buttons.concat(
ui.create.buttons(item[0], item[1], buttons, noclick)
);
}
if (this.buttons.length) {
if (this.forcebutton !== false) this.forcebutton = true;
@ -166,10 +174,19 @@ export class Dialog extends HTMLDivElement {
}
ui.dialog = this;
let translate;
if (lib.config.remember_dialog && lib.config.dialog_transform && !this.classList.contains("fixed")) {
if (
lib.config.remember_dialog &&
lib.config.dialog_transform &&
!this.classList.contains("fixed")
) {
translate = lib.config.dialog_transform;
this._dragtransform = translate;
this.style.transform = "translate(" + translate[0] + "px," + translate[1] + "px) scale(0.8)";
this.style.transform =
"translate(" +
translate[0] +
"px," +
translate[1] +
"px) scale(0.8)";
} else {
this.style.transform = "scale(0.8)";
}
@ -179,8 +196,17 @@ export class Dialog extends HTMLDivElement {
ui.dialogs.unshift(this);
ui.update();
ui.refresh(this);
if (lib.config.remember_dialog && lib.config.dialog_transform && !this.classList.contains("fixed")) {
this.style.transform = "translate(" + translate[0] + "px," + translate[1] + "px) scale(1)";
if (
lib.config.remember_dialog &&
lib.config.dialog_transform &&
!this.classList.contains("fixed")
) {
this.style.transform =
"translate(" +
translate[0] +
"px," +
translate[1] +
"px) scale(1)";
} else {
this.style.transform = "scale(1)";
}

View File

@ -67,37 +67,30 @@ export class GameEvent {
/**
* @type { Player }
*/
// @ts-ignore
source;
/**
* @type { Player }
*/
// @ts-ignore
player;
/**
* @type { Player[] }
*/
// @ts-ignore
players;
/**
* @type { Player }
*/
// @ts-ignore
target;
/**
* @type { Player[] }
*/
// @ts-ignore
targets;
/**
* @type { Card }
*/
// @ts-ignore
card;
/**
* @type { Card[] }
*/
// @ts-ignore
cards;
/**
* @type { string }
@ -114,7 +107,6 @@ export class GameEvent {
/**
* @type { GameEvent }
*/
// @ts-ignore
_trigger;
/**
* @type { Result }
@ -123,61 +115,79 @@ export class GameEvent {
/**
* @type { number }
*/
// @ts-ignore
baseDamage;
/**
* @type { Player }
*/
// @ts-ignore
customSource;
/**
* @type { number }
*/
// @ts-ignore
extraDamage;
/**
* @type { string }
*/
// @ts-ignore
nature;
/**
* @type { boolean }
*/
// @ts-ignore
notrigger;
/**
* @type { number }
*/
// @ts-ignore
original_num;
/**
* @type { boolean }
*/
// @ts-ignore
unreal;
/**
* @type { Button[] }
*/
// @ts-ignore
excludeButton;
/**
* @type { Result }
*/
// @ts-ignore
result;
/**
* @type { GameEventPromise | void | null }
*/
// @ts-ignore
parent;
/**
* @type { string }
*/
name;
/**
* @type { Function | void | null }
* @type { (this: GameEventPromise) => any | undefined | void | null }
*/
filterStop;
/**
* @type { Result['cost_data'] }
*/
cost_data;
/**
* @type { boolean }
*/
responded;
/**
* @type { string | undefined }
*/
judgestr;
/**
* @type { boolean }
*/
judging;
/**
* @type { Function | undefined }
*/
judge2;
/**
* @type { Card[] }
*/
orderingCards;
/**
* @type { Function | undefined }
*/
ai;
/**
* @param {keyof this} key
* @param {number} [value]

View File

@ -1,3 +1,17 @@
/**
* @typedef { {
* useCard: GameEventPromise[],
* respond: GameEventPromise[],
* skipped: GameEventPromise[],
* lose: GameEventPromise[],
* gain: GameEventPromise[],
* sourceDamage: GameEventPromise[],
* damage: GameEventPromise[],
* custom: GameEventPromise[],
* useSkill: GameEventPromise[],
* }} ActionHistory
*/
import { ai } from "../../ai/index.js";
import { get } from "../../get/index.js";
import { game } from "../../game/index.js";
@ -165,6 +179,7 @@ export class Player extends HTMLDivElement {
}
}
/** @type { SMap<HTMLDivElement> } */
// eslint-disable-next-line no-unreachable
node;
/**
* @type { number }
@ -223,17 +238,7 @@ export class Player extends HTMLDivElement {
*/
stat;
/**
* @type { {
* useCard: GameEventPromise[],
* respond: GameEventPromise[],
* skipped: GameEventPromise[],
* lose: GameEventPromise[],
* gain: GameEventPromise[],
* sourceDamage: GameEventPromise[],
* damage: GameEventPromise[],
* custom: GameEventPromise[],
* useSkill: GameEventPromise[],
* }[] }
* @type { ActionHistory[] }
*/
actionHistory;
/**
@ -261,7 +266,8 @@ export class Player extends HTMLDivElement {
* friend: [],
* enemy: [],
* neutral: [],
* handcards: {
* shown?: number,
* handcards?: {
* global: [],
* source: [],
* viewed: []
@ -341,6 +347,18 @@ export class Player extends HTMLDivElement {
* @type { ((player: this) => any)[] }
*/
_inits;
/**
* @type { boolean }
*/
isZhu;
/**
* @type { string }
*/
identity;
/**
* @type { boolean | undefined }
*/
identityShown;
//新函数
/**
* 怒气
@ -1401,7 +1419,7 @@ export class Player extends HTMLDivElement {
/**
* 向target发起协力
* @param { Player } target
* @param {*} type
* @param { string } type
* @param {*} reason
*/
cooperationWith(target, type, reason) {
@ -2022,6 +2040,7 @@ export class Player extends HTMLDivElement {
/**
* @param { string } name
* @param { string } type
* @returns { boolean }
*/
hasUsableCard(name, type) {
if (typeof type !== "string") type = type ? "limit" : "all";
@ -3697,6 +3716,12 @@ export class Player extends HTMLDivElement {
if (num == undefined) return 0;
return num;
}
/**
* @param {*} [unowned]
* @param {*} [unique]
* @param {*} [hidden]
* @returns { string[] }
*/
getStockSkills(unowned, unique, hidden) {
var list = [];
if (lib.character[this.name] && (hidden || !this.isUnseen(0))) {
@ -3841,6 +3866,11 @@ export class Player extends HTMLDivElement {
getDiscardableCards(player, arg1, arg2) {
return Array.from(this.iterableGetDiscardableCards(player, arg1, arg2));
}
/**
* @param {Parameters<lib['filter']['canBeGained']>[1]} player
* @param {Parameters<this['iterableGetCards']>[0]} arg1
* @param {Parameters<this['iterableGetCards']>[1]} arg2
*/
*iterableGetGainableCards(player, arg1, arg2) {
for (let card of this.iterableGetCards(arg1, arg2)) {
if (lib.filter.canBeGained(card, player, this)) {
@ -3848,6 +3878,12 @@ export class Player extends HTMLDivElement {
}
}
}
/**
*
* @param {Parameters<this['iterableGetGainableCards']>[0]} player
* @param {Parameters<this['iterableGetGainableCards']>[1]} [arg1]
* @param {Parameters<this['iterableGetGainableCards']>[2]} [arg2]
*/
getGainableCards(player, arg1, arg2) {
return Array.from(this.iterableGetGainableCards(player, arg1, arg2));
}
@ -3859,6 +3895,10 @@ export class Player extends HTMLDivElement {
}
return list;
}
/**
* @param { Parameters<typeof this['iterableGetCards']>[0] } [arg1]
* @param { Parameters<typeof this['iterableGetCards']>[1] } [arg2]
*/
countCards(arg1, arg2) {
let count = 0;
for (let item of this.iterableGetCards(arg1, arg2)) {
@ -3882,6 +3922,11 @@ export class Player extends HTMLDivElement {
countDiscardableCards(player, arg1, arg2) {
return this.getDiscardableCards(player, arg1, arg2).length;
}
/**
* @param {Parameters<this['getGainableCards']>[0]} player
* @param {Parameters<this['getGainableCards']>[1]} [arg1]
* @param {Parameters<this['getGainableCards']>[2]} [arg2]
*/
countGainableCards(player, arg1, arg2) {
return this.getGainableCards(player, arg1, arg2).length;
}
@ -3905,6 +3950,11 @@ export class Player extends HTMLDivElement {
skills.sort((a, b) => get.priority(a) - get.priority(b));
return skills;
}
/**
* @param { string | boolean | null } [arg2]
* @param { boolean | null} [arg3]
* @param {boolean} [arg4]
*/
getSkills(arg2, arg3, arg4) {
var skills = this.skills.slice(0);
var es = [];
@ -5780,7 +5830,12 @@ export class Player extends HTMLDivElement {
);
return this;
}
gainMultiple(targets, position) {
/**
*
* @param { Player[] } targets
* @param { string } [position]
*/
gainMultiple(targets, position = "h") {
var next = game.createEvent("gainMultiple", false);
next.setContent("gainMultiple");
next.player = this;
@ -5944,6 +5999,12 @@ export class Player extends HTMLDivElement {
next.gaintag = [];
return next;
}
/**
*
* @param { Card | Card[] } cards
* @param { Player } target
* @param { boolean } [visible]
*/
give(cards, target, visible) {
var next = target.gain(cards, this);
next.animate = visible ? "give" : "giveAuto";
@ -6135,6 +6196,9 @@ export class Player extends HTMLDivElement {
next.setContent("doubleDraw");
return next;
}
/**
* @param { number } [num]
*/
loseHp(num) {
var next = game.createEvent("loseHp");
next.num = num;
@ -6786,6 +6850,12 @@ export class Player extends HTMLDivElement {
}
if (typeof proceed == "function") proceed();
}
/**
* @param { string | string[] } name
* @param { Player | Player[] } [targets]
* @param { boolean | string } [nature]
* @param { boolean } [logv]
*/
logSkill(name, targets, nature, logv) {
if (get.itemtype(targets) == "player") targets = [targets];
var nopop = false;
@ -6979,7 +7049,13 @@ export class Player extends HTMLDivElement {
node.classList.add(className);
}
}
popup(name, className, nobroadcast) {
/**
*
* @param { string } name
* @param { string } className
* @param { Parameters<this["damagepop"]>[3] } [nobroadcast]
*/
popup(name, className = "water", nobroadcast) {
var name2 = get.translation(name);
if (!name2) return;
this.$damagepop(name2, className || "water", true, nobroadcast);
@ -7402,6 +7478,13 @@ export class Player extends HTMLDivElement {
this.classList.remove("linked");
}
}
/**
* @param { string | Card | VCard } card
* @param { Player } target
* @param { boolean } [distance]
* @param { GameEventPromise | boolean } [includecard]
* @returns { boolean }
*/
canUse(card, target, distance, includecard) {
if (typeof card == "string") card = { name: card, isCard: true };
var info = get.info(card);
@ -8246,6 +8329,18 @@ export class Player extends HTMLDivElement {
}
});
}
/**
* @overload
* @param { string } skill
* @param { SkillTrigger | string } [expire]
* @param { boolean } [checkConflict]
*/
/**
* @overload
* @param { string[] } skill
* @param { SkillTrigger } [expire]
* @param { boolean } [checkConflict]
*/
addTempSkill(skill, expire, checkConflict) {
if (Array.isArray(skill)) {
for (var i = 0; i < skill.length; i++) {
@ -8416,6 +8511,18 @@ export class Player extends HTMLDivElement {
}
return evts;
}
/**
* @overload
* @returns { ActionHistory }
*/
/**
* @template { keyof ActionHistory } T
* @overload
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { ActionHistory[T] }
*/
getHistory(key, filter, last) {
if (!key) return this.actionHistory[this.actionHistory.length - 1];
if (!filter) return this.actionHistory[this.actionHistory.length - 1][key];
@ -8431,6 +8538,12 @@ export class Player extends HTMLDivElement {
return history.filter(filter);
}
}
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
*/
checkHistory(key, filter, last) {
if (!key || !filter) return;
else {
@ -8446,7 +8559,14 @@ export class Player extends HTMLDivElement {
}
}
}
hasHistory(key, filter, last) {
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { boolean }
*/
hasHistory(key, filter = lib.filter.all, last) {
const history = this.getHistory(key);
if (!filter || typeof filter != "function") filter = lib.filter.all;
if (last) {
@ -8458,6 +8578,14 @@ export class Player extends HTMLDivElement {
}
return history.some(filter);
}
/**
* @template { keyof ActionHistory } T
* @overload
* @param { T } [key]
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { null | ActionHistory[T] | boolean }
*/
getLastHistory(key, filter, last) {
let history = false;
for (let i = this.actionHistory.length - 1; i >= 0; i--) {
@ -8480,6 +8608,12 @@ export class Player extends HTMLDivElement {
return history.filter(filter);
}
}
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
*/
checkAllHistory(key, filter, last) {
if (!key || !filter) return;
this.actionHistory.forEach((value) => {
@ -8495,6 +8629,13 @@ export class Player extends HTMLDivElement {
}
});
}
/**
* @template { keyof ActionHistory } T
* @param { T } [key]
* @param { (event: GameEventPromise) => boolean } [filter]
* @param { GameEventPromise } [last]
* @returns { ActionHistory[T] }
*/
getAllHistory(key, filter, last) {
const history = [];
this.actionHistory.forEach((value) => {
@ -8516,6 +8657,13 @@ export class Player extends HTMLDivElement {
}
return history;
}
/**
* @template { keyof ActionHistory } T
* @param { T } key
* @param { (event: GameEventPromise) => boolean } filter
* @param { GameEventPromise } [last]
* @returns { boolean }
*/
hasAllHistory(key, filter, last) {
return this.actionHistory.some((value) => {
let history = value[key];
@ -9095,6 +9243,12 @@ export class Player extends HTMLDivElement {
}
return false;
}
/**
*
* @param { number | Card[] | Card } [add]
* @param { (card?: Card, player?: Player) => boolean } [filter]
* @param { boolean } [pure]
*/
needsToDiscard(add, filter, pure) {
/**
* add: (逻辑上)同时考虑获得的这张/些牌
@ -9123,9 +9277,23 @@ export class Player extends HTMLDivElement {
distanceFrom(target, method) {
return get.distance(target, this, method);
}
/**
* @param { string } skill
* @param { Parameters<this['getSkills']>[0] } arg2
* @param { Parameters<this['getSkills']>[1] } arg3
* @param { Parameters<this['getSkills']>[2] } arg4
* @returns { boolean }
*/
hasSkill(skill, arg2, arg3, arg4) {
return game.expandSkills(this.getSkills(arg2, arg3, arg4)).includes(skill);
}
/**
* @param { string } skill
* @param { Parameters<this['getStockSkills']>[0] } arg1
* @param { Parameters<this['getStockSkills']>[1] } arg2
* @param { Parameters<this['getStockSkills']>[2] } arg3
* @returns { boolean }
*/
hasStockSkill(skill, arg1, arg2, arg3) {
return game.expandSkills(this.getStockSkills(arg1, arg2, arg3)).includes(skill);
}
@ -9152,6 +9320,11 @@ export class Player extends HTMLDivElement {
}
return false;
}
/**
*
* @param {string} skill
* @param {Player} [player]
*/
hasZhuSkill(skill, player) {
if (!this.hasSkill(skill)) return false;
if (player) {
@ -9186,6 +9359,12 @@ export class Player extends HTMLDivElement {
}
return false;
}
/**
* @param {string} tag
* @param {Parameters<this['getSkills']>[0]} hidden
* @param {Parameters<SkillAI['skillTagFilter']>[2]} arg
* @param {boolean} [globalskill]
*/
hasSkillTag(tag, hidden, arg, globalskill) {
var skills = this.getSkills(hidden);
if (globalskill) {
@ -9280,6 +9459,11 @@ export class Player extends HTMLDivElement {
}
return false;
}
/**
*
* @param {string|boolean} [respond]
* @param {boolean} [noauto]
*/
hasSha(respond, noauto) {
if (this.countCards("hs", "sha")) return true;
if (this.countCards("hs", "hufu")) return true;
@ -10847,7 +11031,14 @@ export class Player extends HTMLDivElement {
avatar ? 1600 : 1000
);
}
$damagepop(num, nature, font, nobroadcast) {
/**
*
* @param { number | string } num
* @param { string } [nature]
* @param { boolean } [font]
* @param { boolean } [nobroadcast]
*/
$damagepop(num, nature = "soil", font, nobroadcast) {
if (typeof num == "number" || typeof num == "string") {
game.addVideo("damagepop", this, [num, nature, font]);
if (nobroadcast !== false)

File diff suppressed because it is too large Load Diff

View File

@ -439,11 +439,11 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
* @param { (value: T) => Promise<boolean> } predicate
*/
const asyncFilter = async (arr, predicate) => {
//将arr每10个分为一个数组分别使用Promise.all
//将arr每20个分为一个数组分别使用Promise.all
/** @type { boolean[] } */
const results = [];
for (let i = 0; i < arr.length; i += 10) {
const pushArr = arr.slice(i, i + 10);
for (let i = 0; i < arr.length; i += 20) {
const pushArr = arr.slice(i, i + 20);
results.push(
...await Promise.all(pushArr.map(predicate))
);
@ -453,8 +453,11 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
const result = await asyncFilter(files.flat(), async v => {
return game.promises.readFile(v.path).then(data => {
// 有设置就不进行对比直接返回false
if (lib.config.asset_notReplaceExistingFiles) return false;
return v.size != data.byteLength;
}).catch(()=>true)
// 报错了就是没有文件
}).catch(() => true);
}).then(arr => arr.map((v) => v.path));
console.log("需要更新的文件有:", result);
@ -463,6 +466,22 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
await lib.init.promises.js("game", "asset");
if (Array.isArray(window.noname_asset_list)) {
game.saveConfig("asset_version", window.noname_asset_list[0]);
try {
// 动态更新素材版本显示
if (
li2 instanceof HTMLLIElement &&
li2.childNodes[0] &&
// nodeType = 3为text
li2.childNodes[0].nodeType === 3 &&
li2.childNodes[0].textContent.startsWith(
"素材版本"
)
) {
li2.childNodes[0].textContent = `素材版本:${window.noname_asset_list[0]}`;
}
} catch (error) {
console.error("动态更新素材版本显示失败:", error);
}
delete window.noname_asset_list;
}
if (confirm("更新完成,是否重启?")) {
@ -655,7 +674,9 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
if (!this.classList.toggle("on")) {
game.saveConfig("asset_toggle_off", true);
[
/* span2, span2_br, span2_check,*/
span7,
span7_br,
span7_check,
span3,
span3_br,
span3_check,
@ -674,7 +695,9 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
} else {
game.saveConfig("asset_toggle_off");
[
/* span2, span2_br, span2_check,*/
span7,
span7_br,
span7_check,
span3,
span3_br,
span3_check,
@ -699,6 +722,23 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM
// li2.lastChild.appendChild(span6_br);
// var span2_br = ui.create.node('br');
var span7 = ui.create.div("", `不替换已有素材`);
span7.style.fontSize = "small";
span7.style.lineHeight = "16px";
li2.lastChild.appendChild(span7);
var span7_check = document.createElement("input");
span7_check.type = "checkbox";
span7_check.style.marginLeft = "5px";
if (lib.config.asset_notReplaceExistingFiles) {
span7_check.checked = true;
}
span7_check.onchange = function () {
game.saveConfig("asset_notReplaceExistingFiles", this.checked);
};
li2.lastChild.appendChild(span7_check);
var span7_br = ui.create.node("br");
li2.lastChild.appendChild(span7_br);
var span4 = ui.create.div("", `字体素材(${lib.config.asset_font_size || "23.4MB"}`);
span4.style.fontSize = "small";
span4.style.lineHeight = "16px";

View File

@ -136,6 +136,14 @@ export class UI {
* @type {HTMLDivElement}
*/
tempnowuxie;
/**
* @type {HTMLDivElement[]}
*/
toastQueue = [];
* @type {HTMLDivElement}
*/
cardPile;
refresh(node) {
void window.getComputedStyle(node, null).getPropertyValue("opacity");
}