From c7209ee903a79292478b866380d9d0111e32478f Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Tue, 23 Apr 2024 00:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=BB=BA=E7=AB=8Blib.charact?= =?UTF-8?q?er=E7=B1=BB=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/key/character.js | 8 +- character/key/index.js | 2 +- mode/identity.js | 26 ++-- noname/get/index.js | 21 +-- noname/init/onload.js | 34 +++-- noname/library/element/character.js | 50 +++++-- noname/library/element/player.js | 50 +++---- noname/library/index.js | 194 ++++++++++++++-------------- 8 files changed, 198 insertions(+), 187 deletions(-) diff --git a/character/key/character.js b/character/key/character.js index 38968de1c..1dc4d0910 100644 --- a/character/key/character.js +++ b/character/key/character.js @@ -1,5 +1,11 @@ const characters = { - sp_key_yuri: ["female", "qun", 4, ["mubing", "ziqu", "diaoling"], ["border:key"]], + sp_key_yuri: { + sex: "female", + group: "qun", + hp: 4, + skills: ["mubing", "ziqu", "diaoling"], + groupBorder: "key", + }, key_lucia: ["female", "key", "2/3", ["lucia_duqu", "lucia_zhenren"]], key_kyousuke: ["male", "key", 4, ["nk_shekong", "key_huanjie"]], key_yuri: ["female", "key", 3, ["yuri_xingdong", "key_huanjie", "yuri_wangxi"], ["zhu"]], diff --git a/character/key/index.js b/character/key/index.js index 0c2812ac4..3814c6fea 100644 --- a/character/key/index.js +++ b/character/key/index.js @@ -7,7 +7,7 @@ import translates from "./translate.js"; game.import("character", function () { return { - name: "key/index", + name: "key", character: { ...characters }, characterFilter: { key_jojiro(mode) { diff --git a/mode/identity.js b/mode/identity.js index 4bbd46f23..5e00d5141 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -1051,7 +1051,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { list.push(group); } map[group].push(i); - if (lib.character[i][4] && lib.character[i][4].includes("zhu")) { + if (lib.character[i].isZhugong) { if (!map_zhu[group]) { map_zhu[group] = []; } @@ -1230,7 +1230,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { list.push(group); } map[group].push(i); - if (lib.character[i][4] && lib.character[i][4].includes("zhu")) { + if (lib.character[i].isZhugong) { if (!map_zhu[group]) { map_zhu[group] = []; } @@ -1496,8 +1496,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { if ( get.is.double(result[i][0]) || (lib.character[result[i][0]] && - lib.character[result[i][0]][1] == "shen" && - !lib.character[result[i][0]][4].includes("hiddenSkill")) + lib.character[result[i][0]].group == "shen" && + !lib.character[result[i][0]].hasHiddenSkill) ) shen.push(lib.playerOL[i]); } @@ -2098,7 +2098,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { } else { var bool = false; for (var j of ix) { - if (lib.character[j][4] && lib.character[j][4].includes("zhu")) { + if (lib.character[j].isZhugong) { bool = true; break; } @@ -2113,7 +2113,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { if (lib.filter.characterDisabled(i)) continue; event.list.push(i); list4.push(i); - if (!stratagemMode && lib.character[i][4] && lib.character[i][4].includes("zhu")) { + if (!stratagemMode && lib.character[i].isZhugong) { list2.push(i); } else { list3.push(i); @@ -2366,8 +2366,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { game.me._groupChosen = true; game.me.chooseControl(get.is.double(name, true)).set("prompt", "请选择你的势力"); } else if ( - lib.character[name][1] == "shen" && - !lib.character[name][4].includes("hiddenSkill") && + lib.character[name].group == "shen" && + !lib.character[name].hasHiddenSkill && get.config("choose_group") ) { var list = lib.group.slice(0); @@ -2560,7 +2560,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var pack = lib.characterPack[lib.configOL.characterPack[i]]; for (var j in pack) { // if(j=='zuoci') continue; - if (lib.character[j]) libCharacter[j] = pack[j]; + if (lib.character[j]) libCharacter[j] = lib.character[j]; } } for (i in lib.characterReplace) { @@ -2575,7 +2575,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { list4.addArray(ix); var bool = false; for (var j of ix) { - if (libCharacter[j][4] && libCharacter[j][4].includes("zhu")) { + if (libCharacter[j].isZhugong) { bool = true; break; } @@ -2597,7 +2597,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { event.list.push(i); event.list2.push(i); list4.push(i); - if (libCharacter[i][4] && libCharacter[i][4].includes("zhu")) { + if (libCharacter[i].isZhugong) { list2.push(i); } else { list3.push(i); @@ -2772,8 +2772,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { if ( get.is.double(result[i][0]) || (lib.character[result[i][0]] && - lib.character[result[i][0]][1] == "shen" && - !lib.character[result[i][0]][4].includes("hiddenSkill")) + lib.character[result[i][0]].group == "shen" && + !lib.character[result[i][0]].hasHiddenSkill) ) shen.push(lib.playerOL[i]); } diff --git a/noname/get/index.js b/noname/get/index.js index 639669fcc..678f5b4f4 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -638,15 +638,8 @@ export class Get { return "暂无武将介绍"; } bordergroup(info, raw) { - if (!Array.isArray(info)) { - info = lib.character[info]; - if (!info) return ""; - } - if (Array.isArray(info[4])) - for (const str of info[4]) { - if (typeof str == "string" && str.startsWith("border:")) return str.slice(7); - } - return raw ? "" : info[1] || ""; + if(info.groupBorder) return info.groupBorder; + return raw ? "" : info.group || ""; } groupnature(group, method) { var nature = lib.groupnature[group]; @@ -2938,15 +2931,7 @@ export class Get { } 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 infoitem = get.character(name); var skills = infoitem[3]; var opacity; for (var i = 0; i < skills.length; i++) { diff --git a/noname/init/onload.js b/noname/init/onload.js index 731dac0b1..359a45469 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -307,20 +307,27 @@ export async function onload(resetGameTimeout) { } for (k in character[i][j]) { if (j == "character") { - if (!character[i][j][k][4]) { - character[i][j][k][4] = []; - } - if ( - character[i][j][k][4].includes("boss") || - character[i][j][k][4].includes("hiddenboss") - ) { - lib.config.forbidai.add(k); - } if (lib.config.forbidai_user && lib.config.forbidai_user.includes(k)) { lib.config.forbidai.add(k); } - for (var l = 0; l < character[i][j][k][3].length; l++) { - lib.skilllist.add(character[i][j][k][3][l]); + if (Array.isArray(character[i][j][k])) { + if (!character[i][j][k][4]) { + character[i][j][k][4] = []; + } + if ( + character[i][j][k][4].includes("boss") || + character[i][j][k][4].includes("hiddenboss") + ) { + lib.config.forbidai.add(k); + } + for (var l = 0; l < character[i][j][k][3].length; l++) { + lib.skilllist.add(character[i][j][k][3][l]); + } + } + else{ + for (var l = 0; l < character[i][j][k].skills.length; l++) { + lib.skilllist.add(character[i][j][k].skills[l]); + } } } if ( @@ -346,6 +353,8 @@ export async function onload(resetGameTimeout) { nopop: character[i][j][k].nopop, derivation: character[i][j][k].derivation, }; + } else if (j === 'character') { + lib.character[k] = character[i][j][k]; } else { Object.defineProperty( lib[j], @@ -649,8 +658,7 @@ export async function onload(resetGameTimeout) { console.log(`加载《${lib.extensions[i][0]}》扩展的content时出现错误。`, e); if (!lib.config.extension_alert) alert( - `加载《${ - lib.extensions[i][0] + `加载《${lib.extensions[i][0] }》扩展的content时出现错误。\n该错误本身可能并不影响扩展运行。您可以在“设置→通用→无视扩展报错”中关闭此弹窗。\n${decodeURI( e.stack )}` diff --git a/noname/library/element/character.js b/noname/library/element/character.js index 10d6fba72..63d79dc4e 100644 --- a/noname/library/element/character.js +++ b/noname/library/element/character.js @@ -12,13 +12,23 @@ export class Character { /** @type { number } */ maxHp; /** @type { number } */ - hujia; + hujia = 0; /** @type { string } */ group; + /** @type { string } */ + groupBorder; + /** @type { string } */ + groupInGuozhan; /** @type { string[] } */ - skills; + skills = []; + /** @type { boolean } */ + isZhugong = false; + /** @type { boolean } */ + isUnseen = false; + /** @type { boolean } */ + hasHiddenSkill = false; /** @type { Array } */ - trashBin; + trashBin = []; /** * @param { Array|Object } [data] */ @@ -31,15 +41,35 @@ export class Character { this.hujia = get.infoHujia(data[2]); this.skills = get.copy(data[3] || []); this.trashBin = get.copy(data[4] || []); + Character.convertTrashToProperties(this, this.trashBin); } else if (get.is.object(data)) { - this.sex = data.sex; - this.group = data.group || ''; - this.hp = data.hp || 1; - this.maxHp = data.maxHp || this.hp; - this.hujia = data.hujia || 0; - this.skills = get.copy(data.skills || []); - this.trashBin = get.copy(data.trashBin || []); + Object.assign(this, data); + if(typeof this.maxHp !== 'number') this.maxHp = this.hp; + } + }; + /** + * @param { Character } character + * @param { Array } trash + */ + static convertTrashToProperties(character, trash){ + for(let i = 0; i < trash.length; i++){ + let item = trash[i]; + if (i === 0 && lib.group.includes(item)){ + character.groupInGuozhan = item; + } + else if(item === 'zhu'){ + character.isZhugong = true; + } + else if(item === 'unseen'){ + character.isUnseen = true; + } + else if(item === 'hiddenSkill'){ + character.hasHiddenSkill = true; + } + else if(item.startsWith('border:')){ + character.groupBorder = item.slice(7); + } } }; /** diff --git a/noname/library/element/player.js b/noname/library/element/player.js index 65ea80540..aed6f4654 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -2358,17 +2358,14 @@ export class Player extends HTMLDivElement { } var info = lib.character[character]; if (!info) { - info = ["", "", 1, [], []]; + info = new lib.element.Character(["", "", 1, [], []]); } - if (!info[4]) { - info[4] = []; - } - var skills = info[3].slice(0); + var skills = info.skills.slice(0); this.clearSkills(true); - var hp1 = get.infoHp(info[2]); - var maxHp1 = get.infoMaxHp(info[2]); - var hujia1 = get.infoHujia(info[2]); + var hp1 = info.hp; + var maxHp1 = info.maxHp; + var hujia1 = info.hujia; this.name = character; this.name1 = character; @@ -2377,8 +2374,8 @@ export class Player extends HTMLDivElement { name: character, name2: character2, }; - this.sex = info[0]; - this.group = info[1]; + this.sex = info.sex; + this.group = info.group; this.hp = hp1; this.maxHp = maxHp1; this.hujia = hujia1; @@ -2389,7 +2386,7 @@ export class Player extends HTMLDivElement { if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) { this.node.name.classList.add("long"); } - if (info[4].includes("hiddenSkill") && !this.noclick) { + if (info.hasHiddenSkill && !this.noclick) { if (!this.hiddenSkills) this.hiddenSkills = []; this.hiddenSkills.addArray(skills); skills = []; @@ -2401,16 +2398,13 @@ export class Player extends HTMLDivElement { if (character2 && lib.character[character2]) { var info2 = lib.character[character2]; if (!info2) { - info2 = ["", "", 1, [], []]; - } - if (!info2[4]) { - info2[4] = []; + info2 = new lib.element.Character(["", "", 1, [], []]); } this.name2 = character2; - var hp2 = get.infoHp(info2[2]); - var maxHp2 = get.infoMaxHp(info2[2]); - var hujia2 = get.infoHujia(info2[2]); + var hp2 = info2.hp; + var maxHp2 = info2.maxHp; + var hujia2 = info2.hujia; this.hujia += hujia2; var double_hp; if (_status.connectMode || get.mode() == "single") { @@ -2445,12 +2439,12 @@ export class Player extends HTMLDivElement { this.hp = hp1 + hp2 - 3; } } - if (info2[4].includes("hiddenSkill") && !this.noclick) { + if (info2.hasHiddenSkill && !this.noclick) { if (!this.hiddenSkills) this.hiddenSkills = []; - this.hiddenSkills.addArray(info2[3]); + this.hiddenSkills.addArray(info2.skills); hidden = true; skills.add("g_hidden_ai"); - } else skills = skills.concat(info2[3]); + } else skills = skills.concat(info2.skills); } if (this.storage.nohp || hidden) { this.storage.rawHp = this.hp; @@ -2493,10 +2487,7 @@ export class Player extends HTMLDivElement { this.classList.add("fullskin"); var info = lib.character[character]; if (!info) { - info = ["", "", 1, [], []]; - } - if (!info[4]) { - info[4] = []; + info = new lib.element.Character(["", "", 1, [], []]); } if (!game.minskin && get.is.newLayout() && !info[4].includes("minskin")) { @@ -2524,7 +2515,7 @@ export class Player extends HTMLDivElement { if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) { this.node.name.classList.add("long"); } - if (info[4].includes("hiddenSkill") && !this.noclick) { + if (info.hasHiddenSkill && !this.noclick) { if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen_show"); this.classList.add(_status.video ? "unseen_v" : "unseen"); if (!this.node.name_seat && !_status.video) { @@ -2539,10 +2530,7 @@ export class Player extends HTMLDivElement { if (character2 && lib.character[character2]) { var info2 = lib.character[character2]; if (!info2) { - info2 = ["", "", 1, [], []]; - } - if (!info2[4]) { - info2[4] = []; + info2 = new lib.element.Character(["", "", 1, [], []]); } this.classList.add("fullskin2"); this.node.avatar2.setBackground(character2, "character"); @@ -2550,7 +2538,7 @@ export class Player extends HTMLDivElement { this.name2 = character2; this.node.count.classList.add("p2"); - if (info2[4].includes("hiddenSkill") && !this.noclick) { + if (info2.hasHiddenSkill && !this.noclick) { if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen2_show"); this.classList.add(_status.video ? "unseen2_v" : "unseen2"); } diff --git a/noname/library/index.js b/noname/library/index.js index cc94bc8ca..2b54baf69 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -44,7 +44,7 @@ export class Library { characterDefaultPicturePath = characterDefaultPicturePath; compatibleEdition = Boolean( typeof nonameInitialized == "string" && - nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//) + nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//) ); changeLog = []; updates = []; @@ -342,19 +342,19 @@ export class Library { typeof yingbianZhuzhanAI == "function" ? yingbianZhuzhanAI(player, card, source, targets) : (cardx) => { - var info = get.info(card); - if (info && info.ai && info.ai.yingbian) { - var ai = info.ai.yingbian( - card, - source, - targets, - player - ); - if (!ai) return 0; - return ai - get.value(cardx); - } else if (get.attitude(player, source) <= 0) return 0; - return 5 - get.value(cardx); - }, + var info = get.info(card); + if (info && info.ai && info.ai.yingbian) { + var ai = info.ai.yingbian( + card, + source, + targets, + player + ); + if (!ai) return 0; + return ai - get.value(cardx); + } else if (get.attitude(player, source) <= 0) return 0; + return 5 - get.value(cardx); + }, }); if (!game.online) return; _status.event._resultid = id; @@ -1170,8 +1170,7 @@ export class Library { unfrequent: true, item: {}, intro: () => - `获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${ - lib.config.extension_sources[lib.config.extension_source] + `获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${lib.config.extension_sources[lib.config.extension_source] }`, }, extension_create: { @@ -1837,7 +1836,7 @@ export class Library { } else { this.lastChild.innerHTML = lib.configMenu.appearence.config.image_background.item[ - lib.config.image_background + lib.config.image_background ]; return; } @@ -1860,7 +1859,7 @@ export class Library { } else { this.lastChild.innerHTML = lib.configMenu.appearence.config.image_background.item[ - lib.config.image_background + lib.config.image_background ]; return; } @@ -2064,8 +2063,8 @@ export class Library { } ui.css.card_stylesheet = lib.init.sheet( ".card:not(*:empty){background-image:url(" + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2234,8 +2233,8 @@ export class Library { } ui.css.cardback_stylesheet = lib.init.sheet( ".card:empty,.card.infohidden{background-image:url(" + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); game.getDB("image", "cardback_style2", function (fileToLoad) { if (!fileToLoad) return; @@ -2246,8 +2245,8 @@ export class Library { } ui.css.cardback_stylesheet2 = lib.init.sheet( ".card.infohidden:not(.infoflip){background-image:url(" + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2404,8 +2403,8 @@ export class Library { } ui.css.hp_stylesheet1 = lib.init.sheet( '.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url(' + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2419,8 +2418,8 @@ export class Library { } ui.css.hp_stylesheet2 = lib.init.sheet( '.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url(' + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2434,8 +2433,8 @@ export class Library { } ui.css.hp_stylesheet3 = lib.init.sheet( '.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url(' + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2449,8 +2448,8 @@ export class Library { } ui.css.hp_stylesheet4 = lib.init.sheet( ".hp:not(.text):not(.actcount)>.lost{background-image:url(" + - fileLoadedEvent.target.result + - ")}" + fileLoadedEvent.target.result + + ")}" ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2571,8 +2570,8 @@ export class Library { } ui.css.player_stylesheet = lib.init.sheet( '#window .player{background-image:url("' + - fileLoadedEvent.target.result + - '");background-size:100% 100%;}' + fileLoadedEvent.target.result + + '");background-size:100% 100%;}' ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2709,8 +2708,8 @@ export class Library { ui.css.border_stylesheet.id = "ui.css.border"; ui.css.border_stylesheet.sheet.insertRule( '#window .player>.framebg{display:block;background-image:url("' + - fileLoadedEvent.target.result + - '")}', + fileLoadedEvent.target.result + + '")}', 0 ); ui.css.border_stylesheet.sheet.insertRule( @@ -2730,18 +2729,18 @@ export class Library { } ui.css.border_stylesheet.sheet.insertRule( '#window .player>.framebg,#window #arena.long.mobile:not(.fewplayer) .player[data-position="0"]>.framebg{display:block;background-image:url("' + - lib.assetURL + - "theme/style/player/" + - layout + - '1.png")}', + lib.assetURL + + "theme/style/player/" + + layout + + '1.png")}', 0 ); ui.css.border_stylesheet.sheet.insertRule( '#window #arena.long:not(.fewplayer) .player>.framebg, #arena.oldlayout .player>.framebg{background-image:url("' + - lib.assetURL + - "theme/style/player/" + - layout + - '3.png")}', + lib.assetURL + + "theme/style/player/" + + layout + + '3.png")}', 0 ); ui.css.border_stylesheet.sheet.insertRule( @@ -2924,8 +2923,8 @@ export class Library { } ui.css.menu_stylesheet = lib.init.sheet( 'html #window>.dialog.popped,html .menu,html .menubg{background-image:url("' + - fileLoadedEvent.target.result + - '");background-size:cover}' + fileLoadedEvent.target.result + + '");background-size:cover}' ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -2947,8 +2946,8 @@ export class Library { } ui.css.menu_stylesheet = lib.init.sheet( "html #window>.dialog.popped,html .menu,html .menubg{background-image:" + - str + - "}" + str + + "}" ); } }, @@ -3062,8 +3061,8 @@ export class Library { } ui.css.control_stylesheet = lib.init.sheet( '#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:url("' + - fileLoadedEvent.target.result + - '")}' + fileLoadedEvent.target.result + + '")}' ); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); @@ -3086,14 +3085,14 @@ export class Library { if (layout == "wood") { ui.css.control_stylesheet = lib.init.sheet( "#window .control,#window .menubutton,#window #system>div>div,#window #system>div>.pressdown2{background-image:" + - str + - "}" + str + + "}" ); } else { ui.css.control_stylesheet = lib.init.sheet( "#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:" + - str + - "}" + str + + "}" ); } } @@ -3128,20 +3127,20 @@ export class Library { } ui.css.buttonsheet = lib.init.sheet( "#system>div>div, .caption>div>.tdnode{padding-top:" + - cbnum1 + - "px !important;padding-bottom:" + - cbnum2 + - "px !important}", + cbnum1 + + "px !important;padding-bottom:" + + cbnum2 + + "px !important}", "#control>.control>div{padding-top:" + - cbnum3 + - "px;padding-bottom:" + - cbnum4 + - "px}", + cbnum3 + + "px;padding-bottom:" + + cbnum4 + + "px}", "#control>.control{padding-top:" + - cbnum5 + - "px;padding-bottom:" + - cbnum6 + - "px}" + cbnum5 + + "px;padding-bottom:" + + cbnum6 + + "px}" ); } }, @@ -8484,10 +8483,10 @@ export class Library { genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { - for (const content of item) { - yield content; - } - })() + for (const content of item) { + yield content; + } + })() : Promise.resolve(item); } gnc = { @@ -9209,9 +9208,9 @@ export class Library { log("键:" + (f - sf) + "/" + f); log( "已启用:" + - (a + b + c + d + e + f - (sa + sb + sc + sd + se + sf)) + - "/" + - (a + b + c + d + e + f) + (a + b + c + d + e + f - (sa + sb + sc + sd + se + sf)) + + "/" + + (a + b + c + d + e + f) ); })(); (function () { @@ -11139,9 +11138,8 @@ export class Library { content: (storage, player) => { const stratagemFuryMax = _status.stratagemFuryMax, fury = storage || 0; - return `当前怒气值:${ - typeof stratagemFuryMax == "number" ? `${fury}/${stratagemFuryMax}` : fury - }`; + return `当前怒气值:${typeof stratagemFuryMax == "number" ? `${fury}/${stratagemFuryMax}` : fury + }`; }, }, }, @@ -11214,7 +11212,7 @@ export class Library { return ( ((zhibi && !zhibi.includes(current)) || get.effect(current, card, player, player) >= - 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && + 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan( player, "use", @@ -11268,16 +11266,16 @@ export class Library { const cardName = get.name(cards[0], player); return cardName ? new lib.element.VCard({ - name: cardName, - nature: get.nature(cards[0], player), - suit: get.suit(cards[0], player), - number: get.number(cards[0], player), - isCard: true, - cards: [cards[0]], - storage: { - stratagem_buffed: 1, - }, - }) + name: cardName, + nature: get.nature(cards[0], player), + suit: get.suit(cards[0], player), + number: get.number(cards[0], player), + isCard: true, + cards: [cards[0]], + storage: { + stratagem_buffed: 1, + }, + }) : new lib.element.VCard(); } return null; @@ -11295,9 +11293,8 @@ export class Library { )}点怒气。${prompt()}`; span.appendChild(li); }); - return `当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。${ - document.createElement("hr").outerHTML - }${span.outerHTML}`; + return `当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。${document.createElement("hr").outerHTML + }${span.outerHTML}`; }, onuse: (result, player) => { player.logSkill(result.skill); @@ -11332,7 +11329,7 @@ export class Library { return ( ((zhibi && !zhibi.includes(current)) || get.effect(current, card, player, player) >= - 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && + 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan( player, "use", @@ -12778,15 +12775,12 @@ export class Library { }, }, }; - character = new Proxy( - {}, - { - set(target, prop, newValue){ - newValue = new lib.element.Character(newValue); - return Reflect.set(target, prop, newValue); - } + character = new Proxy({}, { + set(target, prop, newValue) { + if(!(newValue instanceof Element.Character)) newValue = new Element.Character(newValue); + return Reflect.set(target, prop, newValue); } - ); + }); perfectPair = {}; cardPile = {}; message = { @@ -13379,7 +13373,7 @@ export class Library { navigator.clipboard .readText() .then(read) - .catch((_) => {}); + .catch((_) => { }); } else { var input = ui.create.node("textarea", ui.window, { opacity: "0" }); input.select();