!current.isOut());
+ return players;
+ }
+ static position(card, ordering) {
+ if (get.itemtype(card) == "player") return parseInt(card.dataset.position);
+ if (card.timeout && card.destiny && card.destiny.classList) {
+ if (card.destiny.classList.contains("equips")) return "e";
+ if (card.destiny.classList.contains("judges")) return "j";
+ if (card.destiny.classList.contains("expansions")) return "x";
+ if (card.destiny.classList.contains("handcards")) return card.classList.contains("glows") ? "s" : "h";
+ if (card.destiny.id == "cardPile") return "c";
+ if (card.destiny.id == "discardPile") return "d";
+ if (card.destiny.id == "special") return "s";
+ if (card.destiny.id == "ordering") return ordering ? "o" : "d";
+ return null;
+ }
+ if (!card.parentNode || !card.parentNode.classList) return;
+ if (card.parentNode.classList.contains("equips")) return "e";
+ if (card.parentNode.classList.contains("judges")) return "j";
+ if (card.parentNode.classList.contains("expansions")) return "x";
+ if (card.parentNode.classList.contains("handcards")) return card.classList.contains("glows") ? "s" : "h";
+ if (card.parentNode.id == "cardPile") return "c";
+ if (card.parentNode.id == "discardPile") return "d";
+ if (card.parentNode.id == "special") return "s";
+ if (card.parentNode.id == "ordering") return ordering ? "o" : "d";
+ return null;
+ }
+ static skillTranslation(str, player) {
+ var str2;
+ if (str.startsWith("re")) {
+ str2 = str.slice(2);
+ if (str2) {
+ if (lib.translate[str] == lib.translate[str2]) {
+ if (player.hasSkill(str2)) {
+ return "界" + lib.translate[str];
+ }
+ }
+ }
+ }
+ else if (str.startsWith("xin")) {
+ str2 = str.slice(3);
+ if (str2) {
+ if (lib.translate[str] == lib.translate[str2]) {
+ if (player.hasSkill(str2)) {
+ return "新" + lib.translate[str];
+ }
+ }
+ }
+ }
+ return get.translation(str);
+ }
+ static skillInfoTranslation(name, player) {
+ if (player && lib.dynamicTranslate[name]) return lib.dynamicTranslate[name](player, name);
+ var str = lib.translate[name + "_info"];
+ if (!str) return "";
+ return str;
+ }
/**
* @returns {string}
@@ -117,4 +2052,2384 @@ export class Get {
}
return "";
}
+ static strNumber(num) {
+ switch (num) {
+ case 1: return "A";
+ case 11: return "J";
+ case 12: return "Q";
+ case 13: return "K";
+ default: return num.toString();
+ }
+ }
+ static cnNumber(num, two) {
+ if (num == Infinity) return "∞";
+ if (typeof num != "number" && typeof num != "string") return num;
+ if (isNaN(num)) return "";
+ let numStr = num.toString();
+ if (!/^\d+$/.test(numStr)) return num;
+
+ const chars = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
+ const units = ["", "十", "百", "千"];
+
+ if (numStr.length <= 2) {//两位数以下单独处理保证效率
+ if (numStr.length == 1) return !two && num == 2 ? "两" : chars[num];
+ return (numStr[0] == "1" ? "" : chars[numStr[0]]) + "十" + (numStr[1] == "0" ? "" : chars[numStr[1]]);
+ }
+
+ numStr = numStr.replace(/(?=(\d{4})+$)/g, ",").split(",").filter(Boolean);
+ const handleZero = str => str.replace(/零{2,}/g, "零").replace(/零+$/g, "");
+ const _transform = str => {
+ if (str === "0000") return "零";
+ if (!two && str === "2") return "两";
+ let result = "";
+ for (let i = 0; i < str.length; i++) {
+ let char = chars[+str[i]];
+ const unitIndex = str.length - 1 - i;
+ let unit = units[unitIndex];
+ if (!two && char === "二" && unitIndex > 1) char = "两";
+ if (char === "零") unit = "";
+ result += char + unit;
+ }
+ result = handleZero(result);
+ return result;
+ }
+ let result = "";
+ for (let i = 0; i < numStr.length; i++) {
+ const part = numStr[i];
+ let char = _transform(part);
+ const unitIndex = numStr.length - 1 - i;
+ let unit = unitIndex % 2 ? "万" : "亿".repeat(unitIndex / 2);
+ if (char === "零") unit = "";
+ result += char + unit;
+ }
+ result = handleZero(result);
+ return result;
+ }
+ static selectableButtons(sort) {
+ if (!_status.event.player) return [];
+ var buttons = _status.event.dialog.buttons;
+ var selectable = [];
+ for (var i = 0; i < buttons.length; i++) {
+ if (buttons[i].classList.contains("selectable") &&
+ buttons[i].classList.contains("selected") == false) {
+ selectable.push(buttons[i]);
+ }
+ }
+ if (sort) {
+ selectable.sort(sort);
+ }
+ return selectable;
+ }
+ static selectableCards(sort) {
+ if (!_status.event.player) return [];
+ var cards = _status.event.player.getCards("hes");
+ var selectable = [];
+ for (var i = 0; i < cards.length; i++) {
+ if (cards[i].classList.contains("selectable") &&
+ cards[i].classList.contains("selected") == false) {
+ selectable.push(cards[i]);
+ }
+ }
+ if (sort) {
+ selectable.sort(sort);
+ }
+ return selectable;
+ }
+ static skills() {
+ var skills = [];
+ if (ui.skills) {
+ skills = skills.concat(ui.skills.skills);
+ }
+ if (ui.skills2) {
+ skills = skills.concat(ui.skills2.skills);
+ }
+ if (ui.skills3) {
+ skills = skills.concat(ui.skills3.skills);
+ }
+ return skills;
+ }
+ static gainableSkills(func, player) {
+ var list = [];
+ for (var i in lib.character) {
+ if (lib.filter.characterDisabled(i)) continue;
+ if (lib.filter.characterDisabled2(i)) continue;
+ if (lib.character[i][4]) {
+ if (lib.character[i][4].contains("boss")) continue;
+ if (lib.character[i][4].contains("hiddenboss")) continue;
+ if (lib.character[i][4].contains("minskin")) continue;
+ if (lib.character[i][4].contains("unseen")) continue;
+ }
+ for (var j = 0; j < lib.character[i][3].length; j++) {
+ var skill = lib.character[i][3][j];
+ var info = lib.skill[skill];
+ if (lib.filter.skillDisabled(skill)) continue;
+ if (func && !func(info, skill, i)) continue;
+ if (player && player.hasSkill && info.ai && info.ai.combo && !player.hasSkill(info.ai.combo)) continue;
+ list.add(skill);
+ }
+ }
+ return list;
+ }
+ static gainableSkillsName(name, func) {
+ var list = [];
+ if (name && lib.character[name]) {
+ if (lib.character[name][4]) {
+ if (lib.character[name][4].contains("boss")) return list;
+ if (lib.character[name][4].contains("hiddenboss")) return list;
+ if (lib.character[name][4].contains("minskin")) return list;
+ if (lib.character[name][4].contains("unseen")) return list;
+ }
+ for (var j = 0; j < lib.character[name][3].length; j++) {
+ var skill = lib.character[name][3][j];
+ var info = lib.skill[skill];
+ if (lib.filter.skillDisabled(skill)) continue;
+ if (func && !func(info, skill, name)) continue;
+ list.add(skill);
+ }
+ }
+ return list;
+ }
+ static gainableCharacters(func) {
+ var list = [];
+ for (var i in lib.character) {
+ var info = lib.character[i];
+ if (!info) continue;
+ if (typeof func == "function" && !func(info, i)) continue;
+ if (lib.filter.characterDisabled(i)) continue;
+ if (lib.filter.characterDisabled2(i)) continue;
+ list.push(i);
+ }
+ if (func === true) {
+ var players = game.players.concat(game.dead);
+ for (var i = 0; i < players.length; i++) {
+ list.remove(players[i].name);
+ list.remove(players[i].name1);
+ list.remove(players[i].name2);
+ }
+ }
+ return list;
+ }
+ static selectableTargets(sort) {
+ var selectable = [];
+ var players = game.players.slice(0);
+ if (_status.event.deadTarget) players.addArray(game.dead);
+ for (var i = 0; i < players.length; i++) {
+ if (players[i].classList.contains("selectable") &&
+ players[i].classList.contains("selected") == false) {
+ selectable.push(players[i]);
+ }
+ }
+ selectable.randomSort();
+ if (sort) {
+ selectable.sort(sort);
+ }
+ return selectable;
+ }
+ static filter(filter, i) {
+ if (typeof filter == "function") return filter;
+ if (i == undefined) i = 0;
+ var result = function () {
+ if (filter == arguments[i]) return true;
+ for (var j in filter) {
+ if (Object.prototype.hasOwnProperty.call(filter, j)) {
+ if (get.itemtype(arguments[i]) == "card") {
+ if (j == "name") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.name(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.name(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (j == "type") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.type(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.type(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (j == "subtype") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.subtype(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.subtype(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (j == "color") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.color(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.color(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (j == "suit") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.suit(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.suit(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (j == "number") {
+ if (Array.isArray(filter[j])) {
+ if (filter[j].contains(get.number(arguments[i])) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (get.number(arguments[i]) != filter[j]) return false;
+ }
+ }
+ else if (Array.isArray(filter[j])) {
+ if (filter[j].contains(arguments[i][j]) == false) return false;
+ }
+ else if (typeof filter[j] == "string") {
+ if (arguments[i][j] != filter[j]) return false;
+ }
+ }
+ else {
+ if (arguments[i][j] != filter[j]) return false;
+ }
+ }
+ }
+ return true;
+ }
+ result._filter_args = [filter, i];
+ return result;
+ }
+ static cardCount(card, player) {
+ var num;
+ if (player == undefined) player = _status.event.player;
+ if (card == true) {
+ num = 0;
+ var stat = player.getStat("card");
+ for (var i in stat) {
+ if (typeof stat[i] == "number") num += stat[i];
+ }
+ return num;
+ }
+ if (typeof card == "object") {
+ card = card.name;
+ }
+ num = player.getStat("card")[card];
+ if (num == undefined) return 0;
+ return num;
+ }
+ static skillCount(skill, player) {
+ if (player == undefined) player = _status.event.player;
+ var num = player.getStat("skill")[skill];
+ if (num == undefined) return 0;
+ return num;
+ }
+ static owner(card, method) {
+ return game.players.concat(game.dead).find(current => current.getCards("hejsx").includes(card) || (current.judging[0] == card && method != "judge"));
+ }
+ static noSelected() {
+ return ui.selected.buttons.length + ui.selected.cards.length + ui.selected.targets.length == 0;
+ }
+ static population(identity) {
+ return identity == undefined ? game.players.length + game.dead.length : game.players.filter(current => current.identity == identity).length;
+ }
+ static totalPopulation(identity) {
+ return identity == undefined ? game.players.length + game.dead.length : game.players.concat(game.dead).filter(current => current.identity == identity).length;
+ }
+ static cardtag(item, tag) {
+ return (item.cardid && (get.itemtype(item) == "card" || !item.cards || !item.cards.length || item.name == item.cards[0].name) && _status.cardtag && _status.cardtag[tag] && _status.cardtag[tag].contains(item.cardid)) || (item.cardtags && item.cardtags.contains(tag));
+ }
+ static tag(item, tag, item2, bool) {
+ var result;
+ if (get.info(item, bool) && get.info(item, bool).ai && get.info(item, bool).ai.tag) {
+ result = get.info(item, bool).ai.tag[tag];
+ }
+ if (typeof result == "function") return result(item, item2);
+ return result;
+ }
+ static sortCard(sort) {
+ var func;
+ if (sort == "type_sort") {
+ func = function (card) {
+ var type = get.type(card, null, false);
+ var subtype = get.subtype(card, false);
+ if (lib.cardType[subtype]) {
+ return lib.cardType[subtype];
+ }
+ if (lib.cardType[type]) {
+ return lib.cardType[type];
+ }
+ switch (type) {
+ case "basic": return 2;
+ case "chess": return 1.5;
+ case "trick": return -1;
+ case "delay": return -2;
+ case "equip": return -3;
+ default: return -4;
+ }
+ }
+ }
+ else if (sort == "suit_sort") {
+ func = function (card) {
+ if (get.suit(card) == "heart") return 2;
+ if (get.suit(card) == "diamond") return 1;
+ if (get.suit(card) == "spade") return -1;
+ if (get.suit(card) == "club") return -2;
+ }
+ }
+ else if (sort == "number_sort") {
+ func = function (card) {
+ return get.number(card) - 7 + 0.5;
+ }
+ }
+ return func;
+ }
+ static difficulty() {
+ switch (get.config("difficulty")) {
+ case "easy": return 1;
+ case "normal": return 2;
+ case "hard": return 3;
+ default: return 1;
+ }
+ }
+ static cardPile(name, create) {
+ var filter = function (card) {
+ if (typeof name == "string") {
+ if (card.name == name) {
+ return true;
+ }
+ }
+ else if (typeof name == "function") {
+ if (name(card)) {
+ return true;
+ }
+ }
+ return false;
+ };
+ if (create != "discardPile") {
+ var num = get.rand(0, ui.cardPile.childNodes.length - 1);
+ for (var i = 0; i < ui.cardPile.childNodes.length; i++) {
+ var j = i;
+ if (j >= ui.cardPile.childNodes.length) j -= ui.cardPile.childNodes.length;
+ if (filter(ui.cardPile.childNodes[j])) {
+ return ui.cardPile.childNodes[j];
+ }
+ }
+ }
+ if (create != "cardPile") {
+ for (var i = 0; i < ui.discardPile.childNodes.length; i++) {
+ var j = i;
+ if (j >= ui.discardPile.childNodes.length) j -= ui.discardPile.childNodes.length;
+ if (filter(ui.discardPile.childNodes[j])) {
+ return ui.discardPile.childNodes[j];
+ }
+ }
+ }
+ if (create == "field") {
+ var found = null;
+ game.findPlayer(function (current) {
+ var ej = current.getCards("ej");
+ for (var i = 0; i < ej.length; i++) {
+ if (filter(ej[i])) {
+ found = ej[i];
+ return true;
+ }
+ }
+ });
+ return found;
+ }
+ if (create && !["cardPile", "discardPile", "field"].contains(create)) {
+ return game.createCard(name);
+ }
+ return null;
+ }
+ static cardPile2(name) {
+ return get.cardPile(name, "cardPile");
+ }
+ static discardPile(name) {
+ return get.cardPile(name, "discardPile");
+ }
+ static aiStrategy() {
+ switch (get.config("ai_strategy")) {
+ case "ai_strategy_1": return 1;
+ case "ai_strategy_2": return 2;
+ case "ai_strategy_3": return 3;
+ case "ai_strategy_4": return 4;
+ case "ai_strategy_5": return 5;
+ case "ai_strategy_6": return 6;
+ default: return 1;
+ }
+ }
+ static skillintro(name, learn, learn2) {
+ var str = "";
+ var infoitem = lib.character[name];
+ if (!infoitem) {
+ for (var itemx in lib.characterPack) {
+ if (lib.characterPack[itemx][name]) {
+ infoitem = lib.characterPack[itemx][name]; break;
+ }
+ }
+ }
+ var skills = infoitem[3];
+ var opacity;
+ for (var i = 0; i < skills.length; i++) {
+ if (lib.translate[skills[i]] && lib.translate[skills[i] + "_info"] && lib.skill[skills[i]]) {
+ if (learn && lib.skill[skills[i]].unique && (learn2 || !lib.skill[skills[i]].gainable)) {
+ opacity = "opacity:0.5";
+ }
+ else {
+ opacity = "";
+ }
+ var skilltrans = get.translation(skills[i]).slice(0, 2);
+ str += `【${skilltrans}】
${get.skillInfoTranslation(skills[i])}
`;
+ }
+ }
+ return str;
+ }
+ static intro(name) {
+ var info = lib.character[name];
+ var str = "性别:" + get.translation(info[0]) + "
";
+ str += "势力:" + get.translation(info[1]) + "
";
+ str += "体力:" + get.translation(info[2]) + "
";
+ str += "技能:";
+ if (info[3].length) {
+ str += get.translation(info[3][0]);
+ for (var i = 1; i < info[3].length; i++) {
+ str += "、" + get.translation(info[3][i]);
+ }
+ }
+ return str;
+ }
+ static storageintro(type, content, player, dialog, skill) {
+ switch (type) {
+ case "mark": {
+ if (content > 0) {
+ return "共有" + content + "个标记";
+ }
+ return false;
+ }
+ case "turn": {
+ if (content > 0) {
+ return "剩余" + content + "个回合";
+ }
+ return false;
+ }
+ case "time": {
+ if (content > 0) {
+ return "剩余" + content + "次";
+ }
+ return false;
+ }
+ case "limited": {
+ if (content) {
+ return "已发动";
+ }
+ return "未发动";
+ }
+ case "info": {
+ return lib.translate[skill + "_info"];
+ }
+ case "cardCount": {
+ if (Array.isArray(content)) {
+ return "共有" + get.cnNumber(content.length) + "张牌";
+ }
+ return false;
+ }
+ case "expansion": {
+ content = player.getCards("x", function (card) {
+ return card.hasGaintag(skill);
+ });
+ if (dialog && content.length) {
+ dialog.addAuto(content);
+ }
+ else {
+ return "没有卡牌";
+ }
+ return false;
+ }
+ case "card": case "cards": {
+ if (get.itemtype(content) == "card") {
+ content = [content];
+ }
+ if (dialog && get.itemtype(content) == "cards") {
+ dialog.addAuto(content);
+ }
+ else {
+ if (content && content.length) {
+ return get.translation(content);
+ }
+ }
+ if (Array.isArray(content) && !content.length) {
+ return "没有卡牌";
+ }
+ return false;
+ }
+ case "player": case "players": {
+ if (get.itemtype(content) == "player") {
+ content = [content];
+ }
+ if (dialog && get.itemtype(content) == "players") {
+ dialog.addAuto(content);
+ return false;
+ }
+ else {
+ if (content && content.length) {
+ return get.translation(content);
+ }
+ return false;
+ }
+ }
+ case "character": case "characters": {
+ if (typeof content == "string") {
+ content = [content];
+ }
+ if (dialog && Array.isArray(content)) {
+ dialog.addAuto([content, "character"]);
+ return false;
+ }
+ else {
+ if (content && content.length) {
+ return get.translation(content);
+ }
+ return false;
+ }
+ }
+ default: {
+ if (typeof type == "string") {
+ type = type.replace(/#/g, content);
+ type = type.replace(/&/g, get.cnNumber(content));
+ type = type.replace(/\$/g, get.translation(content));
+ return type;
+ }
+ else if (typeof type == "function") {
+ return type(content, player, skill);
+ }
+ return false;
+ }
+ }
+ }
+ static nodeintro(node, simple, evt) {
+ var uiintro = ui.create.dialog("hidden", "notouchscroll");
+ if (node.classList.contains("player") && !node.name) {
+ return uiintro;
+ }
+ var i, translation, intro, str;
+ if (node._nointro) return;
+ if (typeof node._customintro == "function") {
+ if (node._customintro(uiintro, evt) === false) return;
+ if (evt) lib.placePoppedDialog(uiintro, evt);
+ }
+ else if (Array.isArray(node._customintro)) {
+ var caption = node._customintro[0];
+ var content = node._customintro[1];
+ if (typeof caption == "function") {
+ caption = caption(node);
+ }
+ if (typeof content == "function") {
+ content = content(node);
+ }
+ uiintro.add(caption);
+ uiintro.add(`${content}
`);
+ }
+ else if (node.classList.contains("player") || node.linkplayer) {
+ if (node.linkplayer) {
+ node = node.link;
+ }
+ let capt = get.translation(node.name);
+ const characterInfo = get.character(node.name), sex = node.sex || characterInfo[0];
+ if (sex && sex != "unknown" && lib.config.show_sex) capt += ` ${sex == "none" ? "无" : get.translation(sex)}`;
+ const group = node.group;
+ if (group && group != "unknown" && lib.config.show_group) capt += ` ${get.translation(group)}`;
+ uiintro.add(capt);
+
+ if (lib.characterTitle[node.name]) {
+ uiintro.addText(get.colorspan(lib.characterTitle[node.name]));
+ }
+
+ if (!node.noclick) {
+ const allShown = (node.isUnderControl() || (!game.observe && game.me && game.me.hasSkillTag("viewHandcard", null, node, true)));
+ const shownHs = node.getShownCards();
+ if (shownHs.length) {
+ uiintro.add(`明置的手牌
`);
+ uiintro.addSmall(shownHs);
+ if (allShown) {
+ var hs = node.getCards("h");
+ hs.removeArray(shownHs)
+ if (hs.length) {
+ uiintro.add(`其他手牌
`);
+ uiintro.addSmall(hs);
+ }
+ }
+ }
+ else if (allShown) {
+ var hs = node.getCards("h");
+ if (hs.length) {
+ uiintro.add(`手牌
`);
+ uiintro.addSmall(hs);
+ }
+ }
+ }
+
+ var skills = node.getSkills(null, false, false).slice(0);
+ var skills2 = game.filterSkills(skills, node);
+ if (node == game.me && node.hiddenSkills.length) {
+ skills.addArray(node.hiddenSkills);
+ }
+ for (var i in node.disabledSkills) {
+ if (node.disabledSkills[i].length == 1 &&
+ node.disabledSkills[i][0] == i + "_awake" &&
+ !node.hiddenSkills.contains(i)) {
+ skills.add(i);
+ }
+ }
+ for (i = 0; i < skills.length; i++) {
+ if (lib.skill[skills[i]] && (lib.skill[skills[i]].nopop || lib.skill[skills[i]].equipSkill)) continue;
+ if (lib.translate[skills[i] + "_info"]) {
+ if (lib.translate[skills[i] + "_ab"]) translation = lib.translate[skills[i] + "_ab"];
+ else {
+ translation = get.translation(skills[i]);
+ if (!lib.skill[skills[i]].nobracket) translation = translation.slice(0, 2);
+ }
+
+ if (node.forbiddenSkills[skills[i]]) {
+ var forbidstr = `【${translation}】
`;
+ if (node.forbiddenSkills[skills[i]].length) {
+ forbidstr += "(与" + get.translation(node.forbiddenSkills[skills[i]]) + "冲突)
";
+ }
+ else {
+ forbidstr += "(双将禁用)
";
+ }
+ forbidstr += get.skillInfoTranslation(skills[i], node) + "
"
+ uiintro.add(forbidstr);
+ }
+ else if (!skills2.contains(skills[i])) {
+ if (lib.skill[skills[i]].preHidden && get.mode() == "guozhan") {
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}预亮技能
`);
+ var underlinenode = uiintro.content.lastChild.querySelector(".underlinenode");
+ if (_status.prehidden_skills.contains(skills[i])) {
+ underlinenode.classList.remove("on");
+ }
+ underlinenode.link = skills[i];
+ underlinenode.listen(ui.click.hiddenskill);
+ }
+ else uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
`);
+ }
+ else if (lib.skill[skills[i]].temp || !node.skills.contains(skills[i]) || lib.skill[skills[i]].thundertext) {
+ if (lib.skill[skills[i]].frequent || lib.skill[skills[i]].subfrequent) {
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
自动发动
`);
+ var underlinenode = uiintro.content.lastChild.querySelector(".underlinenode");
+ if (lib.skill[skills[i]].frequent) {
+ if (lib.config.autoskilllist.contains(skills[i])) {
+ underlinenode.classList.remove("on");
+ }
+ }
+ if (lib.skill[skills[i]].subfrequent) {
+ for (var j = 0; j < lib.skill[skills[i]].subfrequent.length; j++) {
+ if (lib.config.autoskilllist.contains(skills[i] + "_" + lib.skill[skills[i]].subfrequent[j])) {
+ underlinenode.classList.remove("on");
+ }
+ }
+ }
+ if (lib.config.autoskilllist.contains(skills[i])) {
+ underlinenode.classList.remove("on");
+ }
+ underlinenode.link = skills[i];
+ underlinenode.listen(ui.click.autoskill2);
+ }
+ else {
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
`);
+ }
+ }
+ else if (lib.skill[skills[i]].frequent || lib.skill[skills[i]].subfrequent) {
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
自动发动
`);
+ var underlinenode = uiintro.content.lastChild.querySelector(".underlinenode");
+ if (lib.skill[skills[i]].frequent) {
+ if (lib.config.autoskilllist.contains(skills[i])) {
+ underlinenode.classList.remove("on");
+ }
+ }
+ if (lib.skill[skills[i]].subfrequent) {
+ for (var j = 0; j < lib.skill[skills[i]].subfrequent.length; j++) {
+ if (lib.config.autoskilllist.contains(skills[i] + "_" + lib.skill[skills[i]].subfrequent[j])) {
+ underlinenode.classList.remove("on");
+ }
+ }
+ }
+ if (lib.config.autoskilllist.contains(skills[i])) {
+ underlinenode.classList.remove("on");
+ }
+ underlinenode.link = skills[i];
+ underlinenode.listen(ui.click.autoskill2);
+ }
+ else if (lib.skill[skills[i]].clickable && node.isIn() && node.isUnderControl(true)) {
+ var intronode = uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
`).querySelector(".skillbutton");
+ if (!_status.gameStarted || (lib.skill[skills[i]].clickableFilter && !lib.skill[skills[i]].clickableFilter(node))) {
+ intronode.classList.add("disabled");
+ intronode.style.opacity = 0.5;
+ }
+ else {
+ intronode.link = node;
+ intronode.func = lib.skill[skills[i]].clickable;
+ intronode.classList.add("pointerdiv");
+ intronode.listen(ui.click.skillbutton);
+ }
+ }
+ else {
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i], node)}
`);
+ }
+ if (lib.translate[skills[i] + "_append"]) {
+ uiintro._place_text = uiintro.add(`${lib.translate[`${skills[i]}_append`]}
`)
+ }
+ }
+ }
+ // if(get.is.phoneLayout()){
+ // var storage=node.storage;
+ // for(i in storage){
+ // if(get.info(i)&&get.info(i).intro){
+ // intro=get.info(i).intro;
+ // if(node.getSkills().concat(lib.skill.global).contains(i)==false&&!intro.show) continue;
+ // var name=intro.name?intro.name:get.translation(i);
+ // if(typeof name=="function"){
+ // name=name(storage[i],node);
+ // }
+ // translation="『"+name.slice(0,2)+"』
";
+ // var stint=get.storageintro(intro.content,storage[i],node,null,i);
+ // if(stint){
+ // translation+=stint+"
";
+ // uiintro.add(translation);
+ // }
+ // }
+ // }
+ // }
+
+ if (lib.config.right_range && _status.gameStarted) {
+ uiintro.add(ui.create.div(".placeholder"));
+ var table, tr, td;
+ table = document.createElement("table");
+ tr = document.createElement("tr");
+ table.appendChild(tr);
+ td = document.createElement("td");
+ td.innerHTML = "距离";
+ tr.appendChild(td);
+ td = document.createElement("td");
+ td.innerHTML = "手牌";
+ tr.appendChild(td);
+ td = document.createElement("td");
+ td.innerHTML = "行动";
+ tr.appendChild(td);
+ td = document.createElement("td");
+ td.innerHTML = "伤害";
+ tr.appendChild(td);
+
+ tr = document.createElement("tr");
+ table.appendChild(tr);
+ td = document.createElement("td");
+ if (node == game.me || !game.me || !game.me.isIn()) {
+ td.innerHTML = "-";
+ }
+ else {
+ var dist1 = get.numStr(Math.max(1, game.me.distanceTo(node)));
+ var dist2 = get.numStr(Math.max(1, node.distanceTo(game.me)));
+ if (dist1 == dist2) {
+ td.innerHTML = dist1;
+ }
+ else {
+ td.innerHTML = dist1 + "/" + dist2;
+ }
+ }
+ tr.appendChild(td);
+ td = document.createElement("td");
+ let handcardLimit = node.getHandcardLimit();
+ td.innerHTML = `${node.countCards("h")}/${handcardLimit >= 114514 ? "∞" : handcardLimit}`;
+ tr.appendChild(td);
+ td = document.createElement("td");
+ td.innerHTML = node.phaseNumber;
+ tr.appendChild(td);
+ td = document.createElement("td");
+
+ (function () {
+ num = 0;
+ for (var j = 0; j < node.stat.length; j++) {
+ if (typeof node.stat[j].damage == "number") num += node.stat[j].damage;
+ }
+ td.innerHTML = num;
+ }());
+ tr.appendChild(td);
+ table.style.width = "calc(100% - 20px)";
+ table.style.marginLeft = "10px";
+
+ uiintro.content.appendChild(table);
+ if (!lib.config.show_favourite) {
+ table.style.paddingBottom = "5px"
+ }
+ }
+ if (!simple || get.is.phoneLayout()) {
+ var es = node.getCards("e");
+ for (var i = 0; i < es.length; i++) {
+ var cardinfo = lib.card[es[i].name];
+ if (cardinfo && cardinfo.cardPrompt) uiintro.add(`${es[i].outerHTML}
${cardinfo.cardPrompt(es[i])}
`);
+ else uiintro.add(`${es[i].outerHTML}
${lib.translate[`${es[i].name}_info`]}
`);
+ uiintro.content.lastChild.querySelector(".skill>.card").style.transform = "";
+
+ if (lib.translate[es[i].name + "_append"]) {
+ uiintro.add(`${lib.translate[`${es[i].name}_append`]}
`);
+ }
+ }
+ var js = node.getCards("j");
+ for (var i = 0; i < js.length; i++) {
+ if (js[i].viewAs && js[i].viewAs != js[i].name) {
+ uiintro.add(`${js[i].outerHTML}
${lib.translate[js[i].viewAs]}:${lib.translate[`${js[i].viewAs}_info`]}
`);
+ }
+ else {
+ uiintro.add(`${js[i].outerHTML}
${lib.translate[`${js[i].name}_info`]}
`);
+ }
+ uiintro.content.lastChild.querySelector(".skill>.card").style.transform = "";
+ }
+ if (get.is.phoneLayout()) {
+ var markCoutainer = ui.create.div(".mark-container.marks");
+ for (var i in node.marks) {
+ var nodemark = node.marks[i].cloneNode(true);
+ nodemark.classList.add("pointerdiv");
+ nodemark.link = node.marks[i];
+ nodemark.style.transform = "";
+ markCoutainer.appendChild(nodemark);
+ nodemark.listen(function () {
+ uiintro.noresume = true;
+ var rect = this.link.getBoundingClientRect();
+ ui.click.intro.call(this.link, {
+ clientX: rect.left + rect.width,
+ clientY: rect.top + rect.height / 2,
+ });
+ if (lib.config.touchscreen) {
+ uiintro._close();
+ }
+ });
+ }
+ if (markCoutainer.childElementCount) {
+ uiintro.addText("标记");
+ uiintro.add(markCoutainer);
+ }
+ }
+ }
+ if (!game.observe && _status.gameStarted && game.me && node != game.me) {
+ ui.throwEmotion = [];
+ uiintro.addText("发送交互表情");
+ var click = function () {
+ if (_status.dragged) return;
+ if (_status.justdragged) return;
+ if (_status.throwEmotionWait) return;
+ var emotion = this.link;
+ if (game.online) {
+ game.send("throwEmotion", node, emotion);
+ }
+ else game.me.throwEmotion(node, emotion);
+ uiintro._close();
+ _status.throwEmotionWait = true;
+ setTimeout(function () {
+ _status.throwEmotionWait = false;
+ if (ui.throwEmotion) {
+ for (var i of ui.throwEmotion) i.classList.remove("exclude");
+ }
+ }, (emotion == "flower" || emotion == "egg") ? 500 : 5000)
+ };
+ var td;
+ var table = document.createElement("div");
+ table.classList.add("add-setting");
+ table.style.margin = "0";
+ table.style.width = "100%";
+ table.style.position = "relative";
+ var listi = ["flower", "egg"];
+ for (var i = 0; i < listi.length; i++) {
+ td = ui.create.div(".menubutton.reduce_radius.pointerdiv.tdnode");
+ ui.throwEmotion.add(td);
+ if (_status.throwEmotionWait) td.classList.add("exclude");
+ td.link = listi[i];
+ table.appendChild(td);
+ td.innerHTML = "" + get.translation(listi[i]) + "";
+ td.addEventListener(lib.config.touchscreen ? "touchend" : "click", click);
+ }
+ uiintro.content.appendChild(table);
+ table = document.createElement("div");
+ table.classList.add("add-setting");
+ table.style.margin = "0";
+ table.style.width = "100%";
+ table.style.position = "relative";
+ var listi = ["wine", "shoe"];
+ if (game.me.storage.zhuSkill_shanli) listi = ["yuxisx", "jiasuo"];
+ for (var i = 0; i < listi.length; i++) {
+ td = ui.create.div(".menubutton.reduce_radius.pointerdiv.tdnode");
+ ui.throwEmotion.add(td);
+ if (_status.throwEmotionWait) td.classList.add("exclude");
+ td.link = listi[i];
+ table.appendChild(td);
+ td.innerHTML = "" + get.translation(listi[i]) + "";
+ td.addEventListener(lib.config.touchscreen ? "touchend" : "click", click);
+ }
+ uiintro.content.appendChild(table);
+ }
+ var modepack = lib.characterPack["mode_" + get.mode()];
+ if (lib.config.show_favourite && lib.character[node.name] && game.players.contains(node) &&
+ (!modepack || !modepack[node.name]) && (!simple || get.is.phoneLayout())) {
+ var addFavourite = ui.create.div(".text.center.pointerdiv");
+ addFavourite.link = node.name;
+ if (lib.config.favouriteCharacter.contains(node.name)) {
+ addFavourite.innerHTML = "移除收藏";
+ }
+ else {
+ addFavourite.innerHTML = "添加收藏";
+ }
+ addFavourite.listen(ui.click.favouriteCharacter)
+ uiintro.add(addFavourite);
+ }
+ if (!simple || get.is.phoneLayout()) {
+ if ((lib.config.change_skin || lib.skin) && !node.isUnseen()) {
+ var num = 1;
+ var introadded = false;
+ var createButtons = function (num, avatar2) {
+ if (!introadded) {
+ introadded = true;
+ uiintro.add(`更改皮肤
`);
+ }
+ var buttons = ui.create.div(".buttons.smallzoom.scrollbuttons");
+ lib.setMousewheel(buttons);
+ var nameskin = (avatar2 ? node.name2 : node.name1);
+ var nameskin2 = nameskin;
+ var gzbool = false;
+ if (nameskin.startsWith("gz_shibing")) {
+ nameskin = nameskin.slice(3, 11);
+ }
+ else if (nameskin.startsWith("gz_")) {
+ nameskin = nameskin.slice(3);
+ gzbool = true;
+ }
+ for (var i = 0; i <= num; i++) {
+ var button = ui.create.div(".button.character.pointerdiv", buttons, function () {
+ if (this._link) {
+ if (avatar2) {
+ lib.config.skin[nameskin] = this._link;
+ node.node.avatar2.style.backgroundImage = this.style.backgroundImage;
+ }
+ else {
+ lib.config.skin[nameskin] = this._link;
+ node.node.avatar.style.backgroundImage = this.style.backgroundImage;
+ }
+ }
+ else {
+ delete lib.config.skin[nameskin];
+ if (avatar2) {
+ if (gzbool && lib.character[nameskin2][4].contains("gzskin") && lib.config.mode_config.guozhan.guozhanSkin) node.node.avatar2.setBackground(nameskin2, "character");
+ else node.node.avatar2.setBackground(nameskin, "character");
+ }
+ else {
+ if (gzbool && lib.character[nameskin2][4].contains("gzskin") && lib.config.mode_config.guozhan.guozhanSkin) node.node.avatar.setBackground(nameskin2, "character");
+ else node.node.avatar.setBackground(nameskin, "character");
+ }
+ }
+ game.saveConfig("skin", lib.config.skin);
+ });
+ button._link = i;
+ if (i) {
+ button.setBackgroundImage("image/skin/" + nameskin + "/" + i + ".jpg");
+ }
+ else {
+ if (gzbool && lib.character[nameskin2][4].contains("gzskin") && lib.config.mode_config.guozhan.guozhanSkin) button.setBackground(nameskin2, "character", "noskin");
+ else button.setBackground(nameskin, "character", "noskin");
+ }
+ }
+ uiintro.add(buttons);
+ };
+ var loadImage = function (avatar2) {
+ var img = new Image();
+ img.onload = function () {
+ num++;
+ loadImage(avatar2);
+ }
+ img.onerror = function () {
+ num--;
+ if (num) {
+ createButtons(num, avatar2);
+ }
+ if (!avatar2) {
+ if (!node.classList.contains("unseen2") && node.name2) {
+ num = 1;
+ loadImage(true);
+ }
+ }
+ }
+ var nameskin = (avatar2 ? node.name2 : node.name1);
+ var nameskin2 = nameskin;
+ var gzbool = false;
+ if (nameskin.startsWith("gz_shibing")) {
+ nameskin = nameskin.slice(3, 11);
+ }
+ else if (nameskin.startsWith("gz_")) {
+ nameskin = nameskin.slice(3);
+ gzbool = true;
+ }
+ img.src = lib.assetURL + "image/skin/" + nameskin + "/" + num + ".jpg";
+ }
+ if (lib.config.change_skin) {
+ if (!node.isUnseen(0)) {
+ loadImage();
+ }
+ else if (node.name2) {
+ loadImage(true);
+ }
+ }
+ else {
+ setTimeout(function () {
+ var nameskin1 = node.name1;
+ var nameskin2 = node.name2;
+ if (nameskin1 && nameskin1.startsWith("gz_")) {
+ nameskin1 = nameskin1.slice(3);
+ }
+ if (nameskin2 && nameskin2.startsWith("gz_")) {
+ nameskin2 = nameskin2.slice(3);
+ }
+ if (!node.isUnseen(0) && lib.skin[nameskin1]) {
+ createButtons(lib.skin[nameskin1]);
+ }
+ if (!node.isUnseen(1) && lib.skin[nameskin2]) {
+ createButtons(lib.skin[nameskin2], true);
+ }
+ });
+ }
+ }
+ }
+
+ uiintro.add(ui.create.div(".placeholder.slim"));
+ }
+ else if (node.classList.contains("mark") && node.info &&
+ node.parentNode && node.parentNode.parentNode && node.parentNode.parentNode.classList.contains("player")) {
+ var info = node.info;
+ var player = node.parentNode.parentNode;
+ if (info.name) {
+ if (typeof info.name == "function") {
+ var named = info.name(player.storage[node.skill], player);
+ if (named) {
+ uiintro.add(named);
+ }
+ }
+ else {
+ uiintro.add(info.name);
+ }
+ }
+ else if (info.name !== false) {
+ uiintro.add(get.translation(node.skill));
+ }
+ if (typeof info.id == "string" && info.id.startsWith("subplayer") &&
+ player.isUnderControl(true) && player.storage[info.id] && !_status.video) {
+ var storage = player.storage[info.id];
+ uiintro.addText("当前体力:" + storage.hp + "/" + storage.maxHp);
+ if (storage.hs.length) {
+ uiintro.addText("手牌区");
+ uiintro.addSmall(storage.hs);
+ }
+ if (storage.es.length) {
+ uiintro.addText("装备区");
+ uiintro.addSmall(storage.es);
+ }
+ }
+ if (typeof info.mark == "function") {
+ var stint = info.mark(uiintro, player.storage[node.skill], player);
+ if (stint) {
+ var placetext = uiintro.add(`${stint}
`);
+ if (!stint.startsWith(`"+stint+"
");
+ // }
+ // else{
+ // uiintro.add(""+stint+"
");
+ // }
+ }
+ }
+ else {
+ var stint = get.storageintro(info.content, player.storage[node.skill], player, uiintro, node.skill);
+ if (stint) {
+ if (stint[0] == "@") {
+ uiintro.add(`${stint.slice(1)}
`);
+ }
+ else {
+ var placetext = uiintro.add(`${stint}
`);
+ if (!stint.startsWith(`"+stint+"
");
+ // }
+ // else{
+ // uiintro.add(""+stint+"
");
+ // }
+ }
+ }
+ uiintro.add(ui.create.div(".placeholder.slim"));
+ }
+ else if (node.classList.contains("card")) {
+ //卡牌长按介绍
+ if (ui.arena.classList.contains("observe") && node.parentNode.classList.contains("handcards")) {
+ return;
+ }
+ var name = node.name;
+ if (node.parentNode.cardMod) {
+ var moded = false;
+ for (var i in node.parentNode.cardMod) {
+ var item = node.parentNode.cardMod[i](node);
+ if (Array.isArray(item)) {
+ moded = true;
+ uiintro.add(item[0]);
+ uiintro._place_text = uiintro.add(`${item[1]}
`);
+ }
+ }
+ if (moded) return uiintro;
+ }
+ if (node.link && node.link.name && lib.card[node.link.name]) {
+ name = node.link.name;
+ }
+ if (get.position(node) == "j" && node.viewAs && node.viewAs != name) {
+ uiintro.add(get.translation(node.viewAs));
+ uiintro.add(`(${get.translation(get.translation(node))})
`);
+ uiintro.nosub = true;
+ name = node.viewAs;
+ }
+ else {
+ uiintro.add(get.translation(node));
+ }
+ if (node._banning) {
+ var clickBanned = function () {
+ var banned = lib.config[this.bannedname] || [];
+ if (banned.contains(name)) {
+ banned.remove(name);
+ }
+ else {
+ banned.push(name);
+ }
+ game.saveConfig(this.bannedname, banned);
+ this.classList.toggle("on");
+ if (node.updateBanned) {
+ node.updateBanned();
+ }
+ };
+ var modeorder = lib.config.modeorder || [];
+ for (var i in lib.mode) {
+ modeorder.add(i);
+ }
+ var list = [];
+ uiintro.contentContainer.listen(function (e) {
+ ui.click.touchpop();
+ e.stopPropagation();
+ });
+ for (var i = 0; i < modeorder.length; i++) {
+ if (node._banning == "online") {
+ if (!lib.mode[modeorder[i]].connect) continue;
+ }
+ else if (modeorder[i] == "connect" || modeorder[i] == "brawl") {
+ continue;
+ }
+ if (lib.config.all.mode.contains(modeorder[i])) {
+ list.push(modeorder[i]);
+ }
+ }
+ if (lib.card[name] && lib.card[name].type == "trick") list.push("zhinang_tricks");
+ var page = ui.create.div(".menu-buttons.configpopped", uiintro.content);
+ var banall = false;
+ for (var i = 0; i < list.length; i++) {
+ var cfg = ui.create.div(".config", list[i] == "zhinang_tricks" ? "设为智囊" : (lib.translate[list[i]] + "模式"), page);
+ cfg.classList.add("toggle");
+ if (list[i] == "zhinang_tricks") {
+ cfg.bannedname = ((node._banning == "offline") ? "" : "connect_") + "zhinang_tricks";
+ }
+ else if (node._banning == "offline") {
+ cfg.bannedname = list[i] + "_bannedcards";
+ }
+ else {
+ cfg.bannedname = "connect_" + list[i] + "_bannedcards";
+ }
+ cfg.listen(clickBanned);
+ ui.create.div(ui.create.div(cfg));
+ var banned = lib.config[cfg.bannedname] || [];
+ if (banned.contains(name) == (list[i] == "zhinang_tricks")) {
+ cfg.classList.add("on");
+ banall = true;
+ }
+ }
+ ui.create.div(".menubutton.pointerdiv", banall ? "全部禁用" : "全部启用", uiintro.content, function () {
+ if (this.innerHTML == "全部禁用") {
+ for (var i = 0; i < page.childElementCount; i++) {
+ if (page.childNodes[i].bannedname.indexOf("zhinang_tricks") == -1 && page.childNodes[i].bannedname && page.childNodes[i].classList.contains("on")) {
+ clickBanned.call(page.childNodes[i]);
+ }
+ }
+ this.innerHTML = "全部启用";
+ }
+ else {
+ for (var i = 0; i < page.childElementCount; i++) {
+ if (page.childNodes[i].bannedname.indexOf("zhinang_tricks") == -1 && page.childNodes[i].bannedname && !page.childNodes[i].classList.contains("on")) {
+ clickBanned.call(page.childNodes[i]);
+ }
+ }
+ this.innerHTML = "全部禁用";
+ }
+ }).style.marginTop = "-10px";
+ ui.create.div(".placeholder.slim", uiintro.content);
+ }
+ else {
+ if (lib.translate[name + "_info"]) {
+ if (!uiintro.nosub) {
+ if (lib.card[name] && lib.card[name].derivation) {
+ if (typeof lib.card[name].derivation == "string") {
+ uiintro.add(`来源:${get.translation(lib.card[name].derivation)}
`);
+ }
+ else if (lib.card[name].derivationpack) {
+ uiintro.add(`来源:${get.translation(`${lib.card[name].derivationpack}_card_config`)}包
`);
+ }
+ }
+ let typeinfo = "";
+ if (lib.card[name].unique) {
+ typeinfo += ("特殊" + get.translation(lib.card[name].type) + "牌");
+ }
+ else if (lib.card[name].type && lib.translate[lib.card[name].type]) {
+ typeinfo += (get.translation(lib.card[name].type) + "牌");
+ }
+ if (get.subtype(name, false)) {
+ typeinfo += ("-" + get.translation(get.subtype(name, false)));
+ }
+ if (typeinfo) {
+ uiintro.add(`${typeinfo}
`);
+ }
+ if (lib.card[name].unique && lib.card[name].type == "equip") {
+ if (lib.cardPile.guozhan && lib.cardPack.guozhan.contains(name)) {
+ uiintro.add(`专属装备
`).style.marginTop = "-5px";
+ }
+ else {
+ uiintro.add(`特殊装备
`).style.marginTop = "-5px";
+ }
+ }
+ if (lib.card[name] && lib.card[name].addinfomenu) {
+ uiintro.add(`${lib.card[name].addinfomenu}
`);
+ }
+ if (get.subtype(name, false) == "equip1") {
+ var added = false;
+ if (lib.card[node.name] && lib.card[node.name].distance) {
+ var dist = lib.card[node.name].distance;
+ if (dist.attackFrom) {
+ added = true;
+ uiintro.add(`攻击范围:${-dist.attackFrom + 1}
`);
+ }
+ }
+ if (!added) {
+ uiintro.add(`攻击范围:1
`);
+ }
+ }
+ }
+ if (lib.card[name].cardPrompt) {
+ var str = lib.card[name].cardPrompt(node.link || node), placetext = uiintro.add(`${str}
`);
+ if (!str.startsWith(`${lib.translate[`${name}_info`]}
`);
+ if (!lib.translate[name + "_info"].startsWith(`应变:${yingbianEffects.map(value => lib.yingbian.prompt.get(value)).join(";")}
`);
+ }
+ if (lib.translate[name + "_append"]) {
+ uiintro.add(`${lib.translate[`${name}_append`]}
`);
+ }
+ }
+ uiintro.add(ui.create.div(".placeholder.slim"));
+ }
+ }
+ else if (node.classList.contains("character")) {
+ const character = node.link, characterInfo = get.character(node.link);
+ let capt = get.translation(character);
+ if (characterInfo) {
+ const infoSex = characterInfo[0];
+ if (infoSex && lib.config.show_sex) capt += ` ${infoSex == "none" ? "无" : lib.translate[infoSex]}`;
+ const infoGroup = characterInfo[1];
+ if (infoGroup && lib.config.show_group) {
+ const group = get.is.double(character, true);
+ if (group) capt += ` ${group.map(value => get.translation(value)).join("/")}`;
+ else capt += ` ${lib.translate[infoGroup]}`;
+ }
+ }
+ uiintro.add(capt);
+
+ if (lib.characterTitle[node.link]) {
+ uiintro.addText(get.colorspan(lib.characterTitle[node.link]));
+ }
+
+ if (node._banning) {
+ var clickBanned = function () {
+ var banned = lib.config[this.bannedname] || [];
+ if (banned.contains(character)) {
+ banned.remove(character);
+ }
+ else {
+ banned.push(character);
+ }
+ game.saveConfig(this.bannedname, banned);
+ this.classList.toggle("on");
+ if (node.updateBanned) {
+ node.updateBanned();
+ }
+ };
+ var modeorder = lib.config.modeorder || [];
+ for (var i in lib.mode) {
+ modeorder.add(i);
+ }
+ var list = [];
+ uiintro.contentContainer.listen(function (e) {
+ ui.click.touchpop();
+ e.stopPropagation();
+ });
+ for (var i = 0; i < modeorder.length; i++) {
+ if (node._banning == "online") {
+ if (!lib.mode[modeorder[i]].connect) continue;
+ if (!lib.config["connect_" + modeorder[i] + "_banned"]) {
+ lib.config["connect_" + modeorder[i] + "_banned"] = [];
+ }
+ }
+ else if (modeorder[i] == "connect" || modeorder[i] == "brawl") {
+ continue;
+ }
+ if (lib.config.all.mode.contains(modeorder[i])) {
+ list.push(modeorder[i]);
+ }
+ }
+ var page = ui.create.div(".menu-buttons.configpopped", uiintro.content);
+ var banall = false;
+ for (var i = 0; i < list.length; i++) {
+ var cfg = ui.create.div(".config", lib.translate[list[i]] + "模式", page);
+ cfg.classList.add("toggle");
+ if (node._banning == "offline") {
+ cfg.bannedname = list[i] + "_banned";
+ }
+ else {
+ cfg.bannedname = "connect_" + list[i] + "_banned";
+ }
+ cfg.listen(clickBanned);
+ ui.create.div(ui.create.div(cfg));
+ var banned = lib.config[cfg.bannedname] || [];
+ if (!banned.contains(character)) {
+ cfg.classList.add("on");
+ banall = true;
+ }
+ }
+ if (node._banning == "offline") {
+ var cfg = ui.create.div(".config", "随机选将可用", page);
+ cfg.classList.add("toggle");
+ cfg.listen(function () {
+ this.classList.toggle("on");
+ if (this.classList.contains("on")) {
+ lib.config.forbidai_user.remove(character);
+ }
+ else {
+ lib.config.forbidai_user.add(character);
+ }
+ game.saveConfig("forbidai_user", lib.config.forbidai_user);
+ });
+ ui.create.div(ui.create.div(cfg));
+ if (!lib.config.forbidai_user.contains(character)) {
+ cfg.classList.add("on");
+ }
+ }
+ ui.create.div(".menubutton.pointerdiv", banall ? "全部禁用" : "全部启用", uiintro.content, function () {
+ if (this.innerHTML == "全部禁用") {
+ for (var i = 0; i < page.childElementCount; i++) {
+ if (page.childNodes[i].bannedname && page.childNodes[i].classList.contains("on")) {
+ clickBanned.call(page.childNodes[i]);
+ }
+ }
+ this.innerHTML = "全部启用";
+ }
+ else {
+ for (var i = 0; i < page.childElementCount; i++) {
+ if (page.childNodes[i].bannedname && !page.childNodes[i].classList.contains("on")) {
+ clickBanned.call(page.childNodes[i]);
+ }
+ }
+ this.innerHTML = "全部禁用";
+ }
+ }).style.marginTop = "-10px";
+ ui.create.div(".placeholder.slim", uiintro.content);
+ }
+ else {
+ var infoitem = get.character(character);
+ var skills = infoitem[3];
+ for (i = 0; i < skills.length; i++) {
+ if (lib.translate[skills[i] + "_info"]) {
+ if (lib.translate[skills[i] + "_ab"]) translation = lib.translate[skills[i] + "_ab"];
+ else {
+ translation = get.translation(skills[i]);
+ if (!lib.skill[skills[i]].nobracket) translation = translation.slice(0, 2);
+ }
+
+ uiintro.add(`【${translation}】
${get.skillInfoTranslation(skills[i])}
`);
+
+ if (lib.translate[skills[i] + "_append"]) {
+ uiintro._place_text = uiintro.add(`${lib.translate[`${skills[i]}_append`]}
`)
+ }
+ }
+ }
+ var modepack = lib.characterPack["mode_" + get.mode()];
+ if (lib.config.show_favourite &&
+ lib.character[node.link] && (!modepack || !modepack[node.link]) && (!simple || get.is.phoneLayout())) {
+ var addFavourite = ui.create.div(".text.center.pointerdiv");
+ addFavourite.link = node.link;
+ addFavourite.style.marginBottom = "15px";
+ if (lib.config.favouriteCharacter.contains(node.link)) {
+ addFavourite.innerHTML = "移除收藏";
+ }
+ else {
+ addFavourite.innerHTML = "添加收藏";
+ }
+ addFavourite.listen(ui.click.favouriteCharacter)
+ uiintro.add(addFavourite);
+ }
+ else {
+ uiintro.add(ui.create.div(".placeholder.slim"));
+ }
+ var addskin = false;
+ if (node.parentNode.classList.contains("menu-buttons")) {
+ addskin = !lib.config.show_charactercard;
+ }
+ else {
+ addskin = lib.config.change_skin || lib.skin;
+ }
+ if (addskin && (!simple || get.is.phoneLayout())) {
+ var num = 1;
+ var introadded = false;
+ var nameskin = node.link;
+ var nameskin2 = nameskin;
+ var gzbool = false;
+ if (nameskin.startsWith("gz_shibing")) {
+ nameskin = nameskin.slice(3, 11);
+ }
+ else if (nameskin.startsWith("gz_")) {
+ nameskin = nameskin.slice(3);
+ gzbool = true;
+ }
+ var createButtons = function (num) {
+ if (!num) return;
+ if (!introadded) {
+ introadded = true;
+ uiintro.add(`更改皮肤
`);
+ }
+ var buttons = ui.create.div(".buttons.smallzoom.scrollbuttons");
+ lib.setMousewheel(buttons);
+ for (var i = 0; i <= num; i++) {
+ var button = ui.create.div(".button.character.pointerdiv", buttons, function () {
+ if (this._link) {
+ lib.config.skin[nameskin] = this._link;
+ node.style.backgroundImage = this.style.backgroundImage;
+ game.saveConfig("skin", lib.config.skin);
+ }
+ else {
+ delete lib.config.skin[nameskin];
+ if (gzbool && lib.character[nameskin2][4].contains("gzskin") && lib.config.mode_config.guozhan.guozhanSkin) node.setBackground(nameskin2, "character");
+ else node.setBackground(nameskin, "character");
+ game.saveConfig("skin", lib.config.skin);
+ }
+ });
+ button._link = i;
+ if (i) {
+ button.setBackgroundImage("image/skin/" + nameskin + "/" + i + ".jpg");
+ }
+ else {
+ if (gzbool && lib.character[nameskin2][4].contains("gzskin") && lib.config.mode_config.guozhan.guozhanSkin) button.setBackground(nameskin2, "character", "noskin");
+ else button.setBackground(nameskin, "character", "noskin");
+ }
+ }
+ uiintro.add(buttons);
+ };
+ var loadImage = function () {
+ var img = new Image();
+ img.onload = function () {
+ num++;
+ loadImage();
+ }
+ img.onerror = function () {
+ num--;
+ createButtons(num);
+ }
+ img.src = lib.assetURL + "image/skin/" + nameskin + "/" + num + ".jpg";
+ }
+ if (lib.config.change_skin) {
+ loadImage();
+ }
+ else {
+ setTimeout(function () {
+ createButtons(lib.skin[nameskin]);
+ });
+ }
+ }
+ }
+ }
+ else if (node.classList.contains("equips") && ui.arena.classList.contains("selecting")) {
+ (function () {
+ uiintro.add("选择装备");
+ uiintro.addSmall(Array.from(node.childNodes).filter(node => !node.classList.contains("feichu")), true);
+ uiintro.clickintro = true;
+ ui.control.hide();
+ uiintro._onclose = function () {
+ ui.control.show();
+ }
+ var confirmbutton;
+ for (var i = 0; i < uiintro.buttons.length; i++) {
+ var button = uiintro.buttons[i];
+ button.classList.add("pointerdiv");
+ if (button.link.classList.contains("selected")) {
+ button.classList.add("selected");
+ }
+ button.listen(function (e) {
+ ui.click.card.call(this.link, "popequip");
+ ui.click.window.call(ui.window, e);
+ if (this.link.classList.contains("selected")) {
+ this.classList.add("selected");
+ }
+ else {
+ this.classList.remove("selected");
+ }
+ if (ui.confirm && ui.confirm.str && ui.confirm.str.includes("o")) {
+ confirmbutton.classList.remove("disabled");
+ }
+ else {
+ confirmbutton.classList.add("disabled");
+ }
+ });
+ }
+ var buttoncontainer = uiintro.add(ui.create.div());
+ buttoncontainer.style.display = "block";
+ confirmbutton = ui.create.div(".menubutton.large.pointerdiv", "确定", function () {
+ if (ui.confirm && ui.confirm.str && ui.confirm.str.includes("o")) {
+ uiintro._clickintro();
+ ui.click.ok(ui.confirm.firstChild);
+ }
+ }, buttoncontainer);
+ confirmbutton.style.position = "relative";
+ setTimeout(function () {
+ if (ui.confirm && ui.confirm.str && ui.confirm.str.includes("o")) {
+ confirmbutton.classList.remove("disabled");
+ }
+ else {
+ confirmbutton.classList.add("disabled");
+ }
+ }, 300);
+ }());
+ }
+ else if (node.classList.contains("identity") && node.dataset.career) {
+ var career = node.dataset.career;
+ uiintro.add(get.translation(career));
+ uiintro.add(`${lib.translate[`_${career}_skill_info`]}
`);
+ }
+ else if (node.classList.contains("skillbar")) {
+ if (node == ui.friendBar) {
+ uiintro.add("友方怒气值");
+ uiintro.add(`${_status.friendRage}/100
`);
+ }
+ else if (node == ui.enemyBar) {
+ uiintro.add("敌方怒气值");
+ uiintro.add(`${_status.enemyRage}/100
`);
+ }
+ }
+ else if (node.parentNode == ui.historybar) {
+ if (node.dead) {
+ if (!node.source || node.source == node.player) {
+ uiintro.add(`${get.translation(node.player)}阵亡
`);
+ uiintro.addSmall([node.player]);
+ }
+ else {
+ uiintro.add(`${get.translation(node.player)}被${get.translation(node.source)}杀害
`);
+ uiintro.addSmall([node.source]);
+ }
+ }
+ if (node.skill) {
+ uiintro.add(`${get.translation(node.skill, "skill")}
`);
+ uiintro._place_text = uiintro.add(`${get.translation(node.skill, "info")}
`);
+ }
+ if (node.targets && get.itemtype(node.targets) == "players") {
+ uiintro.add(`目标
`);
+ uiintro.addSmall(node.targets);
+ }
+ if (node.players && node.players.length > 1) {
+ uiintro.add(`使用者
`);
+ uiintro.addSmall(node.players);
+ }
+ if (node.cards && node.cards.length) {
+ uiintro.add(`卡牌
`);
+ uiintro.addSmall(node.cards);
+ }
+ for (var i = 0; i < node.added.length; i++) {
+ uiintro.add(node.added[i]);
+ }
+ if (node.added.length) {
+ uiintro.add(ui.create.div(".placeholder.slim"));
+ }
+ if (uiintro.content.firstChild) {
+ uiintro.content.firstChild.style.paddingTop = "3px";
+ }
+ }
+ if (lib.config.touchscreen) {
+ lib.setScroll(uiintro.contentContainer);
+ }
+ return uiintro;
+ }
+ static linkintro(dialog, content, player) {
+ dialog.content.firstChild.remove();
+ dialog.add(`已横置
`);
+ var list = [];
+ for (var i = 0; i < game.players.length; i++) {
+ if (game.players[i].isLinked() && game.players[i].name && !game.players[i].name.startsWith("unknown")) {
+ list.push(game.players[i]);
+ }
+ }
+ if (list.length) {
+ dialog.add(list, true, true);
+ }
+ }
+ static groups() {
+ return ["wei", "shu", "wu", "qun", "jin", "western", "key"];
+ }
+ static types() {
+ var types = [];
+ for (var i in lib.card) {
+ if (lib.card[i].mode && lib.card[i].mode.contains(lib.config.mode) == false) continue;
+ if (lib.card[i].forbid && lib.card[i].forbid.contains(lib.config.mode)) continue;
+ if (lib.card[i].type) {
+ if (lib.card[i].type == "delay") types.add("trick");
+ else types.add(lib.card[i].type);
+ }
+ }
+ return types;
+ }
+ static links(buttons) {
+ var links = [];
+ for (var i = 0; i < buttons.length; i++) {
+ if (buttons[i].link != undefined) links.push(buttons[i].link);
+ }
+ return links;
+ }
+ static threaten(target, player, hp) {
+ var threaten = 1;
+ var skills = target.getSkills();
+ if (!player && player !== false) {
+ player = _status.event.player;
+ }
+ for (var i = 0; i < skills.length; i++) {
+ var info = get.info(skills[i]);
+ if (info && info.ai && info.ai.threaten) {
+ if (typeof info.ai.threaten == "function" && player) {
+ var tmp = info.ai.threaten(player, target);
+ if (typeof tmp == "number") {
+ threaten *= tmp;
+ }
+ }
+ else if (typeof info.ai.threaten == "number") {
+ threaten *= info.ai.threaten;
+ }
+ }
+ }
+ if (hp) {
+ switch (target.hp) {
+ case 0: threaten *= 1.5; break;
+ case 1: threaten *= 1.2; break;
+ }
+ switch (target.countCards("h")) {
+ case 0: threaten *= 1.5; break;
+ case 1: threaten *= 1.2; break;
+ }
+ }
+ return threaten;
+ }
+ static condition(player) {
+ var num = player.hp;
+ if (num > 4) {
+ num = 4 + Math.sqrt(num - 4);
+ }
+ else {
+ if (player.isHealthy()) {
+ if (player.hp == 3) {
+ num += 0.5;
+ }
+ else if (player.hp < 3) {
+ num++;
+ }
+ }
+ }
+ num += player.countCards("h") / 2;
+ var es = player.getCards("e");
+ for (var i = 0; i < es.length; i++) {
+ var val = get.equipValueNumber(es[i]);
+ if (val >= 7) num += 0.8;
+ if (val >= 5) num += 0.5;
+ if (val >= 3) num += 0.2;
+ }
+ return num;
+ }
+ static attitude(from, to) {
+ if (!from || !to) return 0;
+ from = from._trueMe || from;
+ arguments[0] = from;
+ var att = get.rawAttitude.apply(this, arguments);
+ if (from.isMad()) att = -att;
+ if (to.isMad() && att > 0) {
+ if (to.identity == "zhu") {
+ att = 1;
+ }
+ else {
+ att = 0;
+ }
+ }
+ if (!_status.tempnofake) {
+ _status.tempnofake = true;
+ if (from.ai.modAttitudeFrom) {
+ att = from.ai.modAttitudeFrom(from, to, att);
+ }
+ if (to.ai.modAttitudeTo) {
+ att = to.ai.modAttitudeTo(from, to, att);
+ }
+ delete _status.tempnofake;
+ }
+ return att;
+ }
+ static sgnAttitude() {
+ return get.sgn(get.attitude.apply(this, arguments));
+ }
+ static useful_raw(card, player) {
+ if (get.position(card) == "j") return -1;
+ if (get.position(card) == "e") return get.equipValue(card);
+ if (card._modUseful) {
+ return card._modUseful();
+ }
+ var i = 0;
+ if (!player) player = _status.event.player;
+ if (player) {
+ if (_status.event.useCache) {
+ i = game.callFuncUseStepCache("player.getCardsInUseful", function (player, position, cardname) {
+ return player.getCards(position, cardname);
+ }, [player, "h", card.name]).indexOf(card);
+ } else {
+ i = player.getCards("h", card.name).indexOf(card);
+ }
+ if (i < 0) i = 0;
+ }
+ var aii = get.info(card).ai;
+ var useful;
+ if (aii && aii.useful) useful = aii.useful;
+ else if (aii && aii.basic) useful = aii.basic.useful;
+ var result;
+ if (useful == undefined) result = -1;
+ else if (typeof useful == "function") {
+ result = useful(card, i);
+ }
+ else if (typeof useful == "number") result = useful;
+ else if (i < useful.length) {
+ result = useful[i];
+ }
+ else result = useful[useful.length - 1];
+ result = game.checkMod(player, card, result, "aiUseful", player);
+ return result;
+ }
+ static useful(card, player) {
+ if (_status.event.useCache) {
+ return game.callFuncUseStepCache("get.useful_raw", get.useful_raw, [card, player]);
+ }
+ return get.useful_raw(card, player);
+ }
+ static unuseful(card) {
+ return -get.useful(card);
+ }
+ static unuseful2(card) {
+ return 10 - get.useful(card);
+ }
+ static unuseful3(card) {
+ if (card.name == "du") return 20;
+ return 10 - get.useful(card);
+ }
+ static value(card, player, method) {
+ var result = 0;
+ var value;
+ if (Array.isArray(card)) {
+ if (!card.length) return 0;
+ value = 0;
+ for (var i = 0; i < card.length; i++) {
+ value += get.value(card[i], player, method);
+ }
+ return value / Math.sqrt(card.length);
+ }
+ if (card._modValue) {
+ return card._modValue(player, method);
+ }
+ var aii = get.info(card).ai;
+ if (aii && aii.value) value = aii.value;
+ else if (aii && aii.basic) value = aii.basic.value;
+ if (player == undefined || get.itemtype(player) != "player") player = _status.event.player;
+ var geti = function () {
+ var num = 0, i;
+ var cards = player.getCards("hs", card.name);
+ if (cards.contains(card)) {
+ return cards.indexOf(card);
+ }
+ return cards.length;
+ };
+ if (typeof value == "function") {
+ result = value(card, player, geti(), method);
+ }
+ if (typeof value == "number") result = value;
+ if (Array.isArray(value)) {
+ if (method == "raw") result = value[0];
+ var num = geti();
+ if (num < value.length) result = value[num];
+ else result = value[value.length - 1];
+ }
+ result = game.checkMod(player, card, result, "aiValue", player);
+ return result;
+ }
+ static equipResult(player, target, name) {
+ var card = get.card();
+ if (!card || card.name != name) {
+ card = { name: name };
+ }
+ var value1 = get.equipValue(card, target);
+ var value2 = 0;
+ if (!player.canEquip(card)) {
+ if (!player.canEquip(card, true)) return 0;
+ var current = target.getEquip(card);
+ if (current && current != card) {
+ value2 = get.equipValue(current, target);
+ if (value2 > 0 && !target.needsToDiscard() && !get.tag(card, "valueswap")) {
+ return 0;
+ }
+ }
+ }
+ return Math.max(0, value1 - value2) / 5;
+ }
+ static equipValue(card, player) {
+ if (player == undefined || get.itemtype(player) != "player") player = get.owner(card);
+ if (player == undefined || get.itemtype(player) != "player") player = _status.event.player;
+ var info = get.info(card);
+ if (!info.ai) return 0;
+ var value = info.ai.equipValue;
+ if (value == undefined) {
+ if (info.ai.basic && info.ai.basic.equipValue != undefined) {
+ value = info.ai.basic.equipValue;
+ }
+ else return 0;
+ }
+ if (typeof value == "number") return value;
+ if (typeof value == "function") return value(card, player, null, "raw2");
+ return 0;
+ }
+ static equipValueNumber(card) {
+ var info = get.info(card);
+ if (info.ai) {
+ if (typeof info.ai.equipValue == "number") return info.ai.equipValue;
+ if (info.ai.basic && typeof info.ai.basic.equipValue == "number") return info.ai.basic.equipValue;
+ }
+ return 0;
+ }
+ static disvalue(card, player) {
+ return -get.value(card, player);
+ }
+ static disvalue2(card, player) {
+ return -get.value(card, player, "raw");
+ }
+ static skillthreaten(skill, player, target) {
+ if (!lib.skill[skill]) return 1;
+ if (!lib.skill[skill].ai) return 1;
+ var threaten = lib.skill[skill].ai.threaten;
+ if (typeof threaten == "number") return threaten;
+ if (typeof threaten == "function") {
+ player = player || _status.event.player;
+ target = target || player;
+ return threaten(player, target);
+ }
+ return 1;
+ }
+ static order(item) {
+ var info = get.info(item);
+ if (!info) return -1;
+ var aii = info.ai;
+ var order;
+ if (aii && aii.order) order = aii.order;
+ else if (aii && aii.basic) order = aii.basic.order;
+ if (order == undefined) return -1;
+ var num = order;
+ if (typeof (order) == "function") {
+ num = order(item, _status.event.player);
+ }
+ if (typeof item == "object" && _status.event.player) {
+ var player = _status.event.player;
+ num = game.checkMod(player, item, num, "aiOrder", player);
+ }
+ return num;
+ }
+ static result(item, skill) {
+ var result;
+ var info = get.info(item);
+ if (info.ai) result = get.copy(info.ai.result);
+ if (typeof (result) == "function") result = result(item);
+ if (!result) result = {};
+ if (skill) {
+ var info2 = get.info(skill);
+ if (info2.ai) {
+ info2 = info2.ai.result;
+ for (var i in info2) {
+ result[i] = info2[i];
+ }
+ }
+ }
+ return result;
+ }
+ static effect_use(target, card, player, player2, isLink) {
+ var event = _status.event;
+ var eventskill = null;
+ if (player == undefined) player = _status.event.player;
+ if (card && typeof card == "object" && "name" in card) card = get.autoViewAs(card);
+ if (typeof card != "string" && (typeof card != "object" || !card.name)) {
+ var skillinfo = get.info(event.skill);
+ if (event.skill && skillinfo.viewAs == undefined) card = _status.event.skill;
+ else {
+ card = get.card();
+ if (skillinfo && skillinfo.viewAs && card.name === skillinfo.viewAs.name) {
+ eventskill = event.skill;
+ }
+ }
+ }
+ var info = get.info(card);
+ if (typeof card == "object" && info && info.changeTarget) {
+ var targets = [target];
+ info.changeTarget(player, targets);
+ var eff = 0;
+ for (var i of targets) {
+ eff += get.effect(i, card, player, player2, isLink);
+ }
+ return eff;
+ }
+ var result = get.result(card, eventskill);
+ var result1 = result.player_use || result.player, result2 = result.target_use || result.target;
+ if (typeof result1 == "function") result1 = result1(player, target, card, isLink);
+ if (typeof result2 == "function") result2 = result2(player, target, card, isLink);
+
+ if (typeof result1 != "number") result1 = 0;
+ if (typeof result2 != "number") result2 = 0;
+ var temp1, temp2, temp3, temp01 = 0, temp02 = 0, threaten = 1;
+ var skills1 = player.getSkills().concat(lib.skill.global);
+ game.expandSkills(skills1);
+ var zerotarget = false, zeroplayer = false;
+ for (var i = 0; i < skills1.length; i++) {
+ temp1 = get.info(skills1[i]).ai;
+ if (temp1 && typeof temp1.effect == "object" && typeof temp1.effect.player_use == "function") {
+ temp1 = temp1.effect.player_use(card, player, target, result1, isLink);
+ }
+ else if (temp1 && typeof temp1.effect == "object" && typeof temp1.effect.player == "function") {
+ temp1 = temp1.effect.player(card, player, target, result1, isLink);
+ }
+ else temp1 = undefined;
+ if (typeof temp1 == "object") {
+ if (temp1.length == 2 || temp1.length == 4) {
+ result1 *= temp1[0];
+ temp01 += temp1[1];
+ }
+ if (temp1.length == 4) {
+ result2 *= temp1[2];
+ temp02 += temp1[3];
+ }
+ }
+ else if (typeof temp1 == "number") {
+ result1 *= temp1;
+ }
+ else if (temp1 == "zeroplayer") {
+ zeroplayer = true;
+ }
+ else if (temp1 == "zerotarget") {
+ zerotarget = true;
+ }
+ else if (temp1 == "zeroplayertarget") {
+ zeroplayer = true;
+ zerotarget = true;
+ }
+ }
+ if (target) {
+ var skills2 = target.getSkills().concat(lib.skill.global);
+ game.expandSkills(skills2);
+ for (var i = 0; i < skills2.length; i++) {
+ temp2 = get.info(skills2[i]).ai;
+ if (temp2 && temp2.threaten) temp3 = temp2.threaten;
+ else temp3 = undefined;
+ if (temp2 && typeof temp2.effect == "function") {
+ if (!player.hasSkillTag("ignoreSkill", true, {
+ card: card,
+ target: target,
+ skill: skills2[i],
+ isLink: isLink,
+ })) temp2 = temp2.effect(card, player, target, result2, isLink);
+ else temp2 = undefined;
+ }
+ else if (temp2 && typeof temp2.effect == "object" && typeof temp2.effect.target_use == "function") {
+ if (!player.hasSkillTag("ignoreSkill", true, {
+ card: card,
+ target: target,
+ skill: skills2[i],
+ isLink: isLink,
+ })) temp2 = temp2.effect.target_use(card, player, target, result2, isLink);
+ else temp2 = undefined;
+ }
+ else if (temp2 && typeof temp2.effect == "object" && typeof temp2.effect.target == "function") {
+ if (!player.hasSkillTag("ignoreSkill", true, {
+ card: card,
+ target: target,
+ skill: skills2[i],
+ isLink: isLink,
+ })) temp2 = temp2.effect.target(card, player, target, result2, isLink);
+ else temp2 = undefined;
+ }
+ else temp2 = undefined;
+ if (typeof temp2 == "object") {
+ if (temp2.length == 2 || temp2.length == 4) {
+ result2 *= temp2[0];
+ temp02 += temp2[1];
+ }
+ if (temp2.length == 4) {
+ result1 *= temp2[2];
+ temp01 += temp2[3];
+ }
+ }
+ else if (typeof temp2 == "number") {
+ result2 *= temp2;
+ }
+ else if (temp2 == "zeroplayer") {
+ zeroplayer = true;
+ }
+ else if (temp2 == "zerotarget") {
+ zerotarget = true;
+ }
+ else if (temp2 == "zeroplayertarget") {
+ zeroplayer = true;
+ zerotarget = true;
+ }
+ if (typeof temp3 == "function" && temp3(player, target) != undefined) {
+ threaten *= temp3(player, target);
+ }
+ else if (typeof temp3 == "object") {
+ if (typeof temp3.target == "number") {
+ threaten *= temp3;
+ }
+ else if (typeof temp3.target == "function" && temp3(player, target) != undefined) {
+ threaten *= temp3(player, target);
+ }
+ }
+ else if (typeof temp3 == "number") {
+ threaten *= temp3;
+ }
+ }
+ result2 += temp02;
+ result1 += temp01;
+ if (typeof card == "object" && !result.ignoreStatus) {
+ if (get.attitude(player, target) < 0) {
+ result2 *= Math.sqrt(threaten);
+ }
+ else {
+ result2 *= Math.sqrt(Math.sqrt(threaten));
+ }
+ if (target.hp == 1) result2 *= 2.5;
+ if (target.hp == 2) result2 *= 1.8;
+ if (target.countCards("h") == 0) {
+ if (get.tag(card, "respondSha") || get.tag(card, "respondShan")) {
+ result2 *= 1.7;
+ }
+ else {
+ result2 *= 1.5;
+ }
+ }
+ if (target.countCards("h") == 1) result2 *= 1.3;
+ if (target.countCards("h") == 2) result2 *= 1.1;
+ if (target.countCards("h") > 3) result2 *= 0.5;
+ if (target.hp == 4) result2 *= 0.9;
+ if (target.hp == 5) result2 *= 0.8;
+ if (target.hp > 5) result2 *= 0.6;
+ }
+ }
+ else {
+ result2 += temp02;
+ result1 += temp01;
+ }
+ if (zeroplayer) result1 = 0;
+ if (zerotarget) result2 = 0;
+ var final = 0;
+ if (player2) {
+ final = (result1 * get.attitude(player2, player) + (target ? result2 * get.attitude(player2, target) : 0));
+ }
+ else final = (result1 * get.attitude(player, player) + (target ? result2 * get.attitude(player, target) : 0));
+ if (!isLink && get.tag(card, "natureDamage") && !zerotarget) {
+ var info = get.info(card);
+ if (!info || !info.ai || !info.ai.canLink) {
+ if (target.isLinked()) game.countPlayer(function (current) {
+ if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
+ });
+ }
+ else if (info.ai.canLink(player, target, card)) {
+ game.countPlayer(function (current) {
+ if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
+ });
+ }
+ }
+ return final;
+ }
+ static effect(target, card, player, player2, isLink) {
+ var event = _status.event;
+ var eventskill = null;
+ if (player == undefined) player = _status.event.player;
+ if (card && typeof card == "object" && "name" in card) card = get.autoViewAs(card);
+ if (typeof card != "string" && (typeof card != "object" || !card.name)) {
+ var skillinfo = get.info(event.skill);
+ if (event.skill && skillinfo.viewAs == undefined) card = _status.event.skill;
+ else {
+ card = get.card();
+ if (skillinfo && skillinfo.viewAs && card.name === skillinfo.viewAs.name) {
+ eventskill = event.skill;
+ }
+ }
+ }
+ var result = get.result(card, eventskill);
+ var result1 = result.player, result2 = result.target;
+ if (typeof result1 == "function") result1 = result1(player, target, card, isLink);
+ if (typeof result2 == "function") result2 = result2(player, target, card, isLink);
+
+ if (typeof result1 != "number") result1 = 0;
+ if (typeof result2 != "number") result2 = 0;
+ var temp1, temp2, temp3, temp01 = 0, temp02 = 0, threaten = 1;
+ var skills1 = player.getSkills().concat(lib.skill.global);
+ game.expandSkills(skills1);
+ var zerotarget = false, zeroplayer = false;
+ for (var i = 0; i < skills1.length; i++) {
+ temp1 = get.info(skills1[i]).ai;
+ if (temp1 && typeof temp1.effect == "object" && typeof temp1.effect.player == "function") {
+ temp1 = temp1.effect.player(card, player, target, result1, isLink);
+ }
+ else temp1 = undefined;
+ if (typeof temp1 == "object") {
+ if (temp1.length == 2 || temp1.length == 4) {
+ result1 *= temp1[0];
+ temp01 += temp1[1];
+ }
+ if (temp1.length == 4) {
+ result2 *= temp1[2];
+ temp02 += temp1[3];
+ }
+ }
+ else if (typeof temp1 == "number") {
+ result1 *= temp1;
+ }
+ else if (temp1 == "zeroplayer") {
+ zeroplayer = true;
+ }
+ else if (temp1 == "zerotarget") {
+ zerotarget = true;
+ }
+ else if (temp1 == "zeroplayertarget") {
+ zeroplayer = true;
+ zerotarget = true;
+ }
+ }
+ if (target) {
+ var skills2 = target.getSkills().concat(lib.skill.global);
+ game.expandSkills(skills2);
+ for (var i = 0; i < skills2.length; i++) {
+ temp2 = get.info(skills2[i]).ai;
+ if (temp2 && temp2.threaten) temp3 = temp2.threaten;
+ else temp3 = undefined;
+ if (temp2 && typeof temp2.effect == "function") {
+ if (!player.hasSkillTag("ignoreSkill", true, {
+ card: card,
+ target: target,
+ skill: skills2[i],
+ isLink: isLink,
+ })) temp2 = temp2.effect(card, player, target, result2, isLink);
+ else temp2 = undefined;
+ }
+ else if (temp2 && typeof temp2.effect == "object" && typeof temp2.effect.target == "function") {
+ if (!player.hasSkillTag("ignoreSkill", true, {
+ card: card,
+ target: target,
+ skill: skills2[i],
+ isLink: isLink,
+ })) temp2 = temp2.effect.target(card, player, target, result2, isLink);
+ else temp2 = undefined;
+ }
+ else temp2 = undefined;
+ if (typeof temp2 == "object") {
+ if (temp2.length == 2 || temp2.length == 4) {
+ result2 *= temp2[0];
+ temp02 += temp2[1];
+ }
+ if (temp2.length == 4) {
+ result1 *= temp2[2];
+ temp01 += temp2[3];
+ }
+ }
+ else if (typeof temp2 == "number") {
+ result2 *= temp2;
+ }
+ else if (temp2 == "zeroplayer") {
+ zeroplayer = true;
+ }
+ else if (temp2 == "zerotarget") {
+ zerotarget = true;
+ }
+ else if (temp2 == "zeroplayertarget") {
+ zeroplayer = true;
+ zerotarget = true;
+ }
+ if (typeof temp3 == "function" && temp3(player, target) != undefined) {
+ threaten *= temp3(player, target);
+ }
+ else if (typeof temp3 == "object") {
+ if (typeof temp3.target == "number") {
+ threaten *= temp3;
+ }
+ else if (typeof temp3.target == "function" && temp3(player, target) != undefined) {
+ threaten *= temp3(player, target);
+ }
+ }
+ else if (typeof temp3 == "number") {
+ threaten *= temp3;
+ }
+ }
+ result2 += temp02;
+ result1 += temp01;
+ if (typeof card == "object" && !result.ignoreStatus) {
+ if (get.attitude(player, target) < 0) {
+ result2 *= Math.sqrt(threaten);
+ }
+ else {
+ result2 *= Math.sqrt(Math.sqrt(threaten));
+ }
+ // *** continue here ***
+ if (target.hp == 1) result2 *= 2.5;
+ if (target.hp == 2) result2 *= 1.8;
+ if (target.countCards("h") == 0) {
+ if (get.tag(card, "respondSha") || get.tag(card, "respondShan")) {
+ result2 *= 1.7;
+ }
+ else {
+ result2 *= 1.5;
+ }
+ }
+ if (target.countCards("h") == 1) result2 *= 1.3;
+ if (target.countCards("h") == 2) result2 *= 1.1;
+ if (target.countCards("h") > 3) result2 *= 0.5;
+ if (target.hp == 4) result2 *= 0.9;
+ if (target.hp == 5) result2 *= 0.8;
+ if (target.hp > 5) result2 *= 0.6;
+ }
+ }
+ else {
+ result2 += temp02;
+ result1 += temp01;
+ }
+ if (zeroplayer) result1 = 0;
+ if (zerotarget) result2 = 0;
+ var final = 0;
+ if (player2) {
+ final = (result1 * get.attitude(player2, player) + (target ? result2 * get.attitude(player2, target) : 0));
+ }
+ else final = (result1 * get.attitude(player, player) + (target ? result2 * get.attitude(player, target) : 0));
+ if (!isLink && get.tag(card, "natureDamage") && !zerotarget) {
+ var info = get.info(card);
+ if (!info || !info.ai || !info.ai.canLink) {
+ if (target.isLinked()) game.countPlayer(function (current) {
+ if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
+ });
+ }
+ else if (info.ai.canLink(player, target, card)) {
+ game.countPlayer(function (current) {
+ if (current != target && current.isLinked()) final += get.effect(current, card, player, player2, true);
+ });
+ }
+ }
+ return final;
+ }
+ static damageEffect(target, player, viewer, nature) {
+ if (get.itemtype(nature) == "natures") {
+ var natures = get.natureList(nature);
+ return natures.map(n => get.damageEffect(target, player, viewer, n)).reduce((p, c) => p + c, 0) / (natures.length || 1);
+ }
+ if (!player) {
+ player = target;
+ }
+ if (!viewer) {
+ viewer = target;
+ }
+ var name = "damage";
+ if (nature == "fire") {
+ name = "firedamage";
+ }
+ else if (nature == "thunder") {
+ name = "thunderdamage";
+ }
+ else if (nature == "ice") {
+ name = "icedamage";
+ }
+ var eff = get.effect(target, { name: name }, player, viewer);
+ if (eff > 0 && target.hujia > 0) return eff / 1.3;
+ return eff;
+ }
+ static recoverEffect(target, player, viewer) {
+ if (target.hp == target.maxHp) return 0;
+ if (!player) {
+ player = target;
+ }
+ if (!viewer) {
+ viewer = target;
+ }
+ return get.effect(target, { name: "recover" }, player, viewer);
+ }
+ static buttonValue(button) {
+ var card = button.link;
+ var player = get.owner(card);
+ if (!player) player = _status.event.player;
+ if (player.getCards("j").contains(card)) {
+ var efff = get.effect(player, {
+ name: card.viewAs || card.name,
+ cards: [card],
+ }, player, player);
+ if (efff > 0) return 0.5;
+ if (efff == 0) return 0;
+ return -1.5;
+ }
+ if (player.getCards("e").contains(card)) {
+ var evalue = get.value(card, player);
+ if (player.hasSkillTag("noe")) {
+ if (evalue >= 7) {
+ return evalue / 6;
+ }
+ return evalue / 10;
+ }
+ return evalue / 3;
+ }
+ if (player.hasSkillTag("noh")) return 0.1;
+ var nh = player.countCards("h");
+ switch (nh) {
+ case 1: return 2;
+ case 2: return 1.6;
+ case 3: return 1;
+ case 4: return 0.8;
+ case 5: return 0.6;
+ default: return 0.4;
+ }
+ }
+ static attitude2(to) {
+ return get.attitude(_status.event.player, to);
+ }
}
diff --git a/noname/get/is.js b/noname/get/is.js
index 8ac69bb1c..e3e58fbcf 100644
--- a/noname/get/is.js
+++ b/noname/get/is.js
@@ -1 +1,378 @@
-export class Is { }
+export class Is {
+ constructor() {
+ throw new TypeError(`${new.target.name} is not a constructor`);
+ }
+ /**
+ * 判断是否为进攻坐骑
+ * @param {Card | VCard} card
+ * @param {false | Player} [player]
+ * @returns {boolean}
+ */
+ static attackingMount(card, player) {
+ const subtype = get.subtype(card, player);
+ if (subtype == "equip4") return true;
+ else if (subtype == "equip6") {
+ const info = get.info(card, player), distance = info.distance;
+ if (!distance) return false;
+ if (distance.globalFrom && !info.notMount) return true;
+ }
+ return false;
+ }
+ /**
+ * 判断是否为防御坐骑
+ * @param {Card | VCard} card
+ * @param {false | Player} [player]
+ * @returns {boolean}
+ */
+ static defendingMount(card, player) {
+ const subtype = get.subtype(card, player);
+ if (subtype == "equip3") return true;
+ else if (subtype == "equip6") {
+ const info = get.info(card, player), distance = info.distance;
+ if (!distance) return false;
+ if (distance.globalTo && !info.notMount) return true;
+ }
+ return false;
+ }
+ /**
+ * 判断坐骑栏是否被合并
+ */
+ static mountCombined() {
+ if (lib.configOL) {
+ return lib.configOL.mount_combine;
+ }
+ else if (typeof _status.mountCombined != "boolean") {
+ _status.mountCombined = lib.config.mount_combine;
+ }
+ return _status.mountCombined;
+ }
+ /**
+ * 判断传入的参数的属性是否相同(参数可以为卡牌、卡牌信息、属性等)
+ * @param {...} infos 要判断的属性列表
+ * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同
+ */
+ static sameNature() {
+ let processedArguments = [], every = false;
+ Array.from(arguments).forEach(argument => {
+ if (typeof argument == "boolean") every = argument;
+ else if (argument) processedArguments.push(argument);
+ });
+ if (!processedArguments.length) return true;
+ if (processedArguments.length == 1) {
+ const argument = processedArguments[0];
+ if (!Array.isArray(argument)) return false;
+ if (!argument.length) return true;
+ if (argument.length == 1) return false;
+ processedArguments = argument;
+ }
+ const naturesList = processedArguments.map(card => {
+ if (typeof card == "string") return card.split(lib.natureSeparator);
+ else if (Array.isArray(card)) return card;
+ return get.natureList(card || {});
+ });
+ const testingNaturesList = naturesList.slice(0, naturesList.length - 1);
+ if (every) return testingNaturesList.every((natures, index) => naturesList.slice(index + 1).every(testingNatures => testingNatures.length == natures.length && testingNatures.every(nature => natures.includes(nature))));
+ return testingNaturesList.every((natures, index) => {
+ const comparingNaturesList = naturesList.slice(index + 1);
+ if (natures.length) return natures.some(nature => comparingNaturesList.every(testingNatures => testingNatures.includes(nature)));
+ return comparingNaturesList.every(testingNatures => !testingNatures.length);
+ });
+ }
+ /**
+ * 判断传入的参数的属性是否不同(参数可以为卡牌、卡牌信息、属性等)
+ * @param ...infos 要判断的属性列表
+ * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同
+ */
+ static differentNature() {
+ let processedArguments = [], every = false;
+ Array.from(arguments).forEach(argument => {
+ if (typeof argument == "boolean") every = argument;
+ else if (argument) processedArguments.push(argument);
+ });
+ if (!processedArguments.length) return false;
+ if (processedArguments.length == 1) {
+ const argument = processedArguments[0];
+ if (!Array.isArray(argument)) return true;
+ if (!argument.length) return false;
+ if (argument.length == 1) return true;
+ processedArguments = argument;
+ }
+ const naturesList = processedArguments.map(card => {
+ if (typeof card == "string") return card.split(lib.natureSeparator);
+ else if (Array.isArray(card)) return card;
+ return get.natureList(card || {});
+ });
+ const testingNaturesList = naturesList.slice(0, naturesList.length - 1);
+ if (every) return testingNaturesList.every((natures, index) => naturesList.slice(index + 1).every(testingNatures => testingNatures.every(nature => !natures.includes(nature))));
+ return testingNaturesList.every((natures, index) => {
+ const comparingNaturesList = naturesList.slice(index + 1);
+ if (natures.length) return natures.some(nature => comparingNaturesList.every(testingNatures => !testingNatures.length || testingNatures.some(testingNature => testingNature != nature)));
+ return comparingNaturesList.every(testingNatures => testingNatures.length);
+ });
+ }
+ /**
+ * 判断一张牌是否为明置手牌
+ */
+ static shownCard(card) {
+ if (!card) return false;
+ const gaintag = card.gaintag;
+ return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith("visible_"));
+ }
+ /**
+ * 是否是虚拟牌
+ */
+ static vituralCard(card) {
+ return card.isCard || (!("cards" in card) || !Array.isArray(card.cards) || card.cards.length == 0);
+ }
+ /**
+ * 是否是转化牌
+ */
+ static convertedCard(card) {
+ return !card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length > 0;
+ }
+ /**
+ * 是否是实体牌
+ */
+ static ordinaryCard(card) {
+ return card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length == 1;
+ }
+ /**
+ * 押韵判断
+ */
+ static yayun(str1, str2) {
+ if (str1 == str2) return true;
+ var pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false);
+ if (!pinyin1.length || !pinyin2.length) return false;
+ var pron1 = pinyin1[pinyin1.length - 1], pron2 = pinyin2[pinyin2.length - 1];
+ if (pron1 == pron2) return true;
+ return get.yunjiao(pron1) == get.yunjiao(pron2);
+ }
+ static blocked(skill, player) {
+ if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false;
+ for (var i of player.storage.skill_blocker) {
+ if (lib.skill[i] && lib.skill[i].skillBlocker && lib.skill[i].skillBlocker(skill, player)) return true;
+ }
+ return false;
+ }
+ static double(name, array) {
+ const extraInformations = get.character(name, 4);
+ if (!extraInformations) return false;
+ for (const extraInformation of extraInformations) {
+ if (!extraInformation.startsWith("doublegroup:")) continue;
+ return array ? extraInformation.split(":").slice(1) : true;
+ }
+ return false;
+ }
+
+ /**
+ * Check if the card has a Yingbian condition
+ *
+ * 检测此牌是否具有应变条件
+ */
+ static yingbianConditional(card) {
+ return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card);
+ }
+ static complexlyYingbianConditional(card) {
+ for (const key of lib.yingbian.condition.complex.keys()) {
+ if (get.cardtag(card, `yingbian_${key}`)) return true;
+ }
+ return false;
+ }
+ static simplyYingbianConditional(card) {
+ for (const key of lib.yingbian.condition.simple.keys()) {
+ if (get.cardtag(card, `yingbian_${key}`)) return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check if the card has a Yingbian effect
+ *
+ * 检测此牌是否具有应变效果
+ */
+ static yingbianEffective(card) {
+ for (const key of lib.yingbian.effect.keys()) {
+ if (get.cardtag(card, `yingbian_${key}`)) return true;
+ }
+ return false;
+ }
+ static yingbian(card) {
+ return get.is.yingbianConditional(card) || get.is.yingbianEffective(card);
+ }
+ static emoji(substring) {
+ if (substring) {
+ var reg = new RegExp("[~#^$@%&!?%*]", "g");
+ if (substring.match(reg)) {
+ return true;
+ }
+ for (var i = 0; i < substring.length; i++) {
+ var hs = substring.charCodeAt(i);
+ if (0xd800 <= hs && hs <= 0xdbff) {
+ if (substring.length > 1) {
+ var ls = substring.charCodeAt(i + 1);
+ var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
+ if (0x1d000 <= uc && uc <= 0x1f77f) {
+ return true;
+ }
+ }
+ }
+ else if (substring.length > 1) {
+ var ls = substring.charCodeAt(i + 1);
+ if (ls == 0x20e3) {
+ return true;
+ }
+ }
+ else {
+ if (0x2100 <= hs && hs <= 0x27ff) {
+ return true;
+ }
+ else if (0x2B05 <= hs && hs <= 0x2b07) {
+ return true;
+ }
+ else if (0x2934 <= hs && hs <= 0x2935) {
+ return true;
+ }
+ else if (0x3297 <= hs && hs <= 0x3299) {
+ return true;
+ }
+ else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030
+ || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b
+ || hs == 0x2b50) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+ static banWords(str) {
+ return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item));
+ }
+ static converted(event) {
+ return !(event.card && event.card.isCard);
+ }
+ static safari() {
+ return userAgent.indexOf("safari" != -1) && userAgent.indexOf("chrome") == -1;
+ }
+ static freePosition(cards) {
+ return !cards.some(card => !card.hasPosition || card.hasPosition());
+ }
+ static nomenu(name, item) {
+ var menus = ["system", "menu"];
+ var configs = {
+ show_round_menu: lib.config.show_round_menu,
+ round_menu_func: lib.config.round_menu_func,
+ touchscreen: lib.config.touchscreen,
+ swipe_up: lib.config.swipe_up,
+ swipe_down: lib.config.swipe_down,
+ swipe_left: lib.config.swipe_left,
+ swipe_right: lib.config.swipe_right,
+ right_click: lib.config.right_click,
+ phonelayout: lib.config.phonelayout
+ };
+ configs[name] = item;
+ if (!configs.phonelayout) return false;
+ if (configs.show_round_menu && menus.contains(configs.round_menu_func)) {
+ return false;
+ }
+ if (configs.touchscreen) {
+ if (menus.contains(configs.swipe_up)) return false;
+ if (menus.contains(configs.swipe_down)) return false;
+ if (menus.contains(configs.swipe_left)) return false;
+ if (menus.contains(configs.swipe_right)) return false;
+ }
+ else {
+ if (configs.right_click == "config") return false;
+ }
+ if (name) {
+ setTimeout(function () {
+ alert("请将至少一个操作绑定为显示按钮或打开菜单,否则将永远无法打开菜单");
+ });
+ }
+ return true;
+ }
+ static altered() {
+ return false;
+ }
+ static node(obj) {
+ var str = Object.prototype.toString.call(obj);
+ if (str && str.indexOf("[object HTML")) return true;
+ return false;
+ }
+ static div(obj) {
+ return Object.prototype.toString.call(obj) === "[object HTMLDivElement]";
+ }
+ static map(obj) {
+ return Object.prototype.toString.call(obj) === "[object Map]";
+ }
+ static set(obj) {
+ return Object.prototype.toString.call(obj) === "[object Set]";
+ }
+ static object(obj) {
+ return Object.prototype.toString.call(obj) === "[object Object]";
+ }
+ static singleSelect(func) {
+ if (typeof func == "function") return false;
+ var select = get.select(func);
+ return select[0] == 1 && select[1] == 1;
+ }
+ static jun(name) {
+ if (get.mode() == "guozhan") {
+ if (name && typeof name == "object") {
+ if (name.isUnseen && name.isUnseen(0)) return false;
+ name = name.name1;
+ }
+ if (typeof name == "string" && name.startsWith("gz_jun_")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ static versus() {
+ return !_status.connectMode && get.mode() == "versus" && _status.mode == "three";
+ }
+ static changban() {
+ return get.mode() == "single" && _status.mode == "changban";
+ }
+ static single() {
+ return get.mode() == "single" && _status.mode == "normal";
+ }
+ static mobileMe(player) {
+ return (game.layout == "mobile" || game.layout == "long") && !game.chess && player.dataset.position == 0;
+ }
+ static newLayout() {
+ return game.layout != "default";
+ }
+ static phoneLayout() {
+ if (!lib.config.phonelayout) return false;
+ return (game.layout == "mobile" || game.layout == "long" || game.layout == "long2" || game.layout == "nova");
+ }
+ static singleHandcard() {
+ return game.singleHandcard || game.layout == "mobile" || game.layout == "long" || game.layout == "long2" || game.layout == "nova";
+ }
+ static linked2(player) {
+ if (game.chess) return true;
+ if (lib.config.link_style2 != "rotate") return true;
+ // if(game.chess) return false;
+ if (game.layout == "long" || game.layout == "long2" || game.layout == "nova") return true;
+ if (player.dataset.position == "0") {
+ return ui.arena.classList.contains("oblongcard");
+ }
+ return false;
+ }
+ static empty(obj) {
+ return Object.keys(obj).length == 0;
+ }
+ static pos(str) {
+ return str == "h" || str == "e" || str == "j" || str == "he" || str == "hj" || str == "ej" || str == "hej";
+ }
+ static locked(skill, player) {
+ var info = lib.skill[skill];
+ if (typeof info.locked == "function") return info.locked(skill, player);
+ if (info.locked == false) return false;
+ if (info.trigger && info.forced) return true;
+ if (info.mod) return true;
+ if (info.locked) return true;
+ return false;
+ }
+}
diff --git a/noname/internal.js b/noname/internal.js
new file mode 100644
index 000000000..89a82766d
--- /dev/null
+++ b/noname/internal.js
@@ -0,0 +1 @@
+export { Library as InternalLibrary } from "./library.js";
diff --git a/noname/internal/internal-library.js b/noname/internal/internal-library.js
deleted file mode 100644
index 10496c084..000000000
--- a/noname/internal/internal-library.js
+++ /dev/null
@@ -1 +0,0 @@
-export { Library as InternalLibrary } from "../library.js";
diff --git a/noname/library.js b/noname/library.js
index 7841dba0b..4b2ec1635 100644
--- a/noname/library.js
+++ b/noname/library.js
@@ -1,7 +1,7 @@
import { Game } from "./game.js";
import { Get } from "./get.js";
import { GNC } from "./gnc.js";
-import { InternalLibrary } from "./internal/internal-library.js";
+import { InternalLibrary } from "./internal.js";
import { animate } from "./library/animate.js";
import { announce } from "./library/announce.js";
import { cardPack } from "./library/card-pack.js";