优化代码提示
This commit is contained in:
parent
931c9a5dda
commit
5b445350be
|
@ -4537,7 +4537,7 @@ export class Game extends Uninstantable {
|
||||||
*
|
*
|
||||||
* @param { string } name
|
* @param { string } name
|
||||||
* @param { false } [trigger]
|
* @param { false } [trigger]
|
||||||
* @param { import('../library/index.js').GameEventPromise } triggerEvent
|
* @param { import('../library/index.js').GameEventPromise } [triggerEvent]
|
||||||
*/
|
*/
|
||||||
static createEvent(name, trigger, triggerEvent) {
|
static createEvent(name, trigger, triggerEvent) {
|
||||||
const next = (new lib.element.GameEvent(name, trigger)).toPromise();
|
const next = (new lib.element.GameEvent(name, trigger)).toPromise();
|
||||||
|
@ -4783,7 +4783,7 @@ export class Game extends Uninstantable {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param { string } skill
|
* @param { string } skill
|
||||||
* @param { import('../library/index.js').Player } player
|
* @param { import('../library/index.js').Player } [player]
|
||||||
*/
|
*/
|
||||||
static addGlobalSkill(skill, player) {
|
static addGlobalSkill(skill, player) {
|
||||||
let info = lib.skill[skill];
|
let info = lib.skill[skill];
|
||||||
|
@ -5701,10 +5701,10 @@ export class Game extends Uninstantable {
|
||||||
}
|
}
|
||||||
if (event.next.length > 0) {
|
if (event.next.length > 0) {
|
||||||
var next = event.next.shift();
|
var next = event.next.shift();
|
||||||
if (next.player && next.player.skipList.contains(next.name)) {
|
if (next.player && next.player.skipList.includes(next.name)) {
|
||||||
event.trigger(next.name + 'Skipped');
|
event.trigger(next.name + 'Skipped');
|
||||||
next.player.skipList.remove(next.name);
|
next.player.skipList.remove(next.name);
|
||||||
if (lib.phaseName.contains(next.name)) next.player.getHistory('skipped').add(next.name);
|
if (lib.phaseName.includes(next.name)) next.player.getHistory('skipped').add(next.name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
next.parent = event;
|
next.parent = event;
|
||||||
|
@ -5868,6 +5868,7 @@ export class Game extends Uninstantable {
|
||||||
};
|
};
|
||||||
|
|
||||||
run(event).then(() => {
|
run(event).then(() => {
|
||||||
|
// 其实这个if几乎一定执行了
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
||||||
event.finish();
|
event.finish();
|
||||||
|
@ -5909,6 +5910,7 @@ export class Game extends Uninstantable {
|
||||||
else if (event.content instanceof AsyncFunction) {
|
else if (event.content instanceof AsyncFunction) {
|
||||||
// _status,lib,game,ui,get,ai六个变量由game.import提供
|
// _status,lib,game,ui,get,ai六个变量由game.import提供
|
||||||
event.content(event, trigger, player).then(() => {
|
event.content(event, trigger, player).then(() => {
|
||||||
|
// 其实这个if几乎一定执行了
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
||||||
event.finish();
|
event.finish();
|
||||||
|
@ -7711,7 +7713,7 @@ export class Game extends Uninstantable {
|
||||||
Object.keys(lib.skill).forEach(value => game.finishSkill(value));
|
Object.keys(lib.skill).forEach(value => game.finishSkill(value));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 这玩意至少19中重载了吧
|
* 这玩意至少19种重载了吧
|
||||||
*/
|
*/
|
||||||
static checkMod() {
|
static checkMod() {
|
||||||
const argumentArray = Array.from(arguments), name = argumentArray[argumentArray.length - 2];
|
const argumentArray = Array.from(arguments), name = argumentArray[argumentArray.length - 2];
|
||||||
|
|
|
@ -9,8 +9,8 @@ import { GNC as gnc } from '../gnc/index.js';
|
||||||
export class Is extends Uninstantable {
|
export class Is extends Uninstantable {
|
||||||
/**
|
/**
|
||||||
* 判断是否为进攻坐骑
|
* 判断是否为进攻坐骑
|
||||||
* @param {Card | VCard} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
static attackingMount(card, player) {
|
static attackingMount(card, player) {
|
||||||
|
@ -25,8 +25,8 @@ export class Is extends Uninstantable {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 判断是否为防御坐骑
|
* 判断是否为防御坐骑
|
||||||
* @param {Card | VCard} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
static defendingMount(card, player) {
|
static defendingMount(card, player) {
|
||||||
|
@ -257,14 +257,14 @@ export class Is extends Uninstantable {
|
||||||
};
|
};
|
||||||
configs[name] = item;
|
configs[name] = item;
|
||||||
if (!configs.phonelayout) return false;
|
if (!configs.phonelayout) return false;
|
||||||
if (configs.show_round_menu && menus.contains(configs.round_menu_func)) {
|
if (configs.show_round_menu && menus.includes(configs.round_menu_func)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (configs.touchscreen) {
|
if (configs.touchscreen) {
|
||||||
if (menus.contains(configs.swipe_up)) return false;
|
if (menus.includes(configs.swipe_up)) return false;
|
||||||
if (menus.contains(configs.swipe_down)) return false;
|
if (menus.includes(configs.swipe_down)) return false;
|
||||||
if (menus.contains(configs.swipe_left)) return false;
|
if (menus.includes(configs.swipe_left)) return false;
|
||||||
if (menus.contains(configs.swipe_right)) return false;
|
if (menus.includes(configs.swipe_right)) return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (configs.right_click == 'config') return false;
|
if (configs.right_click == 'config') return false;
|
||||||
|
@ -1131,7 +1131,7 @@ export class Get extends Uninstantable {
|
||||||
for (var i in lib.cardPile) {
|
for (var i in lib.cardPile) {
|
||||||
for (var j = 0; j < lib.cardPile[i].length; j++) {
|
for (var j = 0; j < lib.cardPile[i].length; j++) {
|
||||||
var info = lib.cardPile[i][j];
|
var info = lib.cardPile[i][j];
|
||||||
if (lib.inpile.contains(info[2]) && get.type(info[2]) == type) {
|
if (lib.inpile.includes(info[2]) && get.type(info[2]) == type) {
|
||||||
list.push({
|
list.push({
|
||||||
name: info[2],
|
name: info[2],
|
||||||
suit: info[0],
|
suit: info[0],
|
||||||
|
@ -1273,7 +1273,7 @@ export class Get extends Uninstantable {
|
||||||
var pack = lib.characterPack[lib.configOL.characterPack[i]];
|
var pack = lib.characterPack[lib.configOL.characterPack[i]];
|
||||||
for (var j in pack) {
|
for (var j in pack) {
|
||||||
if (typeof func == 'function' && func(j)) continue;
|
if (typeof func == 'function' && func(j)) continue;
|
||||||
if (lib.connectBanned.contains(j)) continue;
|
if (lib.connectBanned.includes(j)) continue;
|
||||||
if (lib.character[j]) libCharacter[j] = pack[j];
|
if (lib.character[j]) libCharacter[j] = pack[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1954,8 +1954,8 @@ export class Get extends Uninstantable {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {Card | VCard} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static name(card, player) {
|
static name(card, player) {
|
||||||
|
@ -1968,8 +1968,8 @@ export class Get extends Uninstantable {
|
||||||
return card.name;
|
return card.name;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {Card | VCard | Card[] | VCard[]} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard | Card[] | VCard[]} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static suit(card, player) {
|
static suit(card, player) {
|
||||||
|
@ -1988,13 +1988,13 @@ export class Get extends Uninstantable {
|
||||||
return game.checkMod(card, owner, game.checkMod(card, card.suit, 'suit', owner), 'cardsuit', owner);
|
return game.checkMod(card, owner, game.checkMod(card, card.suit, 'suit', owner), 'cardsuit', owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lib.suits.contains(card.suit)) return card.suit;
|
if (lib.suits.includes(card.suit)) return card.suit;
|
||||||
return 'none';
|
return 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {Card | VCard | Card[] | VCard[]} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard | Card[] | VCard[]} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static color(card, player) {
|
static color(card, player) {
|
||||||
|
@ -2022,8 +2022,8 @@ export class Get extends Uninstantable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {Card | VCard} card
|
* @param {import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {number}
|
* @returns {number}
|
||||||
*/
|
*/
|
||||||
static number(card, player) {
|
static number(card, player) {
|
||||||
|
@ -2047,8 +2047,8 @@ export class Get extends Uninstantable {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder`
|
* 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder`
|
||||||
* @param {string | string[] | Card | VCard} card
|
* @param {string | string[] | import("../library/index.js").Card | import("../library/index.js").VCard} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
static nature(card, player) {
|
static nature(card, player) {
|
||||||
|
@ -2066,7 +2066,7 @@ export class Get extends Uninstantable {
|
||||||
/**
|
/**
|
||||||
* 返回包含所有属性的数组
|
* 返回包含所有属性的数组
|
||||||
* @param {string[] | string} card
|
* @param {string[] | string} card
|
||||||
* @param {false | Player} [player]
|
* @param {false | import("../library/index.js").Player} [player]
|
||||||
* @returns {string[]}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
static natureList(card, player) {
|
static natureList(card, player) {
|
||||||
|
@ -4539,12 +4539,12 @@ export class Get extends Uninstantable {
|
||||||
if (!isLink && get.tag(card, 'natureDamage') && !zerotarget) {
|
if (!isLink && get.tag(card, 'natureDamage') && !zerotarget) {
|
||||||
var info = get.info(card);
|
var info = get.info(card);
|
||||||
if (!info || !info.ai || !info.ai.canLink) {
|
if (!info || !info.ai || !info.ai.canLink) {
|
||||||
if (target.isLinked()) game.countPlayer(function (current) {
|
if (target.isLinked()) game.players.forEach(function (current) {
|
||||||
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (info.ai.canLink(player, target, card)) {
|
else if (info.ai.canLink(player, target, card)) {
|
||||||
game.countPlayer(function (current) {
|
game.players.forEach(function (current) {
|
||||||
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4713,12 +4713,12 @@ export class Get extends Uninstantable {
|
||||||
if (!isLink && get.tag(card, 'natureDamage') && !zerotarget) {
|
if (!isLink && get.tag(card, 'natureDamage') && !zerotarget) {
|
||||||
var info = get.info(card);
|
var info = get.info(card);
|
||||||
if (!info || !info.ai || !info.ai.canLink) {
|
if (!info || !info.ai || !info.ai.canLink) {
|
||||||
if (target.isLinked()) game.countPlayer(function (current) {
|
if (target.isLinked()) game.players.forEach(function (current) {
|
||||||
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (info.ai.canLink(player, target, card)) {
|
else if (info.ai.canLink(player, target, card)) {
|
||||||
game.countPlayer(function (current) {
|
game.players.forEach(function (current) {
|
||||||
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4764,7 +4764,7 @@ export class Get extends Uninstantable {
|
||||||
var card = button.link;
|
var card = button.link;
|
||||||
var player = get.owner(card);
|
var player = get.owner(card);
|
||||||
if (!player) player = _status.event.player;
|
if (!player) player = _status.event.player;
|
||||||
if (player.getCards('j').contains(card)) {
|
if (player.getCards('j').includes(card)) {
|
||||||
var efff = get.effect(player, {
|
var efff = get.effect(player, {
|
||||||
name: card.viewAs || card.name,
|
name: card.viewAs || card.name,
|
||||||
cards: [card],
|
cards: [card],
|
||||||
|
@ -4773,7 +4773,7 @@ export class Get extends Uninstantable {
|
||||||
if (efff == 0) return 0;
|
if (efff == 0) return 0;
|
||||||
return -1.5;
|
return -1.5;
|
||||||
}
|
}
|
||||||
if (player.getCards('e').contains(card)) {
|
if (player.getCards('e').includes(card)) {
|
||||||
var evalue = get.value(card, player);
|
var evalue = get.value(card, player);
|
||||||
if (player.hasSkillTag('noe')) {
|
if (player.hasSkillTag('noe')) {
|
||||||
if (evalue >= 7) {
|
if (evalue >= 7) {
|
||||||
|
|
|
@ -8,27 +8,28 @@ import { UI as ui } from '../../ui/index.js';
|
||||||
export class Button extends HTMLDivElement {
|
export class Button extends HTMLDivElement {
|
||||||
/**
|
/**
|
||||||
* @param {{}} item
|
* @param {{}} item
|
||||||
* @param {keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: typeof Button) => typeof Button)} type
|
* @param {keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button)} type
|
||||||
* @param {HTMLDivElement|DocumentFragment} [position]
|
* @param {HTMLDivElement|DocumentFragment} [position]
|
||||||
* @param {true} [noClick]
|
* @param {true} [noClick]
|
||||||
* @param { typeof Button } [button]
|
* @param { Button } [button]
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
constructor(item, type, position, noClick, button) {
|
constructor(item, type, position, noClick, button) {
|
||||||
if (ui.create.buttonPresets[type]) button = ui.create.buttonPresets[type](item, type, position, noClick, button);
|
if (typeof type == 'function') button = type(item, type, position, noClick, button);
|
||||||
else 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);
|
||||||
|
if (button) {
|
||||||
Object.setPrototypeOf(button, Button.prototype);
|
Object.setPrototypeOf(button, Button.prototype);
|
||||||
// @ts-ignore
|
|
||||||
if (!noClick) button.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.button);
|
if (!noClick) button.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.button);
|
||||||
else {
|
else {
|
||||||
// @ts-ignore
|
|
||||||
button.classList.add('noclick');
|
button.classList.add('noclick');
|
||||||
// @ts-ignore
|
|
||||||
const intro = button.querySelector('.intro');
|
const intro = button.querySelector('.intro');
|
||||||
if (intro) intro.remove();
|
if (intro) intro.remove();
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
|
||||||
return button;
|
return button;
|
||||||
|
} else {
|
||||||
|
console.error([item, type, position, noClick, button]);
|
||||||
|
throw 'button不合法';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exclude() {
|
exclude() {
|
||||||
if (_status.event.excludeButton == undefined) {
|
if (_status.event.excludeButton == undefined) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { UI as ui } from '../../ui/index.js';
|
||||||
import { AsyncFunction } from '../../util/index.js';
|
import { AsyncFunction } from '../../util/index.js';
|
||||||
|
|
||||||
export class GameEvent {
|
export class GameEvent {
|
||||||
/** @type { import('./gameEventPromise.js').default } */
|
/** @type { import('../index.js').GameEventPromise } */
|
||||||
#promise;
|
#promise;
|
||||||
/**
|
/**
|
||||||
* @param {string} [name]
|
* @param {string} [name]
|
||||||
|
@ -26,11 +26,11 @@ export class GameEvent {
|
||||||
this.step = 0;
|
this.step = 0;
|
||||||
this.finished = false;
|
this.finished = false;
|
||||||
/**
|
/**
|
||||||
* @type {(import('./GameEventPromise.js').default)[]}
|
* @type {(import('../index.js').GameEventPromise)[]}
|
||||||
*/
|
*/
|
||||||
this.next = [];
|
this.next = [];
|
||||||
/**
|
/**
|
||||||
* @type {(import('./GameEventPromise.js').default)[]}
|
* @type {(import('../index.js').GameEventPromise)[]}
|
||||||
*/
|
*/
|
||||||
this.after = [];
|
this.after = [];
|
||||||
this.custom = {
|
this.custom = {
|
||||||
|
|
|
@ -37,8 +37,7 @@ export class GameEventPromise extends Promise {
|
||||||
}
|
}
|
||||||
#event;
|
#event;
|
||||||
/**
|
/**
|
||||||
* @param { import('./gameEvent.js').default } event
|
* @param { import('./gameEvent.js').GameEvent } event
|
||||||
* @returns { Promise<import('./gameEvent.js').default> & import('./gameEvent.js').default }
|
|
||||||
*/
|
*/
|
||||||
constructor(event) {
|
constructor(event) {
|
||||||
super(resolve => {
|
super(resolve => {
|
||||||
|
|
|
@ -1400,13 +1400,19 @@ export class Player extends HTMLDivElement {
|
||||||
inRangeOf(source) {
|
inRangeOf(source) {
|
||||||
return source.inRange(this);
|
return source.inRange(this);
|
||||||
}
|
}
|
||||||
//Get the player's HP not less than 0. Set “raw” to true to get the player's raw HP instead.
|
/**
|
||||||
//获取角色的体力值。设置“raw”为true以获取角色的体力。
|
* Get the player's HP not less than 0. Set “raw” to true to get the player's raw HP instead.
|
||||||
|
*
|
||||||
|
* 获取角色的体力值。设置“raw”为true以获取角色的体力。
|
||||||
|
*/
|
||||||
getHp(raw) {
|
getHp(raw) {
|
||||||
return raw ? this.hp : Math.max(0, this.hp);
|
return raw ? this.hp : Math.max(0, this.hp);
|
||||||
}
|
}
|
||||||
//Set “raw” to true to get the player's raw damaged HP instead.
|
/**
|
||||||
//设置“raw”为true以获取角色已损失的体力。
|
* Set “raw” to true to get the player's raw damaged HP instead.
|
||||||
|
*
|
||||||
|
* 设置“raw”为true以获取角色已损失的体力。
|
||||||
|
*/
|
||||||
getDamagedHp(raw) {
|
getDamagedHp(raw) {
|
||||||
return this.maxHp - this.getHp(raw);
|
return this.maxHp - this.getHp(raw);
|
||||||
}
|
}
|
||||||
|
@ -2701,8 +2707,8 @@ export class Player extends HTMLDivElement {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {string} [arg1='h']
|
* @param {string} [arg1='h']
|
||||||
* @param {string | Record<string, any> | (card: Card) => boolean} [arg2]
|
* @param {string | Record<string, any> | ((card: import('../index.js').Card) => boolean)} [arg2]
|
||||||
* @returns {Card[]}
|
* @returns {import('../index.js').Card[]}
|
||||||
*/
|
*/
|
||||||
getCards(arg1, arg2) {
|
getCards(arg1, arg2) {
|
||||||
if (typeof arg1 != 'string') {
|
if (typeof arg1 != 'string') {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { UI as ui } from '../../ui/index.js';
|
||||||
export class VCard {
|
export class VCard {
|
||||||
/**
|
/**
|
||||||
* @param {any} [suitOrCard]
|
* @param {any} [suitOrCard]
|
||||||
* @param {number | Card[]} [numberOrCards]
|
* @param {number | import('./card.js').Card[]} [numberOrCards]
|
||||||
* @param {string} [name]
|
* @param {string} [name]
|
||||||
* @param {string} [nature]
|
* @param {string} [nature]
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@ export class VCard {
|
||||||
*/
|
*/
|
||||||
this.nature = suitOrCard[3];
|
this.nature = suitOrCard[3];
|
||||||
}
|
}
|
||||||
|
// @ts-ignore
|
||||||
else if (get.itemtype(suitOrCard) == 'card') {
|
else if (get.itemtype(suitOrCard) == 'card') {
|
||||||
this.name = get.name(suitOrCard);
|
this.name = get.name(suitOrCard);
|
||||||
this.suit = get.suit(suitOrCard);
|
this.suit = get.suit(suitOrCard);
|
||||||
|
@ -54,6 +55,10 @@ export class VCard {
|
||||||
}
|
}
|
||||||
else if (suitOrCard && typeof suitOrCard != 'string') {
|
else if (suitOrCard && typeof suitOrCard != 'string') {
|
||||||
Object.keys(suitOrCard).forEach(key => {
|
Object.keys(suitOrCard).forEach(key => {
|
||||||
|
/**
|
||||||
|
* @type { PropertyDescriptor }
|
||||||
|
*/
|
||||||
|
// @ts-ignore
|
||||||
const propertyDescriptor = Object.getOwnPropertyDescriptor(suitOrCard, key), value = propertyDescriptor.value;
|
const propertyDescriptor = Object.getOwnPropertyDescriptor(suitOrCard, key), value = propertyDescriptor.value;
|
||||||
if (Array.isArray(value)) this[key] = value.slice();
|
if (Array.isArray(value)) this[key] = value.slice();
|
||||||
else Object.defineProperty(this, key, propertyDescriptor);
|
else Object.defineProperty(this, key, propertyDescriptor);
|
||||||
|
@ -61,7 +66,7 @@ export class VCard {
|
||||||
if (Array.isArray(numberOrCards)) {
|
if (Array.isArray(numberOrCards)) {
|
||||||
const noCards = !this.cards;
|
const noCards = !this.cards;
|
||||||
/**
|
/**
|
||||||
* @type {Card[]}
|
* @type {import('./card.js').Card[]}
|
||||||
*/
|
*/
|
||||||
this.cards = numberOrCards.slice();
|
this.cards = numberOrCards.slice();
|
||||||
if (noCards) {
|
if (noCards) {
|
||||||
|
|
|
@ -9590,6 +9590,9 @@ class Create extends Uninstantable {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
static buttonPresets = {
|
static buttonPresets = {
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
tdnodes: (item, type, position, noclick, node) => {
|
tdnodes: (item, type, position, noclick, node) => {
|
||||||
node = ui.create.div('.shadowed.reduce_radius.pointerdiv.tdnode.tdnodes', position);
|
node = ui.create.div('.shadowed.reduce_radius.pointerdiv.tdnode.tdnodes', position);
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
|
@ -9602,11 +9605,17 @@ class Create extends Uninstantable {
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
blank: (item, type, position, noclick, node) => {
|
blank: (item, type, position, noclick, node) => {
|
||||||
node = ui.create.div('.button.card', position);
|
node = ui.create.div('.button.card', position);
|
||||||
node.link = item;
|
node.link = item;
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
card: (item, type, position, noclick, node) => {
|
card: (item, type, position, noclick, node) => {
|
||||||
if (typeof item.copy == 'function') {
|
if (typeof item.copy == 'function') {
|
||||||
node = item.copy(false);
|
node = item.copy(false);
|
||||||
|
@ -9636,6 +9645,9 @@ class Create extends Uninstantable {
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
vcard: (item, type, position, noclick, node) => {
|
vcard: (item, type, position, noclick, node) => {
|
||||||
if (typeof item == 'string') {
|
if (typeof item == 'string') {
|
||||||
item = [get.type(item), '', item];
|
item = [get.type(item), '', item];
|
||||||
|
@ -9646,6 +9658,9 @@ class Create extends Uninstantable {
|
||||||
node.link = item;
|
node.link = item;
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
character: (item, type, position, noclick, node) => {
|
character: (item, type, position, noclick, node) => {
|
||||||
if (node) {
|
if (node) {
|
||||||
node.classList.add('button');
|
node.classList.add('button');
|
||||||
|
@ -9790,9 +9805,15 @@ class Create extends Uninstantable {
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
characterx: (item, type, position, noclick, node) => {
|
characterx: (item, type, position, noclick, node) => {
|
||||||
return ui.create.buttonPresets.character(item, type, position, noclick, node);
|
return ui.create.buttonPresets.character(item, type, position, noclick, node);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* @returns { import("../library/index.js").Button }
|
||||||
|
*/
|
||||||
player: (item, type, position, noclick, node) => {
|
player: (item, type, position, noclick, node) => {
|
||||||
if (node) {
|
if (node) {
|
||||||
node.classList.add('button');
|
node.classList.add('button');
|
||||||
|
|
Loading…
Reference in New Issue