diff --git a/audio/effect/coin.mp3 b/audio/effect/coin.mp3 new file mode 100644 index 000000000..c5be25569 Binary files /dev/null and b/audio/effect/coin.mp3 differ diff --git a/audio/effect/coin_cost.mp3 b/audio/effect/coin_cost.mp3 new file mode 100644 index 000000000..1bed546bb Binary files /dev/null and b/audio/effect/coin_cost.mp3 differ diff --git a/character/shenhua.js b/character/shenhua.js index 9df90bd42..37ae98e7d 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -140,7 +140,7 @@ game.import("character", function () { guanqiujian: ["wenqin"], }, characterFilter: { - zuoci: function (mode) { + zuoci(mode) { return mode != "guozhan"; }, }, @@ -224,15 +224,16 @@ game.import("character", function () { chendao: "陈到,字叔至,生卒年不详,豫州汝南(今河南驻马店平舆县)人。三国时期蜀汉将领,刘备帐下白毦兵统领,名位常亚于赵云,以忠勇著称。蜀汉建兴年间,任征西将军、永安都督,封亭侯。在任期间去世。", }, + /** @type { importCharacterConfig['skill'] } */ skill: { //庞统写法修改 lianhuan: { audio: 2, - hiddenCard: (player, name) => { + hiddenCard(player, name) { return name == "tiesuo" && player.hasCard((card) => get.suit(card) == "club", "sh"); }, enable: "chooseToUse", - filter: function (event, player) { + filter(event, player) { if (!player.hasCard((card) => get.suit(card) == "club", "sh")) return false; return ( event.type == "phase" || @@ -240,7 +241,7 @@ game.import("character", function () { ); }, position: "hs", - filterCard: function (card, player, event) { + filterCard(card, player, event) { if (!event) event = _status.event; if (get.suit(card) != "club") return false; if (event.type == "phase" && get.position(card) != "s" && player.canRecast(card)) { @@ -252,7 +253,7 @@ game.import("character", function () { return event._backup.filterCard(cardx, player, event); } }, - filterTarget: function (fuck, player, target) { + filterTarget(fuck, player, target) { const card = ui.selected.cards[0], event = _status.event, backup = event._backup; @@ -263,7 +264,7 @@ game.import("character", function () { backup.filterCard(cardx, player, event) && backup.filterTarget(cardx, player, target) ); }, - selectTarget: function () { + selectTarget() { const card = ui.selected.cards[0], event = _status.event, player = event.player, @@ -282,7 +283,7 @@ game.import("character", function () { return select; } }, - filterOk: function () { + filterOk() { const card = ui.selected.cards[0], event = _status.event, player = event.player, @@ -306,13 +307,13 @@ game.import("character", function () { discard: false, lose: false, delay: false, - precontent: function () { + async precontent(event, trigger, player) { var result = event.result; if (result.targets.length > 0) result.card = get.autoViewAs({ name: "tiesuo" }, result.cards); }, - content: function () { - player.recast(cards); + async content(event, trigger, player) { + player.recast(event.cards); }, }, //新杀小加强 陈到 @@ -320,20 +321,20 @@ game.import("character", function () { audio: "drlt_wanglie", locked: false, mod: { - targetInRange: function (card, player, target) { + targetInRange(card, player, target) { if (player.hasSkill("dcwanglie_effect", null, null, false)) return true; }, }, trigger: { player: "useCard", }, - filter: function (event, player) { + filter(event, player) { return ( player.isPhaseUsing() && (event.card.name == "sha" || get.type(event.card) == "trick") ); }, preHidden: true, - check: function (event, player) { + check(event, player) { if (player.hasSkill("dcwanglie2", null, null, false)) return true; if (["wuzhong", "kaihua", "dongzhuxianji"].includes(event.card.name)) return false; player._wanglie_temp = true; @@ -359,7 +360,7 @@ game.import("character", function () { return true; return false; }, - prompt2: function (event) { + prompt2(event) { return ( "令" + get.translation(event.card) + @@ -367,7 +368,7 @@ game.import("character", function () { ); }, group: "dcwanglie_startup", - content: function () { + async content(event, trigger, player) { trigger.nowuxie = true; trigger.directHit.addArray(game.players); player.addTempSkill("dcwanglie2", "phaseUseAfter"); @@ -377,7 +378,7 @@ game.import("character", function () { trigger: { player: "phaseUseBegin" }, forced: true, popup: false, - content: function () { + async content(event, trigger, player) { player.addTempSkill("dcwanglie_effect", "phaseUseAfter"); }, }, @@ -387,10 +388,10 @@ game.import("character", function () { firstDo: true, popup: false, trigger: { player: "useCard1" }, - filter: function (event, player) { + filter(event, player) { return event.targets.some((target) => target != player); }, - content: function () { + async content(event, trigger, player) { player.addMark("dcwanglie_effect", 1, false); if (player.countMark("dcwanglie_effect") >= 2) player.removeSkill("dcwanglie_effect"); @@ -401,7 +402,7 @@ game.import("character", function () { ai: { //pretao:true, directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { //if(tag=='pretao') return true; if (player._wanglie_temp) return false; player._wanglie_temp = true; @@ -438,7 +439,7 @@ game.import("character", function () { dcwanglie2: { charlotte: true, mod: { - playerEnabled: function (card, player, target) { + playerEnabled(card, player, target) { if (player != target) return false; }, }, @@ -449,7 +450,7 @@ game.import("character", function () { trigger: { global: ["loseAfter", "addToExpansionAfter", "cardsGotoSpecialAfter", "loseAsyncAfter"], }, - filter: function (event, player, name) { + filter(event, player, name) { if (event.name == "lose" || event.name == "loseAsync") return event.getlx !== false && event.toStorage == true; if (event.name == "cardsGotoSpecial") return !event.notrigger; @@ -457,9 +458,8 @@ game.import("character", function () { }, direct: true, usable: 1, - content: function () { - "step 0"; - player + async content(event, trigger, player) { + const { result: { bool, targets } } = await player .chooseTarget( get.prompt("olliangyin"), "选择一名其他角色,你与其各摸一张牌", @@ -478,32 +478,32 @@ game.import("character", function () { return 3 * att; return att; }); - "step 1"; - if (result.bool) { - var target = result.targets[0]; + if (bool) { + const target = targets[0]; event.target = target; player.logSkill("olliangyin", target); - game.asyncDraw([player, target].sortBySeat()); - } else event.finish(); - "step 2"; - game.delayx(); - var num = player.getExpansions("olkongsheng").length; - var check = function (player) { + await game.asyncDraw([player, target].sortBySeat()); + } + else return; + await game.asyncDelayx(); + let num = player.getExpansions("olkongsheng").length; + let check = player => { if (!player.isIn() || player.isHealthy()) return false; return player.countCards("h") == num; }; + const { target } = event; if (check(player) || check(target)) { - var choiceList = [ + const choiceList = [ "令自己回复1点体力", "令" + get.translation(target) + "回复1点体力", ]; - var choices = []; + const choices = []; if (check(player)) choices.push("选项一"); else choiceList[0] = '' + choiceList[0] + ""; if (check(target)) choices.push("选项二"); else choiceList[1] = '' + choiceList[1] + ""; choices.push("cancel2"); - player + const { result : { control } } = await player .chooseControl(choices) .set("choiceList", choiceList) .set("prompt", "良姻:是否令一名角色回复体力?") @@ -519,10 +519,9 @@ game.import("character", function () { if (eff2 > 0) return "选项二"; return "cancel2"; }); - } else event.finish(); - "step 3"; - if (result.control == "选项一") player.recover(); - else if (result.control == "选项二") target.recover(); + if (control == "选项一") await player.recover(); + else if (control == "选项二") await target.recover(); + } }, group: "olliangyin_gain", subSkill: { @@ -539,97 +538,93 @@ game.import("character", function () { ], }, direct: true, - filter: function (event, player) { + filter(event, player) { return game.hasPlayer(function (current) { var evt = event.getl(current); return evt && (evt.xs.length > 0 || evt.ss.length > 0); }); }, usable: 1, - content: function () { - "step 0"; + async content(event, trigger, player) { if ( !player.countCards("he") || - !game.hasPlayer(function (current) { - return current != player && current.countCards("he") > 0; - }) - ) - event.finish(); - else - player.chooseCardTarget({ - prompt: get.prompt("olliangyin"), - prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌", - position: "he", - filterCard: lib.filter.cardDiscardable, - filterTarget: function (card, player, target) { - return target != player && target.countCards("he") > 0; - }, - ai1: function (card) { - let player = _status.event.player; - if (_status.event.me) { - if (get.position(card) === _status.event.me) - return 12 - player.hp - get.value(card); - return 0; - } - return 5 - get.value(card); - }, - ai2: function (target) { - let player = _status.event.player, - att = get.attitude(player, target); - if (att > 0 && (_status.event.me || target.isHealthy())) return -att; - if ( - att > 0 && - (target.countCards("he") > target.hp || - target.hasCard(function (card) { - return get.value(card, target) <= 0; - }, "e")) - ) - return att; - return -att; - }, - me: (function () { - if ( - player.isHealthy() || - get.recoverEffect(player, player, _status.event.player) <= 0 - ) - return false; - let ph = player.countCards("h"), - num = player.getExpansions("olkongsheng").length; - if (ph === num) { - if (player.hasSkillTag("noh")) return "h"; - return "e"; - } - if (ph - 1 === num) return "h"; + !game.hasPlayer(current => current != player && + current.countCards("he") > 0) + ) return; + const { result: { bool, targets, cards } } = await player.chooseCardTarget({ + prompt: get.prompt("olliangyin"), + prompt2: "弃置一张牌,并令一名其他角色也弃置一张牌", + position: "he", + filterCard: lib.filter.cardDiscardable, + filterTarget(card, player, target) { + return target != player && target.countCards("he") > 0; + }, + ai1(card) { + let player = _status.event.player; + if (_status.event.me) { + if (get.position(card) === _status.event.me) + return 12 - player.hp - get.value(card); + return 0; + } + return 5 - get.value(card); + }, + ai2(target) { + let player = _status.event.player, + att = get.attitude(player, target); + if (att > 0 && (_status.event.me || target.isHealthy())) return -att; + if ( + att > 0 && + (target.countCards("he") > target.hp || + target.hasCard(function (card) { + return get.value(card, target) <= 0; + }, "e")) + ) + return att; + return -att; + }, + me: (() => { + if ( + player.isHealthy() || + get.recoverEffect(player, player, _status.event.player) <= 0 + ) return false; - })(), - }); - "step 1"; - if (result.bool) { - var target = result.targets[0]; + let ph = player.countCards("h"), + num = player.getExpansions("olkongsheng").length; + if (ph === num) { + if (player.hasSkillTag("noh")) return "h"; + return "e"; + } + if (ph - 1 === num) return "h"; + return false; + })(), + }); + if (bool) { + const target = targets[0]; event.target = target; player.logSkill("olliangyin_gain", target); - player.discard(result.cards); - target.chooseToDiscard("he", true); - } else event.finish(); - "step 2"; - game.delayx(); - var num = player.getExpansions("olkongsheng").length; - var check = function (player) { + await player.discard(cards); + await target.chooseToDiscard("he", true); + } + else return; + await game.asyncDelayx(); + let num = player.getExpansions("olkongsheng").length; + let check = player => { if (!player.isIn() || player.isHealthy()) return false; return player.countCards("h") == num; }; + const { target } = event; if (check(player) || check(target)) { - var choiceList = [ + const choiceList = [ "令自己回复1点体力", "令" + get.translation(target) + "回复1点体力", ]; - var choices = []; + const choices = []; if (check(player)) choices.push("选项一"); else choiceList[0] = '' + choiceList[0] + ""; if (check(target)) choices.push("选项二"); else choiceList[1] = '' + choiceList[1] + ""; choices.push("cancel2"); - player + const { result: { control } } = await player .chooseControl(choices) .set("choiceList", choiceList) .set("prompt", "良姻:是否令一名角色回复体力?") @@ -647,10 +642,9 @@ game.import("character", function () { if (eff2 > 0) return "选项二"; return "cancel2"; }); - } else event.finish(); - "step 3"; - if (result.control == "选项一") player.recover(); - else if (result.control == "选项二") target.recover(); + if (control == "选项一") await player.recover(); + else if (control == "选项二") await target.recover(); + } }, }, }, @@ -659,10 +653,10 @@ game.import("character", function () { audio: "kongsheng", trigger: { player: "phaseZhunbeiBegin" }, direct: true, - filter: function (event, player) { + filter(event, player) { return player.countCards("he") > 0; }, - content: function () { + content() { "step 0"; player .chooseCard( @@ -706,7 +700,7 @@ game.import("character", function () { player.addToExpansion(result.cards, player, "give").gaintag.add("olkongsheng"); } }, - onremove: function (player, skill) { + onremove(player, skill) { var cards = player.getExpansions(skill); if (cards.length) player.loseToDiscardpile(cards); }, @@ -720,14 +714,14 @@ game.import("character", function () { trigger: { player: "phaseJieshuBegin" }, forced: true, locked: false, - filter: function (event, player) { + filter(event, player) { return ( player.getExpansions("olkongsheng").filter(function (card) { return get.type(card, false) != "equip"; }).length > 0 ); }, - content: function () { + content() { "step 0"; var cards = player.getExpansions("olkongsheng").filter(function (card) { return get.type(card, false) != "equip"; @@ -776,7 +770,7 @@ game.import("character", function () { trigger: { player: "useCardToPlayered" }, direct: true, audio: "drlt_zhenrong", - filter: function (event, player) { + filter(event, player) { if (!event.isFirstTarget) return false; if (!["basic", "trick"].includes(get.type(event.card))) return false; if (get.tag(event.card, "damage")) @@ -789,7 +783,7 @@ game.import("character", function () { }); return false; }, - content: function () { + content() { "step 0"; player .chooseTarget( @@ -820,7 +814,7 @@ game.import("character", function () { player.addToExpansion(card, "give", "log", target).gaintag.add("zhengrong"); } }, - onremove: function (player, skill) { + onremove(player, skill) { var cards = player.getExpansions(skill); if (cards.length) player.loseToDiscardpile(cards); }, @@ -839,10 +833,10 @@ game.import("character", function () { skillAnimation: true, animationColor: "thunder", derivation: "qingce", - filter: function (event, player) { + filter(event, player) { return player.getExpansions("zhengrong").length >= 3; }, - content: function () { + content() { "step 0"; player.awakenSkill("hongju"); var cards = player.getExpansions("zhengrong"); @@ -888,23 +882,23 @@ game.import("character", function () { qingce: { enable: "phaseUse", audio: "drlt_qingce", - filter: function (event, player) { + filter(event, player) { return player.getExpansions("zhengrong").length > 0 && player.countCards("h") > 0; }, chooseButton: { - dialog: function (event, player) { + dialog(event, player) { return ui.create.dialog( "请选择要获得的「荣」", player.getExpansions("zhengrong"), "hidden" ); }, - backup: function (links, player) { + backup(links, player) { return { card: links[0], filterCard: true, position: "h", - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target.countDiscardableCards(player, "ej") > 0; }, delay: false, @@ -912,7 +906,7 @@ game.import("character", function () { content: lib.skill.qingce.contentx, ai: { result: { - target: function (player, target) { + target(player, target) { var att = get.attitude(player, target); if ( att > 0 && @@ -934,7 +928,7 @@ game.import("character", function () { }, }; }, - prompt: function (links, player) { + prompt(links, player) { return ( "选择弃置一张手牌,获得" + get.translation(links[0]) + @@ -942,7 +936,7 @@ game.import("character", function () { ); }, }, - contentx: function () { + contentx() { "step 0"; var card = lib.skill.qingce_backup.card; player.gain(card, "gain2", "log"); @@ -954,7 +948,7 @@ game.import("character", function () { ai: { order: 8, result: { - player: function (player) { + player(player) { if ( game.hasPlayer(function (current) { var att = get.attitude(player, current); @@ -984,11 +978,11 @@ game.import("character", function () { trigger: { source: "damageSource", }, - filter: function (event, player) { + filter(event, player) { return event.player != player && event.player.countCards("h") > player.countCards("h"); }, direct: true, - content: function () { + content() { "step 0"; player .choosePlayerCard("hej", get.prompt("drlt_zhenrong"), trigger.player) @@ -1016,10 +1010,10 @@ game.import("character", function () { unique: true, juexingji: true, derivation: ["drlt_qingce"], - filter: function (event, player) { + filter(event, player) { return player.getExpansions("drlt_zhenrong").length >= 3 && game.dead.length > 0; }, - content: function () { + content() { "step 0"; player.awakenSkill("drlt_hongju"); var cards = player.getExpansions("drlt_zhenrong"); @@ -1064,13 +1058,13 @@ game.import("character", function () { drlt_qingce: { audio: 2, enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { return player.getExpansions("drlt_zhenrong").length > 0; }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target.countDiscardableCards(player, "ej") > 0; }, - content: function () { + content() { "step 0"; player.chooseCardButton( player.getExpansions("drlt_zhenrong"), @@ -1090,7 +1084,7 @@ game.import("character", function () { ai: { order: 13, result: { - target: function (player, target) { + target(player, target) { if (get.attitude(player, target) > 0 && target.countCards("j") > 0) return 1; return -1; }, @@ -1103,7 +1097,7 @@ game.import("character", function () { player: "phaseJieshuBegin", }, direct: true, - content: function () { + content() { "step 0"; player .chooseTarget(get.prompt2("drlt_zhenggu"), function (card, player, target) { @@ -1128,7 +1122,7 @@ game.import("character", function () { lib.skill.drlt_zhenggu.sync(player, target); } }, - sync: function (player, target) { + sync(player, target) { var num = player.countCards("h"); var num2 = target.countCards("h"); if (num < num2) { @@ -1144,13 +1138,13 @@ game.import("character", function () { forced: true, charlotte: true, logTarget: "player", - filter: function (event, player) { + filter(event, player) { return ( event.player.storage.drlt_zhenggu_mark && event.player.storage.drlt_zhenggu_mark.includes(player) ); }, - content: function () { + content() { while (trigger.player.storage.drlt_zhenggu_mark.includes(player)) { trigger.player.storage.drlt_zhenggu_mark.remove(player); } @@ -1160,7 +1154,7 @@ game.import("character", function () { }, }, drlt_zhenggu_mark: { - init: function (player, skill) { + init(player, skill) { if (!player.storage[skill]) player.storage[skill] = []; }, marktext: "镇", @@ -1174,7 +1168,7 @@ game.import("character", function () { trigger: { player: "phaseJieshuBegin", }, - check: function (event, player) { + check(event, player) { var num = 0; if ( player.hasHistory("lose", function (evt) { @@ -1187,7 +1181,7 @@ game.import("character", function () { if (num == 3) return player.hp >= 2; return true; }, - prompt: function (event, player) { + prompt(event, player) { var num = 3; if ( player.hasHistory("lose", function (evt) { @@ -1199,7 +1193,7 @@ game.import("character", function () { if (!player.getStat("damage")) num--; return get.prompt("xinfu_zuilun") + "(可获得" + get.cnNumber(num) + "张牌)"; }, - content: function () { + content() { "step 0"; event.num = 0; event.cards = get.cards(3); @@ -1292,7 +1286,7 @@ game.import("character", function () { }, forced: true, audio: 2, - filter: function (event, player) { + filter(event, player) { if (event.player.countCards("h") < player.countCards("h")) return false; if (event.card.name != "sha" && event.card.name != "juedou") return false; return !game.hasPlayer2(function (current) { @@ -1308,12 +1302,12 @@ game.import("character", function () { ); }); }, - content: function () { + content() { trigger.getParent().excluded.add(player); }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { let hs = player.getCards( "h", (i) => i !== card && (!card.cards || !card.cards.includes(i)) @@ -1360,7 +1354,7 @@ game.import("character", function () { locked: true, ai: { effect: { - target: function (card) { + target(card) { if (card.name == "tiesuo") return "zeroplayertarget"; }, }, @@ -1372,16 +1366,16 @@ game.import("character", function () { player: "linkBegin", }, forced: true, - filter: function (event, player) { + filter(event, player) { return !player.isLinked(); }, - content: function () { + content() { trigger.cancel(); }, }, 2: { mod: { - targetEnabled: function (card, player, target) { + targetEnabled(card, player, target) { if (get.type(card) == "delay") return false; }, }, @@ -1395,7 +1389,7 @@ game.import("character", function () { audio: 2, enable: "phaseUse", usable: 1, - filter: function (event, player) { + filter(event, player) { return ( player.hasEnabledSlot(1) || player.hasEnabledSlot(2) || @@ -1403,7 +1397,7 @@ game.import("character", function () { player.hasEnabledSlot("horse") ); }, - content: function () { + content() { "step 0"; player.chooseToDisable(true).set("ai", function (event, player, list) { if (list.includes("equip2")) return "equip2"; @@ -1444,7 +1438,7 @@ game.import("character", function () { ai: { order: 13, result: { - player: function (player) { + player(player) { if (player.hasEnabledSlot("equip2")) return 1; if ( player.hasEnabledSlot("equip1") && @@ -1470,7 +1464,7 @@ game.import("character", function () { }, drlt_jueyan1: { mod: { - cardUsable: function (card, player, num) { + cardUsable(card, player, num) { if (card.name == "sha") return num + 3; }, }, @@ -1480,7 +1474,7 @@ game.import("character", function () { }, drlt_jueyan2: { mod: { - targetInRange: function (card, player, target, now) { + targetInRange(card, player, target, now) { return true; }, }, @@ -1490,7 +1484,7 @@ game.import("character", function () { }, drlt_jueyan3: { mod: { - maxHandcard: function (player, num) { + maxHandcard(player, num) { return num + 3; }, }, @@ -1509,10 +1503,10 @@ game.import("character", function () { unique: true, juexingji: true, derivation: ["drlt_huairou"], - filter: function (event, player) { + filter(event, player) { return !player.hasEnabledSlot() || player.hp == 1; }, - content: function () { + content() { "step 0"; player.awakenSkill("drlt_poshi"); player.loseMaxHp(); @@ -1532,11 +1526,11 @@ game.import("character", function () { lib.skill.drlt_huairou.position ), filterCard: (card, player) => get.type(card) == "equip" && player.canRecast(card), - check: function (card) { + check(card) { if (!_status.event.player.canEquip(card)) return 5; return 3 - get.value(card); }, - content: function () { + content() { player.recast(cards); }, discard: false, @@ -1561,10 +1555,10 @@ game.import("character", function () { player: "phaseDrawBegin2", }, forced: true, - filter: function (event, player) { + filter(event, player) { return !event.numFixed; }, - content: function () { + content() { trigger.num = game.countGroup(); }, }, @@ -1574,14 +1568,14 @@ game.import("character", function () { player: "phaseUseEnd", }, forced: true, - filter: function (event, player) { + filter(event, player) { var num = 0; player.getHistory("sourceDamage", function (evt) { if (evt.getParent("phaseUse") == event) num += evt.num; }); return !num || num > 1; }, - content: function () { + content() { var numx = 0; player.getHistory("sourceDamage", function (evt) { if (evt.getParent("phaseUse") == trigger) numx += evt.num; @@ -1598,7 +1592,7 @@ game.import("character", function () { }, drlt_yongsi1: { mod: { - maxHandcard: function (player, num) { + maxHandcard(player, num) { return num + player.maxHp - 2 * Math.max(0, player.hp); }, }, @@ -1612,7 +1606,7 @@ game.import("character", function () { player: "phaseDiscardBegin", }, direct: true, - filter: function (event, player) { + filter(event, player) { if (!player.hasZhuSkill("drlt_weidi")) return false; return ( player.needsToDiscard() > 0 && @@ -1621,7 +1615,7 @@ game.import("character", function () { }) > 0 ); }, - content: function () { + content() { "step 0"; var num = Math.min( player.needsToDiscard(), @@ -1638,17 +1632,17 @@ game.import("character", function () { get.cnNumber(num) + "张手牌交给等量的其他群势力角色。先按顺序选中所有要给出的手牌,然后再按顺序选择等量的目标角色", selectCard: [1, num], - selectTarget: function () { + selectTarget() { return ui.selected.cards.length; }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target != player && target.group == "qun"; }, complexSelect: true, - filterOk: function () { + filterOk() { return ui.selected.cards.length == ui.selected.targets.length; }, - ai1: function (card) { + ai1(card) { var player = _status.event.player; var value = get.value(card, player, "raw"); if ( @@ -1664,7 +1658,7 @@ game.import("character", function () { return 1 / Math.max(1, get.useful(card)); return -1; }, - ai2: function (target) { + ai2(target) { var player = _status.event.player; var card = ui.selected.cards[ui.selected.targets.length]; if (card && get.value(card, player, "raw") < 0) @@ -1700,13 +1694,13 @@ game.import("character", function () { skillAnimation: true, animationColor: "gray", limited: true, - filter: function (event, player) { + filter(event, player) { return !player.isDisabledJudge() || player.hasEnabledSlot(); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target != player; }, - content: function () { + content() { player.awakenSkill("drlt_xiongluan"); var disables = []; for (var i = 1; i <= 5; i++) { @@ -1755,18 +1749,18 @@ game.import("character", function () { }, }, drlt_xiongluan1: { - onremove: function (player) { + onremove(player) { player.storage.drlt_xiongluan1.removeSkill("drlt_xiongluan2"); player.storage.drlt_xiongluan1.unmarkSkill("drlt_xiongluan1"); delete player.storage.drlt_xiongluan1; }, mod: { - targetInRange: function (card, player, target) { + targetInRange(card, player, target) { if (target.hasSkill("drlt_xiongluan2")) { return true; } }, - cardUsableTarget: function (card, player, target) { + cardUsableTarget(card, player, target) { if (target.hasSkill("drlt_xiongluan2")) return true; }, }, @@ -1774,13 +1768,13 @@ game.import("character", function () { }, drlt_xiongluan2: { mod: { - cardEnabled2: function (card, player) { + cardEnabled2(card, player) { if (get.position(card) == "h") return false; }, }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (get.tag(card, "damage")) return [0, -999999]; }, }, @@ -1794,29 +1788,29 @@ game.import("character", function () { target: "useCardToTargeted", }, direct: true, - filter: function (event, player) { + filter(event, player) { return ( get.type(event.card) == "trick" && event.targets.length > 1 && player.countCards("he") > 0 ); }, - content: function () { + content() { "step 0"; player.chooseCardTarget({ filterCard: true, selectCard: 1, position: "he", - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player != target && _status.event.targets.includes(target); }, - ai1: function (card) { + ai1(card) { if (card.name == "du") return 20; if (_status.event.player.storage.drlt_xiongluan && get.type(card) == "equip") return 15; return 6 - get.value(card); }, - ai2: function (target) { + ai2(target) { var att = get.attitude(_status.event.player, target); if (ui.selected.cards.length && ui.selected.cards[0].name == "du") { if (target.hasSkillTag("nodu")) return 0.1; @@ -1841,7 +1835,7 @@ game.import("character", function () { drlt_wanglie: { locked: false, mod: { - targetInRange: function (card, player, target, now) { + targetInRange(card, player, target, now) { if (game.online) { if (!player.countUsed()) return true; } else { @@ -1861,13 +1855,13 @@ game.import("character", function () { trigger: { player: "useCard", }, - filter: function (event, player) { + filter(event, player) { return ( player.isPhaseUsing() && (event.card.name == "sha" || get.type(event.card) == "trick") ); }, preHidden: true, - check: function (event, player) { + check(event, player) { if (["wuzhong", "kaihua", "dongzhuxianji"].includes(event.card.name)) return false; player._wanglie_temp = true; var eff = 0; @@ -1892,10 +1886,10 @@ game.import("character", function () { return true; return false; }, - prompt2: function (event) { + prompt2(event) { return "令" + get.translation(event.card) + "不能被响应,然后本阶段不能再使用牌"; }, - content: function () { + content() { trigger.nowuxie = true; trigger.directHit.addArray(game.players); player.addTempSkill("drlt_wanglie2", "phaseUseAfter"); @@ -1903,7 +1897,7 @@ game.import("character", function () { ai: { pretao: true, directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if (tag == "pretao") return true; if (player._wanglie_temp) return false; player._wanglie_temp = true; @@ -1939,7 +1933,7 @@ game.import("character", function () { }, drlt_wanglie2: { mod: { - cardEnabled: function (card, player) { + cardEnabled(card, player) { return false; }, }, @@ -1957,14 +1951,14 @@ game.import("character", function () { "loseAsyncAfter", ], }, - filter: function (event, player, name) { + filter(event, player, name) { if (event.name == "lose" || event.name == "loseAsync") return event.getlx !== false && event.toStorage == true; if (event.name == "cardsGotoSpecial") return !event.notrigger; return true; }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget( "是否发动【良姻】令手牌数大于你的一名角色摸一张牌?", @@ -1988,7 +1982,7 @@ game.import("character", function () { trigger: { global: "gainAfter", }, - filter: function (event, player) { + filter(event, player) { return ( event.fromStorage == true || game.hasPlayer2(function (current) { @@ -1998,7 +1992,7 @@ game.import("character", function () { ); }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget( "是否发动【良姻】令手牌数小于你的一名角色弃置一张牌?", @@ -2028,10 +2022,10 @@ game.import("character", function () { player: "phaseZhunbeiBegin", }, direct: true, - filter: function (event, player) { + filter(event, player) { return player.countCards("he") > 0; }, - content: function () { + content() { "step 0"; player .chooseCard(get.prompt("kongsheng"), "将任意张牌置于武将牌上", "he", [ @@ -2063,12 +2057,12 @@ game.import("character", function () { trigger: { player: "phaseJieshuBegin", }, - filter: function (event, player) { + filter(event, player) { return player.getExpansions("kongsheng2").length > 0; }, forced: true, charlotte: true, - content: function () { + content() { "step 0"; player.addTempSkill("kongsheng_ai", "kongsheng2After"); "step 1"; @@ -2099,7 +2093,7 @@ game.import("character", function () { zhuanhuanji: true, marktext: "☯", intro: { - content: function (storage, player, skill) { + content(storage, player, skill) { if (player.storage.nzry_juzhan == true) return "当你使用【杀】指定一名角色为目标后,你可以获得其一张牌,然后你本回合内不能再对其使用牌"; return "当你成为其他角色【杀】的目标后,你可以与其各摸一张牌,然后其本回合内不能再对你使用牌"; @@ -2114,11 +2108,11 @@ game.import("character", function () { }, prompt2: "当你成为其他角色【杀】的目标后,你可以与其各摸一张牌,然后其本回合内不能再对你使用牌。", - filter: function (event, player) { + filter(event, player) { return event.card.name == "sha" && !player.storage.nzry_juzhan; }, logTarget: "player", - content: function () { + content() { "step 0"; game.asyncDraw([player, trigger.player]); trigger.player.addTempSkill("nzry_juzhany"); @@ -2135,14 +2129,14 @@ game.import("character", function () { }, prompt2: "当你使用【杀】指定一名角色为目标后,你可以获得其一张牌,然后你本回合内不能再对其使用牌", - filter: function (event, player) { + filter(event, player) { return ( event.card.name == "sha" && player.storage.nzry_juzhan == true && event.target.countGainableCards(player, "he") > 0 ); }, - check: function (event, player) { + check(event, player) { return ( event.player.countCards("he") > 0 && event.targets && @@ -2150,7 +2144,7 @@ game.import("character", function () { ); }, logTarget: "target", - content: function () { + content() { player.gainPlayerCard(trigger.targets[0], "he", true); player.changeZhuanhuanji("nzry_juzhan"); trigger.target.addTempSkill("nzry_juzhanx"); @@ -2161,7 +2155,7 @@ game.import("character", function () { }, nzry_juzhanx: { mod: { - targetEnabled: function (card, player, target) { + targetEnabled(card, player, target) { if (player.hasSkill("nzry_juzhany")) return false; }, }, @@ -2172,7 +2166,7 @@ game.import("character", function () { if (!Array.isArray(player.storage.nzry_feijun)) player.storage.nzry_feijun = []; }, intro: { - content: function (storage) { + content(storage) { if (!storage || !storage.length) return "尚未发动"; var str = get.translation(storage); return "已对" + str + "发动过〖飞军〗"; @@ -2183,7 +2177,7 @@ game.import("character", function () { usable: 1, position: "he", audio: 2, - filter: function (event, player) { + filter(event, player) { return ( game.hasPlayer(function (current) { return current.countCards("h") >= player.countCards("h"); @@ -2194,10 +2188,10 @@ game.import("character", function () { ); }, filterCard: true, - check: function (card) { + check(card) { return 5 - get.value(card); }, - content: function () { + content() { "step 0"; var list = []; if ( @@ -2285,7 +2279,7 @@ game.import("character", function () { ai: { order: 11, result: { - player: function (player) { + player(player) { if ( game.hasPlayer(function (current) { return ( @@ -2318,10 +2312,10 @@ game.import("character", function () { audio: 2, trigger: { player: "nzry_feijunAfter" }, forced: true, - filter: function (event, player) { + filter(event, player) { return event._nzry_binglve == true; }, - content: function () { + content() { player.draw(2); }, ai: { combo: "nzry_feijun" }, @@ -2330,7 +2324,7 @@ game.import("character", function () { charlotte: true, ai: { filterDamage: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if (!player.hasMark("nzry_huaiju")) return false; if ( !game.hasPlayer(function (current) { @@ -2357,10 +2351,10 @@ game.import("character", function () { player: "enterGame", }, forced: true, - filter: function (event, player) { + filter(event, player) { return event.name != "phase" || game.phaseNumber == 0; }, - content: function () { + content() { player.addMark("nzry_huaiju", 3); player.addSkill("nzry_huaiju_ai"); }, @@ -2373,10 +2367,10 @@ game.import("character", function () { global: ["damageBegin4", "phaseDrawBegin2"], }, forced: true, - filter: function (event, player) { + filter(event, player) { return event.player.hasMark("nzry_huaiju") && (event.name == "damage" || !event.numFixed); }, - content: function () { + content() { player.line(trigger.player, "green"); if (trigger.name == "damage") { trigger.cancel(); @@ -2390,7 +2384,7 @@ game.import("character", function () { player: "phaseUseBegin", }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget( get.prompt("nzry_yili"), @@ -2438,13 +2432,13 @@ game.import("character", function () { trigger: { player: "phaseDrawBefore", }, - filter: function (event, player) { + filter(event, player) { return !player.hasMark("nzry_huaiju"); }, - check: function (event, player) { + check(event, player) { return player.countCards("h") >= 2 || player.skipList.includes("phaseUse"); }, - content: function () { + content() { trigger.cancel(); player.addMark("nzry_huaiju", 1); }, @@ -2458,7 +2452,7 @@ game.import("character", function () { player: "phaseDiscardAfter", }, direct: true, - filter: function (event, player) { + filter(event, player) { var cards = []; player.getHistory("lose", function (evt) { if (evt.type == "discard" && evt.getParent("phaseDiscard") == event) @@ -2466,7 +2460,7 @@ game.import("character", function () { }); return cards.length > 0; }, - content: function () { + content() { "step 0"; var cards = []; player.getHistory("lose", function (evt) { @@ -2556,17 +2550,17 @@ game.import("character", function () { rechezheng: { audio: "nzry_zhizheng", trigger: { source: "damageBegin2" }, - filter: function (event, player) { + filter(event, player) { return player.isPhaseUsing() && !player.inRangeOf(event.player); }, forced: true, logTarget: "player", - content: function () { + content() { trigger.cancel(); }, ai: { effect: { - player: function (card, player, target) { + player(card, player, target) { if (get.tag(card, "damage") && !player.inRangeOf(target)) return "zerotarget"; }, }, @@ -2584,7 +2578,7 @@ game.import("character", function () { player: "phaseUseEnd", }, forced: true, - filter: function (event, player) { + filter(event, player) { return ( player.getHistory("useCard", function (evt) { return evt.getParent("phaseUse") == event; @@ -2601,7 +2595,7 @@ game.import("character", function () { }) ); }, - content: function () { + content() { "step 0"; player.chooseTarget( "请选择〖掣政〗的目标", @@ -2633,7 +2627,7 @@ game.import("character", function () { }, nzry_lijun2: { mod: { - cardUsable: function (card, player, num) { + cardUsable(card, player, num) { if (card.name == "sha") return num + player.countMark("nzry_lijun2"); }, }, @@ -2645,7 +2639,7 @@ game.import("character", function () { trigger: { player: "useCardAfter", }, - filter: function (event, player) { + filter(event, player) { if (event.card.name != "sha" || player.group != "wu") return false; if (player.hasSkill("nzry_lijun2")) return false; if (!player.isPhaseUsing()) return false; @@ -2663,7 +2657,7 @@ game.import("character", function () { return false; }, direct: true, - content: function () { + content() { "step 0"; var list = game.filterPlayer(function (target) { return player != target && target.hasZhuSkill("nzry_lijun", player); @@ -2715,7 +2709,7 @@ game.import("character", function () { zhuanhuanji: true, marktext: "☯", intro: { - content: function (storage, player, skill) { + content(storage, player, skill) { var str = player.storage.nzry_chenglve ? "出牌阶段限一次,你可以摸两张牌,然后弃置一张手牌。若如此做,直到本回合结束,你使用与弃置牌花色相同的牌无距离和次数限制" : "出牌阶段限一次,你可以摸一张牌,然后弃置两张手牌。若如此做,直到本回合结束,你使用与弃置牌花色相同的牌无距离和次数限制"; @@ -2729,7 +2723,7 @@ game.import("character", function () { enable: "phaseUse", usable: 1, audio: 2, - content: function () { + content() { "step 0"; if (player.storage.nzry_chenglve == true) { player.draw(2); @@ -2752,7 +2746,7 @@ game.import("character", function () { ai: { order: 2.7, result: { - player: function (player) { + player(player) { if (!player.storage.nzry_chenglve && player.countCards("h") < 3) return 0; return 1; }, @@ -2761,12 +2755,12 @@ game.import("character", function () { }, nzry_chenglve1: { mod: { - cardUsable: function (card, player) { + cardUsable(card, player) { const suit = get.suit(card); if (suit == "unsure" || player.getStorage("nzry_chenglve1").includes(suit)) return Infinity; }, - targetInRange: function (card, player) { + targetInRange(card, player) { const suit = get.suit(card); if (suit == "unsure" || player.getStorage("nzry_chenglve1").includes(suit)) return true; @@ -2777,7 +2771,7 @@ game.import("character", function () { nzry_shicai: { audio: "nzry_shicai_2", trigger: { player: ["useCardAfter", "useCardToTargeted"] }, - prompt2: function (event, player) { + prompt2(event, player) { const cards = event.cards.filterInD("oe"); return ( "你可以将" + @@ -2786,7 +2780,7 @@ game.import("character", function () { "置于牌堆顶,然后摸一张牌" ); }, - filter: function (event, player) { + filter(event, player) { if (!event.cards.someInD()) return false; let evt = event, type = get.type2(evt.card, false); @@ -2804,7 +2798,7 @@ game.import("character", function () { evt ); }, - check: function (event, player) { + check(event, player) { if (get.type(event.card) == "equip") { if (get.subtype(event.card) == "equip6") return true; if (get.equipResult(player, player, event.card.name) <= 0) return true; @@ -2818,7 +2812,7 @@ game.import("character", function () { } return true; }, - content: function () { + content() { "step 0"; var cards = trigger.cards.filterInD(); if (cards.length == 1) { @@ -2852,7 +2846,7 @@ game.import("character", function () { subSkill: { 2: { audio: 2 } }, ai: { reverseOrder: true, - skillTagFilter: function (player) { + skillTagFilter(player) { if ( player.getHistory("useCard", function (evt) { return get.type(evt.card) == "equip"; @@ -2861,7 +2855,7 @@ game.import("character", function () { return false; }, effect: { - target: function (card, player, target) { + target(card, player, target) { if ( player == target && get.type(card) == "equip" && @@ -2881,7 +2875,7 @@ game.import("character", function () { player: "drawBegin", }, forced: true, - content: function () { + content() { trigger.bottom = true; }, }, @@ -2893,7 +2887,7 @@ game.import("character", function () { content: "expansion", markcount: "expansion", }, - onremove: function (player, skill) { + onremove(player, skill) { var cards = player.getExpansions(skill); if (cards.length) player.loseToDiscardpile(cards); }, @@ -2908,13 +2902,13 @@ game.import("character", function () { }, forced: true, locked: false, - filter: function (event, player) { + filter(event, player) { return ( (event.name != "phase" || game.phaseNumber == 0) && !player.getExpansions("nzry_mingren").length ); }, - content: function () { + content() { "step 0"; player.draw(2); "step 1"; @@ -2937,13 +2931,13 @@ game.import("character", function () { trigger: { player: "phaseJieshuBegin", }, - filter: function (event, player) { + filter(event, player) { return ( player.countCards("h") > 0 && player.getExpansions("nzry_mingren").length > 0 ); }, direct: true, - content: function () { + content() { "step 0"; player .chooseCard( @@ -2998,7 +2992,7 @@ game.import("character", function () { zhuanhuanji: true, marktext: "☯", intro: { - content: function (storage, player, skill) { + content(storage, player, skill) { if (player.storage.nzry_zhenliang == true) return "当你于回合外使用或打出的牌结算完成后,若此牌与“任”颜色相同,则你可以令一名角色摸一张牌。"; return "出牌阶段限一次,你可以弃置一张与“任”颜色相同的牌并对攻击范围内的一名角色造成1点伤害。"; @@ -3010,7 +3004,7 @@ game.import("character", function () { prompt: "弃置一张与“任”颜色相同的牌,并对攻击范围内的一名角色造成1点伤害。", audio: 2, enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { if (player.storage.nzry_zhenliang) return false; var storage = player.getExpansions("nzry_mingren"); if (!storage.length) return false; @@ -3026,23 +3020,23 @@ game.import("character", function () { }); }, position: "he", - filterCard: function (card, player) { + filterCard(card, player) { return get.color(card) == get.color(player.getExpansions("nzry_mingren")[0]); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player.inRange(target); }, - check: function (card) { + check(card) { return 6.5 - get.value(card); }, - content: function () { + content() { player.changeZhuanhuanji("nzry_zhenliang"); target.damage("nocard"); }, ai: { order: 5, result: { - player: function (player, target) { + player(player, target) { return get.damageEffect(target, player, player); }, }, @@ -3052,14 +3046,14 @@ game.import("character", function () { trigger: { player: ["useCardAfter", "respondAfter"], }, - filter: function (event, player) { + filter(event, player) { if (_status.currentPhase == player || !player.storage.nzry_zhenliang) return false; var card = player.getExpansions("nzry_mingren")[0]; return card && get.color(event.card) == get.color(card); }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget(get.prompt("nzry_zhenliang"), "令一名角色摸一张牌").ai = function (target) { @@ -3085,11 +3079,11 @@ game.import("character", function () { trigger: { target: "useCardToTargeted", }, - filter: function (event, player) { + filter(event, player) { return event.player != player; }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget( get.prompt("nzry_jianxiang"), @@ -3114,7 +3108,7 @@ game.import("character", function () { zhuanhuanji: true, marktext: "☯", intro: { - content: function (storage, player, skill) { + content(storage, player, skill) { if (player.storage.nzry_shenshi == true) return "其他角色对你造成伤害后,你可以观看该角色的手牌,然后交给其一张牌,当前角色回合结束时,若此牌仍在该角色的区域内,你将手牌摸至四张"; return "出牌阶段限一次,你可以将一张牌交给一名手牌数最多的角色,然后对其造成1点伤害,若该角色因此死亡,则你可以令一名角色将手牌摸至四张"; @@ -3127,7 +3121,7 @@ game.import("character", function () { prompt: "出牌阶段限一次,你可以将一张牌交给一名手牌数最多的角色,然后对其造成1点伤害,若该角色因此死亡,则你可以令一名角色将手牌摸至四张", enable: "phaseUse", usable: 1, - filter: function (event, player) { + filter(event, player) { return player.countCards("he") > 0 && player.storage.nzry_shenshi != true; }, discard: false, @@ -3136,7 +3130,7 @@ game.import("character", function () { delay: false, position: "he", filterCard: true, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return ( target != player && !game.hasPlayer(function (current) { @@ -3146,10 +3140,10 @@ game.import("character", function () { }) ); }, - check: function (card) { + check(card) { return 5 - get.value(card); }, - content: function () { + content() { "step 0"; player.changeZhuanhuanji("nzry_shenshi"); player.give(cards, target); @@ -3178,7 +3172,7 @@ game.import("character", function () { ai: { order: 1, result: { - target: function (player, target) { + target(player, target) { return -1; }, }, @@ -3189,7 +3183,7 @@ game.import("character", function () { trigger: { player: "damageEnd", }, - filter: function (event, player) { + filter(event, player) { return ( player.countCards("he") > 0 && event.source && @@ -3197,7 +3191,7 @@ game.import("character", function () { player.storage.nzry_shenshi == true ); }, - check: function (event, player) { + check(event, player) { return ( event.source && event.source.countCards("h") <= 2 && @@ -3207,7 +3201,7 @@ game.import("character", function () { logTarget: "source", prompt2: "其他角色对你造成伤害后,你可以观看该角色的手牌,然后交给其一张牌,当前角色回合结束时,若此牌仍在该角色的区域内,你将手牌摸至四张", - content: function () { + content() { "step 0"; player.changeZhuanhuanji("nzry_shenshi"); player.viewHandcards(trigger.source); @@ -3235,12 +3229,12 @@ game.import("character", function () { forced: true, popup: false, charlotte: true, - filter: function (event, player) { + filter(event, player) { return ( player.storage.nzry_shenshi1 != undefined && player.storage.nzry_shenshi2 != undefined ); }, - content: function () { + content() { var pl = player.storage.nzry_shenshi2; var card = player.storage.nzry_shenshi1; if (player.getCards("he").includes(card) && 4 - pl.countCards("h") > 0) { @@ -3255,7 +3249,7 @@ game.import("character", function () { xinjushou: { audio: 2, trigger: { player: "phaseJieshuBegin" }, - content: function () { + content() { "step 0"; player.draw(4); player.turnOver(); @@ -3281,7 +3275,7 @@ game.import("character", function () { }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (card.name == "guiyoujie") return [0, 1]; }, }, @@ -3293,14 +3287,14 @@ game.import("character", function () { filterCard: true, position: "e", viewAs: { name: "wuxie" }, - filter: function (event, player) { + filter(event, player) { return player.countCards("e") > 0; }, - viewAsFilter: function (player) { + viewAsFilter(player) { return player.countCards("e") > 0; }, prompt: "将一张装备区内的牌当无懈可击使用", - check: function (card) { + check(card) { return 8 - get.equipValue(card); }, threaten: 1.2, @@ -3310,10 +3304,10 @@ game.import("character", function () { trigger: { player: "turnOverEnd" }, direct: true, audio: "jiewei", - filter: function (event, player) { + filter(event, player) { return !player.isTurnedOver() && player.canMoveCard(); }, - content: function () { + content() { "step 0"; player .chooseToDiscard( @@ -3343,15 +3337,15 @@ game.import("character", function () { audio: 2, audioname: ["re_pangde"], trigger: { player: "useCardToPlayered" }, - filter: function (event, player) { + filter(event, player) { return event.card.name == "sha" && event.target.countDiscardableCards(player, "he") > 0; }, preHidden: true, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.target) <= 0; }, logTarget: "target", - content: function () { + content() { "step 0"; player .discardPlayerCard(trigger.target, get.prompt("jianchu", trigger.target), true) @@ -3386,7 +3380,7 @@ game.import("character", function () { ai: { unequip_ai: true, directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if (tag == "directHit_ai") return ( arg.card.name == "sha" && @@ -3404,7 +3398,7 @@ game.import("character", function () { enable: "phaseUse", usable: 1, position: "he", - filterCard: function () { + filterCard() { if (ui.selected.targets.length == 2) return false; return true; }, @@ -3412,7 +3406,7 @@ game.import("character", function () { selectTarget: 2, complexCard: true, complexSelect: true, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; if (ui.selected.targets.length == 0) return true; return ( @@ -3422,7 +3416,7 @@ game.import("character", function () { }, multitarget: true, multiline: true, - content: function () { + content() { "step 0"; var cards = targets[0].getCards("h").concat(targets[1].getCards("h")); var dialog = ui.create.dialog("缔盟", true); @@ -3556,7 +3550,7 @@ game.import("character", function () { game.addVideo("cardDialog", null, dialog.videoId); }, targetprompt: ["先拿牌", "后拿牌"], - find: function (type) { + find(type) { var list = game.filterPlayer(function (current) { return current != player && get.attitude(player, current) > 3; }); @@ -3592,7 +3586,7 @@ game.import("character", function () { if (type == 3) return count; return list[i]; }, - check: function (card) { + check(card) { var count = lib.skill.redimeng.find(3); if (count == null) return -1; if (ui.selected.cards.length < count) return 7 - get.value(card); @@ -3603,7 +3597,7 @@ game.import("character", function () { threaten: 1.6, expose: 0.5, result: { - player: function (player, target) { + player(player, target) { if (ui.selected.targets.length == 0) { if (target == lib.skill.redimeng.find(1)) return 1; return 0; @@ -3619,13 +3613,13 @@ game.import("character", function () { audio: 2, enable: "phaseUse", viewAs: { name: "wanjian" }, - filterCard: function (card, player) { + filterCard(card, player) { if (!player.storage.reluanji) return true; return !player.storage.reluanji.includes(get.suit(card)); }, position: "hs", selectCard: 2, - check: function (card) { + check(card) { var player = _status.event.player; var targets = game.filterPlayer(function (current) { return player.canUse("wanjian", current); @@ -3663,7 +3657,7 @@ game.import("character", function () { reset: { trigger: { player: "phaseAfter" }, silent: true, - content: function () { + content() { delete player.storage.reluanji; delete player.storage.reluanji2; }, @@ -3671,10 +3665,10 @@ game.import("character", function () { count: { trigger: { player: "useCard" }, silent: true, - filter: function (event) { + filter(event) { return event.skill == "reluanji"; }, - content: function () { + content() { player.storage.reluanji2 = trigger.card; if (!player.storage.reluanji) { player.storage.reluanji = []; @@ -3687,10 +3681,10 @@ game.import("character", function () { respond: { trigger: { global: "respond" }, silent: true, - filter: function (event) { + filter(event) { return event.getParent(2).skill == "reluanji"; }, - content: function () { + content() { trigger.player.draw(); }, }, @@ -3699,10 +3693,10 @@ game.import("character", function () { forced: true, silent: true, popup: false, - filter: function (event, player) { + filter(event, player) { return player.storage.reluanji2 && event.card == player.storage.reluanji2; }, - content: function () { + content() { delete player.storage.reluanji2; }, }, @@ -3711,10 +3705,10 @@ game.import("character", function () { forced: true, silent: true, popup: false, - filter: function (event, player) { + filter(event, player) { return player.storage.reluanji2 && event.card == player.storage.reluanji2; }, - content: function () { + content() { player.draw(trigger.targets.length); delete player.storage.reluanji2; }, @@ -3726,10 +3720,10 @@ game.import("character", function () { limited: true, audio: 2, enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { return !player.storage.qimou; }, - init: function (player) { + init(player) { player.storage.qimou = false; }, mark: true, @@ -3738,7 +3732,7 @@ game.import("character", function () { }, skillAnimation: true, animationColor: "orange", - content: function () { + content() { "step 0"; var shas = player.getCards("h", "sha"); var num; @@ -3774,7 +3768,7 @@ game.import("character", function () { ai: { order: 2, result: { - player: function (player) { + player(player) { if (player.hp == 1) return 0; var shas = player.getCards("h", "sha"); if (!shas.length) return 0; @@ -3809,12 +3803,12 @@ game.import("character", function () { qimou2: { onremove: true, mod: { - cardUsable: function (card, player, num) { + cardUsable(card, player, num) { if (typeof player.storage.qimou2 == "number" && card.name == "sha") { return num + player.storage.qimou2; } }, - globalFrom: function (from, to, distance) { + globalFrom(from, to, distance) { if (typeof from.storage.qimou2 == "number") { return distance - from.storage.qimou2; } @@ -3825,12 +3819,12 @@ game.import("character", function () { audio: "kuanggu", audioname: ["re_weiyan", "ol_weiyan"], trigger: { source: "damageSource" }, - filter: function (event, player) { + filter(event, player) { return event.kuangguCheck && event.num > 0; }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; event.num = trigger.num; "step 1"; @@ -3867,10 +3861,10 @@ game.import("character", function () { xinliegong: { shaRelated: true, mod: { - aiOrder: function (player, card, num) { + aiOrder(player, card, num) { if (num > 0 && (card.name === "sha" || get.tag(card, "draw"))) return num + 6; }, - targetInRange: function (card, player, target) { + targetInRange(card, player, target) { if (card.name == "sha" && typeof get.number(card) == "number") { if (get.distance(player, target) <= get.number(card)) return true; } @@ -3881,16 +3875,16 @@ game.import("character", function () { trigger: { player: "useCardToTargeted" }, logTarget: "target", locked: false, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.target) <= 0; }, - filter: function (event, player) { + filter(event, player) { if (event.card.name != "sha") return false; if (event.target.countCards("h") <= player.countCards("h")) return true; if (event.target.hp >= player.hp) return true; return false; }, - content: function () { + content() { if (trigger.target.countCards("h") <= player.countCards("h")) trigger.getParent().directHit.push(trigger.target); if (trigger.target.hp >= player.hp) { @@ -3906,7 +3900,7 @@ game.import("character", function () { ai: { threaten: 0.5, directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if ( get.attitude(player, arg.target) <= 0 && arg.card.name == "sha" && @@ -3929,10 +3923,10 @@ game.import("character", function () { }, enable: "phaseUse", usable: 1, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target != player && target.inRange(player) && target.countCards("he") > 0; }, - content: function () { + content() { "step 0"; target .chooseToUse(function (card, player, event) { @@ -3962,7 +3956,7 @@ game.import("character", function () { expose: 0.2, result: { target: -1, - player: function (player, target) { + player(player, target) { if (target.countCards("h") == 0) return 0; if (target.countCards("h") == 1) return -0.1; if (player.hp <= 2) return -2; @@ -3985,11 +3979,11 @@ game.import("character", function () { derivation: "reguanxing", trigger: { player: "phaseZhunbeiBegin" }, forced: true, - filter: function (event, player) { + filter(event, player) { if (player.storage.zhiji) return false; return player.countCards("h") == 0; }, - content: function () { + content() { "step 0"; player.awakenSkill("zhiji"); player.chooseDrawRecover(2, true); @@ -4004,10 +3998,10 @@ game.import("character", function () { trigger: { target: "useCardToTargeted" }, forced: true, preHidden: true, - filter: function (event, player) { + filter(event, player) { return event.card.name == "sha"; }, - content: function () { + content() { "step 0"; var eff = get.effect(player, trigger.card, trigger.player, trigger.player); trigger.player @@ -4031,7 +4025,7 @@ game.import("character", function () { }, ai: { effect: { - target_use: function (card, player, target, current) { + target_use(card, player, target, current) { if (card.name == "sha" && get.attitude(player, target) < 0) { if (_status.event.name == "xiangle") return; if (get.attitude(player, target) > 0 && current < 0) return "zerotarget"; @@ -4058,12 +4052,12 @@ game.import("character", function () { fangquan: { audio: 2, trigger: { player: "phaseUseBefore" }, - filter: function (event, player) { + filter(event, player) { return player.countCards("h") > 0 && !player.hasSkill("fangquan3"); }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; var fang = player.countMark("fangquan2") == 0 && @@ -4105,7 +4099,7 @@ game.import("character", function () { audio: false, //priority:-50, onremove: true, - content: function () { + content() { "step 0"; event.count = player.countMark(event.name); player.removeMark(event.name, event.count); @@ -4144,7 +4138,7 @@ game.import("character", function () { forced: true, popup: false, audio: false, - content: function () { + content() { player.unmarkSkill("fangquan"); player.removeSkill("fangquan3"); }, @@ -4161,10 +4155,10 @@ game.import("character", function () { derivation: "rejijiang", trigger: { player: "phaseZhunbeiBegin" }, forced: true, - filter: function (event, player) { + filter(event, player) { return player.isMinHp(); }, - content: function () { + content() { "step 0"; player.awakenSkill("ruoyu"); player.gainMaxHp(); @@ -4178,12 +4172,12 @@ game.import("character", function () { trigger: { player: ["phaseJudgeBefore", "phaseDrawBefore", "phaseUseBefore", "phaseDiscardBefore"], }, - filter: function (event, player) { + filter(event, player) { return player.countCards("h") > 0; }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; var check, str = "弃置一张手牌并跳过"; @@ -4304,13 +4298,13 @@ game.import("character", function () { }, frequent: true, preHidden: true, - filter: function (event, player) { + filter(event, player) { if (player == _status.currentPhase) return false; if (event.name == "gain" && event.player == player) return false; var evt = event.getl(player); return evt && evt.cards2 && evt.cards2.length > 0; }, - content: function () { + content() { "step 0"; var next = player.judge(function (card) { if (get.suit(card) == "heart") return -1; @@ -4340,7 +4334,7 @@ game.import("character", function () { } player.addToExpansion(event.card, "gain2").gaintag.add("tuntian"); }, - callback: function () { + callback() { if (!event.judgeResult.bool) { event.finish(); return; @@ -4352,7 +4346,7 @@ game.import("character", function () { content: "expansion", markcount: "expansion", }, - onremove: function (player, skill) { + onremove(player, skill) { var cards = player.getExpansions(skill); if (cards.length) player.loseToDiscardpile(cards); }, @@ -4362,7 +4356,7 @@ game.import("character", function () { dist: { locked: false, mod: { - globalFrom: function (from, to, distance) { + globalFrom(from, to, distance) { var num = distance - from.getExpansions("tuntian").length; if ( _status.event.skill == "jixi_backup" || @@ -4376,7 +4370,7 @@ game.import("character", function () { }, ai: { effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if ( typeof card === "object" && get.name(card) === "sha" && @@ -4423,7 +4417,7 @@ game.import("character", function () { } }, }, - threaten: function (player, target) { + threaten(player, target) { if (target.countCards("h") == 0) return 2; return 0.5; }, @@ -4440,11 +4434,11 @@ game.import("character", function () { juexingji: true, trigger: { player: "phaseZhunbeiBegin" }, forced: true, - filter: function (event, player) { + filter(event, player) { return player.getExpansions("tuntian").length >= 3; }, derivation: "jixi", - content: function () { + content() { player.awakenSkill("zaoxian"); player.loseMaxHp(); player.addSkills("jixi"); @@ -4454,23 +4448,23 @@ game.import("character", function () { audio: 2, audioname: ["re_dengai", "gz_dengai", "ol_dengai"], enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { return ( player.getExpansions("tuntian").length > 0 && event.filterCard({ name: "shunshou" }, player, event) ); }, chooseButton: { - dialog: function (event, player) { + dialog(event, player) { return ui.create.dialog("急袭", player.getExpansions("tuntian"), "hidden"); }, - filter: function (button, player) { + filter(button, player) { var card = button.link; if (!game.checkMod(card, player, "unchanged", "cardEnabled2", player)) return false; var evt = _status.event.getParent(); return evt.filterCard(get.autoViewAs({ name: "shunshou" }, [card]), player, evt); }, - backup: function (links, player) { + backup(links, player) { var skill = _status.event.buttoned; return { audio: "jixi", @@ -4485,14 +4479,14 @@ game.import("character", function () { card: links[0], }; }, - prompt: function (links, player) { + prompt(links, player) { return "选择 顺手牵羊(" + get.translation(links[0]) + ")的目标"; }, }, ai: { order: 10, result: { - player: function (player) { + player(player) { return player.getExpansions("tuntian").length - 1; }, }, @@ -4505,7 +4499,7 @@ game.import("character", function () { preHidden: true, audioname: ["sp_lvmeng", "re_sunben", "re_sunce"], mod: { - aiOrder: function (player, card, num) { + aiOrder(player, card, num) { if (get.color(card) === "red" && get.name(card) === "sha") return get.order({ name: "sha" }) + 0.15; }, @@ -4514,7 +4508,7 @@ game.import("character", function () { player: "useCardToPlayered", target: "useCardToTargeted", }, - filter: function (event, player) { + filter(event, player) { if ( !( event.card.name == "juedou" || @@ -4526,15 +4520,15 @@ game.import("character", function () { }, locked: false, frequent: true, - content: function () { + content() { player.draw(); }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (card.name == "sha" && get.color(card) == "red") return [1, 0.6]; }, - player: function (card, player, target) { + player(card, player, target) { if (card.name == "sha" && get.color(card) == "red") return [1, 1]; }, }, @@ -4549,24 +4543,24 @@ game.import("character", function () { derivation: ["reyingzi", "gzyinghun"], unique: true, trigger: { player: "phaseZhunbeiBegin" }, - filter: function (event, player) { + filter(event, player) { return player.hp <= 1 && !player.storage.hunzi; }, forced: true, //priority:3, - content: function () { + content() { player.awakenSkill(event.name); player.loseMaxHp(); player.addSkills(["reyingzi", "gzyinghun"]); }, ai: { - threaten: function (player, target) { + threaten(player, target) { if (target.hp == 1) return 2; return 0.5; }, maixie: true, effect: { - target: function (card, player, target) { + target(card, player, target) { if (!target.hasFriend()) return; if ( target.hp === 2 && @@ -4600,7 +4594,7 @@ game.import("character", function () { audioname: ["re_sunben"], //forceaudio:true, enable: "phaseUse", - prompt: function () { + prompt() { var player = _status.event.player; var list = game.filterPlayer(function (target) { return target.hasZhuSkill("zhiba", player) && player.canCompare(target); @@ -4610,21 +4604,21 @@ game.import("character", function () { str += "进行拼点。若你没赢,其可以获得两张拼点牌。"; return str; }, - filter: function (event, player) { + filter(event, player) { if (player.group != "wu" || player.countCards("h") == 0) return false; return game.hasPlayer(function (target) { return target.hasZhuSkill("zhiba", player) && player.canCompare(target); }); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target.hasZhuSkill("zhiba", player) && player.canCompare(target); }, log: false, - prepare: function (cards, player, targets) { + prepare(cards, player, targets) { targets[0].logSkill("zhiba"); }, usable: 1, - content: function () { + content() { "step 0"; if (target.storage.hunzi || target.storage.rehunzi) { target @@ -4674,7 +4668,7 @@ game.import("character", function () { }, expose: 0.2, result: { - target: function (player, target) { + target(player, target) { if (player.countCards("h", "du") && get.attitude(player, target) < 0) return -1; if (player.countCards("h") <= player.hp) return 0; var maxnum = 0; @@ -4698,20 +4692,20 @@ game.import("character", function () { zhijian: { audio: 2, enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { return player.countCards("h", { type: "equip" }) > 0; }, - filterCard: function (card) { + filterCard(card) { return get.type(card) == "equip"; }, - check: function (card) { + check(card) { var player = _status.currentPhase; if (player.countCards("he", { subtype: get.subtype(card) }) > 1) { return 11 - get.equipValue(card); } return 6 - get.value(card); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (target.isMin()) return false; return player != target && target.canEquip(card); }, @@ -4721,7 +4715,7 @@ game.import("character", function () { }, discard: false, lose: false, - prepare: function (cards, player, targets) { + prepare(cards, player, targets) { player.$give(cards, targets[0], false); }, ai: { @@ -4729,7 +4723,7 @@ game.import("character", function () { order: 10, }, result: { - target: function (player, target) { + target(player, target) { var card = ui.selected.cards[0]; if (card) return get.effect(target, card, target, target); return 0; @@ -4742,7 +4736,7 @@ game.import("character", function () { audio: 2, audioname: ["re_zhangzhang"], trigger: { global: "phaseDiscardAfter" }, - filter: function (event, player) { + filter(event, player) { if (event.player != player && event.player.isIn()) { return ( event.player.getHistory("lose", function (evt) { @@ -4756,7 +4750,7 @@ game.import("character", function () { } return false; }, - checkx: function (event, player, cards, cards2) { + checkx(event, player, cards, cards2) { if (cards.length > 2 || get.attitude(player, event.player) > 0) return true; for (var i = 0; i < cards2.length; i++) { if (get.value(cards2[i], event.player, "raw") < 0) return true; @@ -4765,7 +4759,7 @@ game.import("character", function () { }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; var cards = [], cards2 = []; @@ -4878,7 +4872,7 @@ game.import("character", function () { audio: 2, audioname: ["re_caiwenji", "ol_caiwenji"], trigger: { global: "damageEnd" }, - filter: function (event, player) { + filter(event, player) { return ( event.card && event.card.name == "sha" && @@ -4888,13 +4882,13 @@ game.import("character", function () { ); }, direct: true, - checkx: function (event, player) { + checkx(event, player) { var att1 = get.attitude(player, event.player); var att2 = get.attitude(player, event.source); return att1 > 0 && att2 <= 0; }, preHidden: true, - content: function () { + content() { "step 0"; var next = player.chooseToDiscard("he", get.prompt2("beige", trigger.player)); var check = lib.skill.beige.checkx(trigger, player); @@ -4940,21 +4934,21 @@ game.import("character", function () { forceDie: true, skillAnimation: true, animationColor: "gray", - filter: function (event) { + filter(event) { return event.source && event.source.isIn(); }, - content: function () { + content() { trigger.source.clearSkills(); }, logTarget: "source", ai: { maixie_defend: true, - threaten: function (player, target) { + threaten(player, target) { if (target.hp == 1) return 0.2; return 1.5; }, effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if (!target.hasFriend()) return; if (target.hp <= 1 && get.tag(card, "damage")) { if (player.hasSkillTag("jueqing", false, target)) return 3; @@ -4967,7 +4961,7 @@ game.import("character", function () { huashen: { audio: "huashen2", unique: true, - init: function (player) { + init(player) { if (!player.storage.huashen) { player.storage.huashen = { owned: {}, @@ -4993,7 +4987,7 @@ game.import("character", function () { }); }, intro: { - content: function (storage, player) { + content(storage, player) { var str = ""; var list = Object.keys(storage.owned); if (list.length) { @@ -5008,11 +5002,11 @@ game.import("character", function () { } return str; }, - onunmark: function (storage, player) { + onunmark(storage, player) { _status.characterlist.addArray(Object.keys(storage.owned)); storage.owned = []; }, - mark: function (dialog, content, player) { + mark(dialog, content, player) { var list = Object.keys(content.owned); if (list.length) { var skill = player.storage.huashen.current2; @@ -5060,7 +5054,7 @@ game.import("character", function () { } }, }, - addHuashen: function (player) { + addHuashen(player) { if (!player.storage.huashen) return; if (!_status.characterlist) { lib.skill.pingjian.initList(); @@ -5087,7 +5081,7 @@ game.import("character", function () { } } }, - addHuashens: function (player, num) { + addHuashens(player, num) { var list = []; for (var i = 0; i < num; i++) { var name = lib.skill.huashen.addHuashen(player); @@ -5104,13 +5098,13 @@ game.import("character", function () { global: "phaseBefore", player: ["enterGame", "phaseBegin", "phaseEnd"], }, - filter: function (event, player, name) { + filter(event, player, name) { if (event.name != "phase") return true; if (name == "phaseBefore") return game.phaseNumber == 0; return !get.is.empty(player.storage.huashen.owned); }, direct: true, - content: function () { + content() { "step 0"; var name = event.triggername; if (trigger.name != "phase" || (name == "phaseBefore" && game.phaseNumber == 0)) { @@ -5332,7 +5326,7 @@ game.import("character", function () { unique: true, trigger: { player: "damageEnd" }, frequent: true, - content: function () { + content() { "step 0"; event.num = trigger.num; "step 1"; @@ -5360,7 +5354,7 @@ game.import("character", function () { preHidden: ["huoshou1", "huoshou2"], ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (card.name == "nanman") return 0; }, }, @@ -5372,10 +5366,10 @@ game.import("character", function () { trigger: { target: "useCardToBefore" }, forced: true, priority: 15, - filter: function (event, player) { + filter(event, player) { return event.card.name == "nanman"; }, - content: function () { + content() { trigger.cancel(); }, }, @@ -5384,10 +5378,10 @@ game.import("character", function () { audioname: ["re_menghuo"], trigger: { global: "useCard" }, forced: true, - filter: function (event, player) { + filter(event, player) { return event.card && event.card.name == "nanman" && event.player != player; }, - content: function () { + content() { trigger.customArgs.default.customSource = player; }, }, @@ -5398,10 +5392,10 @@ game.import("character", function () { zaiqi: { audio: 2, trigger: { player: "phaseDrawBegin1" }, - filter: function (event, player) { + filter(event, player) { return !event.numFixed && player.hp < player.maxHp; }, - check: function (event, player) { + check(event, player) { if (player.getDamagedHp() < 2) { return false; } else if (player.getDamagedHp() == 2) { @@ -5409,7 +5403,7 @@ game.import("character", function () { } return true; }, - content: function () { + content() { "step 0"; trigger.changeToZero(); event.cards = get.cards(player.getDamagedHp() + (event.name == "zaiqi" ? 0 : 1)); @@ -5432,7 +5426,7 @@ game.import("character", function () { } }, ai: { - threaten: function (player, target) { + threaten(player, target) { if (target.hp == 1) return 2; if (target.hp == 2) return 1.5; return 1; @@ -5448,7 +5442,7 @@ game.import("character", function () { preHidden: ["juxiang1", "juxiang2"], ai: { effect: { - target: function (card) { + target(card) { if (card.name == "nanman") return [0, 1]; }, }, @@ -5460,10 +5454,10 @@ game.import("character", function () { trigger: { target: "useCardToBefore" }, forced: true, priority: 15, - filter: function (event, player) { + filter(event, player) { return event.card.name == "nanman"; }, - content: function () { + content() { trigger.cancel(); }, }, @@ -5472,10 +5466,10 @@ game.import("character", function () { audioname: ["re_zhurong", "ol_zhurong"], trigger: { global: "useCardAfter" }, forced: true, - filter: function (event, player) { + filter(event, player) { return event.card.name == "nanman" && event.player != player && event.cards.someInD(); }, - content: function () { + content() { player.gain(trigger.cards.filterInD(), "gain2"); }, }, @@ -5484,7 +5478,7 @@ game.import("character", function () { audio: 2, audioname: ["boss_lvbu3", "ol_zhurong"], trigger: { source: "damageSource" }, - filter: function (event, player) { + filter(event, player) { if (event._notrigger.includes(event.player)) return false; return ( event.card && @@ -5494,11 +5488,11 @@ game.import("character", function () { player.canCompare(event.player) ); }, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.player) < 0 && player.countCards("h") > 1; }, //priority:5, - content: function () { + content() { "step 0"; player.chooseToCompare(trigger.player); "step 1"; @@ -5511,10 +5505,10 @@ game.import("character", function () { audio: 2, trigger: { global: "die" }, preHidden: true, - filter: function (event) { + filter(event) { return event.player.countCards("he") > 0; }, - content: function () { + content() { "step 0"; event.togain = trigger.player.getCards("he"); player.gain(event.togain, trigger.player, "giveAuto", "bySelf"); @@ -5525,7 +5519,7 @@ game.import("character", function () { trigger: { player: "damageEnd" }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; var draw = player.getDamagedHp(); player @@ -5580,7 +5574,7 @@ game.import("character", function () { maixie: true, maixie_hp: true, effect: { - target: function (card, player, target) { + target(card, player, target) { if (get.tag(card, "damage")) { if (player.hasSkillTag("jueqing", false, target)) return [1, -2]; if (target.hp <= 1) return; @@ -5617,13 +5611,13 @@ game.import("character", function () { audioname: ["re_caopi"], forceaudio: true, trigger: { global: "judgeEnd" }, - filter: function (event, player) { + filter(event, player) { if (event.player == player || event.player.group != "wei") return false; if (event.result.color != "black") return false; return player.hasZhuSkill("songwei", event.player); }, direct: true, - content: function () { + content() { "step 0"; trigger.player .chooseBool("是否发动【颂威】,令" + get.translation(player) + "摸一张牌?") @@ -5640,10 +5634,10 @@ game.import("character", function () { trigger: { global: ["phaseDrawSkipped", "phaseDrawCancelled"] }, audio: 2, forced: true, - filter: function (event, player) { + filter(event, player) { return event.player != player; }, - content: function () { + content() { player.draw(); }, }, @@ -5667,17 +5661,17 @@ game.import("character", function () { audio: 2, audioname: ["re_xuhuang"], enable: "chooseToUse", - filterCard: function (card) { + filterCard(card) { if (get.type(card) != "basic" && get.type(card) != "equip") return false; return get.color(card) == "black"; }, - filter: function (event, player) { + filter(event, player) { return player.countCards("hes", { type: ["basic", "equip"], color: "black" }); }, position: "hes", viewAs: { name: "bingliang" }, prompt: "将一黑色的基本牌或装备牌当兵粮寸断使用", - check: function (card) { + check(card) { return 6 - get.value(card); }, ai: { @@ -5686,7 +5680,7 @@ game.import("character", function () { }, duanliang2: { mod: { - targetInRange: function (card, player, target) { + targetInRange(card, player, target) { if (card.name == "bingliang") { if (get.distance(player, target) <= 2) return true; } @@ -5695,7 +5689,7 @@ game.import("character", function () { }, duanliang3: { mod: { - targetInRange: function (card, player, target) { + targetInRange(card, player, target) { if (card.name == "bingliang") { if (target.countCards("h") >= player.countCards("h")) return true; } @@ -5705,11 +5699,11 @@ game.import("character", function () { haoshi: { audio: 2, trigger: { player: "phaseDrawBegin2" }, - filter: function (event, player) { + filter(event, player) { return !event.numFixed; }, preHidden: true, - check: function (event, player) { + check(event, player) { return ( player.countCards("h") + 2 + event.num <= 5 || game.hasPlayer(function (target) { @@ -5727,14 +5721,14 @@ game.import("character", function () { }) ); }, - content: function () { + content() { trigger.num += 2; player.addSkill("haoshi2"); }, ai: { threaten: 2, noh: true, - skillTagFilter: function (player, tag) { + skillTagFilter(player, tag) { if (tag == "noh") { if (player.countCards("h") != 2) return false; } @@ -5746,7 +5740,7 @@ game.import("character", function () { forced: true, popup: false, audio: false, - content: function () { + content() { "step 0"; player.removeSkill("haoshi2"); if (player.countCards("h") <= 5) { @@ -5755,12 +5749,12 @@ game.import("character", function () { } player.chooseCardTarget({ selectCard: Math.floor(player.countCards("h") / 2), - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target.isMinHandcard(); }, prompt: "将一半的手牌交给场上手牌数最少的一名角色", forced: true, - ai2: function (target) { + ai2(target) { return get.attitude(_status.event.player, target); }, }); @@ -5775,7 +5769,7 @@ game.import("character", function () { enable: "phaseUse", usable: 1, position: "he", - filterCard: function () { + filterCard() { var targets = ui.selected.targets; if (targets.length == 2) { if ( @@ -5789,11 +5783,11 @@ game.import("character", function () { selectCard: [0, Infinity], selectTarget: 2, complexCard: true, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; return true; }, - filterOk: function () { + filterOk() { var targets = ui.selected.targets; if (targets.length != 2) return false; return ( @@ -5803,10 +5797,10 @@ game.import("character", function () { }, multitarget: true, multiline: true, - content: function () { + content() { targets[0].swapHandcards(targets[1]); }, - check: function (card) { + check(card) { var list = [], player = _status.event.player; var num = player.countCards("he"); @@ -5847,7 +5841,7 @@ game.import("character", function () { threaten: 3, expose: 0.9, result: { - target: function (player, target) { + target(player, target) { var list = []; var num = player.countCards("he"); var players = game.filterPlayer(); @@ -5898,7 +5892,7 @@ game.import("character", function () { tw_ol_sunjian: "yinghun_ol_sunjian", }, mod: { - aiOrder: function (player, card, num) { + aiOrder(player, card, num) { if ( num > 0 && _status.event && @@ -5914,7 +5908,7 @@ game.import("character", function () { trigger: { player: "phaseZhunbeiBegin" }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; player .chooseTarget(get.prompt2("yinghun"), function (card, player, target) { @@ -5966,7 +5960,7 @@ game.import("character", function () { }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if ( get.tag(card, "damage") && get.itemtype(player) === "player" && @@ -5981,7 +5975,7 @@ game.import("character", function () { return [1, 1]; }, }, - threaten: function (player, target) { + threaten(player, target) { return Math.max(0.5, target.getDamagedHp() / 2); }, maixie: true, @@ -5995,7 +5989,7 @@ game.import("character", function () { tw_ol_sunjian: "yinghun_ol_sunjian", }, mod: { - aiOrder: function (player, card, num) { + aiOrder(player, card, num) { if ( num > 0 && _status.event && @@ -6009,12 +6003,12 @@ game.import("character", function () { }, locked: false, trigger: { player: "phaseZhunbeiBegin" }, - filter: function (event, player) { + filter(event, player) { return player.getDamagedHp() > 0; }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; player .chooseTarget(get.prompt2("gzyinghun"), function (card, player, target) { @@ -6065,7 +6059,7 @@ game.import("character", function () { }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if ( get.tag(card, "damage") && get.itemtype(player) === "player" && @@ -6080,7 +6074,7 @@ game.import("character", function () { return [1, 1]; }, }, - threaten: function (player, target) { + threaten(player, target) { return Math.max(0.5, target.getDamagedHp() / 2); }, maixie: true, @@ -6091,16 +6085,16 @@ game.import("character", function () { audio: 2, audioname: ["re_dongzhuo"], enable: "chooseToUse", - filterCard: function (card) { + filterCard(card) { return get.suit(card) == "spade"; }, viewAs: { name: "jiu" }, - viewAsFilter: function (player) { + viewAsFilter(player) { if (!player.countCards("hs", { suit: "spade" })) return false; return true; }, prompt: "将一张黑桃手牌当酒使用", - check: function (card) { + check(card) { if (_status.event.type == "dying") return 1 / Math.max(0.1, get.value(card)); return 4 - get.value(card); }, @@ -6113,17 +6107,17 @@ game.import("character", function () { audioname: ["re_dongzhuo", "ol_dongzhuo"], trigger: { player: "useCardToPlayered", target: "useCardToTargeted" }, forced: true, - filter: function (event, player) { + filter(event, player) { if (event.card.name != "sha") return false; if (player == event.player) { return event.target.hasSex("female"); } return event.player.hasSex("female"); }, - check: function (event, player) { + check(event, player) { return player == event.player; }, - content: function () { + content() { var id = (player == trigger.player ? trigger.target : player).playerid; var map = trigger.getParent().customArgs; if (!map[id]) map[id] = {}; @@ -6136,7 +6130,7 @@ game.import("character", function () { ai: { halfneg: true, directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if (tag === "directHit_ai") return; if ( arg.card.name != "sha" || @@ -6152,17 +6146,17 @@ game.import("character", function () { audioname: ["zhugedan", "re_dongzhuo", "ol_dongzhuo", "re_zhugedan"], trigger: { player: "phaseJieshuBegin" }, forced: true, - check: function () { + check() { return false; }, - filter: function (event, player) { + filter(event, player) { return ( !player.isMinHp() && !player.hasSkill("rejiuchi_air") && !player.hasSkill("oljiuchi_air") ); }, - content: function () { + content() { "step 0"; player .chooseControl("baonue_hp", "baonue_maxHp", function (event, player) { @@ -6195,12 +6189,12 @@ game.import("character", function () { audioname: ["re_dongzhuo"], //forceaudio:true, trigger: { global: "damageSource" }, - filter: function (event, player) { + filter(event, player) { if (player == event.source || !event.source || event.source.group != "qun") return false; return player.hasZhuSkill("baonue", event.source); }, direct: true, - content: function () { + content() { "step 0"; trigger.source .chooseBool("是否对" + get.translation(player) + "发动【暴虐】?") @@ -6232,13 +6226,13 @@ game.import("character", function () { limited: true, skillAnimation: "epic", animationColor: "thunder", - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target != player; }, selectTarget: -1, multitarget: true, multiline: true, - content: function () { + content() { "step 0"; player.awakenSkill("luanwu"); event.current = player.next; @@ -6283,7 +6277,7 @@ game.import("character", function () { ai: { order: 1, result: { - player: function (player) { + player(player) { if (lib.config.mode == "identity" && game.zhu.isZhu && player.identity == "fan") { if (game.zhu.hp == 1 && game.zhu.countCards("h") <= 2) return 1; } @@ -6320,14 +6314,14 @@ game.import("character", function () { priority: 15, forced: true, preHidden: true, - filter: function (event, player, name) { + filter(event, player, name) { return _status.currentPhase == player && event.player != player; }, - content: function () {}, + content() {}, }, wansha2: { mod: { - cardSavable: function (card, player) { + cardSavable(card, player) { if ( card.name == "tao" && _status.currentPhase && @@ -6338,7 +6332,7 @@ game.import("character", function () { if (!player.isDying()) return false; } }, - cardEnabled: function (card, player) { + cardEnabled(card, player) { if ( card.name == "tao" && _status.currentPhase && @@ -6356,7 +6350,7 @@ game.import("character", function () { audio: 2, forced: true, firstDo: true, - filter: function (event, player, card) { + filter(event, player, card) { if (get.color(event.card) != "black") return false; return ( (event.card.name == "nanman" && player != event.player) || @@ -6365,9 +6359,9 @@ game.import("character", function () { event.card.name == "wugu" ); }, - content: function () {}, + content() {}, mod: { - targetEnabled: function (card) { + targetEnabled(card) { if ( (get.type(card) == "trick" || get.type(card) == "delay") && get.color(card) == "black" @@ -6379,16 +6373,16 @@ game.import("character", function () { huoji: { audio: 2, enable: "chooseToUse", - filterCard: function (card) { + filterCard(card) { return get.color(card) == "red"; }, viewAs: { name: "huogong" }, - viewAsFilter: function (player) { + viewAsFilter(player) { if (!player.countCards("hs", { color: "red" })) return false; }, position: "hs", prompt: "将一张红色牌当火攻使用", - check: function (card) { + check(card) { var player = get.player(); if (player.countCards("h") > player.hp) { return 6 - get.value(card); @@ -6411,7 +6405,7 @@ game.import("character", function () { equipSkill: true, noHidden: true, inherit: "bagua_skill", - filter: function (event, player) { + filter(event, player) { if (!lib.skill.bagua_skill.filter(event, player)) return false; if (!player.hasEmptySlot(2)) return false; return true; @@ -6432,7 +6426,7 @@ game.import("character", function () { return true; }, effect: { - target: function (card, player, target) { + target(card, player, target) { if (player == target && get.subtype(card) == "equip2") { if (get.equipValue(card) <= 7.5) return 0; } @@ -6444,7 +6438,7 @@ game.import("character", function () { }, kanpo: { mod: { - aiValue: function (player, card, num) { + aiValue(player, card, num) { if (get.name(card) != "wuxie" && get.color(card) != "black") return; var cards = player.getCards("hs", function (card) { return get.name(card) == "wuxie" || get.color(card) == "black"; @@ -6462,23 +6456,23 @@ game.import("character", function () { return Math.min(num, [6, 4, 3][Math.min(geti(), 2)]) * 0.6; return Math.max(num, [6, 4, 3][Math.min(geti(), 2)]); }, - aiUseful: function () { + aiUseful() { return lib.skill.kanpo.mod.aiValue.apply(this, arguments); }, }, locked: false, audio: 2, enable: "chooseToUse", - filterCard: function (card) { + filterCard(card) { return get.color(card) == "black"; }, - viewAsFilter: function (player) { + viewAsFilter(player) { return player.countCards("hs", { color: "black" }) > 0; }, viewAs: { name: "wuxie" }, position: "hs", prompt: "将一张黑色手牌当无懈可击使用", - check: function (card) { + check(card) { var tri = _status.event.getTrigger(); if (tri && tri.card && tri.card.name == "chiling") return -1; return 8 - get.value(card); @@ -6494,10 +6488,10 @@ game.import("character", function () { limited: true, skillAnimation: true, animationColor: "fire", - init: function (player) { + init(player) { player.storage.niepan = false; }, - filter: function (event, player) { + filter(event, player) { if (player.storage.niepan) return false; if (event.type == "dying") { if (player != event.dying) return false; @@ -6507,7 +6501,7 @@ game.import("character", function () { } return false; }, - content: function () { + content() { "step 0"; player.awakenSkill("niepan"); player.storage.niepan = true; @@ -6525,18 +6519,18 @@ game.import("character", function () { }, ai: { order: 0.5, - skillTagFilter: function (player, tag, target) { + skillTagFilter(player, tag, target) { if (player != target || player.storage.niepan) return false; }, save: true, result: { - player: function (player) { + player(player) { if (player.hp <= 0) return 10; if (player.hp <= 1 && player.countCards("he") <= 1) return 10; return 0; }, }, - threaten: function (player, target) { + threaten(player, target) { if (!target.storage.niepan) return 0.6; }, }, @@ -6552,10 +6546,10 @@ game.import("character", function () { skillAnimation: true, limited: true, animationColor: "orange", - init: function (player) { + init(player) { player.storage.oldniepan = false; }, - filter: function (event, player) { + filter(event, player) { if (player.storage.oldniepan) return false; if (event.type == "dying") { if (player != event.dying) return false; @@ -6563,7 +6557,7 @@ game.import("character", function () { } return false; }, - content: function () { + content() { "step 0"; player.awakenSkill("oldniepan"); player.storage.oldniepan = true; @@ -6581,18 +6575,18 @@ game.import("character", function () { }, ai: { order: 1, - skillTagFilter: function (player, arg, target) { + skillTagFilter(player, arg, target) { if (player != target || player.storage.oldniepan) return false; }, save: true, result: { - player: function (player) { + player(player) { if (player.hp <= 0) return 10; if (player.hp <= 2 && player.countCards("he") <= 1) return 10; return 0; }, }, - threaten: function (player, target) { + threaten(player, target) { if (!target.storage.oldniepan) return 0.6; }, }, @@ -6605,16 +6599,16 @@ game.import("character", function () { audioname: ["re_xunyu", "ol_xunyu"], enable: "phaseUse", usable: 1, - filter: function (event, player) { + filter(event, player) { if (player.countCards("h") == 0) return false; return game.hasPlayer(function (current) { return current.hp > player.hp && player.canCompare(current); }); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return target.hp > player.hp && player.canCompare(target); }, - content: function () { + content() { "step 0"; player.chooseToCompare(target); "step 1"; @@ -6649,7 +6643,7 @@ game.import("character", function () { ai: { order: 0.5, result: { - target: function (player, target) { + target(player, target) { var att = get.attitude(player, target); var oc = target.countCards("h") == 1; if (att > 0 && oc) return 0; @@ -6667,7 +6661,7 @@ game.import("character", function () { } return 0; }, - player: function (player, target) { + player(player, target) { if (target.hasSkillTag("jueqing", false, target)) return -10; var mn = 1; var hs = player.getCards("h"); @@ -6706,7 +6700,7 @@ game.import("character", function () { audio: 2, trigger: { player: "damageEnd" }, direct: true, - content: function () { + content() { "step 0"; event.count = trigger.num; "step 1"; @@ -6736,7 +6730,7 @@ game.import("character", function () { maixie: true, maixie_hp: true, effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if (get.tag(card, "damage") && target.hp > 1) { if (player.hasSkillTag("jueqing", false, target)) return [1, -2]; var max = 0; @@ -6775,7 +6769,7 @@ game.import("character", function () { audioname: ["boss_lvbu3"], audio: "qiangxi", usable: 2, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; if (target.hasSkill("reqiangxi_off")) return false; return true; @@ -6786,15 +6780,15 @@ game.import("character", function () { enable: "phaseUse", usable: 1, audioname: ["boss_lvbu3"], - filterCard: function (card) { + filterCard(card) { return get.subtype(card) == "equip1"; }, selectCard: [0, 1], - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; return player.inRange(target); }, - content: function () { + content() { "step 0"; if (cards.length == 0) { player.loseHp(); @@ -6802,7 +6796,7 @@ game.import("character", function () { "step 1"; target.damage("nocard"); }, - check: function (card) { + check(card) { return 10 - get.value(card); }, position: "he", @@ -6810,13 +6804,13 @@ game.import("character", function () { damage: true, order: 8, result: { - player: function (player, target) { + player(player, target) { if (ui.selected.cards.length) return 0; if (player.hp >= target.hp) return -0.9; if (player.hp <= 2) return -10; return -2; }, - target: function (player, target) { + target(player, target) { if (!ui.selected.cards.length) { if (player.hp < 2) return 0; if (player.hp == 2 && target.hp >= 2) return 0; @@ -6831,7 +6825,7 @@ game.import("character", function () { xinqiangxi: { audio: "qiangxi", enable: "phaseUse", - filter: function (event, player) { + filter(event, player) { if (player.hasSkill("xinqiangxi2")) { return !player.hasSkill("xinqiangxi3"); } else if (player.hasSkill("xinqiangxi3")) { @@ -6842,22 +6836,22 @@ game.import("character", function () { return true; } }, - filterCard: function (card) { + filterCard(card) { var player = _status.event.player; if (player.hasSkill("xinqiangxi2")) return false; return get.type(card) == "equip"; }, - selectCard: function () { + selectCard() { var player = _status.event.player; if (player.hasSkill("xinqiangxi2")) return -1; if (player.hasSkill("xinqiangxi3")) return [1, 1]; return [0, 1]; }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; return player.inRange(target); }, - content: function () { + content() { "step 0"; if (cards.length == 0) { player.loseHp(); @@ -6868,14 +6862,14 @@ game.import("character", function () { "step 1"; target.damage("nocard"); }, - check: function (card) { + check(card) { return 10 - get.value(card); }, position: "he", ai: { order: 8.5, result: { - target: function (player, target) { + target(player, target) { if (!ui.selected.cards.length) { if (player.hp < 2) return 0; if (target.hp >= player.hp) return 0; @@ -6893,13 +6887,13 @@ game.import("character", function () { audioname: ["re_taishici"], enable: "phaseUse", usable: 1, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player.canCompare(target); }, - filter: function (event, player) { + filter(event, player) { return player.countCards("h") > 0; }, - content: function () { + content() { "step 0"; player.chooseToCompare(target); "step 1"; @@ -6910,7 +6904,7 @@ game.import("character", function () { } }, ai: { - order: function (name, player) { + order(name, player) { var cards = player.getCards("h"); if (player.countCards("h", "sha") == 0) { return 1; @@ -6927,7 +6921,7 @@ game.import("character", function () { return get.order({ name: "sha" }) - 1; }, result: { - player: function (player) { + player(player) { if (player.countCards("h", "sha") > 0) return 0.6; var num = player.countCards("h"); if (num > player.hp) return 0; @@ -6935,7 +6929,7 @@ game.import("character", function () { if (num == 2) return -1; return -0.7; }, - target: function (player, target) { + target(player, target) { var num = target.countCards("h"); if (num == 1) return -1; if (num == 2) return -0.7; @@ -6947,13 +6941,13 @@ game.import("character", function () { }, tianyi2: { mod: { - targetInRange: function (card, player, target, now) { + targetInRange(card, player, target, now) { if (card.name == "sha") return true; }, - selectTarget: function (card, player, range) { + selectTarget(card, player, range) { if (card.name == "sha" && range[1] != -1) range[1]++; }, - cardUsable: function (card, player, num) { + cardUsable(card, player, num) { if (card.name == "sha") return num + 1; }, }, @@ -6961,7 +6955,7 @@ game.import("character", function () { }, tianyi3: { mod: { - cardEnabled: function (card) { + cardEnabled(card) { if (card.name == "sha") return false; }, }, @@ -6979,21 +6973,21 @@ game.import("character", function () { shuangxiong1: { audio: true, trigger: { player: "phaseDrawBegin1" }, - check: function (event, player) { + check(event, player) { if (player.countCards("h") > player.hp) return true; if (player.countCards("h") > 3) return true; return false; }, - filter: function (event, player) { + filter(event, player) { return !event.numFixed; }, preHidden: true, prompt2: () => "进行一次判定,本回合可以将一张与此牌颜色不同的手牌当作【决斗】使用", - content: function () { + content() { player.judge().set("callback", lib.skill.shuangxiong1.callback); trigger.changeToZero(); }, - callback: function () { + callback() { player.gain(card, "gain2"); player.addTempSkill("shuangxiong2"); player.markAuto("shuangxiong2", [event.judgeResult.color]); @@ -7009,10 +7003,10 @@ game.import("character", function () { enable: "chooseToUse", viewAs: { name: "juedou" }, position: "hs", - viewAsFilter: function (player) { + viewAsFilter(player) { return player.hasCard((card) => lib.skill.shuangxiong2.filterCard(card, player), "hs"); }, - filterCard: function (card, player) { + filterCard(card, player) { var color = get.color(card), colors = player.getStorage("shuangxiong2"); for (var i of colors) { @@ -7020,7 +7014,7 @@ game.import("character", function () { } return false; }, - prompt: function () { + prompt() { var colors = _status.event.player.getStorage("shuangxiong2"); var str = "将一张颜色"; for (var i = 0; i < colors.length; i++) { @@ -7031,7 +7025,7 @@ game.import("character", function () { str += "的牌当做【决斗】使用"; return str; }, - check: function (card) { + check(card) { var player = _status.event.player; var raw = player.getUseValue(card, null, true); var eff = player.getUseValue(get.autoViewAs({ name: "juedou" }, [card])); @@ -7044,7 +7038,7 @@ game.import("character", function () { enable: "phaseUse", position: "hs", viewAs: { name: "wanjian" }, - filterCard: function (card, player) { + filterCard(card, player) { if (ui.selected.cards.length) { return get.suit(card) == get.suit(ui.selected.cards[0]); } @@ -7058,7 +7052,7 @@ game.import("character", function () { }, selectCard: 2, complexCard: true, - check: function (card) { + check(card) { var player = _status.event.player; var targets = game.filterPlayer(function (current) { return player.canUse("wanjian", current); @@ -7092,7 +7086,7 @@ game.import("character", function () { audioname: ["re_yuanshao"], forced: true, firstDo: true, - filter: function (event, player) { + filter(event, player) { return ( player.hasZhuSkill("xueyi") && game.hasPlayer(function (current) { @@ -7101,9 +7095,9 @@ game.import("character", function () { player.countCards("h") > player.hp ); }, - content: function () {}, + content() {}, mod: { - maxHandcard: function (player, num) { + maxHandcard(player, num) { if (player.hasZhuSkill("xueyi")) { return ( num + @@ -7122,14 +7116,14 @@ game.import("character", function () { audio: 2, trigger: { player: "shaMiss" }, //priority:-1, - filter: function (event) { + filter(event) { return event.target.countCards("he") > 0; }, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.target) < 0; }, logTarget: "target", - content: function () { + content() { player.discardPlayerCard("he", trigger.target, true); }, }, @@ -7138,7 +7132,7 @@ game.import("character", function () { //direct:true, frequent: true, audio: "xinjiewei", - content: function () { + content() { "step 0"; player.draw(); player.chooseToUse(function (card) { @@ -7200,11 +7194,11 @@ game.import("character", function () { audio: 2, audioname: ["boss_qinglong"], trigger: { player: ["useCard", "respond"] }, - filter: function (event, player) { + filter(event, player) { return event.card.name == "shan"; }, direct: true, - content: function () { + content() { "step 0"; player.chooseTarget(get.prompt2("releiji"), function (card, player, target) { return target != player; @@ -7243,7 +7237,7 @@ game.import("character", function () { ai: { useShan: true, effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if ( get.tag(card, "respondShan") && !player.hasSkillTag( @@ -7336,7 +7330,7 @@ game.import("character", function () { }, trigger: { player: "phaseJudgeBefore" }, direct: true, - content: function () { + content() { "step 0"; player .chooseTarget( @@ -7370,7 +7364,7 @@ game.import("character", function () { }, trigger: { player: "phaseUseBefore" }, direct: true, - filter: function (event, player) { + filter(event, player) { return ( player.countCards("he", function (card) { if (_status.connectMode) return true; @@ -7378,25 +7372,25 @@ game.import("character", function () { }) > 0 ); }, - content: function () { + content() { "step 0"; player .chooseCardTarget({ prompt: get.prompt("shensu"), prompt2: "弃置一张装备牌并跳过出牌阶段,视为对一名其他角色使用一张【杀】", - filterCard: function (card, player) { + filterCard(card, player) { return get.type(card) == "equip" && lib.filter.cardDiscardable(card, player); }, position: "he", - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { if (player == target) return false; return player.canUse({ name: "sha" }, target, false); }, - ai1: function (card) { + ai1(card) { if (_status.event.check) return 0; return 6 - get.value(card); }, - ai2: function (target) { + ai2(target) { if (_status.event.check) return 0; return get.effect(target, { name: "sha" }, _status.event.player); }, @@ -7424,7 +7418,7 @@ game.import("character", function () { }, trigger: { player: "phaseDiscardBefore" }, direct: true, - content: function () { + content() { "step 0"; var check = player.needsToDiscard() || @@ -7461,16 +7455,16 @@ game.import("character", function () { jushou: { audio: 2, trigger: { player: "phaseJieshuBegin" }, - check: function (event, player) { + check(event, player) { return event.player.hp + player.countCards("h") < 4; }, - content: function () { + content() { player.draw(3); player.turnOver(); }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (card.name == "guiyoujie") return [0, 1]; }, }, @@ -7479,16 +7473,16 @@ game.import("character", function () { moon_jushou: { audio: "xinjushou", trigger: { player: "phaseJieshuBegin" }, - check: function (event, player) { + check(event, player) { return event.player.hp + player.countCards("h") < 4; }, - content: function () { + content() { player.draw(); player.turnOver(); }, ai: { effect: { - target: function (card, player, target) { + target(card, player, target) { if (card.name == "guiyoujie") return [0, 1]; }, }, @@ -7499,28 +7493,28 @@ game.import("character", function () { audio: 2, audioname: ["re_huangzhong"], trigger: { player: "useCardToPlayered" }, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.target) <= 0; }, logTarget: "target", - filter: function (event, player) { + filter(event, player) { if (event.card.name != "sha") return false; var length = event.target.countCards("h"); return length >= player.hp || length <= player.getAttackRange(); }, preHidden: true, - content: function () { + content() { trigger.getParent().directHit.push(trigger.target); }, locked: false, mod: { - attackRange: function (player, distance) { + attackRange(player, distance) { if (get.zhu(player, "shouyue")) return distance + 1; }, }, ai: { directHit_ai: true, - skillTagFilter: function (player, tag, arg) { + skillTagFilter(player, tag, arg) { if (get.attitude(player, arg.target) > 0 || arg.card.name != "sha") return false; var length = arg.target.countCards("h"); return length >= player.hp || length <= player.getAttackRange(); @@ -7532,10 +7526,10 @@ game.import("character", function () { audioname: ["re_weiyan", "ol_weiyan"], trigger: { source: "damageSource" }, forced: true, - filter: function (event, player) { + filter(event, player) { return event.kuangguCheck && player.isDamaged(); }, - content: function () { + content() { player.recover(trigger.num); }, group: "kuanggu_check", @@ -7543,12 +7537,12 @@ game.import("character", function () { check: { charlotte: true, trigger: { source: "damage" }, - filter: function (event, player) { + filter(event, player) { return get.distance(player, event.player) <= 1; }, firstDo: true, silent: true, - content: function () { + content() { trigger.kuangguCheck = true; }, }, @@ -7559,22 +7553,22 @@ game.import("character", function () { audioname: ["daxiaoqiao", "re_xiaoqiao", "ol_xiaoqiao"], trigger: { player: "damageBegin3" }, direct: true, - filter: function (event, player) { + filter(event, player) { return player.countCards("h", { suit: "heart" }) > 0 && event.num > 0; }, - content: function () { + content() { "step 0"; player.chooseCardTarget({ - filterCard: function (card, player) { + filterCard(card, player) { return get.suit(card) == "heart" && lib.filter.cardDiscardable(card, player); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player != target; }, - ai1: function (card) { + ai1(card) { return 10 - get.value(card); }, - ai2: function (target) { + ai2(target) { var att = get.attitude(_status.event.player, target); var trigger = _status.event.getTrigger(); var da = 0; @@ -7620,12 +7614,12 @@ game.import("character", function () { ai: { maixie_defend: true, effect: { - target: function (card, player, target) { + target(card, player, target) { if (player.hasSkillTag("jueqing", false, target)) return; if (get.tag(card, "damage") && target.countCards("h") > 1) return 0.7; }, }, - threaten: function (player, target) { + threaten(player, target) { if (target.countCards("h") == 0) return 2; }, }, @@ -7637,7 +7631,7 @@ game.import("character", function () { audio: false, vanish: true, charlotte: true, - content: function () { + content() { if (player.getDamagedHp()) player.draw(player.getDamagedHp()); player.removeSkill("tianxiang2"); player.popup("tianxiang"); @@ -7649,27 +7643,27 @@ game.import("character", function () { trigger: { player: "damageBegin4" }, direct: true, preHidden: true, - filter: function (event, player) { + filter(event, player) { return ( player.countCards("h", function (card) { return _status.connectMode || get.suit(card, player) == "heart"; }) > 0 && event.num > 0 ); }, - content: function () { + content() { "step 0"; player .chooseCardTarget({ - filterCard: function (card, player) { + filterCard(card, player) { return get.suit(card) == "heart" && lib.filter.cardDiscardable(card, player); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player != target; }, - ai1: function (card) { + ai1(card) { return 10 - get.value(card); }, - ai2: function (target) { + ai2(target) { var att = get.attitude(_status.event.player, target); var trigger = _status.event.getTrigger(); var da = 0; @@ -7743,7 +7737,7 @@ game.import("character", function () { ai: { maixie_defend: true, effect: { - target: function (card, player, target) { + target(card, player, target) { if (player.hasSkillTag("jueqing", false, target)) return; if (get.tag(card, "damage") && target.countCards("he") > 1) return 0.7; }, @@ -7754,17 +7748,17 @@ game.import("character", function () { trigger: { player: "loseHpAfter" }, forced: true, popup: false, - filter: function (event) { + filter(event) { return event.type == "retianxiang"; }, vanish: true, - content: function () { + content() { "step 0"; player.gain(player.storage.retianxiang3, "gain2"); "step 1"; player.removeSkill("retianxiang3"); }, - onremove: function (player) { + onremove(player) { var card = player.storage.retianxiang3; if (get.position(card) == "s") { game.cardsDiscard(card); @@ -7776,11 +7770,11 @@ game.import("character", function () { trigger: { player: "damageAfter" }, forced: true, popup: false, - filter: function (event) { + filter(event) { return event.type == "retianxiang"; }, vanish: true, - content: function () { + content() { if (player.isDamaged()) { player.draw(player.getDamagedHp()); } @@ -7791,27 +7785,27 @@ game.import("character", function () { audio: "tianxiang", trigger: { player: "damageBefore" }, direct: true, - filter: function (event, player) { + filter(event, player) { return ( player.countCards("he", { suit: "heart" }) > 0 && event.num > 0 && !player.hasSkill("xintianxiang3") ); }, - content: function () { + content() { "step 0"; player.chooseCardTarget({ - filterCard: function (card, player) { + filterCard(card, player) { return get.suit(card) == "heart" && lib.filter.cardDiscardable(card, player); }, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return player != target; }, position: "he", - ai1: function (card) { + ai1(card) { return 10 - get.value(card); }, - ai2: function (target) { + ai2(target) { var att = get.attitude(_status.event.player, target); var trigger = _status.event.getTrigger(); var da = 0; @@ -7860,7 +7854,7 @@ game.import("character", function () { ai: { maixie_defend: true, effect: { - target: function (card, player, target) { + target(card, player, target) { if (player.hasSkillTag("jueqing", false, target)) return; if (get.tag(card, "damage") && target.countCards("he") > 1) return 0.7; }, @@ -7873,7 +7867,7 @@ game.import("character", function () { popup: false, audio: false, vanish: true, - content: function () { + content() { "step 0"; var source = player.storage.xintianxiang; if (source.isDead()) { @@ -7920,7 +7914,7 @@ game.import("character", function () { xintianxiang3: { trigger: { player: ["phaseZhunbeiBegin", "dieBegin"] }, silent: true, - content: function () { + content() { if (player.storage.xintianxiang3) { player.storage.xintianxiang3.removeSkill("xintianxiang4"); delete player.storage.xintianxiang3; @@ -7936,7 +7930,7 @@ game.import("character", function () { content: "防止造成和受到的一切伤害", }, priority: 15, - content: function () { + content() { trigger.cancel(); }, ai: { @@ -7946,12 +7940,12 @@ game.import("character", function () { notrick: true, notricksource: true, effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if (get.tag(card, "damage")) { return "zeroplayertarget"; } }, - player: function (card, player, target, current) { + player(card, player, target, current) { if (get.tag(card, "damage")) { return "zeroplayertarget"; } @@ -7961,7 +7955,7 @@ game.import("character", function () { }, hongyan: { mod: { - suit: function (card, suit) { + suit(card, suit) { if (suit == "spade") return "heart"; }, }, @@ -7970,17 +7964,17 @@ game.import("character", function () { audio: 2, audioname: ["sb_xiaoqiao"], mod: { - suit: function (card, suit) { + suit(card, suit) { if (suit == "spade") return "heart"; }, }, trigger: { global: "judge" }, direct: true, - filter: function (event, player) { + filter(event, player) { if (event.fixedResult && event.fixedResult.suit) return event.fixedResult.suit == "heart"; return get.suit(event.player.judging[0], event.player) == "heart"; }, - content: function () { + content() { "step 0"; var str = "红颜:" + @@ -8035,7 +8029,7 @@ game.import("character", function () { gzbuqu: { audio: 2, trigger: { player: "changeHp" }, - filter: function (event, player) { + filter(event, player) { return player.hp <= 0 && event.num < 0; }, marktext: "创", @@ -8046,7 +8040,7 @@ game.import("character", function () { group: "gzbuqu_recover", frequent: true, ondisable: true, - onremove: function (player, skill) { + onremove(player, skill) { var cards = player.getExpansions(skill); if (cards.length) { //delete player.nodying; @@ -8054,7 +8048,7 @@ game.import("character", function () { if (player.hp <= 0) player.dying({}); } }, - process: function (player) { + process(player) { //delete player.nodying; var nums = []; var cards = player.getExpansions("gzbuqu"); @@ -8071,12 +8065,12 @@ game.import("character", function () { subSkill: { recover: { trigger: { player: "recoverAfter" }, - filter: function (event, player) { + filter(event, player) { return player.getExpansions("gzbuqu").length > 0 && event.num > 0; }, forced: true, popup: false, - content: function () { + content() { "step 0"; event.count = trigger.num; "step 1"; @@ -8122,7 +8116,7 @@ game.import("character", function () { }, }, }, - content: function () { + content() { "step 0"; var num = -trigger.num - Math.max(player.hp - trigger.num, 1) + 1; player.addToExpansion(get.cards(num), "gain2").gaintag.add("gzbuqu"); @@ -8144,7 +8138,7 @@ game.import("character", function () { trigger: { player: "chooseToUseBefore" }, forced: true, preHidden: true, - filter: function (event, player) { + filter(event, player) { return ( event.type == "dying" && player.isDying() && @@ -8152,7 +8146,7 @@ game.import("character", function () { !event.getParent()._buqu ); }, - content: function () { + content() { "step 0"; trigger.getParent()._buqu = true; var card = get.cards()[0]; @@ -8175,7 +8169,7 @@ game.import("character", function () { } }, mod: { - maxHandcardBase: function (player, num) { + maxHandcardBase(player, num) { if (get.mode() != "guozhan" && player.getExpansions("buqu").length) return player.getExpansions("buqu").length; }, @@ -8183,7 +8177,7 @@ game.import("character", function () { ai: { save: true, mingzhi: true, - skillTagFilter: function (player, tag, target) { + skillTagFilter(player, tag, target) { if (player != target) return false; }, }, @@ -8198,7 +8192,7 @@ game.import("character", function () { global: ["gainAfter", "loseAfter", "loseAsyncAfter"], }, direct: true, - filter: function (event, player) { + filter(event, player) { if (event.name == "lose") { if (event.type != "discard" || !event.player.isIn()) return false; if ((event.discarder || event.getParent(2).player) == event.player) return false; @@ -8234,7 +8228,7 @@ game.import("character", function () { } return false; }, - content: function () { + content() { "step 0"; var targets = []; if (trigger.name == "gain") { @@ -8290,15 +8284,15 @@ game.import("character", function () { trigger: { global: "phaseJieshuBegin", }, - filter: function (event, player) { + filter(event, player) { if (event.player.countCards("h") == 0 && event.player.isIn()) return true; return false; }, preHidden: true, - check: function (event, player) { + check(event, player) { return get.attitude(player, event.player) > 2; }, - content: function () { + content() { player.line(trigger.player, "green"); trigger.player.draw(2); player.loseHp(); @@ -8307,12 +8301,12 @@ game.import("character", function () { leiji: { audio: 2, trigger: { player: ["useCard", "respond"] }, - filter: function (event, player) { + filter(event, player) { return event.card.name == "shan"; }, direct: true, preHidden: true, - content: function () { + content() { "step 0"; player.chooseTarget(get.prompt2("leiji")).setHiddenSkill(event.name).ai = function ( target @@ -8347,7 +8341,7 @@ game.import("character", function () { mingzhi: false, useShan: true, effect: { - target: function (card, player, target, current) { + target(card, player, target, current) { if ( get.tag(card, "respondShan") && !player.hasSkillTag( @@ -8401,11 +8395,11 @@ game.import("character", function () { audio: 2, audioname: ["sp_zhangjiao"], trigger: { global: "judge" }, - filter: function (event, player) { + filter(event, player) { return player.countCards("hes", { color: "black" }) > 0; }, direct: true, - content: function () { + content() { "step 0"; player .chooseCard( @@ -8550,10 +8544,10 @@ game.import("character", function () { lose: false, delay: false, line: true, - prepare: function (cards, player, targets) { + prepare(cards, player, targets) { targets[0].logSkill("huangtian"); }, - prompt: function () { + prompt() { var player = _status.event.player; var list = game.filterPlayer(function (target) { return target != player && target.hasZhuSkill("huangtian", player); @@ -8562,7 +8556,7 @@ game.import("character", function () { if (list.length > 1) str += "中的一人"; return str; }, - filter: function (event, player) { + filter(event, player) { if (player.group != "qun") return false; if (player.countCards("h", "shan") + player.countCards("h", "shandian") == 0) return 0; return game.hasPlayer(function (target) { @@ -8573,12 +8567,12 @@ game.import("character", function () { ); }); }, - filterCard: function (card) { + filterCard(card) { return card.name == "shan" || card.name == "shandian"; }, log: false, visible: true, - filterTarget: function (card, player, target) { + filterTarget(card, player, target) { return ( target != player && target.hasZhuSkill("huangtian", player) && @@ -8587,7 +8581,7 @@ game.import("character", function () { }, //usable:1, //forceaudio:true, - content: function () { + content() { player.give(cards, target); target.addTempSkill("huangtian3", "phaseUseEnd"); }, @@ -8604,14 +8598,14 @@ game.import("character", function () { audio: "guhuo_guess", derivation: ["chanyuan"], enable: ["chooseToUse", "chooseToRespond"], - hiddenCard: function (player, name) { + hiddenCard(player, name) { return ( lib.inpile.includes(name) && player.countCards("hs") > 0 && !player.hasSkill("guhuo_phase") ); }, - filter: function (event, player) { + filter(event, player) { if (player.hasSkill("guhuo_phase")) return false; if (!player.countCards("hs")) return false; for (var i of lib.inpile) { @@ -8637,7 +8631,7 @@ game.import("character", function () { return false; }, chooseButton: { - dialog: function (event, player) { + dialog(event, player) { var list = []; for (var i of lib.inpile) { if (event.type != "phase") @@ -8660,11 +8654,11 @@ game.import("character", function () { } return ui.create.dialog("蛊惑", [list, "vcard"]); }, - filter: function (button, player) { + filter(button, player) { var evt = _status.event.getParent(); return evt.filterCard({ name: button.link[2], nature: button.link[3] }, player, evt); }, - check: function (button) { + check(button) { var player = _status.event.player; var enemyNum = game.countPlayer(function (current) { return ( @@ -8695,9 +8689,9 @@ game.import("character", function () { } return val; }, - backup: function (links, player) { + backup(links, player) { return { - filterCard: function (card, player, target) { + filterCard(card, player, target) { var result = true; var suit = card.suit, number = card.number; @@ -8719,7 +8713,7 @@ game.import("character", function () { suit: "none", number: null, }, - ai1: function (card) { + ai1(card) { var player = _status.event.player; var enemyNum = game.countPlayer(function (current) { return ( @@ -8740,7 +8734,7 @@ game.import("character", function () { } return 6 - get.value(card); }, - precontent: function () { + precontent() { player.logSkill("xinfu_guhuo"); player.addTempSkill("guhuo_guess"); var card = event.result.cards[0]; @@ -8749,7 +8743,7 @@ game.import("character", function () { }, }; }, - prompt: function (links, player) { + prompt(links, player) { return ( "将一张手牌当做" + get.translation(links[0][2]) + @@ -8762,7 +8756,7 @@ game.import("character", function () { respondSha: true, respondShan: true, fireAttack: true, - skillTagFilter: function (player) { + skillTagFilter(player) { if (!player.countCards("hs") || player.hasSkill("guhuo_phase")) return false; }, threaten: 1.2, @@ -8780,13 +8774,13 @@ game.import("character", function () { popup: false, firstDo: true, charlotte: true, - filter: function (event, player) { + filter(event, player) { return ( event.skill && (event.skill.indexOf("guhuo_") == 0 || event.skill.indexOf("xinfu_guhuo_") == 0) ); }, - content: function () { + content() { "step 0"; player.addTempSkill("guhuo_phase"); event.fake = false; @@ -8933,14 +8927,14 @@ game.import("character", function () { }, }, chanyuan: { - init: function (player, skill) { + init(player, skill) { if (player.hp == 1) player.logSkill(skill); player.addSkillBlocker(skill); }, - onremove: function (player, skill) { + onremove(player, skill) { player.removeSkillBlocker(skill); }, - skillBlocker: function (skill, player) { + skillBlocker(skill, player) { return ( skill != "chanyuan" && skill != "rechanyuan" && @@ -8950,7 +8944,7 @@ game.import("character", function () { }, mark: true, intro: { - content: function (storage, player, skill) { + content(storage, player, skill) { var str = "
  • 锁定技。你不能于〖蛊惑〗的结算流程中进行质疑。当你的体力值为1时,你的其他技能失效。"; var list = player.getSkills(null, false, false).filter(function (i) { @@ -8962,32 +8956,32 @@ game.import("character", function () { }, audio: 2, trigger: { player: "changeHp" }, - filter: function (event, player) { + filter(event, player) { return player.hp == 1; }, forced: true, - content: function () {}, + content() {}, }, guhuo_phase: {}, }, card: {}, dynamicTranslate: { - nzry_juzhan: function (player) { + nzry_juzhan(player) { if (player.storage.nzry_juzhan == true) return '转换技,阴:当你成为其他角色【杀】的目标后,你可以与其各摸一张牌,然后其本回合内不能再对你使用牌。阳:当你使用【杀】指定一名角色为目标后,你可以获得其一张牌,然后你本回合内不能再对其使用牌。'; return '转换技,阴:当你成为其他角色【杀】的目标后,你可以与其各摸一张牌,然后其本回合内不能再对你使用牌。阳:当你使用【杀】指定一名角色为目标后,你可以获得其一张牌,然后你本回合内不能再对其使用牌。'; }, - nzry_zhenliang: function (player) { + nzry_zhenliang(player) { if (player.storage.nzry_zhenliang == true) return '转换技,阴:出牌阶段限一次,你可以弃置一张与“任”颜色相同的牌并对攻击范围内的一名角色造成1点伤害。阳:当你于回合外使用或打出的牌结算完成后,若此牌与“任”颜色相同,则你可以令一名角色摸一张牌。'; return '转换技,阴:出牌阶段限一次,你可以弃置一张与“任”颜色相同的牌并对攻击范围内的一名角色造成1点伤害。阳:当你于回合外使用或打出的牌结算完成后,若此牌与“任”颜色相同,则你可以令一名角色摸一张牌。'; }, - nzry_chenglve: function (player) { + nzry_chenglve(player) { if (player.storage.nzry_chenglve == true) return '转换技,出牌阶段限一次,阴:你可以摸一张牌,然后弃置两张手牌。阳:你可以摸两张牌,然后弃置一张手牌。若如此做,直到本回合结束,你使用与弃置牌花色相同的牌无距离和次数限制。'; return '转换技,出牌阶段限一次,阴:你可以摸一张牌,然后弃置两张手牌。阳:你可以摸两张牌,然后弃置一张手牌。若如此做,直到本回合结束,你使用与弃置牌花色相同的牌无距离和次数限制。'; }, - nzry_shenshi: function (player) { + nzry_shenshi(player) { if (player.storage.nzry_shenshi == true) return '转换技,阴:出牌阶段限一次,你可以将一张牌交给一名手牌数最多的角色,然后对其造成1点伤害,若该角色因此死亡,则你可以令一名角色将手牌摸至四张。阳:其他角色对你造成伤害后,你可以观看该角色的手牌,然后交给其一张牌,当前角色回合结束时,若此牌仍在该角色的区域内,你将手牌摸至四张。'; return '转换技,阴:出牌阶段限一次,你可以将一张牌交给一名手牌数最多的角色,然后对其造成1点伤害,若该角色因此死亡,则你可以令一名角色将手牌摸至四张。阳:其他角色对你造成伤害后,你可以观看该角色的手牌,然后交给其一张牌,当前角色回合结束时,若此牌仍在该角色的区域内,你将手牌摸至四张。'; diff --git a/character/standard.js b/character/standard.js index 6f2226595..7b5f1c003 100755 --- a/character/standard.js +++ b/character/standard.js @@ -129,6 +129,7 @@ game.import("character", function () { ganning: ["lingtong", "xf_sufei"], guanyu: ["zhangfei", "liaohua"], }, + /** @type { importCharacterConfig['skill'] } */ skill: { //标准版甘夫人 stdshushen: { @@ -578,7 +579,7 @@ game.import("character", function () { async cost(event, trigger, player) { let num = game.countPlayer( (current) => - current != player && current.countCards("h") && get.attitude(player, current) <= 0 + current != player && current.countCards("h") > 0 && get.attitude(player, current) <= 0 ); let check = num >= 2; const { result } = await player @@ -2611,7 +2612,7 @@ game.import("character", function () { global: ["dying", "gainAfter", "loseAsyncAfter"], }, audio: 2, - getIndex: function (event, player) { + getIndex(event, player) { if (event.name !== "loseAsync") return [event.player]; else return game diff --git a/extension/coin/extension.js b/extension/coin/extension.js index 0e59440fe..3e5e1293c 100644 --- a/extension/coin/extension.js +++ b/extension/coin/extension.js @@ -131,8 +131,21 @@ game.import("play", function () { } }, game: { - changeCoin: function (num) { + changeCoin: function (num, toast, audio) { if (typeof num == "number" && ui.coin) { + if (num != 0 && toast !== false) { + ui.create.toast( + `${num > 0 ? "获得" : "花费"} ${Math.abs( + num + )} 金币` + ); + } + if (audio !== false) { + game.playAudio( + "effect", + num > 0 ? "coin" : "coin_cost" + ); + } game.saveConfig("coin", lib.config.coin + num); var str; if (lib.config.coin_display_playpackconfig == "text") { diff --git a/layout/default/toast.css b/layout/default/toast.css new file mode 100644 index 000000000..b5f3d60bb --- /dev/null +++ b/layout/default/toast.css @@ -0,0 +1,43 @@ +.toast-container { + display: block; + position: absolute; + top: 15%; + left: 50%; + transform: translateX(-50%); + z-index: 9999; +} + +.toast { + display: block; + position: absolute; + left: 50%; + transform: translateX(-50%); + background-color: rgba(255, 165, 0, 0.7); + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); + color: white; + font-weight: bold; + padding: 10px 20px; + text-align: center; + white-space: nowrap; + width: max-content; + animation: fadeInOut 1500ms ease-in-out forwards; +} + +@keyframes fadeInOut { + 0% { + opacity: 0; + } + + 20% { + opacity: 1; + } + + 80% { + opacity: 1; + } + + 100% { + opacity: 0; + } +} \ No newline at end of file diff --git a/mode/boss.js b/mode/boss.js index dc1b569a1..673a86cd2 100644 --- a/mode/boss.js +++ b/mode/boss.js @@ -1718,7 +1718,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/brawl.js b/mode/brawl.js index 1ddbb59d8..7963c93b7 100644 --- a/mode/brawl.js +++ b/mode/brawl.js @@ -3420,7 +3420,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/chess.js b/mode/chess.js index ca13e949d..16326c333 100644 --- a/mode/chess.js +++ b/mode/chess.js @@ -4306,7 +4306,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/doudizhu.js b/mode/doudizhu.js index 9acb775e0..a0b6e7e94 100644 --- a/mode/doudizhu.js +++ b/mode/doudizhu.js @@ -1094,7 +1094,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/guozhan.js b/mode/guozhan.js index b979e592c..5ef523cb5 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -22429,7 +22429,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/identity.js b/mode/identity.js index 15c00e139..4bbd46f23 100644 --- a/mode/identity.js +++ b/mode/identity.js @@ -2303,7 +2303,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/stone.js b/mode/stone.js index 9d7de1f9a..1a5ebf5f5 100644 --- a/mode/stone.js +++ b/mode/stone.js @@ -2486,7 +2486,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/mode/versus.js b/mode/versus.js index 8a1967da4..2ee231b97 100644 --- a/mode/versus.js +++ b/mode/versus.js @@ -841,7 +841,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; @@ -1115,7 +1115,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; @@ -1446,7 +1446,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; @@ -1637,7 +1637,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.cheat2 = ui.create.control("自由选将", function () { if (this.dialog == _status.event.dialog) { if (game.changeCoin) { - game.changeCoin(50); + game.changeCoin(10); } this.dialog.close(); _status.event.dialog = this.backup; diff --git a/node_modules/@types/noname-typings/Result.d.ts b/node_modules/@types/noname-typings/Result.d.ts index 24bfb85aa..80a75be54 100644 --- a/node_modules/@types/noname-typings/Result.d.ts +++ b/node_modules/@types/noname-typings/Result.d.ts @@ -37,7 +37,12 @@ declare interface Result { * 当前有“视为”操作,该card参数特供给视为牌,不需要cards[0]获取视为牌 ; * 判断是否为视为牌:card.isCard,false为视为牌 */ - card: Card; + card: Card | CardBaseUIData; + + + cost_data: { + [key: string]: any; + }; [key: string]: any; } \ No newline at end of file diff --git a/node_modules/@types/noname-typings/Skill.d.ts b/node_modules/@types/noname-typings/Skill.d.ts index cbc602a8a..1fbb75517 100644 --- a/node_modules/@types/noname-typings/Skill.d.ts +++ b/node_modules/@types/noname-typings/Skill.d.ts @@ -442,7 +442,7 @@ declare interface Skill { * * 若该属性值是“check”,则调用当前技能得check方法检测 */ - frequent?: boolean | string | TwoParmFun; + frequent?: boolean | string | TwoParmFun; /** * 此技能是否可以被设置为自动发动2 * @@ -1285,7 +1285,7 @@ declare interface Skill { * * @param target v1.10.11 触发的目标 */ - logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null); + logTarget?: string | ((event?: GameEventPromise, player?: Player, triggername?: string, target?: Player) => string | Player | Player[] | null | undefined); /** * 是否通过logTarget显示触发者的目标日志; * diff --git a/node_modules/@types/noname-typings/nonameModules/noname.d.ts b/node_modules/@types/noname-typings/nonameModules/noname.d.ts index 24d68dcae..4221e9b7d 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname.d.ts @@ -1,8 +1,8 @@ -export { GNC, gnc, setGNC } from './noname/gnc/index.js'; -export { AI, ai, setAI } from './noname/ai/index.js'; -export { Game, game, setGame } from './noname/game/index.js'; -export { Get, get, setGet } from './noname/get/index.js'; -export { Library, lib, setLibrary } from './noname/library/index.js'; -export { status, _status, setStatus } from './noname/status/index.js'; -export { UI, ui, setUI } from './noname/ui/index.js'; -export { boot } from './noname/init/index.js'; +export { boot } from "./noname/init/index.js"; +export { GNC, gnc, setGNC } from "./noname/gnc/index.js"; +export { AI, ai, setAI } from "./noname/ai/index.js"; +export { Game, game, setGame } from "./noname/game/index.js"; +export { Get, get, setGet } from "./noname/get/index.js"; +export { Library, lib, setLibrary } from "./noname/library/index.js"; +export { status, _status, setStatus } from "./noname/status/index.js"; +export { UI, ui, setUI } from "./noname/ui/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts index 3195ed436..5fcef7eef 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts @@ -5,7 +5,7 @@ export class Basic { * buttons?: Button[] * ) => number } check */ - chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined; + chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean | undefined; /** * @param { ( * card?: Card, @@ -13,12 +13,12 @@ export class Basic { * ) => number } check * @returns { boolean | undefined } */ - chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined; + chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined; /** * @param { ( * target?: Player, * targets?: Player[] * ) => number } check */ - chooseTarget(check: (target?: any, targets?: Player[]) => number): boolean | undefined; + chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean | undefined; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts index a5e8109d6..bf812acf2 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts @@ -5,4 +5,4 @@ export class AI { export let ai: AI; export function setAI(instance?: AI | undefined): void; export { Basic }; -import { Basic } from './basic.js'; +import { Basic } from "./basic.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts index ce8f14d61..9971c369c 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts @@ -15,7 +15,7 @@ export class Game { * @type { { [key: string]: Player } } */ playerMap: { - [key: string]: any; + [key: string]: import("noname-typings/nonameModules/noname/library/element/player.js").Player; }; phaseNumber: number; roundNumber: number; @@ -28,11 +28,15 @@ export class Game { /** * @type { Player } */ - me: any; + me: Player; /** * @type { boolean } */ chess: boolean; + /** + * @type { Player } + */ + zhu: Player; globalEventHandlers: { _handlers: {}; getHandler(name: any, type: any): any; @@ -173,19 +177,19 @@ export class Game { /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { boolean } */ - hasGlobalHistory(key: T, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean; + hasGlobalHistory(key: T, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { void } */ - checkGlobalHistory(key: T_1, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void; + checkGlobalHistory(key: T_1, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void; /** * @overload * @returns { GameHistory } @@ -195,27 +199,27 @@ export class Game { * @template { keyof GameHistory } T * @overload * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter] - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - getGlobalHistory(key: T_2, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_2]; + getGlobalHistory(key: T_2, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): GameHistory[T_2]; /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { boolean } */ - hasAllGlobalHistory(key: T_3, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): boolean; + hasAllGlobalHistory(key: T_3, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { void } */ - checkAllGlobalHistory(key: T_4, filter: (event: import('../library/index.js').GameEventPromise) => boolean, last?: import("../library/index.js").GameEventPromise | undefined): void; + checkAllGlobalHistory(key: T_4, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void; /** * @overload * @returns { GameHistory[] } @@ -225,11 +229,11 @@ export class Game { * @template { keyof GameHistory } T * @overload * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter] - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - getAllGlobalHistory(key: T_5, filter?: ((event: import('../library/index.js').GameEventPromise) => boolean) | undefined, last?: import("../library/index.js").GameEventPromise | undefined): GameHistory[T_5]; + getAllGlobalHistory(key: T_5, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): GameHistory[T_5]; /** * @overload * @returns { void } @@ -238,15 +242,15 @@ export class Game { /** * @overload * @param { Card } cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsDiscard(cards: any): import('../library/index.js').GameEventPromise; + cardsDiscard(cards: Card): GameEventPromise; /** * @overload * @param {Card[]} cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsDiscard(cards: Card[]): import('../library/index.js').GameEventPromise; + cardsDiscard(cards: Card[]): GameEventPromise; /** * @overload * @returns { void } @@ -255,15 +259,15 @@ export class Game { /** * @overload * @param { Card } cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsGotoOrdering(cards: any): import('../library/index.js').GameEventPromise; + cardsGotoOrdering(cards: Card): GameEventPromise; /** * @overload * @param {Card[]} cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsGotoOrdering(cards: Card[]): import('../library/index.js').GameEventPromise; + cardsGotoOrdering(cards: Card[]): GameEventPromise; /** * @overload * @returns { void } @@ -273,16 +277,16 @@ export class Game { * @overload * @param { Card } cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise; + cardsGotoSpecial(cards: Card, bool?: false | "toRenku" | undefined): GameEventPromise; /** * @overload * @param {Card[]} cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ - cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): import('../library/index.js').GameEventPromise; + cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): GameEventPromise; /** * * @param {...( @@ -299,9 +303,9 @@ export class Game { any ])[]): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; /** - * @param { import('../library/index.js').GameEventPromise } event + * @param { GameEventPromise } event */ - $cardsGotoPile(event: import('../library/index.js').GameEventPromise): void; + $cardsGotoPile(event: GameEventPromise): void; /** * @param { false } [pause] */ @@ -316,16 +320,22 @@ export class Game { * @param { string } url * @param { Player } [player] */ - changeLand(url: string, player?: any): void; + changeLand(url: string, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): void; /** * @param { string[] } updates * @param { Function } proceed */ checkFileList(updates: string[], proceed: Function): void; /** - * @param {...(Player[] | Player)} args + * @overload + * @param {[Player[]]} args */ - replaceHandcards(...args: (Player[] | Player)[]): void; + replaceHandcards(args: [Player[]]): any; + /** + * @overload + * @param {Player[]} args + */ + replaceHandcards(args: Player[]): any; /** * @param { string } name */ @@ -344,7 +354,7 @@ export class Game { * @param { ...Parameters } args * @returns { void } */ - broadcast(func: T_6, ...args: Parameters<{ + broadcast(func: T_6, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -376,7 +386,7 @@ export class Game { * @param { ...T } args * @returns { void } */ - broadcast(func: (...args: T_6) => void, ...args: T_6 | undefined): void; + broadcast(func: (...args: T_6) => void, ...args: T_6 | undefined): void; /** * @template { keyof typeof lib.message.client } T * @overload @@ -384,7 +394,7 @@ export class Game { * @param { ...Parameters } args * @returns { void } */ - broadcastAll(func: T_7, ...args: Parameters<{ + broadcastAll(func: T_7, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -416,7 +426,7 @@ export class Game { * @param { ...T } args * @returns { void } */ - broadcastAll(func: (...args: T_7) => void, ...args: T_7 | undefined): void; + broadcastAll(func: (...args: T_7) => void, ...args: T_7 | undefined): void; syncState(): void; updateWaiting(): void; /** @@ -447,44 +457,44 @@ export class Game { */ playAudio(...args: any[]): HTMLAudioElement; /** - * 根据skill中的audio,audioname,audioname2和player来获取音频地址列表 - * @typedef {[string,number]|string|number|boolean} audioInfo - * @typedef {{audio: audioInfo, audioname?:string[], audioname2?:{[playerName: string]: audioInfo}}} skillInfo - * @param { string } skill 技能名 - * @param { Player | string } [player] 角色/角色名 - * @param { skillInfo | audioInfo } [skillInfo] 预设的skillInfo/audioInfo(转为skillInfo),覆盖lib.skill[skill] - * @returns { string[] } 语音地址列表 - * @example - * ```js - * const info=lib.skill['skillname']; - * info.audio=undefined //默认值[true,2] - * info.audio=false // 不播放语音 - * info.audio=true // [skill/skillname.mp3] - * info.audio=3 // [skill/skillname1.mp3,skill/skillname2.mp3,skill/skillname3.mp3](项数为数字大小) - * info.audio="(ext:extName|db:extension-extName)(/anyPath):true|number(:format)" //间接路径 - * // 同上,只是将目录改为(ext:extName|db:extension-extName)(/anyPath),且可以指定格式(默认mp3) - * info.audio="(ext:extName|db:extension-extName/)(anyPath/)filename(.format)" //直接路径 - * //path和format至少有一个,否则会识别为引用技能 - * //起始位置为audio/(若无anyPath则为audio/skill/),若没有format默认mp3 - * info.audio="otherSkillname" //引用技能 - * //引用一个其他技能的语音,若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为默认值[true,2] - * info.audio=["otherSkillname", number] //带fixedNum的引用技能 - * //同样引用一个其他技能的语音,若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为number - * //若"otherSkillname"的语音数超过number,则只取前number个 - * info.audio=[true,2,"otherSkillname1",["otherSkillname2",2]] //任意元素拼接 - * //数组里可以放任何以上的格式,结果为分析完的结果合并 - * - * info.audioname=['player1','player2'] - * //audioname里可以放任意角色名。 - * //如果其中包含发动技能的角色名"player",且info.audio不是直接路径"(anyPath/)filename(.format)"的形式 - * //则在"skill"和number中插入"_player",形如 - * - * info.audioname2={'player1':audioInfo1,'player2':audioInfo2} - * //audioname2是一个对象,其中key为角色名,value的类型和info.audio一样 - * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 - * ``` - */ - parseSkillAudio(skill: string, player?: Player | string, skillInfo?: { + * 根据skill中的audio,audioname,audioname2和player来获取音频地址列表 + * @typedef {[string,number]|string|number|boolean} audioInfo + * @typedef {{audio: audioInfo, audioname?:string[], audioname2?:{[playerName: string]: audioInfo}}} skillInfo + * @param { string } skill 技能名 + * @param { Player | string } [player] 角色/角色名 + * @param { skillInfo | audioInfo } [skillInfo] 预设的skillInfo/audioInfo(转为skillInfo),覆盖lib.skill[skill] + * @returns { string[] } 语音地址列表 + * @example + * ```js + * const info=lib.skill['skillname']; + * info.audio=undefined //默认值[true,2] + * info.audio=false // 不播放语音 + * info.audio=true // [skill/skillname.mp3] + * info.audio=3 // [skill/skillname1.mp3,skill/skillname2.mp3,skill/skillname3.mp3](项数为数字大小) + * info.audio="(ext:extName|db:extension-extName)(/anyPath):true|number(:format)" //间接路径 + * // 同上,只是将目录改为(ext:extName|db:extension-extName)(/anyPath),且可以指定格式(默认mp3) + * info.audio="(ext:extName|db:extension-extName/)(anyPath/)filename(.format)" //直接路径 + * //path和format至少有一个,否则会识别为引用技能 + * //起始位置为audio/(若无anyPath则为audio/skill/),若没有format默认mp3 + * info.audio="otherSkillname" //引用技能 + * //引用一个其他技能的语音,若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为默认值[true,2] + * info.audio=["otherSkillname", number] //带fixedNum的引用技能 + * //同样引用一个其他技能的语音,若lib.skill["otherSkillname"]不存在则读取"otherSkillname"的audio为number + * //若"otherSkillname"的语音数超过number,则只取前number个 + * info.audio=[true,2,"otherSkillname1",["otherSkillname2",2]] //任意元素拼接 + * //数组里可以放任何以上的格式,结果为分析完的结果合并 + * + * info.audioname=['player1','player2'] + * //audioname里可以放任意角色名。 + * //如果其中包含发动技能的角色名"player",且info.audio不是直接路径"(anyPath/)filename(.format)"的形式 + * //则在"skill"和number中插入"_player",形如 + * + * info.audioname2={'player1':audioInfo1,'player2':audioInfo2} + * //audioname2是一个对象,其中key为角色名,value的类型和info.audio一样 + * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 + * ``` + */ + parseSkillAudio(skill: string, player?: string | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined, skillInfo?: { audio: string | number | boolean | [string, number]; audioname?: string[] | undefined; audioname2?: { @@ -838,7 +848,7 @@ export class Game { * @param { any } [content] * @returns */ - addVideo(type: string, player: any, content?: any): void; + addVideo(type: string, player: Player, content?: any): void; /** * @param { Function } func */ @@ -876,18 +886,18 @@ export class Game { * @param { string } name * @param { string } skill * @param { Player } player - * @param { import('../library/index.js').GameEventPromise } event - * @returns { import('../library/index.js').GameEventPromise } + * @param { GameEventPromise } event + * @returns { GameEventPromise } */ - createTrigger(name: string, skill: string, player: any, event: import('../library/index.js').GameEventPromise, indexedData: any): import('../library/index.js').GameEventPromise; + createTrigger(name: string, skill: string, player: Player, event: GameEventPromise, indexedData: any): GameEventPromise; /** * @legacy Use {@link lib.element.GameEvent.constructor} instead. * * @param { string } name * @param { false } [trigger] - * @param { import('../library/index.js').GameEventPromise } [triggerEvent] + * @param { GameEventPromise } [triggerEvent] */ - createEvent(name: string, trigger?: false | undefined, triggerEvent?: import("../library/index.js").GameEventPromise | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; + createEvent(name: string, trigger?: false | undefined, triggerEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; /** * @param { string } name * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information @@ -921,7 +931,7 @@ export class Game { * @param { Card } info * @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2 */ - addCard(name: string, info: any, info2: { + addCard(name: string, info: Card, info2: { extension: string; translate: string; description: string; @@ -938,7 +948,7 @@ export class Game { forbid?: string[] | undefined; list: any[]; card: { - [key: string]: any; + [key: string]: import("noname-typings/nonameModules/noname/library/element/card.js").Card; }; skill: { [key: string]: any; @@ -970,7 +980,7 @@ export class Game { * @param { string } skill * @param { Player } [player] */ - addGlobalSkill(skill: string, player?: any): boolean; + addGlobalSkill(skill: string, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean; /** * @param { string } skill * @param { lib.element.Player } player @@ -980,7 +990,7 @@ export class Game { /** * @param { string } extensionName */ - hasExtension(extensionName: string): any; + hasExtension(extensionName: string): boolean; /** * @param { string } extensionName */ @@ -988,7 +998,7 @@ export class Game { /** * @param { string } extensionName */ - hasExtensionLoaded(extensionName: string): any; + hasExtensionLoaded(extensionName: string): boolean; /** * @param { string } extensionName * @param { Function } runnable @@ -1004,7 +1014,7 @@ export class Game { * @overload * @returns { Card } */ - createCard(): any; + createCard(): Card; /** * @overload * @param { Card | string } name @@ -1017,7 +1027,7 @@ export class Game { * @overload * @returns { Card } */ - createCard2(): any; + createCard2(): Card; /** * @overload * @param { Card | string } name @@ -1046,17 +1056,17 @@ export class Game { */ executingAsyncEventMap: Map>; /** - * @type { import('../library/index.js').GameEventPromise[] } + * @type { GameEventPromise[] } */ - belongAsyncEventList: import('../library/index.js').GameEventPromise[]; + belongAsyncEventList: GameEventPromise[]; /** - * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] + * @param { GameEventPromise } [belongAsyncEvent] */ - loop(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise; + loop(belongAsyncEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): Promise; /** - * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] + * @param { GameEventPromise } [belongAsyncEvent] */ - runContent(belongAsyncEvent?: import("../library/index.js").GameEventPromise | undefined): Promise; + runContent(belongAsyncEvent?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): Promise; pause(): void; pause2(): void; resume(): void; @@ -1092,9 +1102,9 @@ export class Game { */ asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise; /** - * @param { import('../library/index.js').GameEventPromise } [event] + * @param { GameEventPromise } [event] */ - check(event?: import("../library/index.js").GameEventPromise | undefined): boolean; + check(event?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; Check: Check; uncheck(...args: any[]): void; /** @@ -1104,21 +1114,21 @@ export class Game { * @param { boolean } [behind] * @param { boolean } [noanimate] */ - swapSeat(player1: any, player2: any, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void; + swapSeat(player1: Player, player2: Player, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void; /** * @param { Player } player1 * @param { Player } [player2] */ - swapPlayer(player: any, player2?: any): void; + swapPlayer(player: any, player2?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): void; /** * @param { Player } player */ - swapControl(player: any): void; + swapControl(player: Player): void; swapPlayerAuto(player: any): void; /** * @param { Player } player */ - findNext(player: any): any; + findNext(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player; /** * @param { string } name * @param { Function } callback @@ -1140,20 +1150,20 @@ export class Game { /** * @param { Player } player */ - phaseLoop(player: any): void; + phaseLoop(player: Player): void; /** * @param { Player } [player] */ - gameDraw(player?: any, num?: number): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; + gameDraw(player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined, num?: number): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; chooseCharacterDouble(...args: any[]): void; updateRoundNumber(): void; /** * @param { Player[] } players - * @param { number | number[] | (player: Player) => number } num + * @param { number | number[] | (player: Player) => number } [num] * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - asyncDraw(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { + asyncDraw(players: Player[], num?: number | number[] | ((player: Player) => number) | undefined, drawDeck?: { drawDeck: boolean; } | undefined, bottom?: boolean | undefined): void; /** @@ -1161,7 +1171,7 @@ export class Game { * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] */ - asyncDrawAuto(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { + asyncDrawAuto(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: { drawDeck: boolean; } | undefined, ...args: any[]): void; finishSkill(i: any, sub: any): void; @@ -1181,11 +1191,11 @@ export class Game { * @param { Player } player * @param { string | Card[] } card * @param { Player[] } [targets] - * @param { import('../library/index.js').GameEventPromise } [event] + * @param { GameEventPromise } [event] * @param { boolean } [forced] * @param { string } [logvid] */ - logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: import("../library/index.js").GameEventPromise | undefined, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined; + logv(player: Player, card: string | Card[], targets?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, event?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined; /** * @param { string } storeName * @param { string } idbValidKey @@ -1267,28 +1277,28 @@ export class Game { /** * @param { Player } player */ - triggerEnter(player: any): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; + triggerEnter(player: Player): import("../library/element/gameEvent.js").GameEvent & import("../library/element/gameEventPromise.js").GameEventPromise; /** * @param { Player } player */ - restorePlayer(player: any): any; + restorePlayer(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined; /** * @param { Player } player */ - removePlayer(player: any): any; + removePlayer(player: Player): import("noname-typings/nonameModules/noname/library/element/player.js").Player; /** * @param { Player } player * @param { string } [character] * @param { string } [character2] */ - replacePlayer(player: any, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; + replacePlayer(player: Player, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; arrangePlayers(): void; /** * @param { string[] } skills * @param { Player } player * @param { string[] } exclude */ - filterSkills(skills: string[], player: any, exclude: string[]): string[]; + filterSkills(skills: string[], player: Player, exclude: string[]): string[]; /** * @param { string[] } skills */ @@ -1303,22 +1313,22 @@ export class Game { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - hasPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; + hasPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - hasPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; + hasPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - countPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; + countPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): number; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - countPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; + countPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): number; /** * @overload * @returns { Player[] } @@ -1331,7 +1341,7 @@ export class Game { * @param { boolean } [includeOut] * @returns { Player[] } */ - filterPlayer(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; + filterPlayer(func: (player: Player) => boolean, list?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @overload * @returns { Player[] } @@ -1344,23 +1354,23 @@ export class Game { * @param { boolean } [includeOut] * @returns { Player[] } */ - filterPlayer2(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; + filterPlayer2(func: (player: Player) => boolean, list?: import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - findPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; + findPlayer(func: (player: Player) => boolean, includeOut?: boolean | undefined): import("noname-typings/nonameModules/noname/library/element/player.js").Player | null; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - findPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; + findPlayer2(func: (player: Player) => boolean, includeOut?: boolean | undefined): import("noname-typings/nonameModules/noname/library/element/player.js").Player | null; /** * @param { (player: Player) => boolean } func * @param { boolean } [all] */ - findCards(func: (player: any) => boolean, all?: boolean | undefined): string[]; - countGroup(): any; + findCards(func: (player: Player) => boolean, all?: boolean | undefined): string[]; + countGroup(): number; /** * 此函数用于计算函数的时间消耗。 * @param {function} 测试的函数 @@ -1374,7 +1384,7 @@ export class Game { * @param { (player: Player, i: number) => Promise } asyncFunc 需要执行的async方法 * @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat */ - doAsyncInOrder(targets: Player[], asyncFunc: (player: any, i: number) => Promise, sort: (a: any, b: any) => number): Promise; + doAsyncInOrder(targets: Player[], asyncFunc: (player: Player, i: number) => Promise, sort: (a: Player, b: Player) => number): Promise; } export let game: Game; export function setGame(instance?: Game | undefined): void; @@ -1403,6 +1413,6 @@ export type Videos = { }; import { GamePromises } from "./promises.js"; import { DynamicStyle } from "./dynamic-style/index.js"; -import { lib } from '../library/index.js'; +import { lib } from "../library/index.js"; import { Check } from "./check.js"; import { delay } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts index 2f4e24fbc..c5b8861fd 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts @@ -25,7 +25,11 @@ export class GamePromises { */ alert(title: string): Promise; download(url: any, folder: any, dev: any, onprogress: any): Promise; - readFile(filename: any): Promise; + /** + * @param {string} filename + * @returns {Promise} + */ + readFile(filename: string): Promise; readFileAsText(filename: any): Promise; writeFile(data: any, path: any, name: any): Promise; ensureDirectory(list: any, callback: any, file: any): Promise; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts index e2aaa5672..b4290be5e 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts @@ -74,7 +74,7 @@ export class Get { * @param { false | Player } [player] * @returns { string[] } */ - subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[]; + subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string[]; /** * @returns { string[] } */ @@ -90,7 +90,7 @@ export class Get { * @param { Player } player * @returns { string[] } */ - skillCategoriesOf(skill: string, player: any): string[]; + skillCategoriesOf(skill: string, player: Player): string[]; numOf(obj: any, item: any): any; connectNickname(): any; zhinangs(filter: any): any; @@ -99,7 +99,7 @@ export class Get { infoHp(hp: any): number; infoMaxHp(hp: any): number; infoHujia(hp: any): number; - bottomCards(num: any, putBack: any): any; + bottomCards(num: any, putBack: any): Node | Node[]; discarded(): any; cardOffset(): number; colorspan(str: any): any; @@ -175,7 +175,7 @@ export class Get { charactersOL(func: any): number[]; trimip(str: any): any; mode(): any; - idDialog(id: any): any; + idDialog(id: any): import("noname-typings/nonameModules/noname/library/element/dialog.js").Dialog | null; arenaState(): { number: string | undefined; players: {}; @@ -198,7 +198,7 @@ export class Get { rank(name: any, num: any): number | "x" | "s" | "c" | "d" | "b" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; skillRank(skill: any, type: any, grouped: any): number; targetsInfo(targets: any): any[]; - infoTargets(infos: any): any[]; + infoTargets(infos: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[]; cardInfo(card: any): any[]; cardsInfo(cards?: any[]): any[][]; infoCard(info: any): import("../library/element/card.js").Card; @@ -279,25 +279,25 @@ export class Get { * @param { Button } obj * @returns { 'button' } */ - itemtype(obj: any): 'button'; + itemtype(obj: Button): 'button'; /** * @overload * @param { Card } obj * @returns { 'card' } */ - itemtype(obj: any): 'card'; + itemtype(obj: Card): 'card'; /** * @overload * @param { Player } obj * @returns { 'player' } */ - itemtype(obj: any): 'player'; + itemtype(obj: Player): 'player'; /** * @overload * @param { Dialog } obj * @returns { 'dialog' } */ - itemtype(obj: any): 'dialog'; + itemtype(obj: Dialog): 'dialog'; /** * @overload * @param { GameEvent | GameEventPromise } obj @@ -314,7 +314,7 @@ export class Get { * @param { false | Player } [player] * @returns { string } */ - subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; + subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string; equiptype(card: any, player: any): number; /** * @@ -322,40 +322,40 @@ export class Get { * @param { false | Player } [player] * @returns { string } */ - name(card: Card | VCard | CardBaseUIData, player?: false | Player): string; + name(card: Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + suit(card: Card | VCard | Card[] | VCard[], player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + color(card: Card | VCard | Card[] | VCard[], player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string; /** * @param {Card | VCard} card * @param {false | Player} [player] * @returns {number} */ - number(card: Card | VCard, player?: false | Player): number; + number(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): number; /** * 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder` * @param {string | string[] | Card | VCard} card * @param {false | Player} [player] * @returns {string} */ - nature(card: string | string[] | Card | VCard, player?: false | Player): string; + nature(card: string | string[] | Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string; /** * 返回包含所有属性的数组 * @param {string[] | string} card * @param {false | Player} [player] * @returns {string[]} */ - natureList(card: string[] | string, player?: false | Player): string[]; - cards(num: any, putBack: any): any; + natureList(card: string[] | string, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): string[]; + cards(num: any, putBack: any): Node | Node[]; judge(card: any): any; judge2(card: any): any; distance(from: any, to: any, method: any): number; @@ -371,7 +371,7 @@ export class Get { * @param { Player | false } [player] * @returns { any } */ - info(item: Card | VCard | CardBaseUIData, player?: Player | false): any; + info(item: Card | VCard | CardBaseUIData, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): any; /** * @param { number | Select | (()=>Select) } [select] * @returns { Select } @@ -382,16 +382,16 @@ export class Get { * @overload * @returns {GameEvent} */ - event(): any; + event(): GameEvent; /** * @template { keyof GameEvent } T * @overload * @param {T} key * @returns {GameEvent[T]} */ - event(key: T_2): any; - player(): any; - players(sort: any, dead: any, out: any): any[]; + event(key: T_2): import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent[T_2]; + player(): import("noname-typings/nonameModules/noname/library/element/player.js").Player; + players(sort: any, dead: any, out: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[]; position(card: any, ordering: any): number | "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o" | null | undefined; skillTranslation(str: any, player: any): string; skillInfoTranslation(name: any, player: any): any; @@ -412,12 +412,12 @@ export class Get { * @param {((a: Button, b: Button) => number)} [sort] 排序函数 * @returns { Button[] } */ - selectableButtons(sort?: ((a: any, b: any) => number) | undefined): Button[]; + selectableButtons(sort?: ((a: Button, b: Button) => number) | undefined): Button[]; /** * @param {((a: Card, b: Card) => number)} [sort] 排序函数 * @returns { Card[] } */ - selectableCards(sort?: ((a: any, b: any) => number) | undefined): Card[]; + selectableCards(sort?: ((a: Card, b: Card) => number) | undefined): Card[]; /** * @returns { string[] } 技能名数组 */ @@ -429,11 +429,11 @@ export class Get { * @param {((a: Player, b: Player) => number)} [sort] 排序函数 * @returns { Player[] } */ - selectableTargets(sort?: ((a: any, b: any) => number) | undefined): Player[]; + selectableTargets(sort?: ((a: Player, b: Player) => number) | undefined): Player[]; filter(filter: any, i: any): any; cardCount(card: any, player: any): any; skillCount(skill: any, player: any): any; - owner(card: any, method: any): any; + owner(card: any, method: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined; noSelected(): boolean; population(identity: any): number; totalPopulation(identity: any): number; @@ -467,8 +467,8 @@ export class Get { unuseful3(card: any): number; value(card: any, player: any, method: any): any; equipResult(player: any, target: any, name: any): number; - equipValue(card: any, player: any): any; - equipValueNumber(card: any): any; + equipValue(card: any, player: any): number; + equipValueNumber(card: any): number; disvalue(card: any, player: any): number; disvalue2(card: any, player: any): number; skillthreaten(skill: any, player: any, target: any): number | void; @@ -476,7 +476,7 @@ export class Get { /** * @returns { number } */ - order(item: any, player?: any): number; + order(item: any, player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player): number; result(item: any, skill: any): any; cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; effect_use(target: any, card: any, player: any, player2: any, isLink: any): number; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts index 45add36bd..dfcf107d3 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts @@ -5,14 +5,14 @@ export class Is { * @param { false | Player } [player] * @returns { boolean } */ - attackingMount(card: Card | VCard, player?: false | Player): boolean; + attackingMount(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean; /** * 判断是否为防御坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - defendingMount(card: Card | VCard, player?: false | Player): boolean; + defendingMount(card: Card | VCard, player?: false | import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean; /** * 判断坐骑栏是否被合并 * @returns { boolean } @@ -34,7 +34,7 @@ export class Is { * 判断一张牌是否为明置手牌 * @param { Card } card */ - shownCard(card: any): boolean; + shownCard(card: Card): boolean; /** * 是否是虚拟牌 * @param { Card | VCard } card @@ -49,7 +49,7 @@ export class Is { * 是否是实体牌 * @param { Card | VCard } card */ - ordinaryCard(card: Card | VCard): any; + ordinaryCard(card: Card | VCard): boolean; /** * 押韵判断 * @param { string } str1 @@ -61,7 +61,7 @@ export class Is { * @param { Player } player 玩家 * @returns */ - blocked(skill: string, player: any): boolean; + blocked(skill: string, player: Player): boolean; /** * 是否是双势力武将 * @param { string } name @@ -107,7 +107,7 @@ export class Is { /** * @param { GameEventPromise } event */ - converted(event: any): boolean; + converted(event: GameEventPromise): boolean; safari(): boolean; /** * @param { (Card | VCard)[]} cards @@ -162,14 +162,14 @@ export class Is { /** * @param { Player } [player] */ - mobileMe(player?: any): any; + mobileMe(player?: import("noname-typings/nonameModules/noname/library/element/player.js").Player | undefined): boolean | undefined; newLayout(): boolean; phoneLayout(): boolean; singleHandcard(): any; /** * @param { Player } player */ - linked2(player: any): boolean; + linked2(player: Player): boolean; /** * @param { {} } obj */ @@ -183,11 +183,11 @@ export class Is { * @param { Player } player * @returns */ - locked(skill: string, player: any): any; + locked(skill: string, player: Player): any; /** * @param { string } skill * @param { Player } player * @returns */ - zhuanhuanji(skill: string, player: any): boolean; + zhuanhuanji(skill: string, player: Player): boolean; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/childNodesWatcher.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/childNodesWatcher.d.ts index e7efe33ae..ea1749c1e 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/childNodesWatcher.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/childNodesWatcher.d.ts @@ -1,6 +1,6 @@ /** -* 子节点观察器,对于需要频繁遍历子节点的DOM对象的实时变化进行缓存。 -*/ + * 子节点观察器,对于需要频繁遍历子节点的DOM对象的实时变化进行缓存。 + */ export class ChildNodesWatcher { constructor(dom: any); dom: any; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts index 58f5afd4d..98c3dd6a1 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts @@ -14,4 +14,4 @@ export class Button extends HTMLDivElement { exclude(): void; get updateTransform(): (bool: any, delay: any) => void; } -import { ui } from '../../ui/index.js'; +import { ui } from "../../ui/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts index cce666e53..d0e622684 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts @@ -34,6 +34,10 @@ export class Card extends HTMLDivElement { * @type { string } */ name: string; + /** + * @type { boolean } + */ + isCard: boolean; selfDestroy(event: any): void; willBeDestroyed(targetPosition: any, player: any, event: any): any; hasNature(nature: any, player: any): boolean; @@ -63,7 +67,7 @@ export class Card extends HTMLDivElement { cardid: string | undefined; /** * @param {[string, number, string, string]} card - */ + */ $init(card: [string, number, string, string]): this; updateTransform(bool: any, delay: any): void; aiexclude(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts index 3d3de19f4..64d9acd0f 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts @@ -1,4 +1,4 @@ /** * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]> } */ -export const Contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; +export const Contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]>; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts index 388b39ecc..dc2406ed3 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts @@ -22,14 +22,14 @@ export class Dialog extends HTMLDivElement { * @param {*} [noclick] * @param { boolean } [zoom] */ - add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement; + add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | HTMLDivElement | import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; forcebutton: boolean | undefined; /** * @param { string } str * @param { boolean } [center] */ addText(str: string, center?: boolean | undefined): this; - addSmall(item: any, noclick: any): string | any[] | HTMLDivElement; + addSmall(item: any, noclick: any): string | HTMLDivElement | import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; addAuto(content: any): void; open(): this | undefined; _dragtransform: any; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts index efa0b6699..de20fcee0 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts @@ -43,15 +43,19 @@ export class GameEvent { /** * @type { Player } */ - source: any; + source: Player; /** * @type { Player } */ - player: any; + player: Player; + /** + * @type { Player[] } + */ + players: Player[]; /** * @type { Player } */ - target: any; + target: Player; /** * @type { Player[] } */ @@ -59,7 +63,7 @@ export class GameEvent { /** * @type { Card } */ - card: any; + card: Card; /** * @type { Card[] } */ @@ -87,7 +91,7 @@ export class GameEvent { /** * @type { Player } */ - customSource: any; + customSource: Player; /** * @type { number } */ @@ -121,9 +125,37 @@ export class GameEvent { */ parent: GameEventPromise | void | null; /** - * @type { Function | void | null } + * @type { (this: GameEventPromise) => any | undefined | void | null } */ - filterStop: Function | void | null; + filterStop: (this: GameEventPromise) => any | undefined | void | null; + /** + * @type { Result['cost_data'] } + */ + cost_data: Result['cost_data']; + /** + * @type { boolean } + */ + responded: boolean; + /** + * @type { string | undefined } + */ + judgestr: string | undefined; + /** + * @type { boolean } + */ + judging: boolean; + /** + * @type { Function | undefined } + */ + judge2: Function | undefined; + /** + * @type { Card[] } + */ + orderingCards: Card[]; + /** + * @type { Function | undefined } + */ + ai: Function | undefined; /** * @param {keyof this} key * @param {number} [value] @@ -232,12 +264,12 @@ export class GameEvent { * 获取事件的父节点。 * 获取事件链上的指定事件。 * 默认获取上一个父节点(核心)。 - * @param {number|string|(evt:gameEvent)=>boolean} [level=1] 获取深度(number)/指定名字(string)/指定特征(function) + * @param {number|string|((evt:GameEvent)=>boolean)} [level=1] 获取深度(number)/指定名字(string)/指定特征(function) * @param {boolean} [forced] 若获取不到节点,默认返回{},若forced为true则返回null * @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身 * @returns {GameEvent|{}|null} */ - getParent(level?: string | number | ((evt: gameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null; + getParent(level?: string | number | ((evt: GameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null; getTrigger(): any; getRand(name: any): any; _rand_map: {} | undefined; @@ -267,8 +299,8 @@ export class GameEvent { _cardChoice: any; _targetChoice: any; _skillChoice: any; - isMine(): any; - isOnline(): any; + isMine(): boolean; + isOnline(): boolean; notLink(): boolean; isPhaseUsing(player: any): boolean; addTrigger(skills: any, player: any): this; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts index eb2481761..8ca046c2b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts @@ -21,7 +21,7 @@ * game.log('等待', player, '摸牌完成执行log'); * ``` */ -export class GameEventPromise extends Promise { +export class GameEventPromise extends Promise { /** * @param { import('./gameEvent.js').GameEvent } arg */ @@ -140,10 +140,6 @@ export class GameEventPromise extends Promise { * @returns { Promise[]> } */ forResult(params: T[]): Promise[]>; - /** - * 返回result中的bool项 - */ - forResultTest(): Promise<(boolean | any[])[]>; /** * 返回result中的bool项 */ @@ -151,11 +147,11 @@ export class GameEventPromise extends Promise { /** * 返回result中的targets项。 */ - forResultTargets(): Promise; + forResultTargets(): Promise; /** * 返回result中的cards项 */ - forResultCards(): Promise; + forResultCards(): Promise; /** * 返回result中的card项 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts index 34afa35d4..be00c0882 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts @@ -69,29 +69,9 @@ export class Player extends HTMLDivElement { skill: {}; }[]; /** - * @type { { - * useCard: GameEventPromise[], - * respond: GameEventPromise[], - * skipped: GameEventPromise[], - * lose: GameEventPromise[], - * gain: GameEventPromise[], - * sourceDamage: GameEventPromise[], - * damage: GameEventPromise[], - * custom: GameEventPromise[], - * useSkill: GameEventPromise[], - * }[] } + * @type { ActionHistory[] } */ - actionHistory: { - useCard: GameEventPromise[]; - respond: GameEventPromise[]; - skipped: GameEventPromise[]; - lose: GameEventPromise[]; - gain: GameEventPromise[]; - sourceDamage: GameEventPromise[]; - damage: GameEventPromise[]; - custom: GameEventPromise[]; - useSkill: GameEventPromise[]; - }[]; + actionHistory: ActionHistory[]; /** * @type { SMap } */ @@ -117,7 +97,8 @@ export class Player extends HTMLDivElement { * friend: [], * enemy: [], * neutral: [], - * handcards: { + * shown?: number, + * handcards?: { * global: [], * source: [], * viewed: [] @@ -128,7 +109,8 @@ export class Player extends HTMLDivElement { friend: []; enemy: []; neutral: []; - handcards: { + shown?: number; + handcards?: { global: []; source: []; viewed: []; @@ -208,6 +190,18 @@ export class Player extends HTMLDivElement { * @type { ((player: this) => any)[] } */ _inits: ((player: this) => any)[]; + /** + * @type { boolean } + */ + isZhu: boolean; + /** + * @type { string } + */ + identity: string; + /** + * @type { boolean | undefined } + */ + identityShown: boolean | undefined; /** * 怒气 * @param { number } amount @@ -295,13 +289,13 @@ export class Player extends HTMLDivElement { /** * 获取角色所有的明置手牌 */ - getShownCards(): any[]; + getShownCards(): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; /** * 获取该角色被other所知的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - getKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): any[]; + getKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; /** * 判断此角色的手牌是否已经被看光了 * @param { Player } [other] @@ -312,13 +306,13 @@ export class Player extends HTMLDivElement { * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - hasKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): boolean; + hasKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): boolean; /** * 数此角色被知道的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - countKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): number; + countKnownCards(other?: Player | undefined, filter?: ((card: Card) => boolean) | undefined): number; /** * Execute the delay card effect * @@ -336,7 +330,7 @@ export class Player extends HTMLDivElement { * 检测此牌是否不计入手牌上限 * @param { Card } card */ - canIgnoreHandcard(card: any): boolean; + canIgnoreHandcard(card: Card): boolean; /** * Gift * @@ -353,7 +347,7 @@ export class Player extends HTMLDivElement { * @param { Player } target * @param { boolean } [strict] */ - canGift(card: any, target: Player, strict?: boolean | undefined): boolean; + canGift(card: Card, target: Player, strict?: boolean | undefined): boolean; /** * Check if the player refuses gifts * @@ -361,7 +355,7 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } player */ - refuseGifts(card: any, player: Player): boolean; + refuseGifts(card: Card, player: Player): boolean; /** * Gift AI related * @@ -369,12 +363,12 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - getGiftAIResultTarget(card: any, target: Player): number; + getGiftAIResultTarget(card: Card, target: Player): number; /** * @param { Card } card * @param { Player } target */ - getGiftEffect(card: any, target: Player): number; + getGiftEffect(card: Card, target: Player): number; /** * 重铸 * @param { Card | Card[] } cards @@ -390,7 +384,7 @@ export class Player extends HTMLDivElement { * @param { Player } [source] * @param { boolean } [strict] */ - canRecast(card: any, source?: Player | undefined, strict?: boolean | undefined): boolean; + canRecast(card: Card, source?: Player | undefined, strict?: boolean | undefined): boolean; /** * 判断一名角色的某个区域是否被废除 * @@ -516,10 +510,10 @@ export class Player extends HTMLDivElement { /** * 向target发起协力 * @param { Player } target - * @param {*} type + * @param { string } type * @param {*} reason */ - cooperationWith(target: Player, type: any, reason: any): void; + cooperationWith(target: Player, type: string, reason: any): void; chooseCooperationFor(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; checkCooperationStatus(target: any, reason: any): boolean; removeCooperation(info: any): void; @@ -574,7 +568,7 @@ export class Player extends HTMLDivElement { * @param { string } tag * @param { Card[] } [cards] */ - removeGaintag(tag: string, cards?: any[] | undefined): void; + removeGaintag(tag: string, cards?: import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined): void; /** * @param { Player } target */ @@ -583,18 +577,18 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - canSaveCard(card: any, target: Player): any; + canSaveCard(card: Card, target: Player): any; /** * @param { String } from * @param { String } to * @returns { GameEventPromise } */ - reinitCharacter(from: string, to: string, log?: boolean): any; + reinitCharacter(from: string, to: string, log?: boolean): GameEventPromise; /** * @param { String[] } newPairs * @returns { GameEventPromise } */ - changeCharacter(newPairs: string[], log?: boolean): any; + changeCharacter(newPairs: string[], log?: boolean): GameEventPromise; /** * @param { 0 | 1 | 2 } num * @param { false } [log] @@ -630,12 +624,13 @@ export class Player extends HTMLDivElement { * @param { string } [nature] * @param { string } [popname] */ - tryCardAnimate(card: any, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void; + tryCardAnimate(card: Card, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void; /** * @param { string } name * @param { string } type + * @returns { boolean } */ - hasUsableCard(name: string, type: string): true | undefined; + hasUsableCard(name: string, type: string): boolean; /** * @param { Player } to * @returns { boolean } @@ -754,12 +749,12 @@ export class Player extends HTMLDivElement { name: string; name1: string; name2: string; - handcards: any[]; + handcards: import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; gaintag: never[]; - equips: any[]; - judges: any[]; - specials: any[]; - expansions: any[]; + equips: import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; + judges: import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; + specials: import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; + expansions: import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; expansion_gaintag: never[]; disableJudge: boolean; disabledSlots: SMap; @@ -768,9 +763,9 @@ export class Player extends HTMLDivElement { position: number; hujia: number; side: any; - identityShown: any; + identityShown: boolean | undefined; identityNode: (string | undefined)[]; - identity: any; + identity: string; dead: boolean; linked: boolean; turnedover: boolean; @@ -806,31 +801,62 @@ export class Player extends HTMLDivElement { countUsed(card: any, type: any): number; getCacheKey(): string; countSkill(skill: any): any; - getStockSkills(unowned: any, unique: any, hidden: any): any[]; + /** + * @param {*} [unowned] + * @param {*} [unique] + * @param {*} [hidden] + * @returns { string[] } + */ + getStockSkills(unowned?: any, unique?: any, hidden?: any): string[]; /** * @param { string } [arg1='h'] * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Iterable } */ - iterableGetCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Iterable; + iterableGetCards(arg1?: string | undefined, arg2?: string | Record | ((card: Card) => boolean) | undefined): Iterable; /** * @param { string } [arg1='h'] * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Card[] } */ - getCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Card[]; - iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator; - getDiscardableCards(player: any, arg1: any, arg2: any): any[]; - iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator; - getGainableCards(player: any, arg1: any, arg2: any): any[]; + getCards(arg1?: string | undefined, arg2?: string | Record | ((card: Card) => boolean) | undefined): Card[]; + iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator; + getDiscardableCards(player: any, arg1: any, arg2: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; + /** + * @param {Parameters[1]} player + * @param {Parameters[0]} arg1 + * @param {Parameters[1]} arg2 + */ + iterableGetGainableCards(player: [card?: any, player?: any, target?: any, event?: any][1], arg1: Parameters[0], arg2: Parameters[1]): Generator; + /** + * + * @param {Parameters[0]} player + * @param {Parameters[1]} [arg1] + * @param {Parameters[2]} [arg2] + */ + getGainableCards(player: Parameters[0], arg1?: Parameters[1] | undefined, arg2?: Parameters[2] | undefined): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; getGainableSkills(func: any): any[]; - countCards(arg1: any, arg2: any): number; + /** + * @param { Parameters[0] } [arg1] + * @param { Parameters[1] } [arg2] + */ + countCards(arg1?: Parameters[0] | undefined, arg2?: Parameters[1] | undefined): number; getCardIndex(arg1: any, name: any, card: any, max: any): number; countDiscardableCards(player: any, arg1: any, arg2: any): number; - countGainableCards(player: any, arg1: any, arg2: any): number; + /** + * @param {Parameters[0]} player + * @param {Parameters[1]} [arg1] + * @param {Parameters[2]} [arg2] + */ + countGainableCards(player: Parameters[0], arg1?: Parameters[1] | undefined, arg2?: Parameters[2] | undefined): number; getOriginalSkills(): any[]; getModableSkills(): any[]; - getSkills(arg2: any, arg3: any, arg4: any): any[]; + /** + * @param { string | boolean | null } [arg2] + * @param { boolean | null} [arg3] + * @param {boolean} [arg4] + */ + getSkills(arg2?: string | boolean | null | undefined, arg3?: boolean | null | undefined, arg4?: boolean | undefined): any[]; get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode | undefined; syncStorage(skill: any): void; syncSkills(): void; @@ -879,7 +905,7 @@ export class Player extends HTMLDivElement { useSkill(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; drawTo(num: any, args: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; draw(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; - randomDiscard(...args: any[]): any[]; + randomDiscard(...args: any[]): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; randomGain(...args: any[]): any; discard(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; loseToDiscardpile(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; @@ -889,16 +915,30 @@ export class Player extends HTMLDivElement { $addToExpansion(cards: any, broadcast: any, gaintag: any): this; directgain(cards: any, broadcast: any, gaintag: any): this; directgains(cards: any, broadcast: any, gaintag: any): this; - gainMultiple(targets: any, position: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; + /** + * + * @param { Player[] } targets + * @param { string } [position] + */ + gainMultiple(targets: Player[], position?: string | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; gain(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; addToExpansion(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; - give(cards: any, target: any, visible: any): any; + /** + * + * @param { Card | Card[] } cards + * @param { Player } target + * @param { boolean } [visible] + */ + give(cards: Card | Card[], target: Player, visible?: boolean | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; lose(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; damage(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; recover(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; recoverTo(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; doubleDraw(): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; - loseHp(num: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; + /** + * @param { number } [num] + */ + loseHp(num?: number | undefined): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; loseMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; gainMaxHp(...args: any[]): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; changeHp(num: any, popup: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; @@ -930,18 +970,30 @@ export class Player extends HTMLDivElement { wait(callback: any): void; unwait(result: any): void; tempUnwait(result: any): void; - logSkill(name: any, targets: any, nature: any, logv: any): void; + /** + * @param { string | string[] } name + * @param { Player | Player[] } [targets] + * @param { boolean | string } [nature] + * @param { boolean } [logv] + */ + logSkill(name: string | string[], targets?: Player | Player[] | undefined, nature?: string | boolean | undefined, logv?: boolean | undefined): void; unprompt(): void; prompt(str: any, nature: any): void; prompt_old(name2: any, className: any): void; - popup(name: any, className: any, nobroadcast: any): void; + /** + * + * @param { string } name + * @param { string } className + * @param { Parameters[3] } [nobroadcast] + */ + popup(name: string, className?: string, nobroadcast?: Parameters[3] | undefined): void; popup_old(name: any, className: any): HTMLDivElement; _popup(): void; showTimer(time: any): void; hideTimer(): void; markAuto(name: any, info: any): void; unmarkAuto(name: any, info: any): void; - getExpansions(tag: any): any[]; + getExpansions(tag: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card[]; countExpansions(tag: any): number; hasExpansions(tag: any): boolean; setStorage(name: any, value: any, mark: any): any; @@ -961,7 +1013,14 @@ export class Player extends HTMLDivElement { unmark(name: any, info: any): void; addLink(): void; removeLink(): void; - canUse(card: any, target: any, distance: any, includecard: any): any; + /** + * @param { string | Card | VCard } card + * @param { Player } target + * @param { boolean } [distance] + * @param { GameEventPromise | boolean } [includecard] + * @returns { boolean } + */ + canUse(card: string | Card | VCard, target: Player, distance?: boolean | undefined, includecard?: boolean | import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; hasUseTarget(card: any, distance: any, includecard: any): boolean; hasValueTarget(card: any, distance: any, includecard: any): boolean; getUseValue(card: any, distance: any, includecard: any): number; @@ -997,7 +1056,20 @@ export class Player extends HTMLDivElement { removeSkillTrigger(skills: any, triggeronly: any): this; removeSkill(skill: any, ...args: any[]): any; addTempSkills(skillsToAdd: any, expire: any): import("./gameEvent.js").GameEvent & import("./gameEventPromise.js").GameEventPromise; - addTempSkill(skill: any, expire: any, checkConflict: any): any; + /** + * @overload + * @param { string } skill + * @param { SkillTrigger | string } [expire] + * @param { boolean } [checkConflict] + */ + addTempSkill(skill: string, expire?: string | SkillTrigger | undefined, checkConflict?: boolean | undefined): any; + /** + * @overload + * @param { string[] } skill + * @param { SkillTrigger } [expire] + * @param { boolean } [checkConflict] + */ + addTempSkill(skill: string[], expire?: SkillTrigger | undefined, checkConflict?: boolean | undefined): any; tempBanSkill(skill: any, expire: any, log: any): any; isTempBanned(skill: any): boolean; attitudeTo(target: any): any; @@ -1019,14 +1091,68 @@ export class Player extends HTMLDivElement { * @param { string | function | number | boolean | object } map */ getRoundHistory(key: any, filter: any, num: any, keep: any, last: any): any[]; - getHistory(key: any, filter: any, last: any): any; - checkHistory(key: any, filter: any, last: any): void; - hasHistory(key: any, filter: any, last: any): any; - getLastHistory(key: any, filter: any, last: any): any; - checkAllHistory(key: any, filter: any, last: any): void; - getAllHistory(key: any, filter: any, last: any): any[]; - hasAllHistory(key: any, filter: any, last: any): boolean; - getLastUsed(num: any): any; + /** + * @overload + * @returns { ActionHistory } + */ + getHistory(): ActionHistory; + /** + * @template { keyof ActionHistory } T + * @overload + * @param { T } key + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { ActionHistory[T] } + */ + getHistory(key: T, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): ActionHistory[T]; + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + */ + checkHistory(key: T_1, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void; + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { boolean } + */ + hasHistory(key: T_2, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; + /** + * @template { keyof ActionHistory } T + * @overload + * @param { T } [key] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { null | ActionHistory[T] | boolean } + */ + getLastHistory(key?: T_3 | undefined, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean | ActionHistory[T_3] | null; + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + */ + checkAllHistory(key: T_4, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): void; + /** + * @template { keyof ActionHistory } T + * @param { T } [key] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { ActionHistory[T] } + */ + getAllHistory(key?: T_5 | undefined, filter?: ((event: GameEventPromise) => boolean) | undefined, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): ActionHistory[T_5]; + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + * @returns { boolean } + */ + hasAllHistory(key: T_6, filter: (event: GameEventPromise) => boolean, last?: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | undefined): boolean; + getLastUsed(num: any): import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise | null; getStat(key: any): any; getLastStat(key: any): any; queue(time: any): void; @@ -1037,7 +1163,7 @@ export class Player extends HTMLDivElement { getGlobalFrom(): number; getGlobalTo(): number; getHandcardLimit(): number; - getEnemies(func: any): any[] | undefined; + getEnemies(func: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined; getFriends(func: any): any[]; isEnemyOf(...args: any[]): boolean; isFriendOf(player: any): boolean; @@ -1067,27 +1193,63 @@ export class Player extends HTMLDivElement { isOnline2(): boolean; isOffline(): boolean; checkShow(skill: any, showonly: any): false | "main" | "vice"; - needsToDiscard(add: any, filter: any, pure: any): number; + /** + * + * @param { number | Card[] | Card } [add] + * @param { (card?: Card, player?: Player) => boolean } [filter] + * @param { boolean } [pure] + */ + needsToDiscard(add?: number | import("noname-typings/nonameModules/noname/library/element/card.js").Card | import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined, filter?: ((card?: Card, player?: Player) => boolean) | undefined, pure?: boolean | undefined): number; distanceTo(target: any, method: any): number; distanceFrom(target: any, method: any): number; - hasSkill(skill: any, arg2: any, arg3: any, arg4: any): boolean; - hasStockSkill(skill: any, arg1: any, arg2: any, arg3: any): boolean; + /** + * @param { string } skill + * @param { Parameters[0] } arg2 + * @param { Parameters[1] } arg3 + * @param { Parameters[2] } arg4 + * @returns { boolean } + */ + hasSkill(skill: string, arg2: Parameters[0], arg3: Parameters[1], arg4: Parameters[2]): boolean; + /** + * @param { string } skill + * @param { Parameters[0] } arg1 + * @param { Parameters[1] } arg2 + * @param { Parameters[2] } arg3 + * @returns { boolean } + */ + hasStockSkill(skill: string, arg1: Parameters[0], arg2: Parameters[1], arg3: Parameters[2]): boolean; isZhu2(): boolean; isInitFilter(tag: any): boolean; - hasZhuSkill(skill: any, player: any): boolean; + /** + * + * @param {string} skill + * @param {Player} [player] + */ + hasZhuSkill(skill: string, player?: Player | undefined): boolean; hasGlobalTag(tag: any, arg: any): boolean; - hasSkillTag(tag: any, hidden: any, arg: any, globalskill: any): boolean; + /** + * @param {string} tag + * @param {Parameters[0]} hidden + * @param {Parameters[2]} arg + * @param {boolean} [globalskill] + */ + hasSkillTag(tag: string, hidden: Parameters[0], arg: [player: import("noname-typings/nonameModules/noname/library/element/player.js").Player, tag: string, arg: any][2], globalskill?: boolean | undefined): boolean; hasJudge(name: any): boolean; hasFriend(): boolean; hasUnknown(num: any): boolean; isUnknown(player: any): boolean; hasWuxie(info: any): boolean; - hasSha(respond: any, noauto: any): true | undefined; - hasShan(respond: any): true | undefined; + /** + * + * @param {string|boolean} [respond] + * @param {boolean} [noauto] + */ + hasSha(respond?: string | boolean | undefined, noauto?: boolean | undefined): boolean; + hasShan(respond: any): boolean; mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean; mayHaveShan(viewer: any, type: any, ignore: any, rvt: any): number | boolean; hasCard(name: any, position: any): boolean; - getEquip(name: any): any; + getEquip(name: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card | null; getJudge(name: any): ChildNode | null; $drawAuto(cards: any, target: any): void; $draw(num: any, init: any, config: any): void; @@ -1119,9 +1281,27 @@ export class Player extends HTMLDivElement { $dust(): void; $recover(): void; $fullscreenpop(str: any, nature: any, avatar: any, broadcast: any): void; - $damagepop(num: any, nature: any, font: any, nobroadcast: any): void; + /** + * + * @param { number | string } num + * @param { string } [nature] + * @param { boolean } [font] + * @param { boolean } [nobroadcast] + */ + $damagepop(num: number | string, nature?: string | undefined, font?: boolean | undefined, nobroadcast?: boolean | undefined): void; $damage(source: any, ...args: any[]): void; $die(): void; $dieflip(type: any): void; $phaseJudge(card: any): void; } +export type ActionHistory = { + useCard: GameEventPromise[]; + respond: GameEventPromise[]; + skipped: GameEventPromise[]; + lose: GameEventPromise[]; + gain: GameEventPromise[]; + sourceDamage: GameEventPromise[]; + damage: GameEventPromise[]; + custom: GameEventPromise[]; + useSkill: GameEventPromise[]; +}; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts index d4dd547d9..5b04b8a3b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts @@ -5,7 +5,7 @@ export class VCard { * @param { string } [name] * @param { string } [nature] */ - constructor(suitOrCard?: any, numberOrCards?: number | any[] | undefined, name?: string | undefined, nature?: string | undefined); + constructor(suitOrCard?: any, numberOrCards?: number | import("noname-typings/nonameModules/noname/library/element/card.js").Card[] | undefined, name?: string | undefined, nature?: string | undefined); /** * @type {string} */ @@ -43,7 +43,7 @@ export class VCard { /** * @param { Player } player */ - hasNature(nature: any, player: any): boolean; + hasNature(nature: any, player: Player): boolean; getCacheKey(): string; hasGaintag(tag: any): any; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts index 9f5125615..38a4c0d53 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts @@ -62,7 +62,10 @@ export class Library { onload: any[]; onload2: any[]; onprepare: any[]; - arenaReady: any[]; + /** + * @type { Function[] | undefined } + */ + arenaReady: Function[] | undefined; onfree: any[]; inpile: any[]; inpile_nature: any[]; @@ -503,11 +506,11 @@ export class Library { intro: string; init: string; item: { - '500': string; - '700': string; - '1000': string; - '1500': string; - '2500': string; + 500: string; + 700: string; + 1000: string; + 1500: string; + 2500: string; }; }; doubleclick_intro: { @@ -521,12 +524,12 @@ export class Library { init: string; intro: string; item: { - '0': string; - '5': string; - '10': string; - '20': string; - '50': string; - '10000': string; + 0: string; + 5: string; + 10: string; + 20: string; + 50: string; + 10000: string; }; unfrequent: boolean; }; @@ -719,10 +722,10 @@ export class Library { init: string; item: { off: string; - '30000': string; - '60000': string; - '120000': string; - '300000': string; + 30000: string; + 60000: string; + 120000: string; + 300000: string; }; intro: string; onclick(item: any): void; @@ -889,17 +892,17 @@ export class Library { name: string; init: string; item: { - '-5x': string; - '-4x': string; - '-3x': string; - '-2x': string; - '-1x': string; - '0x': string; - '1x': string; - '2x': string; - '3x': string; - '4x': string; - '5x': string; + "-5x": string; + "-4x": string; + "-3x": string; + "-2x": string; + "-1x": string; + "0x": string; + "1x": string; + "2x": string; + "3x": string; + "4x": string; + "5x": string; }; unfrequent: boolean; onclick(item: any): void; @@ -908,17 +911,17 @@ export class Library { name: string; init: string; item: { - '-5x': string; - '-4x': string; - '-3x': string; - '-2x': string; - '-1x': string; - '0x': string; - '1x': string; - '2x': string; - '3x': string; - '4x': string; - '5x': string; + "-5x": string; + "-4x": string; + "-3x": string; + "-2x": string; + "-1x": string; + "0x": string; + "1x": string; + "2x": string; + "3x": string; + "4x": string; + "5x": string; }; unfrequent: boolean; onclick(item: any): void; @@ -927,17 +930,17 @@ export class Library { name: string; init: string; item: { - '-5x': string; - '-4x': string; - '-3x': string; - '-2x': string; - '-1x': string; - '0x': string; - '1x': string; - '2x': string; - '3x': string; - '4x': string; - '5x': string; + "-5x": string; + "-4x": string; + "-3x": string; + "-2x": string; + "-1x": string; + "0x": string; + "1x": string; + "2x": string; + "3x": string; + "4x": string; + "5x": string; }; unfrequent: boolean; onclick(item: any): void; @@ -946,17 +949,17 @@ export class Library { name: string; init: string; item: { - '-5x': string; - '-4x': string; - '-3x': string; - '-2x': string; - '-1x': string; - '0x': string; - '1x': string; - '2x': string; - '3x': string; - '4x': string; - '5x': string; + "-5x": string; + "-4x": string; + "-3x": string; + "-2x": string; + "-1x": string; + "0x": string; + "1x": string; + "2x": string; + "3x": string; + "4x": string; + "5x": string; }; unfrequent: boolean; onclick(item: any): void; @@ -1390,10 +1393,10 @@ export class Library { intro: string; init: string; item: { - '6': string; - '12': string; - '20': string; - '30': string; + 6: string; + 12: string; + 20: string; + 30: string; }; unfrequent: boolean; }; @@ -1624,15 +1627,15 @@ export class Library { name: string; init: number; item: { - '0': string; - '1': string; - '2': string; - '3': string; - '4': string; - '5': string; - '6': string; - '7': string; - '8': string; + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; + 5: string; + 6: string; + 7: string; + 8: string; }; onclick(volume: any): void; }; @@ -1640,15 +1643,15 @@ export class Library { name: string; init: number; item: { - '0': string; - '1': string; - '2': string; - '3': string; - '4': string; - '5': string; - '6': string; - '7': string; - '8': string; + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; + 5: string; + 6: string; + 7: string; + 8: string; }; onclick(volume: any): void; }; @@ -1722,108 +1725,108 @@ export class Library { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; huosha: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; leisha: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; shan: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; tao: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; jiu: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; wuxie: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; nanman: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; wanjian: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; guohe: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; shunshou: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; tiesuo: { name: string; init: string; item: { - '1': string; - '0.5': string; - '0': string; + 1: string; + 0.5: string; + 0: string; }; }; hide: { @@ -1869,10 +1872,10 @@ export class Library { name: string; init: string; item: { - '0.1': string; - '0.2': string; - '0.3': string; - '0.5': string; + 0.1: string; + 0.2: string; + 0.3: string; + 0.5: string; }; }; hide: { @@ -1946,9 +1949,9 @@ export class Library { item: { off: string; group: string; - '4': string; - '6': string; - '8': string; + 4: string; + 6: string; + 8: string; }; }; connect_zhong_card: { @@ -2221,12 +2224,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; limit_zhu: { @@ -2236,9 +2239,9 @@ export class Library { item: { off: string; group: string; - '4': string; - '6': string; - '8': string; + 4: string; + 6: string; + 8: string; }; }; choice_zhong: { @@ -2246,12 +2249,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; choice_nei: { @@ -2259,12 +2262,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; choice_fan: { @@ -2272,12 +2275,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; enable_commoner: { @@ -2292,12 +2295,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; enable_year_limit: { @@ -2552,12 +2555,12 @@ export class Library { init: string; restart: boolean; item: { - '5': string; - '6': string; - '7': string; - '8': string; - '9': string; - '10': string; + 5: string; + 6: string; + 7: string; + 8: string; + 9: string; + 10: string; }; }; }; @@ -2570,10 +2573,10 @@ export class Library { name: string; init: string; item: { - '1v1': string; - '2v2': string; - '3v3': string; - '4v4': string; + "1v1": string; + "2v2": string; + "3v3": string; + "4v4": string; guandu: string; }; frequent: boolean; @@ -2595,11 +2598,11 @@ export class Library { init: string; frequent: boolean; item: { - '12': string; - '16': string; - '20': string; - '24': string; - '40': string; + 12: string; + 16: string; + 20: string; + 24: string; + 40: string; }; }; connect_replace_number: { @@ -2607,12 +2610,12 @@ export class Library { init: string; frequent: boolean; item: { - '0': string; - '1': string; - '2': string; - '3': string; - '4': string; - '5': string; + 0: string; + 1: string; + 2: string; + 3: string; + 4: string; + 5: string; }; }; }; @@ -2949,12 +2952,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; choice_fan: { @@ -2962,12 +2965,12 @@ export class Library { init: string; restart: boolean; item: { - '3': string; - '4': string; - '5': string; - '6': string; - '8': string; - '10': string; + 3: string; + 4: string; + 5: string; + 6: string; + 8: string; + 10: string; }; }; edit_character: { @@ -3089,10 +3092,10 @@ export class Library { name: string; init: string; item: { - '0': string; - '0.2': string; - '0.333': string; - '0.5': string; + 0: string; + 0.2: string; + 0.333: string; + 0.5: string; }; frequent: boolean; }; @@ -3129,10 +3132,10 @@ export class Library { init: string; intro: string; item: { - '0': string; - '10': string; - '20': string; - '30': string; + 0: string; + 10: string; + 20: string; + 30: string; }; }; }; @@ -3145,10 +3148,10 @@ export class Library { init: string; frequent: boolean; item: { - '10': string; - '20': string; - '30': string; - '1000': string; + 10: string; + 20: string; + 30: string; + 1000: string; }; }; tafang_difficulty: { @@ -3156,9 +3159,9 @@ export class Library { init: string; frequent: boolean; item: { - '1': string; - '2': string; - '3': string; + 1: string; + 2: string; + 3: string; }; }; show_range: { @@ -3174,10 +3177,10 @@ export class Library { intro: string; init: string; item: { - '0': string; - '10': string; - '20': string; - '30': string; + 0: string; + 10: string; + 20: string; + 30: string; }; }; }; @@ -3255,13 +3258,13 @@ export class Library { init: string; frequent: boolean; item: { - '1': string; - '2': string; - '3': string; - '4': string; - '6': string; - '8': string; - '10': string; + 1: string; + 2: string; + 3: string; + 4: string; + 6: string; + 8: string; + 10: string; }; onclick(num: any): void; }; @@ -3992,7 +3995,7 @@ export class Library { link: () => void; chooseToGuanxing: () => void; }; - contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; + contents: SMap<((event: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise, trigger: import("noname-typings/nonameModules/noname/library/index.js").GameEventPromise, player: import("noname-typings/nonameModules/noname/library/element/player.js").Player) => Promise)[]>; Player: typeof Element.Player; Card: typeof Element.Card; VCard: typeof Element.VCard; @@ -4243,7 +4246,7 @@ export class Library { attackFrom: (card: any, player: any, target: any) => boolean; globalFrom: (card: any, player: any, target: any) => boolean; selectCard: () => number[]; - selectTarget: (card: any, player: any) => any; + selectTarget: (card: any, player: any) => number | number[] | (() => number | Select) | undefined; judge: (card: any, player: any, target: any) => any; autoRespondSha: () => boolean; autoRespondShan: () => boolean; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts index f52662f1a..20359ec48 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts @@ -1,3 +1,6 @@ +/** + * 获取github授权的token + */ export function gainAuthorization(): Promise; /** * 字节转换 @@ -6,9 +9,10 @@ export function gainAuthorization(): Promise; export function parseSize(limit: number): string; /** * 对比版本号 - * @param { string } ver1 - * @param { string } ver2 - * @returns { -1 | 0 | 1 } + * @param { string } ver1 版本号1 + * @param { string } ver2 版本号2 + * @returns { -1 | 0 | 1 } -1为ver1 < ver2, 0为ver1 == ver2, 1为ver1 > ver2 + * @throws {Error} */ export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1; /** @@ -91,7 +95,7 @@ export function getRepoTagDescription(tagName: string, options?: { }>; /** * - * 获取仓库指定分支和指定目录内的所有文件和目录 + * 获取仓库指定分支和指定(单个)目录内的所有文件和目录 * @param { string } [path = ''] 路径名称(可放参数) * @param { string } [branch = ''] 仓库分支名称 * @param { Object } options @@ -128,6 +132,9 @@ export function getRepoFilesList(path?: string | undefined, branch?: string | un /** * * 获取仓库指定分支和指定目录内的所有文件(包含子目录的文件) + * + * **注意: 此api可能会大幅度消耗请求次数,请谨慎使用** + * * @param { string } [path = ''] 路径名称(可放参数) * @param { string } [branch = ''] 仓库分支名称 * @param { Object } options @@ -155,7 +162,7 @@ export function flattenRepositoryFiles(path?: string | undefined, branch?: strin type: 'file'; }[]>; /** - * 请求一个文件而不是直接储存为文件 + * 请求一个文件而不是直接储存为文件,这样可以省内存空间 * @param { string } url * @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress] * @param { RequestInit } [options={}] @@ -174,3 +181,37 @@ export function request(url: string, onProgress?: ((receivedBytes: number, total * @returns { progress } */ export function createProgress(title?: string | undefined, max?: string | number | undefined, fileName?: string | undefined, value?: string | number | undefined): progress; +/** + * 从GitHub存储库检索最新版本(tag),不包括特定tag。 + * + * 此函数从GitHub存储库中获取由所有者和存储库名称指定的tags列表,然后返回不是“v1998”的最新tag名称。 + * @param {string} owner GitHub上拥有存储库的用户名或组织名称。 + * @param {string} repo 要从中提取tag的存储库的名称。 + * @returns {Promise} 以最新版本tag的名称解析的promise,或者如果操作失败则以错误拒绝。 + * @throws {Error} 如果获取操作失败或找不到有效tag,将抛出错误。 + */ +export function getLatestVersionFromGitHub(owner?: string, repo?: string): Promise; +/** + * 从指定目录中的GitHub存储库中获取树 + * @param {string[]} directories 要从中获取树的目录列表 + * @param {string} version 从中获取树的版本或分支。 + * @param {string} [owner = 'libccy'] GitHub上拥有存储库的用户名或组织名称。 + * @param {string} [repo = 'noname'] GitHub存储库的名称 + * @returns {Promise<{ + * path: string; + * mode: string; + * type: "blob" | "tree"; + * sha: string; + * size: number; + * url: string; + * }[][]>} A promise that resolves with trees from the specified directories. + * @throws {Error} Will throw an error if unable to fetch the repository tree from GitHub. + */ +export function getTreesFromGithub(directories: string[], version: string, owner?: string | undefined, repo?: string | undefined): Promise<{ + path: string; + mode: string; + type: "blob" | "tree"; + sha: string; + size: number; + url: string; +}[][]>; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts index 74198ffa9..4e22b6b21 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts @@ -8,7 +8,7 @@ export class status { /** * @type { GameEventPromise } */ - event: any; + event: GameEventPromise; ai: {}; lastdragchange: any[]; skillaudio: any[]; @@ -30,39 +30,43 @@ export class status { prehidden_skills: any[]; postReconnect: {}; /** - * @type { string | void } + * @type { string | undefined } */ - extension: string | void; + extension: string | undefined; /** - * @type { boolean | void } + * @type { boolean | undefined } */ - dragged: boolean | void; + dragged: boolean | undefined; /** - * @type { boolean | void } + * @type { boolean | undefined } */ - touchconfirmed: boolean | void; + touchconfirmed: boolean | undefined; /** - * @type { boolean | void } + * @type { boolean | undefined } */ - connectMode: boolean | void; + connectMode: boolean | undefined; /** - * @type { boolean | void } + * @type { boolean | undefined } */ - importingExtension: boolean | void; + importingExtension: boolean | undefined; /** - * @type { Promise[] | void } + * @type { Promise[] | undefined } */ - extensionLoaded: Promise[] | void; + extensionLoaded: Promise[] | undefined; /** - * @type { Promise[] | void } + * @type { Promise[] | undefined } */ - extensionLoading: Promise[] | void; + extensionLoading: Promise[] | undefined; /** - * @type { { [key: string]: Promise[] } | void } + * @type { { [key: string]: Promise[] } | undefined } */ - importing: void | { + importing: { [key: string]: Promise[]; - }; + } | undefined; + /** + * @type { Function | boolean | undefined } + */ + new_tutorial: Function | boolean | undefined; } export let _status: status; export function setStatus(instance?: status | undefined): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts index 35b3b467c..18a0944c2 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts @@ -7,6 +7,10 @@ export class Click { * @type {(arg0: string) => void} */ menuTab: (arg0: string) => void; + /** + * @type {() => void} + */ + configMenu: () => void; identitycircle(): void; connectEvents(): void; connectClients(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts index ad87669c0..bd28a4c5b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts @@ -2,7 +2,7 @@ export class Create { /** * @type {(video: Videos, before: boolean) => void} */ - videoNode: (video: any, before: boolean) => void; + videoNode: (video: Videos, before: boolean) => void; /** * 创建身份牌实例 */ @@ -62,9 +62,9 @@ export class Create { caption(str: any, position: any): HTMLDivElement; control(...args: any[]): import("../../library/element/control.js").Control; confirm(str: any, func: any): void; - skills(skills: any): any; - skills2(skills: any): any; - skills3(skills: any): any; + skills(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined; + skills2(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined; + skills3(skills: any): import("noname-typings/nonameModules/noname/library/element/control.js").Control | undefined; arena(): void; system(str: any, func: any, right: any, before: any): HTMLDivElement; pause(): HTMLDivElement | undefined; @@ -104,7 +104,7 @@ export class Create { textbuttons(list: any, dialog: any, noclick: any): void; player(position: any, noclick: any): import("../../library/element/player.js").Player; connectPlayers(ip: any): void; - players(numberOfPlayers: any): any[] | undefined; + players(numberOfPlayers: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[] | undefined; me(hasme: any): void; card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; cardsAsync(...args: any[]): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts index b99c9fecf..a51c397cf 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts @@ -30,7 +30,7 @@ export class UI { /** * @type { Dialog } */ - dialog: any; + dialog: Dialog; /** * @type { HTMLDivElement } */ @@ -42,7 +42,7 @@ export class UI { /** * @type { Control } */ - control: any; + control: Control; /** * @type { Control | undefined } */ @@ -129,6 +129,10 @@ export class UI { * @type {HTMLDivElement} */ tempnowuxie: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + cardPile: HTMLDivElement; refresh(node: any): void; clear(): void; updatec(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/util/browser.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/util/browser.d.ts index 381e59efc..b03c4cfff 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/util/browser.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/util/browser.d.ts @@ -7,4 +7,4 @@ */ export const promiseErrorHandlerMap: Record<"firefox" | "chrome" | "safari" | "other", new () => PromiseErrorHandler>; export type PromiseErrorHandler = import('./struct/interface/promise-error-handler.js').PromiseErrorHandler; -import { PromiseErrorHandler } from './struct/index.js'; +import { PromiseErrorHandler } from "./struct/index.js"; diff --git a/noname-server.exe b/noname-server.exe index 09a1389ce..69295a94e 100644 Binary files a/noname-server.exe and b/noname-server.exe differ diff --git a/noname/game/index.js b/noname/game/index.js index 002c12b42..9053a1371 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -53,18 +53,19 @@ export class Game { /** * @type { string } */ - // @ts-ignore layout; /** * @type { Player } */ - // @ts-ignore me; /** * @type { boolean } */ - // @ts-ignore chess; + /** + * @type { Player } + */ + zhu; globalEventHandlers = new (class { constructor() { this._handlers = {}; @@ -557,8 +558,8 @@ export class Game { /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { boolean } */ hasGlobalHistory(key, filter, last) { @@ -580,8 +581,8 @@ export class Game { /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { void } */ checkGlobalHistory(key, filter, last) { @@ -608,8 +609,8 @@ export class Game { * @template { keyof GameHistory } T * @overload * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter] - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ getGlobalHistory(key, filter, last) { @@ -630,8 +631,8 @@ export class Game { /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { boolean } */ hasAllGlobalHistory(key, filter, last) { @@ -656,8 +657,8 @@ export class Game { /** * @template { keyof GameHistory } T * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } filter - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] * @returns { void } */ checkAllGlobalHistory(key, filter, last) { @@ -686,8 +687,8 @@ export class Game { * @template { keyof GameHistory } T * @overload * @param { T } key - * @param { (event: import('../library/index.js').GameEventPromise) => boolean } [filter] - * @param { import('../library/index.js').GameEventPromise } [last] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ getAllGlobalHistory(key, filter, last) { @@ -718,12 +719,12 @@ export class Game { /** * @overload * @param { Card } cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ /** * @overload * @param {Card[]} cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ cardsDiscard(cards) { /** @type { 'cards' | 'card' | void } */ @@ -746,12 +747,12 @@ export class Game { /** * @overload * @param { Card } cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ /** * @overload * @param {Card[]} cards - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ cardsGotoOrdering(cards) { /** @type { 'cards' | 'card' | void } */ @@ -771,13 +772,13 @@ export class Game { * @overload * @param { Card } cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ /** * @overload * @param {Card[]} cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 - * @returns { import('../library/index.js').GameEventPromise } + * @returns { GameEventPromise } */ cardsGotoSpecial(cards, bool) { /** @type { 'cards' | 'card' | void } */ @@ -836,7 +837,7 @@ export class Game { return next; } /** - * @param { import('../library/index.js').GameEventPromise } event + * @param { GameEventPromise } event */ $cardsGotoPile(event) { const cards = event.cards; @@ -4651,8 +4652,8 @@ export class Game { * @param { string } name * @param { string } skill * @param { Player } player - * @param { import('../library/index.js').GameEventPromise } event - * @returns { import('../library/index.js').GameEventPromise } + * @param { GameEventPromise } event + * @returns { GameEventPromise } */ createTrigger(name, skill, player, event, indexedData) { let info = get.info(skill); @@ -4675,7 +4676,7 @@ export class Game { * * @param { string } name * @param { false } [trigger] - * @param { import('../library/index.js').GameEventPromise } [triggerEvent] + * @param { GameEventPromise } [triggerEvent] */ createEvent(name, trigger, triggerEvent) { const next = new lib.element.GameEvent(name, trigger).toPromise(); @@ -5832,11 +5833,11 @@ export class Game { */ executingAsyncEventMap = new Map(); /** - * @type { import('../library/index.js').GameEventPromise[] } + * @type { GameEventPromise[] } */ belongAsyncEventList = []; /** - * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] + * @param { GameEventPromise } [belongAsyncEvent] */ async loop(belongAsyncEvent) { if (belongAsyncEvent) { @@ -6017,7 +6018,7 @@ export class Game { } } /** - * @param { import('../library/index.js').GameEventPromise } [belongAsyncEvent] + * @param { GameEventPromise } [belongAsyncEvent] */ runContent(belongAsyncEvent) { return new Promise((resolve) => { @@ -6331,7 +6332,7 @@ export class Game { return game.asyncDelay(time, time2); } /** - * @param { import('../library/index.js').GameEventPromise } [event] + * @param { GameEventPromise } [event] */ check(event = _status.event) { game.callHook("checkBegin", [event]); @@ -7486,20 +7487,21 @@ export class Game { } /** * @param { Player[] } players - * @param { number | number[] | (player: Player) => number } num + * @param { number | number[] | (player: Player) => number } [num] * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - asyncDraw(players, num, drawDeck, bottom) { - return players.forEach((value, index) => { + async asyncDraw(players, num, drawDeck, bottom) { + for (let index = 0; index < players.length; index++) { + const value = players[index]; let num2 = 1; if (typeof num == "number") num2 = num; else if (Array.isArray(num)) num2 = num[index]; else if (typeof num == "function") num2 = num(value); - if (drawDeck && drawDeck.drawDeck) value.draw(num2, false, drawDeck); - else if (bottom) value.draw(num2, "nodelay", "bottom"); - else value.draw(num2, "nodelay"); - }); + if (drawDeck && drawDeck.drawDeck) await value.draw(num2, false, drawDeck); + else if (bottom) await value.draw(num2, "nodelay", "bottom"); + else await value.draw(num2, "nodelay"); + } } /** * @param { Player[] } players @@ -7936,7 +7938,7 @@ export class Game { * @param { Player } player * @param { string | Card[] } card * @param { Player[] } [targets] - * @param { import('../library/index.js').GameEventPromise } [event] + * @param { GameEventPromise } [event] * @param { boolean } [forced] * @param { string } [logvid] */ diff --git a/noname/get/index.js b/noname/get/index.js index 1cfd07316..b1a632e09 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -916,23 +916,32 @@ export class Get { "[object Date]": true, }; - if (typeof obj !== "object" || obj === null || !canTranverse[getType(obj)]) return obj; + if ( + typeof obj !== "object" || + obj === null || + !canTranverse[getType(obj)] + ) + return obj; // @ts-ignore if (map.has(obj)) return map.get(obj); const constructor = obj.constructor; // @ts-ignore + // 这四类数据处理单独处理 + // (实际上需要处理的只有Map和Set) + // 除此之外的就只能祝愿有拷贝构造函数了 const target = constructor - ? // 这四类数据处理单独处理 - // (实际上需要处理的只有Map和Set) - // 除此之外的就只能祝愿有拷贝构造函数了 - Array.isArray(obj) || obj instanceof Map || obj instanceof Set || constructor === Object + ? Array.isArray(obj) || + obj instanceof Map || + obj instanceof Set || + constructor === Object ? // @ts-ignore - new constructor() - : constructor.name in window && /\[native code\]/.test(constructor.toString()) + new constructor() + : constructor.name in window && + /\[native code\]/.test(constructor.toString()) ? // @ts-ignore - new constructor(obj) + new constructor(obj) : obj : Object.create(null); if (target === obj) return target; @@ -959,7 +968,11 @@ export class Get { if (obj.hasOwnProperty(key)) { const result = { enumerable, configurable }; if (descriptor.hasOwnProperty("value")) { - result.value = get.copy(descriptor.value, copyKeyDeep, map); + result.value = get.copy( + descriptor.value, + copyKeyDeep, + map + ); result.writable = descriptor.writable; } else { const { get, set } = descriptor; diff --git a/noname/library/element/button.js b/noname/library/element/button.js index daf50ec3d..5f8fe51f3 100644 --- a/noname/library/element/button.js +++ b/noname/library/element/button.js @@ -6,6 +6,7 @@ export class Button extends HTMLDivElement { /** * @type { string | undefined } */ + // eslint-disable-next-line no-unreachable buttonid; /** * @param {{}} item @@ -21,13 +22,26 @@ export class Button extends HTMLDivElement { // @ts-ignore [item, type, position, noClick, button] = other._args; } - if (typeof type == "function") button = type(item, type, position, noClick, button); + if (typeof type == "function") + button = type(item, type, position, noClick, button); else if (ui.create.buttonPresets[type]) - button = ui.create.buttonPresets[type](item, type, position, noClick, button); + button = ui.create.buttonPresets[type]( + item, + type, + position, + noClick, + button + ); if (button) { - Object.setPrototypeOf(button, (lib.element.Button || Button).prototype); + Object.setPrototypeOf( + button, + (lib.element.Button || Button).prototype + ); if (!noClick) - button.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.button); + button.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.button + ); else { button.classList.add("noclick"); const intro = button.querySelector(".intro"); diff --git a/noname/library/element/card.js b/noname/library/element/card.js index f316b57cd..d793cb1bf 100644 --- a/noname/library/element/card.js +++ b/noname/library/element/card.js @@ -40,7 +40,10 @@ export class Card extends HTMLDivElement { buildEventListener(info) { let card = this; if (info != "noclick") { - card.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.card); + card.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.card + ); if (lib.config.touchscreen) { card.addEventListener("touchstart", ui.click.cardtouchstart); card.addEventListener("touchmove", ui.click.cardtouchmove); @@ -75,6 +78,7 @@ export class Card extends HTMLDivElement { if (!noclick) lib.setIntro(this); } /** @type { SMap } */ + // eslint-disable-next-line no-unreachable node; /** * @type { string } @@ -96,6 +100,10 @@ export class Card extends HTMLDivElement { * @type { any[] } */ _uncheck; + /** + * @type { boolean } + */ + isCard; //执行销毁一张牌的钩子函数 selfDestroy(event) { if (this._selfDestroyed) return; @@ -192,7 +200,10 @@ export class Card extends HTMLDivElement { } removeGaintag(tag) { if (tag === true) { - if ((this.gaintag && this.gaintag.length) || this.node.gaintag.innerHTML.length) + if ( + (this.gaintag && this.gaintag.length) || + this.node.gaintag.innerHTML.length + ) this.addGaintag([]); } else if (this.hasGaintag(tag)) { this.gaintag.remove(tag); @@ -260,7 +271,11 @@ export class Card extends HTMLDivElement { this.number = parseInt(card[1]) || 0; this.name = card[2]; - if (info.destroy && typeof info.destroy != "boolean" && !lib.skill[info.destroy]) { + if ( + info.destroy && + typeof info.destroy != "boolean" && + !lib.skill[info.destroy] + ) { this.destroyed = info.destroy; } @@ -291,7 +306,21 @@ export class Card extends HTMLDivElement { var cardnum = card[1] || ""; if (parseInt(cardnum) == cardnum) cardnum = parseInt(cardnum); if (cardnum > 0 && cardnum < 14) { - cardnum = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K"][cardnum - 1]; + cardnum = [ + "A", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "J", + "Q", + "K", + ][cardnum - 1]; } if (this.name) { this.classList.remove("epic"); @@ -338,14 +367,20 @@ export class Card extends HTMLDivElement { this.classList.add("fullskin"); if (img) { if (img.startsWith("ext:")) { - this.node.image.setBackgroundImage(img.replace(/^ext:/, "extension/")); + this.node.image.setBackgroundImage( + img.replace(/^ext:/, "extension/") + ); } else { this.node.image.setBackgroundDB(img); } } else { if (lib.card[bg].modeimage) { this.node.image.setBackgroundImage( - "image/mode/" + lib.card[bg].modeimage + "/card/" + bg + ".png" + "image/mode/" + + lib.card[bg].modeimage + + "/card/" + + bg + + ".png" ); } else { do { @@ -353,18 +388,29 @@ export class Card extends HTMLDivElement { if (bg == "sha" && typeof nature == "string") { let natures = get.natureList(nature), _bg; - for (const n of natures) if (lib.natureBg.has(n)) _bg = n; + for (const n of natures) + if (lib.natureBg.has(n)) _bg = n; if (_bg) { - this.node.image.setBackgroundImage(lib.natureBg.get(_bg)); + this.node.image.setBackgroundImage( + lib.natureBg.get(_bg) + ); break; } } - this.node.image.setBackgroundImage("image/card/" + bg + ".png"); + this.node.image.setBackgroundImage( + "image/card/" + bg + ".png" + ); } while (0); } } - } else if (get.dynamicVariable(lib.card[bg].image, this) == "background") { - if (card[3]) this.node.background.setBackground(bg + "_" + get.natureList(card[3])[0], "card"); + } else if ( + get.dynamicVariable(lib.card[bg].image, this) == "background" + ) { + if (card[3]) + this.node.background.setBackground( + bg + "_" + get.natureList(card[3])[0], + "card" + ); else this.node.background.setBackground(bg, "card"); } else if (lib.card[bg].fullimage) { this.classList.add("fullimage"); @@ -376,10 +422,19 @@ export class Card extends HTMLDivElement { this.setBackgroundDB(img); } } else if (get.dynamicVariable(lib.card[bg].image, this)) { - if (get.dynamicVariable(lib.card[bg].image, this).startsWith("character:")) { - this.setBackground(get.dynamicVariable(lib.card[bg].image, this).slice(10), "character"); + if ( + get + .dynamicVariable(lib.card[bg].image, this) + .startsWith("character:") + ) { + this.setBackground( + get.dynamicVariable(lib.card[bg].image, this).slice(10), + "character" + ); } else { - this.setBackground(get.dynamicVariable(lib.card[bg].image, this)); + this.setBackground( + get.dynamicVariable(lib.card[bg].image, this) + ); } } else { var cardPack = lib.cardPack["mode_" + get.mode()]; @@ -407,30 +462,44 @@ export class Card extends HTMLDivElement { } if (img) { if (img.startsWith("ext:")) { - this.node.avatar.setBackgroundImage(img.replace(/^ext:/, "extension/")); + this.node.avatar.setBackgroundImage( + img.replace(/^ext:/, "extension/") + ); this.node.avatar.style.backgroundSize = "cover"; } else { this.node.avatar.setBackgroundDB(img); } } else if (get.dynamicVariable(lib.card[bg].image, this)) { - if (get.dynamicVariable(lib.card[bg].image, this).startsWith("character:")) { + if ( + get + .dynamicVariable(lib.card[bg].image, this) + .startsWith("character:") + ) { this.node.avatar.setBackground( get.dynamicVariable(lib.card[bg].image, this).slice(10), "character" ); } else { - this.node.avatar.setBackground(get.dynamicVariable(lib.card[bg].image, this)); + this.node.avatar.setBackground( + get.dynamicVariable(lib.card[bg].image, this) + ); } } else { var cardPack = lib.cardPack["mode_" + get.mode()]; if (Array.isArray(cardPack) && cardPack.includes(bg)) { - this.node.avatar.setBackground("mode/" + get.mode() + "/card/" + bg); + this.node.avatar.setBackground( + "mode/" + get.mode() + "/card/" + bg + ); } else { this.node.avatar.setBackground("card/" + bg); } } } else if (get.dynamicVariable(lib.card[bg].image, this) == "card") { - if (card[3]) this.setBackground(bg + "_" + get.natureList(card[3])[0], "card"); + if (card[3]) + this.setBackground( + bg + "_" + get.natureList(card[3])[0], + "card" + ); else this.setBackground(bg, "card"); } else if ( typeof get.dynamicVariable(lib.card[bg].image, this) == "string" && @@ -444,13 +513,18 @@ export class Card extends HTMLDivElement { this.setBackgroundDB(img); } } else { - this.setBackground(get.dynamicVariable(lib.card[bg].image, this)); + this.setBackground( + get.dynamicVariable(lib.card[bg].image, this) + ); } } else { this.node.background.innerHTML = - lib.translate[bg + "_cbg"] || lib.translate[bg + "_bg"] || get.translation(bg)[0]; + lib.translate[bg + "_cbg"] || + lib.translate[bg + "_bg"] || + get.translation(bg)[0]; // this.node.background.style.fontFamily=lib.config.card_font; - if (this.node.background.innerHTML.length > 1) this.node.background.classList.add("tight"); + if (this.node.background.innerHTML.length > 1) + this.node.background.classList.add("tight"); else this.node.background.classList.remove("tight"); } if (!lib.card[bg].fullborder && this.node.avatar && this.node.framebg) { @@ -502,7 +576,10 @@ export class Card extends HTMLDivElement { let natures = get.natureList(nature); natures.sort(lib.sort.nature); for (let nature of natures) { - name += lib.translate["nature_" + nature] || lib.translate[nature] || ""; + name += + lib.translate["nature_" + nature] || + lib.translate[nature] || + ""; if (nature != "stab") this.node.image.classList.add(nature); } } @@ -515,7 +592,8 @@ export class Card extends HTMLDivElement { this.node.name.classList.add("longlong"); } } - this.node.name2.innerHTML = get.translation(card[0]) + cardnum + " " + name; + this.node.name2.innerHTML = + get.translation(card[0]) + cardnum + " " + name; this.classList.add("card"); if (card[3]) { let natures = get.natureList(card[3]); @@ -539,7 +617,8 @@ export class Card extends HTMLDivElement { var dist = lib.card[this.name].distance; if (dist.attackFrom) { added = true; - this.node.range.innerHTML = "范围: " + (-dist.attackFrom + 1); + this.node.range.innerHTML = + "范围: " + (-dist.attackFrom + 1); } } if (!added) { @@ -548,13 +627,15 @@ export class Card extends HTMLDivElement { break; case "equip3": if (info.distance && info.distance.globalTo) { - this.node.range.innerHTML = "防御: " + info.distance.globalTo; + this.node.range.innerHTML = + "防御: " + info.distance.globalTo; this.node.name2.innerHTML += "+"; } break; case "equip4": if (info.distance && info.distance.globalFrom) { - this.node.range.innerHTML = "进攻: " + -info.distance.globalFrom; + this.node.range.innerHTML = + "进攻: " + -info.distance.globalFrom; this.node.name2.innerHTML += "-"; } break; @@ -608,7 +689,8 @@ export class Card extends HTMLDivElement { game.layout == "nova") ) { if (bool) { - this.style.transform = this._transform + " translateY(-20px)"; + this.style.transform = + this._transform + " translateY(-20px)"; } else { this.style.transform = this._transform || ""; } @@ -659,12 +741,16 @@ export class Card extends HTMLDivElement { let owner = get.owner(this); if (owner) { if (owner == player) return true; //是牌主,必知情。 - if (player.hasSkillTag("viewHandcard", null, owner, true)) return true; //有viewHandcard标签,必知情。 + if (player.hasSkillTag("viewHandcard", null, owner, true)) + return true; //有viewHandcard标签,必知情。 if (owner.isUnderControl(true, player)) return true; //被操控,必知情。 } if (get.is.shownCard(this)) return true; //此牌是明置牌,必知情。 if (this._knowers) { - return this._knowers.includes("everyone") || this._knowers.includes(player.playerid); + return ( + this._knowers.includes("everyone") || + this._knowers.includes(player.playerid) + ); } return false; } @@ -702,8 +788,13 @@ export class Card extends HTMLDivElement { this.style.left = this.offsetLeft + "px"; this.style.top = this.offsetTop + "px"; - dx = player.getLeft() + player.offsetWidth / 2 - 52 - this.offsetLeft; - dy = player.getTop() + player.offsetHeight / 2 - 52 - this.offsetTop; + dx = + player.getLeft() + + player.offsetWidth / 2 - + 52 - + this.offsetLeft; + dy = + player.getTop() + player.offsetHeight / 2 - 52 - this.offsetTop; } if (get.is.mobileMe(player)) { dx += get.cardOffset(); @@ -753,8 +844,10 @@ export class Card extends HTMLDivElement { var clone = true; var position; for (var i = 0; i < arguments.length; i++) { - if (typeof arguments[i] == "string") node.classList.add(arguments[i]); - else if (["div", "fragment"].includes(get.objtype(arguments[i]))) position = arguments[i]; + if (typeof arguments[i] == "string") + node.classList.add(arguments[i]); + else if (["div", "fragment"].includes(get.objtype(arguments[i]))) + position = arguments[i]; else if (typeof arguments[i] == "boolean") clone = arguments[i]; } node.moveTo = lib.element.Card.prototype.moveTo; @@ -780,7 +873,9 @@ export class Card extends HTMLDivElement { * @returns {boolean} 是否包含class */ classListContains(className) { - return Array.from(arguments).some((name) => this.classList.contains(className)); + return Array.from(arguments).some((name) => + this.classList.contains(className) + ); } /** * 判断此牌是否包含class样式,参数有多个时,需全部满足。 @@ -790,7 +885,9 @@ export class Card extends HTMLDivElement { * @returns {boolean} 是否包含class */ classListContainsAll() { - return Array.from(arguments).every((name) => this.classList.contains(this.className)); + return Array.from(arguments).every((name) => + this.classList.contains(this.className) + ); } /** * 返回一个键值,用于在缓存中作为键名。 @@ -809,7 +906,9 @@ export class Card extends HTMLDivElement { if (bool === false) { ui.cardPile.insertBefore( this, - ui.cardPile.childNodes[Math.floor(Math.random() * ui.cardPile.childNodes.length)] + ui.cardPile.childNodes[ + Math.floor(Math.random() * ui.cardPile.childNodes.length) + ] ); } else { if (_status.discarded) { diff --git a/noname/library/element/dialog.js b/noname/library/element/dialog.js index 7ce4fda5b..138b32334 100644 --- a/noname/library/element/dialog.js +++ b/noname/library/element/dialog.js @@ -5,6 +5,7 @@ import { ui } from "../../ui/index.js"; export class Dialog extends HTMLDivElement { /** @type { HTMLDivElement } */ + // eslint-disable-next-line no-unreachable contentContainer; /** @type { HTMLDivElement } */ content; @@ -51,7 +52,8 @@ export class Dialog extends HTMLDivElement { else dialog.add(argument); }); //if (!hidden) dialog.open(); - if (!lib.config.touchscreen) dialog.contentContainer.onscroll = ui.update; + if (!lib.config.touchscreen) + dialog.contentContainer.onscroll = ui.update; if (!noTouchScroll) { dialog.contentContainer.ontouchstart = ui.click.dialogtouchStart; dialog.contentContainer.ontouchmove = ui.click.touchScroll; @@ -98,21 +100,27 @@ export class Dialog extends HTMLDivElement { const buttons = ui.create.div(".buttons", this.content); if (zoom) buttons.classList.add("smallzoom"); // @ts-ignore - this.buttons = this.buttons.concat(ui.create.buttons(item, "card", buttons, noclick)); + this.buttons = this.buttons.concat( + ui.create.buttons(item, "card", buttons, noclick) + ); } // @ts-ignore else if (get.itemtype(item) == "players") { var buttons = ui.create.div(".buttons", this.content); if (zoom) buttons.classList.add("smallzoom"); // @ts-ignore - this.buttons = this.buttons.concat(ui.create.buttons(item, "player", buttons, noclick)); + this.buttons = this.buttons.concat( + ui.create.buttons(item, "player", buttons, noclick) + ); } else if (item[1] == "textbutton") { ui.create.textbuttons(item[0], this, noclick); } else { var buttons = ui.create.div(".buttons", this.content); if (zoom) buttons.classList.add("smallzoom"); // @ts-ignore - this.buttons = this.buttons.concat(ui.create.buttons(item[0], item[1], buttons, noclick)); + this.buttons = this.buttons.concat( + ui.create.buttons(item[0], item[1], buttons, noclick) + ); } if (this.buttons.length) { if (this.forcebutton !== false) this.forcebutton = true; @@ -166,10 +174,19 @@ export class Dialog extends HTMLDivElement { } ui.dialog = this; let translate; - if (lib.config.remember_dialog && lib.config.dialog_transform && !this.classList.contains("fixed")) { + if ( + lib.config.remember_dialog && + lib.config.dialog_transform && + !this.classList.contains("fixed") + ) { translate = lib.config.dialog_transform; this._dragtransform = translate; - this.style.transform = "translate(" + translate[0] + "px," + translate[1] + "px) scale(0.8)"; + this.style.transform = + "translate(" + + translate[0] + + "px," + + translate[1] + + "px) scale(0.8)"; } else { this.style.transform = "scale(0.8)"; } @@ -179,8 +196,17 @@ export class Dialog extends HTMLDivElement { ui.dialogs.unshift(this); ui.update(); ui.refresh(this); - if (lib.config.remember_dialog && lib.config.dialog_transform && !this.classList.contains("fixed")) { - this.style.transform = "translate(" + translate[0] + "px," + translate[1] + "px) scale(1)"; + if ( + lib.config.remember_dialog && + lib.config.dialog_transform && + !this.classList.contains("fixed") + ) { + this.style.transform = + "translate(" + + translate[0] + + "px," + + translate[1] + + "px) scale(1)"; } else { this.style.transform = "scale(1)"; } diff --git a/noname/library/element/gameEvent.js b/noname/library/element/gameEvent.js index 736855ee6..a19280100 100644 --- a/noname/library/element/gameEvent.js +++ b/noname/library/element/gameEvent.js @@ -67,37 +67,30 @@ export class GameEvent { /** * @type { Player } */ - // @ts-ignore source; /** * @type { Player } */ - // @ts-ignore player; /** * @type { Player[] } */ - // @ts-ignore players; /** * @type { Player } */ - // @ts-ignore target; /** * @type { Player[] } */ - // @ts-ignore targets; /** * @type { Card } */ - // @ts-ignore card; /** * @type { Card[] } */ - // @ts-ignore cards; /** * @type { string } @@ -114,7 +107,6 @@ export class GameEvent { /** * @type { GameEvent } */ - // @ts-ignore _trigger; /** * @type { Result } @@ -123,61 +115,79 @@ export class GameEvent { /** * @type { number } */ - // @ts-ignore baseDamage; /** * @type { Player } */ - // @ts-ignore customSource; /** * @type { number } */ - // @ts-ignore extraDamage; /** * @type { string } */ - // @ts-ignore nature; /** * @type { boolean } */ - // @ts-ignore notrigger; /** * @type { number } */ - // @ts-ignore original_num; /** * @type { boolean } */ - // @ts-ignore unreal; /** * @type { Button[] } */ - // @ts-ignore excludeButton; /** * @type { Result } */ - // @ts-ignore result; /** * @type { GameEventPromise | void | null } */ - // @ts-ignore parent; /** * @type { string } */ name; /** - * @type { Function | void | null } + * @type { (this: GameEventPromise) => any | undefined | void | null } */ filterStop; + /** + * @type { Result['cost_data'] } + */ + cost_data; + /** + * @type { boolean } + */ + responded; + /** + * @type { string | undefined } + */ + judgestr; + /** + * @type { boolean } + */ + judging; + /** + * @type { Function | undefined } + */ + judge2; + /** + * @type { Card[] } + */ + orderingCards; + /** + * @type { Function | undefined } + */ + ai; /** * @param {keyof this} key * @param {number} [value] diff --git a/noname/library/element/player.js b/noname/library/element/player.js index 0fabfa39b..65ea80540 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -1,3 +1,17 @@ +/** + * @typedef { { + * useCard: GameEventPromise[], + * respond: GameEventPromise[], + * skipped: GameEventPromise[], + * lose: GameEventPromise[], + * gain: GameEventPromise[], + * sourceDamage: GameEventPromise[], + * damage: GameEventPromise[], + * custom: GameEventPromise[], + * useSkill: GameEventPromise[], + * }} ActionHistory + */ + import { ai } from "../../ai/index.js"; import { get } from "../../get/index.js"; import { game } from "../../game/index.js"; @@ -165,6 +179,7 @@ export class Player extends HTMLDivElement { } } /** @type { SMap } */ + // eslint-disable-next-line no-unreachable node; /** * @type { number } @@ -223,17 +238,7 @@ export class Player extends HTMLDivElement { */ stat; /** - * @type { { - * useCard: GameEventPromise[], - * respond: GameEventPromise[], - * skipped: GameEventPromise[], - * lose: GameEventPromise[], - * gain: GameEventPromise[], - * sourceDamage: GameEventPromise[], - * damage: GameEventPromise[], - * custom: GameEventPromise[], - * useSkill: GameEventPromise[], - * }[] } + * @type { ActionHistory[] } */ actionHistory; /** @@ -261,7 +266,8 @@ export class Player extends HTMLDivElement { * friend: [], * enemy: [], * neutral: [], - * handcards: { + * shown?: number, + * handcards?: { * global: [], * source: [], * viewed: [] @@ -341,6 +347,18 @@ export class Player extends HTMLDivElement { * @type { ((player: this) => any)[] } */ _inits; + /** + * @type { boolean } + */ + isZhu; + /** + * @type { string } + */ + identity; + /** + * @type { boolean | undefined } + */ + identityShown; //新函数 /** * 怒气 @@ -1401,7 +1419,7 @@ export class Player extends HTMLDivElement { /** * 向target发起协力 * @param { Player } target - * @param {*} type + * @param { string } type * @param {*} reason */ cooperationWith(target, type, reason) { @@ -2022,6 +2040,7 @@ export class Player extends HTMLDivElement { /** * @param { string } name * @param { string } type + * @returns { boolean } */ hasUsableCard(name, type) { if (typeof type !== "string") type = type ? "limit" : "all"; @@ -3697,6 +3716,12 @@ export class Player extends HTMLDivElement { if (num == undefined) return 0; return num; } + /** + * @param {*} [unowned] + * @param {*} [unique] + * @param {*} [hidden] + * @returns { string[] } + */ getStockSkills(unowned, unique, hidden) { var list = []; if (lib.character[this.name] && (hidden || !this.isUnseen(0))) { @@ -3841,6 +3866,11 @@ export class Player extends HTMLDivElement { getDiscardableCards(player, arg1, arg2) { return Array.from(this.iterableGetDiscardableCards(player, arg1, arg2)); } + /** + * @param {Parameters[1]} player + * @param {Parameters[0]} arg1 + * @param {Parameters[1]} arg2 + */ *iterableGetGainableCards(player, arg1, arg2) { for (let card of this.iterableGetCards(arg1, arg2)) { if (lib.filter.canBeGained(card, player, this)) { @@ -3848,6 +3878,12 @@ export class Player extends HTMLDivElement { } } } + /** + * + * @param {Parameters[0]} player + * @param {Parameters[1]} [arg1] + * @param {Parameters[2]} [arg2] + */ getGainableCards(player, arg1, arg2) { return Array.from(this.iterableGetGainableCards(player, arg1, arg2)); } @@ -3859,6 +3895,10 @@ export class Player extends HTMLDivElement { } return list; } + /** + * @param { Parameters[0] } [arg1] + * @param { Parameters[1] } [arg2] + */ countCards(arg1, arg2) { let count = 0; for (let item of this.iterableGetCards(arg1, arg2)) { @@ -3882,6 +3922,11 @@ export class Player extends HTMLDivElement { countDiscardableCards(player, arg1, arg2) { return this.getDiscardableCards(player, arg1, arg2).length; } + /** + * @param {Parameters[0]} player + * @param {Parameters[1]} [arg1] + * @param {Parameters[2]} [arg2] + */ countGainableCards(player, arg1, arg2) { return this.getGainableCards(player, arg1, arg2).length; } @@ -3905,6 +3950,11 @@ export class Player extends HTMLDivElement { skills.sort((a, b) => get.priority(a) - get.priority(b)); return skills; } + /** + * @param { string | boolean | null } [arg2] + * @param { boolean | null} [arg3] + * @param {boolean} [arg4] + */ getSkills(arg2, arg3, arg4) { var skills = this.skills.slice(0); var es = []; @@ -5780,7 +5830,12 @@ export class Player extends HTMLDivElement { ); return this; } - gainMultiple(targets, position) { + /** + * + * @param { Player[] } targets + * @param { string } [position] + */ + gainMultiple(targets, position = "h") { var next = game.createEvent("gainMultiple", false); next.setContent("gainMultiple"); next.player = this; @@ -5944,6 +5999,12 @@ export class Player extends HTMLDivElement { next.gaintag = []; return next; } + /** + * + * @param { Card | Card[] } cards + * @param { Player } target + * @param { boolean } [visible] + */ give(cards, target, visible) { var next = target.gain(cards, this); next.animate = visible ? "give" : "giveAuto"; @@ -6135,6 +6196,9 @@ export class Player extends HTMLDivElement { next.setContent("doubleDraw"); return next; } + /** + * @param { number } [num] + */ loseHp(num) { var next = game.createEvent("loseHp"); next.num = num; @@ -6786,6 +6850,12 @@ export class Player extends HTMLDivElement { } if (typeof proceed == "function") proceed(); } + /** + * @param { string | string[] } name + * @param { Player | Player[] } [targets] + * @param { boolean | string } [nature] + * @param { boolean } [logv] + */ logSkill(name, targets, nature, logv) { if (get.itemtype(targets) == "player") targets = [targets]; var nopop = false; @@ -6979,7 +7049,13 @@ export class Player extends HTMLDivElement { node.classList.add(className); } } - popup(name, className, nobroadcast) { + /** + * + * @param { string } name + * @param { string } className + * @param { Parameters[3] } [nobroadcast] + */ + popup(name, className = "water", nobroadcast) { var name2 = get.translation(name); if (!name2) return; this.$damagepop(name2, className || "water", true, nobroadcast); @@ -7402,6 +7478,13 @@ export class Player extends HTMLDivElement { this.classList.remove("linked"); } } + /** + * @param { string | Card | VCard } card + * @param { Player } target + * @param { boolean } [distance] + * @param { GameEventPromise | boolean } [includecard] + * @returns { boolean } + */ canUse(card, target, distance, includecard) { if (typeof card == "string") card = { name: card, isCard: true }; var info = get.info(card); @@ -8246,6 +8329,18 @@ export class Player extends HTMLDivElement { } }); } + /** + * @overload + * @param { string } skill + * @param { SkillTrigger | string } [expire] + * @param { boolean } [checkConflict] + */ + /** + * @overload + * @param { string[] } skill + * @param { SkillTrigger } [expire] + * @param { boolean } [checkConflict] + */ addTempSkill(skill, expire, checkConflict) { if (Array.isArray(skill)) { for (var i = 0; i < skill.length; i++) { @@ -8416,6 +8511,18 @@ export class Player extends HTMLDivElement { } return evts; } + /** + * @overload + * @returns { ActionHistory } + */ + /** + * @template { keyof ActionHistory } T + * @overload + * @param { T } key + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { ActionHistory[T] } + */ getHistory(key, filter, last) { if (!key) return this.actionHistory[this.actionHistory.length - 1]; if (!filter) return this.actionHistory[this.actionHistory.length - 1][key]; @@ -8431,6 +8538,12 @@ export class Player extends HTMLDivElement { return history.filter(filter); } } + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + */ checkHistory(key, filter, last) { if (!key || !filter) return; else { @@ -8446,7 +8559,14 @@ export class Player extends HTMLDivElement { } } } - hasHistory(key, filter, last) { + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { boolean } + */ + hasHistory(key, filter = lib.filter.all, last) { const history = this.getHistory(key); if (!filter || typeof filter != "function") filter = lib.filter.all; if (last) { @@ -8458,6 +8578,14 @@ export class Player extends HTMLDivElement { } return history.some(filter); } + /** + * @template { keyof ActionHistory } T + * @overload + * @param { T } [key] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { null | ActionHistory[T] | boolean } + */ getLastHistory(key, filter, last) { let history = false; for (let i = this.actionHistory.length - 1; i >= 0; i--) { @@ -8480,6 +8608,12 @@ export class Player extends HTMLDivElement { return history.filter(filter); } } + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + */ checkAllHistory(key, filter, last) { if (!key || !filter) return; this.actionHistory.forEach((value) => { @@ -8495,6 +8629,13 @@ export class Player extends HTMLDivElement { } }); } + /** + * @template { keyof ActionHistory } T + * @param { T } [key] + * @param { (event: GameEventPromise) => boolean } [filter] + * @param { GameEventPromise } [last] + * @returns { ActionHistory[T] } + */ getAllHistory(key, filter, last) { const history = []; this.actionHistory.forEach((value) => { @@ -8516,6 +8657,13 @@ export class Player extends HTMLDivElement { } return history; } + /** + * @template { keyof ActionHistory } T + * @param { T } key + * @param { (event: GameEventPromise) => boolean } filter + * @param { GameEventPromise } [last] + * @returns { boolean } + */ hasAllHistory(key, filter, last) { return this.actionHistory.some((value) => { let history = value[key]; @@ -9095,6 +9243,12 @@ export class Player extends HTMLDivElement { } return false; } + /** + * + * @param { number | Card[] | Card } [add] + * @param { (card?: Card, player?: Player) => boolean } [filter] + * @param { boolean } [pure] + */ needsToDiscard(add, filter, pure) { /** * add: (逻辑上)同时考虑“获得”的这张/些牌 @@ -9123,9 +9277,23 @@ export class Player extends HTMLDivElement { distanceFrom(target, method) { return get.distance(target, this, method); } + /** + * @param { string } skill + * @param { Parameters[0] } arg2 + * @param { Parameters[1] } arg3 + * @param { Parameters[2] } arg4 + * @returns { boolean } + */ hasSkill(skill, arg2, arg3, arg4) { return game.expandSkills(this.getSkills(arg2, arg3, arg4)).includes(skill); } + /** + * @param { string } skill + * @param { Parameters[0] } arg1 + * @param { Parameters[1] } arg2 + * @param { Parameters[2] } arg3 + * @returns { boolean } + */ hasStockSkill(skill, arg1, arg2, arg3) { return game.expandSkills(this.getStockSkills(arg1, arg2, arg3)).includes(skill); } @@ -9152,6 +9320,11 @@ export class Player extends HTMLDivElement { } return false; } + /** + * + * @param {string} skill + * @param {Player} [player] + */ hasZhuSkill(skill, player) { if (!this.hasSkill(skill)) return false; if (player) { @@ -9186,6 +9359,12 @@ export class Player extends HTMLDivElement { } return false; } + /** + * @param {string} tag + * @param {Parameters[0]} hidden + * @param {Parameters[2]} arg + * @param {boolean} [globalskill] + */ hasSkillTag(tag, hidden, arg, globalskill) { var skills = this.getSkills(hidden); if (globalskill) { @@ -9280,6 +9459,11 @@ export class Player extends HTMLDivElement { } return false; } + /** + * + * @param {string|boolean} [respond] + * @param {boolean} [noauto] + */ hasSha(respond, noauto) { if (this.countCards("hs", "sha")) return true; if (this.countCards("hs", "hufu")) return true; @@ -10847,7 +11031,14 @@ export class Player extends HTMLDivElement { avatar ? 1600 : 1000 ); } - $damagepop(num, nature, font, nobroadcast) { + /** + * + * @param { number | string } num + * @param { string } [nature] + * @param { boolean } [font] + * @param { boolean } [nobroadcast] + */ + $damagepop(num, nature = "soil", font, nobroadcast) { if (typeof num == "number" || typeof num == "string") { game.addVideo("damagepop", this, [num, nature, font]); if (nobroadcast !== false) diff --git a/noname/ui/create/index.js b/noname/ui/create/index.js index 109b031a1..235a5cbc9 100644 --- a/noname/ui/create/index.js +++ b/noname/ui/create/index.js @@ -21,9 +21,13 @@ export class Create { */ identityCard(identity, position, noclick) { const card = ui.create.card(position, "noclick", noclick); - card.removeEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.card); + card.removeEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.card + ); card.classList.add("button"); - card._customintro = (uiintro) => uiintro.add(`${get.translation(`${identity}${2}`)}的身份牌`); + card._customintro = (uiintro) => + uiintro.add(`${get.translation(`${identity}${2}`)}的身份牌`); const fileName = `image/card/identity_${identity}.jpg`; new Promise((resolve, reject) => { const image = new Image(); @@ -35,7 +39,8 @@ export class Create { card.classList.add("fullskin"); card.node.image.setBackgroundImage(fileName); }, - () => (card.node.background.innerHTML = get.translation(identity)[0]) + () => + (card.node.background.innerHTML = get.translation(identity)[0]) ); return card; } @@ -53,16 +58,19 @@ export class Create { card.classList.add("infohidden"); } card.style.transition = "all 0s"; - card.style.transform = "perspective(600px) rotateY(180deg) translateX(0)"; + card.style.transform = + "perspective(600px) rotateY(180deg) translateX(0)"; const onEnd01 = function () { setTimeout(function () { card.style.transition = "all ease-in 0.3s"; - card.style.transform = "perspective(600px) rotateY(270deg) translateX(52px)"; + card.style.transform = + "perspective(600px) rotateY(270deg) translateX(52px)"; var onEnd = function () { card.classList.remove("infohidden"); card.style.transition = "all 0s"; ui.refresh(card); - card.style.transform = "perspective(600px) rotateY(-90deg) translateX(52px)"; + card.style.transform = + "perspective(600px) rotateY(-90deg) translateX(52px)"; ui.refresh(card); card.style.transition = ""; ui.refresh(card); @@ -97,7 +105,8 @@ export class Create { //删除container的时候,删除创建的ul列表 container.delete = function () { for (let i = createList.length - 1; i >= 0; i--) { - createList[i].parentNode && createList[i].parentNode.removeChild(createList[i]); + createList[i].parentNode && + createList[i].parentNode.removeChild(createList[i]); } Array.from(editorpage.children).forEach((v) => { v.style.background = ""; @@ -132,7 +141,9 @@ export class Create { width: (pos.width * 4) / game.documentZoom + "px", //'font-family':'shousha', "font-size": - (lib.config.codeMirror_fontSize ? lib.config.codeMirror_fontSize.slice(0, -2) : 16) / + (lib.config.codeMirror_fontSize + ? lib.config.codeMirror_fontSize.slice(0, -2) + : 16) / game.documentZoom + "px", }); @@ -143,13 +154,20 @@ export class Create { const getActive = () => { let i = 0; while (i < ul.childElementCount) { - if (ul.childNodes[i].classList.contains("CodeMirror-hint-active")) break; + if ( + ul.childNodes[i].classList.contains( + "CodeMirror-hint-active" + ) + ) + break; else i++; } return i; }; const setActive = (i) => { - ul.childNodes[getActive()].classList.remove("CodeMirror-hint-active"); + ul.childNodes[getActive()].classList.remove( + "CodeMirror-hint-active" + ); ul.childNodes[i].classList.add("CodeMirror-hint-active"); return i; }; @@ -164,8 +182,11 @@ export class Create { } else { elt.innerHTML = cur; } - let className = "CodeMirror-hint" + (i != 0 ? "" : " " + "CodeMirror-hint-active"); - if (cur.className != null) className = cur.className + " " + className; + let className = + "CodeMirror-hint" + + (i != 0 ? "" : " " + "CodeMirror-hint-active"); + if (cur.className != null) + className = cur.className + " " + className; elt.className = className; elt.hintId = i; ui.window.listen.call(elt, function () { @@ -193,121 +214,201 @@ export class Create { createList.remove(ul); return ul; }; - const discardConfig = ui.create.div(".editbutton", "取消", editorpage, function () { - ui.window.classList.remove("shortcutpaused"); - ui.window.classList.remove("systempaused"); - container.delete(null); - delete window.saveNonameInput; - }); - const saveConfig = ui.create.div(".editbutton", "保存", editorpage, saveInput); - const theme = ui.create.div(".editbutton", "主题", editorpage, function () { - if (!this || this == window) return; - if (this.ul && this.ul.parentNode) { - return closeMenu.call(this); + const discardConfig = ui.create.div( + ".editbutton", + "取消", + editorpage, + function () { + ui.window.classList.remove("shortcutpaused"); + ui.window.classList.remove("systempaused"); + container.delete(null); + delete window.saveNonameInput; } - //this - const self = this; - if (!this.ul) { - //主题列表 - const list = ["mdn-like", "mbo"]; - //正在使用的主题 - const active = container.editor.options.theme; - //排个序 - list.remove(active).splice(0, 0, active); - //元素位置 - const pos = self.getBoundingClientRect(); - //点击事件 - const click = function (e) { - const theme = this.innerHTML; - container.editor.setOption("theme", theme); - setTimeout(() => container.editor.refresh(), 0); - game.saveConfig("codeMirror_theme", theme); - closeMenu.call(self); - }; - const ul = createMenu(pos, self, list, click); - self.ul = ul; - } else { - createMenu(null, self); + ); + const saveConfig = ui.create.div( + ".editbutton", + "保存", + editorpage, + saveInput + ); + const theme = ui.create.div( + ".editbutton", + "主题", + editorpage, + function () { + if (!this || this == window) return; + if (this.ul && this.ul.parentNode) { + return closeMenu.call(this); + } + //this + const self = this; + if (!this.ul) { + //主题列表 + const list = ["mdn-like", "mbo"]; + //正在使用的主题 + const active = container.editor.options.theme; + //排个序 + list.remove(active).splice(0, 0, active); + //元素位置 + const pos = self.getBoundingClientRect(); + //点击事件 + const click = function (e) { + const theme = this.innerHTML; + container.editor.setOption("theme", theme); + setTimeout(() => container.editor.refresh(), 0); + game.saveConfig("codeMirror_theme", theme); + closeMenu.call(self); + }; + const ul = createMenu(pos, self, list, click); + self.ul = ul; + } else { + createMenu(null, self); + } } - }); - const edit = ui.create.div(".editbutton", "编辑", editorpage, function () { - if (!this || this == window) return; - if (this.ul && this.ul.parentNode) { - return closeMenu.call(this); + ); + const edit = ui.create.div( + ".editbutton", + "编辑", + editorpage, + function () { + if (!this || this == window) return; + if (this.ul && this.ul.parentNode) { + return closeMenu.call(this); + } + const self = this; + if (!this.ul) { + const pos = this.getBoundingClientRect(); + const list = ["撤销 Ctrl+Z", "恢复撤销 Ctrl+Y"]; + const click = function (e) { + const num = this.innerHTML.indexOf("Ctrl"); + const inner = this.innerHTML + .slice(num) + .replace("+", "-"); + container.editor.execCommand( + container.editor.options.extraKeys[inner] + ); + setTimeout(() => container.editor.refresh(), 0); + closeMenu.call(self); + }; + const ul = createMenu(pos, self, list, click); + this.ul = ul; + } else { + createMenu(null, self); + } } - const self = this; - if (!this.ul) { - const pos = this.getBoundingClientRect(); - const list = ["撤销 Ctrl+Z", "恢复撤销 Ctrl+Y"]; - const click = function (e) { - const num = this.innerHTML.indexOf("Ctrl"); - const inner = this.innerHTML.slice(num).replace("+", "-"); - container.editor.execCommand(container.editor.options.extraKeys[inner]); - setTimeout(() => container.editor.refresh(), 0); - closeMenu.call(self); - }; - const ul = createMenu(pos, self, list, click); - this.ul = ul; - } else { - createMenu(null, self); + ); + const fontSize = ui.create.div( + ".editbutton", + "字号", + editorpage, + function () { + if (!this || this == window) return; + if (this.ul && this.ul.parentNode) { + return closeMenu.call(this); + } + const self = this; + if (!this.ul) { + const pos = this.getBoundingClientRect(); + const list = [ + "16px", + "18px", + "20px", + "22px", + "24px", + "26px", + ]; + const click = function (e) { + const size = this.innerHTML; + container.style.fontSize = + size.slice(0, -2) / game.documentZoom + "px"; + Array.from(self.parentElement.children) + .map((v) => v.ul) + .filter(Boolean) + .forEach((v) => { + v.style.fontSize = + size.slice(0, -2) / game.documentZoom + + "px"; + }); + setTimeout(() => container.editor.refresh(), 0); + game.saveConfig("codeMirror_fontSize", size); + closeMenu.call(self); + }; + const ul = createMenu(pos, self, list, click); + this.ul = ul; + } else { + createMenu(null, self); + } } - }); - const fontSize = ui.create.div(".editbutton", "字号", editorpage, function () { - if (!this || this == window) return; - if (this.ul && this.ul.parentNode) { - return closeMenu.call(this); - } - const self = this; - if (!this.ul) { - const pos = this.getBoundingClientRect(); - const list = ["16px", "18px", "20px", "22px", "24px", "26px"]; - const click = function (e) { - const size = this.innerHTML; - container.style.fontSize = size.slice(0, -2) / game.documentZoom + "px"; - Array.from(self.parentElement.children) - .map((v) => v.ul) - .filter(Boolean) - .forEach((v) => { - v.style.fontSize = size.slice(0, -2) / game.documentZoom + "px"; - }); - setTimeout(() => container.editor.refresh(), 0); - game.saveConfig("codeMirror_fontSize", size); - closeMenu.call(self); - }; - const ul = createMenu(pos, self, list, click); - this.ul = ul; - } else { - createMenu(null, self); - } - }); + ); const editor = ui.create.div(editorpage); return editor; } + /** + * 弹出提示。 + * @param {string} message 弹出的文字 + */ + toast(message) { + if(!ui.toastStyle){ + ui.toastStyle = lib.init.css(lib.assetURL+"layout/default/toast.css"); + } + const toastContainer = + document.querySelector(".toast-container") || + (() => { + const container = document.createElement("div"); + container.classList.add("toast-container"); + document.body.appendChild(container); + return container; + })(); + const toast = document.createElement("div"); + toast.innerHTML = message; + toast.classList.add("toast"); + toastContainer.appendChild(toast); + ui.toastQueue.push(toast); + ui.create.showNextToast(); + return toast; + } + showNextToast() { + const toast = ui.toastQueue.shift(); + if(!toast)return; + toast.style.display = "block"; + toast.addEventListener("animationend", () => { + toast.remove(); + ui.create.showNextToast(); + }); + return toast; + } cardTempName(card, applyNode) { let getApplyNode = applyNode || card; let cardName = get.name(card); let cardNature = get.nature(card); let tempname = get.translation(cardName); let cardTempNameConfig = lib.config.cardtempname; - let node = getApplyNode._tempName || ui.create.div(".tempname", getApplyNode); + let node = + getApplyNode._tempName || ui.create.div(".tempname", getApplyNode); let datasetNature = ""; getApplyNode._tempName = node; if (cardTempNameConfig != "image") { //清空,避免和下面的image部分有冲突 node.innerHTML = ""; datasetNature = "fire"; - if (get.position(card) == "j" && card.viewAs && card.viewAs != card.name) { + if ( + get.position(card) == "j" && + card.viewAs && + card.viewAs != card.name + ) { datasetNature = "wood"; tempname = get.translation(card.viewAs); } else { if (cardName == "sha") { - if (cardNature) tempname = get.translation(cardNature) + tempname; + if (cardNature) + tempname = get.translation(cardNature) + tempname; if (cardNature == "thunder") datasetNature = "thunder"; if (cardNature == "kami") datasetNature = "kami"; if (cardNature == "ice") datasetNature = "ice"; } } - if (cardTempNameConfig == "default") getApplyNode._tempName.classList.add("vertical"); + if (cardTempNameConfig == "default") + getApplyNode._tempName.classList.add("vertical"); if (datasetNature.length > 0) { node.dataset.nature = datasetNature; } else { @@ -315,12 +416,17 @@ export class Create { node.classList.add(datasetNature); } } else { - if (get.position(card) == "j" && card.viewAs && card.viewAs != card.name) { + if ( + get.position(card) == "j" && + card.viewAs && + card.viewAs != card.name + ) { cardName = card.viewAs; tempname = get.translation(card.viewAs); } if (cardName == "sha") { - if (cardNature) tempname = get.translation(cardNature) + tempname; + if (cardNature) + tempname = get.translation(cardNature) + tempname; if (cardNature == "fire") datasetNature = "fire"; if (cardNature == "thunder") datasetNature = "thunder"; if (cardNature == "kami") datasetNature = "kami"; @@ -344,65 +450,103 @@ export class Create { if (lib.card[cardName].fullskin) { if (img) { if (img.startsWith("ext:")) { - bg.setBackgroundImage(img.replace(/^ext:/, "extension/")); + bg.setBackgroundImage( + img.replace(/^ext:/, "extension/") + ); } else { bg.setBackgroundDB(img); } } else { if (lib.card[cardName].modeimage) { bg.setBackgroundImage( - "image/mode/" + lib.card[cardName].modeimage + "/card/" + cardName + ".png" + "image/mode/" + + lib.card[cardName].modeimage + + "/card/" + + cardName + + ".png" ); } else { if (cardName == "sha" && cardNature == "stab") bg.setBackgroundImage("image/card/cisha.png"); - else bg.setBackgroundImage("image/card/" + cardName + ".png"); + else + bg.setBackgroundImage( + "image/card/" + cardName + ".png" + ); } } - } else if (get.dynamicVariable(lib.card[cardName].image, card) == "background") { - if (cardNature) bg.setBackground(cardName + "_" + cardNature, "card"); + } else if ( + get.dynamicVariable(lib.card[cardName].image, card) == + "background" + ) { + if (cardNature) + bg.setBackground(cardName + "_" + cardNature, "card"); else bg.setBackground(cardName, "card"); } else if (lib.card[cardName].fullimage) { if (img) { if (img.startsWith("ext:")) { - bg.setBackgroundImage(img.replace(/^ext:/, "extension/")); + bg.setBackgroundImage( + img.replace(/^ext:/, "extension/") + ); bg.style.backgroundSize = "cover"; } else { bg.setBackgroundDB(img); } - } else if (get.dynamicVariable(lib.card[cardName].image, card)) { - if (get.dynamicVariable(lib.card[cardName].image, card).startsWith("character:")) { + } else if ( + get.dynamicVariable(lib.card[cardName].image, card) + ) { + if ( + get + .dynamicVariable(lib.card[cardName].image, card) + .startsWith("character:") + ) { bg.setBackground( - get.dynamicVariable(lib.card[cardName].image, card).slice(10), + get + .dynamicVariable(lib.card[cardName].image, card) + .slice(10), "character" ); } else { - bg.setBackground(get.dynamicVariable(lib.card[cardName].image, card)); + bg.setBackground( + get.dynamicVariable(lib.card[cardName].image, card) + ); } } else { let cardPack = lib.cardPack["mode_" + get.mode()]; - if (Array.isArray(cardPack) && cardPack.includes(cardName)) { - bg.setBackground("mode/" + get.mode() + "/card/" + cardName); + if ( + Array.isArray(cardPack) && + cardPack.includes(cardName) + ) { + bg.setBackground( + "mode/" + get.mode() + "/card/" + cardName + ); } else { bg.setBackground("card/" + cardName); } } - } else if (get.dynamicVariable(lib.card[cardName].image, card) == "card") { - if (cardNature) bg.setBackground(cardName + "_" + cardNature, "card"); + } else if ( + get.dynamicVariable(lib.card[cardName].image, card) == "card" + ) { + if (cardNature) + bg.setBackground(cardName + "_" + cardNature, "card"); else bg.setBackground(cardName, "card"); } else if ( - typeof get.dynamicVariable(lib.card[cardName].image, card) == "string" && + typeof get.dynamicVariable(lib.card[cardName].image, card) == + "string" && !lib.card[cardName].fullskin ) { if (img) { if (img.startsWith("ext:")) { - bg.setBackgroundImage(img.replace(/^ext:/, "extension/")); + bg.setBackgroundImage( + img.replace(/^ext:/, "extension/") + ); bg.style.backgroundSize = "cover"; } else { bg.setBackgroundDB(img); } } else { - bg.setBackground(get.dynamicVariable(lib.card[cardName].image, card)); + bg.setBackground( + get.dynamicVariable(lib.card[cardName].image, card) + ); } } else { console.warn("卡牌图片解析失败"); @@ -413,7 +557,9 @@ export class Create { delete node.dataset.nature; } node.innerHTML += `${ - cardTempNameConfig == "default" ? get.verticalStr(tempname) : tempname + cardTempNameConfig == "default" + ? get.verticalStr(tempname) + : tempname }`; node.tempname = tempname; return node; @@ -433,7 +579,10 @@ export class Create { ); player.roomindex = i; player.initRoom = lib.element.Player.prototype.initRoom; - player.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.connectroom); + player.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.connectroom + ); player.initRoom(list[i]); ui.rooms.push(player); } @@ -480,10 +629,15 @@ export class Create { } else { str = arguments[i]; } - } else if (["div", "table", "tr", "td", "body", "fragment"].includes(get.objtype(arguments[i]))) + } else if ( + ["div", "table", "tr", "td", "body", "fragment"].includes( + get.objtype(arguments[i]) + ) + ) position = arguments[i]; else if (typeof arguments[i] == "number") position2 = arguments[i]; - else if (get.itemtype(arguments[i]) == "divposition") divposition = arguments[i]; + else if (get.itemtype(arguments[i]) == "divposition") + divposition = arguments[i]; else if (typeof arguments[i] == "object") style = arguments[i]; else if (typeof arguments[i] == "function") listen = arguments[i]; } @@ -494,19 +648,30 @@ export class Create { if (node.className.length != 0) { node.className += " "; } - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.className += str[i + 1]; i++; } } else if (str[i] == "#") { - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.id += str[i + 1]; i++; } } } if (position) { - if (typeof position2 == "number" && position.childNodes.length > position2) { + if ( + typeof position2 == "number" && + position.childNodes.length > position2 + ) { position.insertBefore(node, position.childNodes[position2]); } else { position.appendChild(node); @@ -539,7 +704,14 @@ export class Create { return div; } node() { - var tagName, str, innerHTML, position, position2, style, divposition, listen; + var tagName, + str, + innerHTML, + position, + position2, + style, + divposition, + listen; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == "string") { if (typeof tagName == "string") { @@ -547,10 +719,15 @@ export class Create { } else { tagName = arguments[i]; } - } else if (["div", "table", "tr", "td", "body", "fragment"].includes(get.objtype(arguments[i]))) + } else if ( + ["div", "table", "tr", "td", "body", "fragment"].includes( + get.objtype(arguments[i]) + ) + ) position = arguments[i]; else if (typeof arguments[i] == "number") position2 = arguments[i]; - else if (get.itemtype(arguments[i]) == "divposition") divposition = arguments[i]; + else if (get.itemtype(arguments[i]) == "divposition") + divposition = arguments[i]; else if (typeof arguments[i] == "object") style = arguments[i]; else if (typeof arguments[i] == "function") listen = arguments[i]; } @@ -574,12 +751,20 @@ export class Create { if (node.className.length != 0) { node.className += " "; } - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.className += str[i + 1]; i++; } } else if (str[i] == "#") { - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.id += str[i + 1]; i++; } @@ -587,14 +772,18 @@ export class Create { } } if (position) { - if (typeof position2 == "number" && position.childNodes.length > position2) { + if ( + typeof position2 == "number" && + position.childNodes.length > position2 + ) { position.insertBefore(node, position.childNodes[position2]); } else { position.appendChild(node); } } if (style) HTMLDivElement.prototype.css.call(node, style); - if (divposition) HTMLDivElement.prototype.setPosition.call(node, divposition); + if (divposition) + HTMLDivElement.prototype.setPosition.call(node, divposition); if (innerHTML) node.innerHTML = innerHTML; if (listen) node.onclick = listen; return node; @@ -618,15 +807,21 @@ export class Create { webview.style.border = "none"; layer.appendChild(webview); - var backbutton = ui.create.div(".menubutton.round", "返", layer, function () { - layer.remove(); - }); + var backbutton = ui.create.div( + ".menubutton.round", + "返", + layer, + function () { + layer.remove(); + } + ); backbutton.style.bottom = "10px"; backbutton.style.right = "10px"; backbutton.style.background = "rgba(0,0,0,0.4)"; backbutton.style.color = "white"; backbutton.style.textShadow = "rgba(0,0,0,0.5) 0px 0px 2px"; - backbutton.style.boxShadow = "rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 0, 0, 0.3) 0 3px 10px"; + backbutton.style.boxShadow = + "rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 0, 0, 0.3) 0 3px 10px"; backbutton.style.position = "fixed"; ui.window.appendChild(layer); @@ -764,10 +959,15 @@ export class Create { if (typeof col == "number") position2 = arguments[i]; else col = arguments[i]; } else row = arguments[i]; - } else if (["div", "table", "tr", "td", "body", "fragment"].includes(get.objtype(arguments[i]))) + } else if ( + ["div", "table", "tr", "td", "body", "fragment"].includes( + get.objtype(arguments[i]) + ) + ) position = arguments[i]; else if (typeof arguments[i] == "boolean") fixed = arguments[i]; - else if (get.itemtype(arguments[i]) == "divposition") divposition = arguments[i]; + else if (get.itemtype(arguments[i]) == "divposition") + divposition = arguments[i]; else if (typeof arguments[i] == "object") style = arguments[i]; } if (str == undefined) str = ""; @@ -777,12 +977,20 @@ export class Create { if (node.className.length != 0) { node.className += " "; } - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.className += str[i + 1]; i++; } } else if (str[i] == "#") { - while (str[i + 1] != "." && str[i + 1] != "#" && i + 1 < str.length) { + while ( + str[i + 1] != "." && + str[i + 1] != "#" && + i + 1 < str.length + ) { node.id += str[i + 1]; i++; } @@ -799,7 +1007,10 @@ export class Create { } } if (position) { - if (typeof position2 == "number" && position.childNodes.length > position2) { + if ( + typeof position2 == "number" && + position.childNodes.length > position2 + ) { position.insertBefore(node, position.childNodes[position2]); } else { position.appendChild(node); @@ -837,51 +1048,68 @@ export class Create { ); } groupControl(dialog) { - return ui.create.control("wei", "shu", "wu", "qun", "jin", "western", "key", function (link, node) { - if (link == "全部") { - dialog.currentcapt = ""; - dialog.currentgroup = ""; - for (var i = 0; i < dialog.buttons.length; i++) { - dialog.buttons[i].style.display = ""; - } - } else { - if (node.classList.contains("thundertext")) { - dialog.currentgroup = null; - dialog.currentgroupnode = null; - node.classList.remove("thundertext"); + return ui.create.control( + "wei", + "shu", + "wu", + "qun", + "jin", + "western", + "key", + function (link, node) { + if (link == "全部") { + dialog.currentcapt = ""; + dialog.currentgroup = ""; for (var i = 0; i < dialog.buttons.length; i++) { - if ( - dialog.currentcapt && - dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) - ) { - dialog.buttons[i].classList.add("nodisplay"); - } else { - dialog.buttons[i].classList.remove("nodisplay"); - } + dialog.buttons[i].style.display = ""; } } else { - if (dialog.currentgroupnode) { - dialog.currentgroupnode.classList.remove("thundertext"); - } - dialog.currentgroup = link; - dialog.currentgroupnode = node; - node.classList.add("thundertext"); - for (var i = 0; i < dialog.buttons.length; i++) { - if ( - dialog.buttons[i].group != link || - (dialog.currentcapt && + if (node.classList.contains("thundertext")) { + dialog.currentgroup = null; + dialog.currentgroupnode = null; + node.classList.remove("thundertext"); + for (var i = 0; i < dialog.buttons.length; i++) { + if ( + dialog.currentcapt && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt)) - ) { - dialog.buttons[i].classList.add("nodisplay"); - } else { - dialog.buttons[i].classList.remove("nodisplay"); + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) + ) { + dialog.buttons[i].classList.add("nodisplay"); + } else { + dialog.buttons[i].classList.remove("nodisplay"); + } + } + } else { + if (dialog.currentgroupnode) { + dialog.currentgroupnode.classList.remove( + "thundertext" + ); + } + dialog.currentgroup = link; + dialog.currentgroupnode = node; + node.classList.add("thundertext"); + for (var i = 0; i < dialog.buttons.length; i++) { + if ( + dialog.buttons[i].group != link || + (dialog.currentcapt && + dialog.buttons[i].capt != + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + )) + ) { + dialog.buttons[i].classList.add("nodisplay"); + } else { + dialog.buttons[i].classList.remove("nodisplay"); + } } } } } - }); + ); } cardDialog() { var args = ["thisiscard"]; @@ -894,7 +1122,10 @@ export class Create { var list = []; for (var i in lib.character) { if (lib.character[i][4].includes("minskin")) continue; - if (lib.character[i][4].includes("boss") || lib.character[i][4].includes("hiddenboss")) { + if ( + lib.character[i][4].includes("boss") || + lib.character[i][4].includes("hiddenboss") + ) { if (lib.config.mode == "boss") continue; if (!lib.character[i][4].includes("bossallowed")) continue; } @@ -943,7 +1174,12 @@ export class Create { } else if (packname == "收藏") { pack = lib.config.favouriteCharacter; } - var node = ui.create.div(".dialogbutton.menubutton.large", packname, packnode, clickCapt); + var node = ui.create.div( + ".dialogbutton.menubutton.large", + packname, + packnode, + clickCapt + ); node.pack = pack; return node; }; @@ -974,7 +1210,11 @@ export class Create { clickCapt.call(packnode.firstChild); } - var node = ui.create.div(".dialogbutton.menubutton.large", "筛选", packnode); + var node = ui.create.div( + ".dialogbutton.menubutton.large", + "筛选", + packnode + ); return dialog; } characterDialog() { @@ -1009,9 +1249,15 @@ export class Create { precharacter = true; } else if (arguments[i] == "characterx") { characterx = true; - } else if (typeof arguments[i] == "string" && arguments[i].startsWith("onlypack:")) { + } else if ( + typeof arguments[i] == "string" && + arguments[i].startsWith("onlypack:") + ) { onlypack = arguments[i].slice(9); - } else if (typeof arguments[i] == "object" && typeof arguments[i].seperate == "function") { + } else if ( + typeof arguments[i] == "object" && + typeof arguments[i].seperate == "function" + ) { seperate = arguments[i].seperate; } else if (typeof arguments[i] === "string") { str = arguments[i]; @@ -1054,7 +1300,10 @@ export class Create { } else { for (var i in lib.character) { if (lib.character[i][4].includes("minskin")) continue; - if (lib.character[i][4].includes("boss") || lib.character[i][4].includes("hiddenboss")) { + if ( + lib.character[i][4].includes("boss") || + lib.character[i][4].includes("hiddenboss") + ) { if (lib.config.mode == "boss") continue; if (!lib.character[i][4].includes("bossallowed")) continue; } @@ -1062,7 +1311,11 @@ export class Create { if (lib.character[i][4].includes("stonehidden")) continue; if (lib.character[i][4].includes("unseen")) continue; if (lib.config.banned.includes(i)) continue; - if (lib.characterFilter[i] && !lib.characterFilter[i](get.mode())) continue; + if ( + lib.characterFilter[i] && + !lib.characterFilter[i](get.mode()) + ) + continue; if (filter && filter(i)) continue; list.push(i); if (get.is.double(i)) { @@ -1108,12 +1361,19 @@ export class Create { this.touchlink.classList.remove("active"); } for (var i = 0; i < dialog.buttons.length; i++) { - if (dialog.currentgroup && dialog.buttons[i].group != dialog.currentgroup) { + if ( + dialog.currentgroup && + dialog.buttons[i].group != dialog.currentgroup + ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.currentcapt2 && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt, true) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt, + true + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else { @@ -1124,7 +1384,9 @@ export class Create { if (dialog.currentcaptnode) { dialog.currentcaptnode.classList.remove("thundertext"); if (dialog.currentcaptnode.touchlink) { - dialog.currentcaptnode.touchlink.classList.remove("active"); + dialog.currentcaptnode.touchlink.classList.remove( + "active" + ); } } dialog.currentcapt = this.link; @@ -1136,16 +1398,26 @@ export class Create { for (var i = 0; i < dialog.buttons.length; i++) { if ( dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.currentcapt2 && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt, true) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt, + true + ) ) { dialog.buttons[i].classList.add("nodisplay"); - } else if (dialog.currentgroup && dialog.buttons[i].group != dialog.currentgroup) { + } else if ( + dialog.currentgroup && + dialog.buttons[i].group != dialog.currentgroup + ) { dialog.buttons[i].classList.add("nodisplay"); } else { dialog.buttons[i].classList.remove("nodisplay"); @@ -1157,7 +1429,10 @@ export class Create { newlined2.style.display = "none"; if (!packsource.onlypack) { packsource.classList.remove("thundertext"); - if (!get.is.phoneLayout() || !lib.config.filternode_button) { + if ( + !get.is.phoneLayout() || + !lib.config.filternode_button + ) { packsource.innerHTML = "武将包"; } } @@ -1170,12 +1445,18 @@ export class Create { this.touchlink.classList.remove("active"); } for (var i = 0; i < dialog.buttons.length; i++) { - if (dialog.currentgroup && dialog.buttons[i].group != dialog.currentgroup) { + if ( + dialog.currentgroup && + dialog.buttons[i].group != dialog.currentgroup + ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.currentcapt && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else { @@ -1186,7 +1467,9 @@ export class Create { if (dialog.currentcaptnode2) { dialog.currentcaptnode2.classList.remove("thundertext"); if (dialog.currentcaptnode2.touchlink) { - dialog.currentcaptnode2.touchlink.classList.remove("active"); + dialog.currentcaptnode2.touchlink.classList.remove( + "active" + ); } } dialog.currentcapt2 = this.link; @@ -1202,15 +1485,25 @@ export class Create { if ( dialog.currentcapt && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt, true) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt, + true + ) ) { dialog.buttons[i].classList.add("nodisplay"); - } else if (dialog.currentgroup && dialog.buttons[i].group != dialog.currentgroup) { + } else if ( + dialog.currentgroup && + dialog.buttons[i].group != dialog.currentgroup + ) { dialog.buttons[i].classList.add("nodisplay"); } else { if (dialog.buttons[i].activate) { @@ -1223,7 +1516,11 @@ export class Create { } if (dialog.seperate) { for (var i = 0; i < dialog.seperate.length; i++) { - if (!dialog.seperate[i].nextSibling.querySelector(".button:not(.nodisplay)")) { + if ( + !dialog.seperate[i].nextSibling.querySelector( + ".button:not(.nodisplay)" + ) + ) { dialog.seperate[i].style.display = "none"; dialog.seperate[i].nextSibling.style.display = "none"; } else { @@ -1255,12 +1552,17 @@ export class Create { newlined.style.textAlign = "center"; node.appendChild(newlined); } else if (newlined) { - var span = ui.create.div(".tdnode.pointerdiv.shadowed.reduce_radius"); + var span = ui.create.div( + ".tdnode.pointerdiv.shadowed.reduce_radius" + ); span.style.margin = "3px"; span.style.width = "auto"; span.innerHTML = " " + namecapt[i].toUpperCase() + " "; span.link = namecapt[i]; - span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickCapt); + span.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + clickCapt + ); newlined.appendChild(span); node[namecapt[i]] = span; if (namecapt[i] == "收藏") { @@ -1273,7 +1575,10 @@ export class Create { span.innerHTML = " " + namecapt[i].toUpperCase() + " "; span.link = namecapt[i]; span.alphabet = true; - span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickCapt); + span.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + clickCapt + ); node.appendChild(span); } } @@ -1304,13 +1609,20 @@ export class Create { if ( dialog.currentcapt && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.currentcapt2 && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt, true) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt, + true + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else { @@ -1328,13 +1640,20 @@ export class Create { if ( dialog.currentcapt && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else if ( dialog.currentcapt2 && dialog.buttons[i].capt != - dialog.getCurrentCapt(dialog.buttons[i].link, dialog.buttons[i].capt, true) + dialog.getCurrentCapt( + dialog.buttons[i].link, + dialog.buttons[i].capt, + true + ) ) { dialog.buttons[i].classList.add("nodisplay"); } else if (dialog.currentgroup == "double") { @@ -1359,20 +1678,27 @@ export class Create { } }; for (var i = 0; i < groups.length; i++) { - var span = ui.create.div(".tdnode.pointerdiv.shadowed.reduce_radius.reduce_margin"); + var span = ui.create.div( + ".tdnode.pointerdiv.shadowed.reduce_radius.reduce_margin" + ); span.style.margin = "3px"; newlined.appendChild(span); span.innerHTML = get.translation(groups[i]); span.link = groups[i]; span._nature = natures[i]; - span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickGroup); + span.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + clickGroup + ); } var span = document.createElement("span"); newlined.appendChild(span); span.style.margin = "8px"; - packsource = ui.create.div(".tdnode.pointerdiv.shadowed.reduce_radius.reduce_margin"); + packsource = ui.create.div( + ".tdnode.pointerdiv.shadowed.reduce_radius.reduce_margin" + ); packsource.style.margin = "3px"; newlined.appendChild(packsource); var filternode = null; @@ -1386,7 +1712,9 @@ export class Create { if (get.is.phoneLayout() && lib.config.filternode_button) { newlined.style.marginTop = ""; packsource.innerHTML = "筛选"; - filternode = ui.create.div(".popup-container.filter-character.modenopause"); + filternode = ui.create.div( + ".popup-container.filter-character.modenopause" + ); ui.create.div(filternode); filternode.listen(function (e) { if (this.classList.contains("removing")) return; @@ -1412,7 +1740,9 @@ export class Create { } else { if (onlypack) { packsource.onlypack = true; - packsource.innerHTML = get.translation(onlypack + "_character_config"); + packsource.innerHTML = get.translation( + onlypack + "_character_config" + ); packsource.style.display = "none"; packsource.previousSibling.style.display = "none"; } else { @@ -1433,32 +1763,46 @@ export class Create { newlined2.style.textAlign = "center"; node.appendChild(newlined2); - packsource.addEventListener(lib.config.touchscreen ? "touchend" : "click", function () { - if (packsource.onlypack) return; - if (_status.dragged) return; - if (get.is.phoneLayout() && lib.config.filternode_button && filternode) { - _status.filterCharacter = true; - ui.window.classList.add("shortcutpaused"); - ui.window.appendChild(filternode); - ui.refresh(filternode); - filternode.classList.add("shown"); - var dh = filternode.offsetHeight - filternode.firstChild.offsetHeight; - if (dh > 0) { - filternode.firstChild.style.top = dh / 2 + "px"; + packsource.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + function () { + if (packsource.onlypack) return; + if (_status.dragged) return; + if ( + get.is.phoneLayout() && + lib.config.filternode_button && + filternode + ) { + _status.filterCharacter = true; + ui.window.classList.add("shortcutpaused"); + ui.window.appendChild(filternode); + ui.refresh(filternode); + filternode.classList.add("shown"); + var dh = + filternode.offsetHeight - + filternode.firstChild.offsetHeight; + if (dh > 0) { + filternode.firstChild.style.top = dh / 2 + "px"; + } else { + filternode.firstChild.style.top = ""; + } } else { - filternode.firstChild.style.top = ""; - } - } else { - if (newlined2.style.display == "none") { - newlined2.style.display = "block"; - } else { - newlined2.style.display = "none"; + if (newlined2.style.display == "none") { + newlined2.style.display = "block"; + } else { + newlined2.style.display = "none"; + } } } - }); + ); var packlist = []; for (var i = 0; i < lib.config.all.characters.length; i++) { - if (!lib.config.characters.includes(lib.config.all.characters[i])) continue; + if ( + !lib.config.characters.includes( + lib.config.all.characters[i] + ) + ) + continue; packlist.add(lib.config.all.characters[i]); } Object.keys(lib.characterPack) @@ -1466,7 +1810,10 @@ export class Create { if (key.indexOf("mode_extension") != 0) return false; const extName = key.slice(15); //if (!game.hasExtension(extName) || !game.hasExtensionLoaded(extName)) return false; - return lib.config[`extension_${extName}_characters_enable`] === true; + return ( + lib.config[`extension_${extName}_characters_enable`] === + true + ); }) .forEach((key) => packlist.add(key)); for (var i = 0; i < packlist.length; i++) { @@ -1479,9 +1826,13 @@ export class Create { } else { span.style.fontSize = "22px"; } - span.innerHTML = lib.translate[packlist[i] + "_character_config"]; + span.innerHTML = + lib.translate[packlist[i] + "_character_config"]; span.link = packlist[i]; - span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickCapt); + span.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + clickCapt + ); newlined2.appendChild(span); if (filternode && !onlypack) { span.touchlink = ui.create.div( @@ -1543,11 +1894,16 @@ export class Create { dialog.classList.add("scroll1"); dialog.classList.add("scroll2"); dialog.classList.add("scroll3"); - dialog.addEventListener(lib.config.touchscreen ? "touchend" : "mouseup", function () { - _status.clicked2 = true; - }); + dialog.addEventListener( + lib.config.touchscreen ? "touchend" : "mouseup", + function () { + _status.clicked2 = true; + } + ); if (heightset) { - dialog.style.height = (game.layout == "long2" || game.layout == "nova" ? 380 : 350) + "px"; + dialog.style.height = + (game.layout == "long2" || game.layout == "nova" ? 380 : 350) + + "px"; dialog._scrollset = true; } dialog.getCurrentCapt = function (link, capt, noalph) { @@ -1594,7 +1950,10 @@ export class Create { span.innerHTML = i; span.link = i; span.seperate = true; - span.addEventListener(lib.config.touchscreen ? "touchend" : "click", clickCapt); + span.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + clickCapt + ); newlined.appendChild(span); } } @@ -1628,7 +1987,8 @@ export class Create { if (thisiscard) { dialog.buttons[i].capt = getCapt(dialog.buttons[i].link[2]); } else { - dialog.buttons[i].group = lib.character[dialog.buttons[i].link][1]; + dialog.buttons[i].group = + lib.character[dialog.buttons[i].link][1]; dialog.buttons[i].capt = getCapt(dialog.buttons[i].link); } } @@ -1698,8 +2058,12 @@ export class Create { func; var node = ui.create.div(".config"); for (var i = 0; i < arguments.length; i++) { - if (typeof arguments[i] == "string" || typeof arguments[i] == "number") { - if (two) ui.create.div(".toggle", node).innerHTML = arguments[i]; + if ( + typeof arguments[i] == "string" || + typeof arguments[i] == "number" + ) { + if (two) + ui.create.div(".toggle", node).innerHTML = arguments[i]; else { ui.create.div(node).innerHTML = arguments[i]; two = true; @@ -1707,7 +2071,8 @@ export class Create { } else if (typeof arguments[i] == "function") func = arguments[i]; } if (func) { - for (var i = 0; i < node.childNodes.length; i++) node.childNodes[i].listen(func); + for (var i = 0; i < node.childNodes.length; i++) + node.childNodes[i].listen(func); } return node; } @@ -1728,12 +2093,18 @@ export class Create { switcher.innerHTML = get.translation(current); switcher.contentEditable = true; switcher.style.webkitUserSelect = "text"; - switcher.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.editor); + switcher.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.editor + ); } else if (typeof current == "object") { switcher.link = current2 || current[0]; switcher.innerHTML = get.translation(switcher.link); switcher.choice = current; - switcher.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.switcher); + switcher.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.switcher + ); } else { if (current) { switcher.classList.add("on"); @@ -1741,7 +2112,10 @@ export class Create { switcher.classList.add("onoff"); ui.create.div(ui.create.div(switcher)); switcher.link = current ? true : false; - switcher.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.toggle); + switcher.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.toggle + ); } if (func) switcher.additionalCommand = func; return node; @@ -1789,7 +2163,10 @@ export class Create { skills(skills) { var i, same; if (ui.skills) { - if (ui.skills.skills.length == skills.length && ui.skills.style.display != "none") { + if ( + ui.skills.skills.length == skills.length && + ui.skills.style.display != "none" + ) { same = true; for (i = 0; i < skills.length; i++) { if (ui.skills.skills.includes(skills[i]) == false) { @@ -1825,7 +2202,10 @@ export class Create { skills2(skills) { var i, same; if (ui.skills2) { - if (ui.skills2.skills.length == skills.length && ui.skills2.style.display != "none") { + if ( + ui.skills2.skills.length == skills.length && + ui.skills2.style.display != "none" + ) { same = true; for (i = 0; i < skills.length; i++) { if (ui.skills2.skills.includes(skills[i]) == false) { @@ -1861,7 +2241,10 @@ export class Create { skills3(skills) { var i, same; if (ui.skills3) { - if (ui.skills3.skills.length == skills.length && ui.skills3.style.display != "none") { + if ( + ui.skills3.skills.length == skills.length && + ui.skills3.style.display != "none" + ) { same = true; for (i = 0; i < skills.length; i++) { if (ui.skills3.skills.includes(skills[i]) == false) { @@ -1911,7 +2294,11 @@ export class Create { ui.window.classList.add("server"); var serverinfo = ui.create.div(".serverinfo", ui.window); ui.create.div("", "服务器正在运行", serverinfo); - var serverinfotable = ui.create.table(2, 2, ui.create.div(serverinfo)); + var serverinfotable = ui.create.table( + 2, + 2, + ui.create.div(serverinfo) + ); serverinfotable.style.display = "inline-block"; serverinfotable.firstChild.firstChild.innerHTML = "房间人数:"; serverinfotable.firstChild.lastChild.id = "server_count"; @@ -1925,7 +2312,9 @@ export class Create { function () { if ( _status.gameStarted && - !confirm("关闭服务器当前进行的游戏将终止且不可恢复,是否确定关闭?") + !confirm( + "关闭服务器当前进行的游戏将终止且不可恢复,是否确定关闭?" + ) ) { return; } @@ -1936,7 +2325,10 @@ export class Create { ); } - ui.window.addEventListener(lib.config.touchscreen ? "touchend" : "click", ui.click.window); + ui.window.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + ui.click.window + ); ui.system = ui.create.div("#system.", ui.window); ui.arena = ui.create.div("#arena.nome", ui.window); if (lib.device == "ios" && !get.is.phoneLayout()) { @@ -1971,7 +2363,11 @@ export class Create { if (game.layout == "default") { ui.arena.classList.add("oldlayout"); } - if (lib.config.player_border != "wide" || game.layout == "long" || game.layout == "long2") { + if ( + lib.config.player_border != "wide" || + game.layout == "long" || + game.layout == "long2" + ) { ui.arena.classList.add("slim_player"); } if (lib.config.player_border == "slim") { @@ -2021,7 +2417,8 @@ export class Create { document.body.classList.add("statusbar"); } if (lib.config.keep_awake) { - if (window.plugins && window.plugins.insomnia) window.plugins.insomnia.keepAwake(); + if (window.plugins && window.plugins.insomnia) + window.plugins.insomnia.keepAwake(); else { lib.init.js(lib.assetURL + "game", "NoSleep", function () { var noSleep = new NoSleep(); @@ -2044,12 +2441,14 @@ export class Create { lib.init.js(lib.assetURL + "game", "pinyinjs", function () {}); lib.init.js(lib.assetURL + "game", "keyWords", function () {}); - lib.updateURL = lib.updateURLS[lib.config.update_link] || lib.updateURLS.coding; + lib.updateURL = + lib.updateURLS[lib.config.update_link] || lib.updateURLS.coding; lib.init.cssstyles(); ui.arena.dataset.player_height = lib.config.player_height || "default"; - ui.arena.dataset.player_height_nova = lib.config.player_height_nova || "default"; + ui.arena.dataset.player_height_nova = + lib.config.player_height_nova || "default"; // if(lib.config.player_height_nova=='long') ui.arena.classList.add('player_autolong'); ui.arena.dataset.target_shake = lib.config.target_shake || "off"; ui.backgroundMusic = document.createElement("audio"); @@ -2083,9 +2482,15 @@ export class Create { ui.arena.classList.add("hide_name"); } if (lib.config.change_skin_auto != "off") { - _status.skintimeout = setTimeout(ui.click.autoskin, parseInt(lib.config.change_skin_auto)); + _status.skintimeout = setTimeout( + ui.click.autoskin, + parseInt(lib.config.change_skin_auto) + ); } - if (lib.config.border_style && lib.config.border_style.startsWith("dragon_")) { + if ( + lib.config.border_style && + lib.config.border_style.startsWith("dragon_") + ) { ui.arena.dataset.framedecoration = lib.config.border_style.slice(7); } @@ -2100,7 +2505,10 @@ export class Create { ui.historybar = ui.create.div("#historybar.shadowed", ui.window); lib.setScroll(ui.historybar); - ui.roundmenu = ui.create.div("#roundmenu.roundarenabutton.menubutton.round", ui.arena); + ui.roundmenu = ui.create.div( + "#roundmenu.roundarenabutton.menubutton.round", + ui.arena + ); ui.roundmenu._position = [180, 210]; ui.create.div(ui.roundmenu); ui.create.div(ui.roundmenu); @@ -2198,7 +2606,8 @@ export class Create { if (!ui.roundmenu._dragtransform) { ui.roundmenu._dragtransform = [0, 0]; } - ui.roundmenu._dragorigintransform = ui.roundmenu._dragtransform.slice(0); + ui.roundmenu._dragorigintransform = + ui.roundmenu._dragtransform.slice(0); ui.roundmenu._resetTimeout = setTimeout(function () { resetround(); delete ui.roundmenu._resetTimeout; @@ -2213,7 +2622,8 @@ export class Create { if (lib.config.roundmenu_transform) { var translate = lib.config.roundmenu_transform; ui.roundmenu._dragtransform = translate; - ui.roundmenu.style.transform = "translate(" + translate[0] + "px," + translate[1] + "px)"; + ui.roundmenu.style.transform = + "translate(" + translate[0] + "px," + translate[1] + "px)"; ui.click.checkroundtranslate(); } if (get.is.phoneLayout()) { @@ -2281,7 +2691,14 @@ export class Create { ui.pause.hide(); } if (!lib.config.touchscreen) { - lib.setPopped(ui.pause, ui.click.pausehistory, 220, 400, null, true); + lib.setPopped( + ui.pause, + ui.click.pausehistory, + 220, + 400, + null, + true + ); } if (!lib.config.show_pause) { ui.pause.style.display = "none"; @@ -2309,7 +2726,11 @@ export class Create { }); } ui.auto.id = "autobutton"; - ui.autonode = ui.create.div("#autonode", "
    托管中...
    ", ui.arena); + ui.autonode = ui.create.div( + "#autonode", + "
    托管中...
    ", + ui.arena + ); ui.autonode.listen(ui.click.auto); if (lib.config.mode == "connect") { ui.auto.hide(); @@ -2317,11 +2738,16 @@ export class Create { } if (lib.forcehide) { - if (lib.forcehide.includes("replay")) ui.replay.classList.add("forcehide"); - if (lib.forcehide.includes("auto")) ui.auto.classList.add("forcehide"); - if (lib.forcehide.includes("pause")) ui.pause.classList.add("forcehide"); - if (lib.forcehide.includes("wuxie")) ui.wuxie.classList.add("forcehide"); - if (lib.forcehide.includes("cardPileButton")) ui.cardPileButton.classList.add("forcehide"); + if (lib.forcehide.includes("replay")) + ui.replay.classList.add("forcehide"); + if (lib.forcehide.includes("auto")) + ui.auto.classList.add("forcehide"); + if (lib.forcehide.includes("pause")) + ui.pause.classList.add("forcehide"); + if (lib.forcehide.includes("wuxie")) + ui.wuxie.classList.add("forcehide"); + if (lib.forcehide.includes("cardPileButton")) + ui.cardPileButton.classList.add("forcehide"); } ui.volumn = ui.create.system("♫"); lib.setPopped(ui.volumn, ui.click.volumn, 200); @@ -2357,7 +2783,8 @@ export class Create { } else hs.sort(function (b, a) { if (a.name != b.name) return lib.sort.card(a.name, b.name); - else if (a.suit != b.suit) return lib.suit.indexOf(a) - lib.suit.indexOf(b); + else if (a.suit != b.suit) + return lib.suit.indexOf(a) - lib.suit.indexOf(b); else return a.number - b.number; }); game.me.directgain(hs, false); @@ -2400,9 +2827,12 @@ export class Create { "rotate(" + get.round((hours + 9) * 30, 2) + "deg)"; } else { ui.roundmenu.childNodes[13].style.transform = - "rotate(" + get.round((hours + minutes / 60 + 9) * 30, 2) + "deg)"; + "rotate(" + + get.round((hours + minutes / 60 + 9) * 30, 2) + + "deg)"; } - ui.roundmenu.childNodes[12].style.transform = "rotate(" + (minutes + 45) * 6 + "deg)"; + ui.roundmenu.childNodes[12].style.transform = + "rotate(" + (minutes + 45) * 6 + "deg)"; if (minutes < 10) { minutes = "0" + minutes.toString(); } @@ -2468,7 +2898,12 @@ export class Create { ui.shortcut, game.reload ).dataset.position = 1; - ui.create.div(".menubutton.round", "退出", ui.shortcut, game.exit).dataset.position = 3; + ui.create.div( + ".menubutton.round", + "退出", + ui.shortcut, + game.exit + ).dataset.position = 3; ui.create.div( ".menubutton.round", "记录", @@ -2493,7 +2928,9 @@ export class Create { } if (removed) game.saveConfigValue("favouriteMode"); this.innerHTML = ""; - favouriteMode.slice(0, 6).forEach((value, index) => this.add(value, index)); + favouriteMode + .slice(0, 6) + .forEach((value, index) => this.add(value, index)); let mode = lib.config.mode; const config = get.config(`${mode}_mode`); if (typeof config == "string") mode += `|${config}`; @@ -2506,7 +2943,10 @@ export class Create { submode = info[1], node = ui.create.div(".menubutton.large", this), dataset = node.dataset; - dataset.type = Math.min(6, lib.config.favouriteMode.length) % 2 == 0 ? "even" : "odd"; + dataset.type = + Math.min(6, lib.config.favouriteMode.length) % 2 == 0 + ? "even" + : "odd"; dataset.position = index; let str = lib.translate[name] || lib.translate[mode] || ""; if (str.length == 2) str += "模式"; @@ -2519,7 +2959,9 @@ export class Create { }; ui.favmode = ui.create.system("收藏", function () { const mode = - typeof _status.mode == "string" ? `${lib.config.mode}|${_status.mode}` : lib.config.mode; + typeof _status.mode == "string" + ? `${lib.config.mode}|${_status.mode}` + : lib.config.mode; if (this.classList.contains("glow")) { this.classList.remove("glow"); lib.config.favouriteMode.remove(mode); @@ -2561,9 +3003,12 @@ export class Create { // @ts-ignore while (lib.arenaReady.length) lib.arenaReady.shift()(); delete lib.arenaReady; - if (lib.config.auto_check_update && !sessionStorage.getItem("auto_check_update")) { + if ( + lib.config.auto_check_update && + !sessionStorage.getItem("auto_check_update") + ) { setTimeout(() => { - sessionStorage.setItem("auto_check_update", '1'); + sessionStorage.setItem("auto_check_update", "1"); game.checkForUpdate(false); }, 3000); } @@ -2574,8 +3019,12 @@ export class Create { game.saveConfig("asset_version", "无"); } else { var func = function () { - if (confirm("是否下载图片和字体素材?(约386.6MB)")) { - if (!ui.arena.classList.contains("menupaused")) { + if ( + confirm("是否下载图片和字体素材?(约386.6MB)") + ) { + if ( + !ui.arena.classList.contains("menupaused") + ) { ui.click.configMenu(); ui.click.menuTab("其它"); } @@ -2625,15 +3074,25 @@ export class Create { node.listen(func); } if (lib.config.button_press) { - node.addEventListener(lib.config.touchscreen ? "touchstart" : "mousedown", function (e) { - if (!node.classList.contains("hidden")) node.classList.add("pressdown"); - }); - node.addEventListener(lib.config.touchscreen ? "touchend" : "mouseup", function (e) { - node.classList.remove("pressdown"); - }); - node.addEventListener(lib.config.touchscreen ? "touchmove" : "mousemove", function (e) { - node.classList.remove("pressdown"); - }); + node.addEventListener( + lib.config.touchscreen ? "touchstart" : "mousedown", + function (e) { + if (!node.classList.contains("hidden")) + node.classList.add("pressdown"); + } + ); + node.addEventListener( + lib.config.touchscreen ? "touchend" : "mouseup", + function (e) { + node.classList.remove("pressdown"); + } + ); + node.addEventListener( + lib.config.touchscreen ? "touchmove" : "mousemove", + function (e) { + node.classList.remove("pressdown"); + } + ); } return node; } @@ -2692,7 +3151,10 @@ export class Create { * @returns { import("../library/index.js").Button } */ tdnodes: (item, type, position, noclick, node) => { - node = ui.create.div(".shadowed.reduce_radius.pointerdiv.tdnode.tdnodes", position); + node = ui.create.div( + ".shadowed.reduce_radius.pointerdiv.tdnode.tdnodes", + position + ); if (Array.isArray(item)) { node.innerHTML = "" + item[1] + ""; node.link = item[0]; @@ -2708,10 +3170,16 @@ export class Create { blank: (item, type, position, noclick, node) => { node = ui.create.div(".button.card", position); node.link = item; - if (get.position(item) == "j" && item.viewAs && lib.config.cardtempname != "off") { + if ( + get.position(item) == "j" && + item.viewAs && + lib.config.cardtempname != "off" + ) { node.classList.add("infoflip"); node.classList.add("infohidden"); - ui.create.cardTempName(item, node).style.setProperty("display", "block", "important"); + ui.create + .cardTempName(item, node) + .style.setProperty("display", "block", "important"); } return node; }, @@ -2776,9 +3244,13 @@ export class Create { node = ui.create.div(".button.character", position); } node._link = item; - if (_status.noReplaceCharacter && type == "characterx") type = "character"; + if (_status.noReplaceCharacter && type == "characterx") + type = "character"; if (type == "characterx") { - if (lib.characterReplace[item] && lib.characterReplace[item].length) + if ( + lib.characterReplace[item] && + lib.characterReplace[item].length + ) item = lib.characterReplace[item].randomGet(); } node.link = item; @@ -2798,7 +3270,8 @@ export class Create { node.node.hp.remove(); node.node.group.remove(); node.node.intro.remove(); - if (node.node.replaceButton) node.node.replaceButton.remove(); + if (node.node.replaceButton) + node.node.replaceButton.remove(); } node.node = { name: ui.create.div(".name", node), @@ -2824,8 +3297,13 @@ export class Create { node.node.group.style.display = "none"; } node.classList.add("newstyle"); - node.node.name.dataset.nature = get.groupnature(get.bordergroup(infoitem)); - node.node.group.dataset.nature = get.groupnature(get.bordergroup(infoitem), "raw"); + node.node.name.dataset.nature = get.groupnature( + get.bordergroup(infoitem) + ); + node.node.group.dataset.nature = get.groupnature( + get.bordergroup(infoitem), + "raw" + ); ui.create.div(node.node.hp); var hp = get.infoHp(infoitem[2]), maxHp = get.infoMaxHp(infoitem[2]), @@ -2852,7 +3330,8 @@ export class Create { var maxHp = get.infoMaxHp(infoitem[2]); var shield = get.infoHujia(infoitem[2]); if (maxHp > 14) { - if (typeof infoitem[2] == "string") node.node.hp.innerHTML = infoitem[2]; + if (typeof infoitem[2] == "string") + node.node.hp.innerHTML = infoitem[2]; else node.node.hp.innerHTML = get.numStr(infoitem[2]); node.node.hp.classList.add("text"); } else { @@ -2871,8 +3350,14 @@ export class Create { if (node.node.name.querySelectorAll("br").length >= 4) { node.node.name.classList.add("long"); if (lib.config.buttoncharacter_style == "old") { - node.addEventListener("mouseenter", ui.click.buttonnameenter); - node.addEventListener("mouseleave", ui.click.buttonnameleave); + node.addEventListener( + "mouseenter", + ui.click.buttonnameenter + ); + node.addEventListener( + "mouseleave", + ui.click.buttonnameleave + ); } } node.node.intro.innerHTML = lib.config.intro; @@ -2889,9 +3374,13 @@ export class Create { "" ); if (double.length > 4) - if (new Set([5, 6, 9]).has(double.length)) node.node.group.style.height = "48px"; + if (new Set([5, 6, 9]).has(double.length)) + node.node.group.style.height = "48px"; else node.node.group.style.height = "64px"; - } else node.node.group.innerHTML = `
    ${get.translation(infoitem[1])}
    `; + } else + node.node.group.innerHTML = `
    ${get.translation( + infoitem[1] + )}
    `; node.node.group.style.backgroundColor = get.translation( `${get.bordergroup(infoitem)}Color` ); @@ -2904,21 +3393,24 @@ export class Create { node.node.replaceButton = intro; intro.innerHTML = "切换"; intro._node = node; - intro.addEventListener(lib.config.touchscreen ? "touchend" : "click", function () { - _status.tempNoButton = true; - var node = this._node; - var list = lib.characterReplace[node._link]; - var link = node.link; - var index = list.indexOf(link); - if (index == list.length - 1) index = 0; - else index++; - link = list[index]; - node.link = link; - node.refresh(node, link); - setTimeout(function () { - delete _status.tempNoButton; - }, 200); - }); + intro.addEventListener( + lib.config.touchscreen ? "touchend" : "click", + function () { + _status.tempNoButton = true; + var node = this._node; + var list = lib.characterReplace[node._link]; + var link = node.link; + var index = list.indexOf(link); + if (index == list.length - 1) index = 0; + else index++; + link = list[index]; + node.link = link; + node.refresh(node, link); + setTimeout(function () { + delete _status.tempNoButton; + }, 200); + } + ); } }; node.refresh = func; @@ -2930,7 +3422,13 @@ export class Create { * @returns { import("../library/index.js").Button } */ characterx: (item, type, position, noclick, node) => { - return ui.create.buttonPresets.character(item, type, position, noclick, node); + return ui.create.buttonPresets.character( + item, + type, + position, + noclick, + node + ); }, /** * @returns { import("../library/index.js").Button } @@ -2952,7 +3450,11 @@ export class Create { if (item.name && item.name.startsWith("unknown")) { if (item.node && item.node.name_seat) { node.classList.add("cardbg"); - ui.create.div(".avatar_name", node, get.translation(item.name)); + ui.create.div( + ".avatar_name", + node, + get.translation(item.name) + ); } else { node.setBackground(item.name1, "character"); } @@ -2984,9 +3486,18 @@ export class Create { var fragment = document.createDocumentFragment(); for (var i = 0; i < list.length; i++) { if (pre) { - buttons.push(ui.create.prebutton(list[i], type.slice(3), fragment, noclick)); + buttons.push( + ui.create.prebutton( + list[i], + type.slice(3), + fragment, + noclick + ) + ); } else { - buttons.push(ui.create.button(list[i], type, fragment, noclick)); + buttons.push( + ui.create.button(list[i], type, fragment, noclick) + ); } } if (position) position.appendChild(fragment); @@ -3002,7 +3513,8 @@ export class Create { str = item; link = item; } - if (!str.startsWith(""; + if (!str.startsWith(""; var next = dialog.add(str); if (!noclick) next.firstChild.addEventListener( @@ -3021,7 +3533,8 @@ export class Create { ui.updateConnectPlayerPositions(); game.connectPlayers = []; const configOL = lib.configOL; - const numberOfPlayers = parseInt(configOL.player_number) || configOL.number; + const numberOfPlayers = + parseInt(configOL.player_number) || configOL.number; for (let position = 0; position < numberOfPlayers; position++) { const player = ui.create.player(ui.window); player.dataset.position = position; @@ -3058,7 +3571,11 @@ export class Create { } else { var num = 0; for (var i of game.connectPlayers) { - if (!i.nickname && !i.classList.contains("unselectable2")) num++; + if ( + !i.nickname && + !i.classList.contains("unselectable2") + ) + num++; } if (num >= lib.configOL.number - 1) { alert("至少要有两名玩家才能开始游戏!"); @@ -3084,8 +3601,12 @@ export class Create { var text = `无名杀-联机-${lib.translate[get.mode()]}-${ game.connectPlayers.filter((p) => p.avatar).length }/${ - game.connectPlayers.filter((p) => !p.classList.contains("unselectable2")).length - }\n${get.connectNickname()}邀请你加入${game.roomId}房间\n联机地址:${ + game.connectPlayers.filter( + (p) => !p.classList.contains("unselectable2") + ).length + }\n${get.connectNickname()}邀请你加入${ + game.roomId + }房间\n联机地址:${ game.ip }\n请先通过游戏内菜单-开始-联机中启用“读取邀请链接”选项`; window.focus(); @@ -3099,7 +3620,9 @@ export class Create { game.alert(`分享内容复制失败${e || ""}`); }); } else { - var input = ui.create.node("textarea", ui.window, { opacity: "0" }); + var input = ui.create.node("textarea", ui.window, { + opacity: "0", + }); input.value = text; input.focus(); input.select(); @@ -3213,11 +3736,23 @@ export class Create { if (lib.card[lib.card.list[i][2]]) { if (!lib.card.list[i]._replaced) { if (!_status.connectMode) { - if (lib.config.bannedcards.includes(lib.card.list[i][2])) continue; + if ( + lib.config.bannedcards.includes(lib.card.list[i][2]) + ) + continue; } else { - if (lib.configOL.bannedcards.includes(lib.card.list[i][2])) continue; + if ( + lib.configOL.bannedcards.includes( + lib.card.list[i][2] + ) + ) + continue; } - if (game.bannedcards && game.bannedcards.includes(lib.card.list[i][2])) continue; + if ( + game.bannedcards && + game.bannedcards.includes(lib.card.list[i][2]) + ) + continue; } lib.inpile.add(lib.card.list[i][2]); if (lib.card.list[i][2] == "sha" && lib.card.list[i][3]) @@ -3235,7 +3770,8 @@ export class Create { } game.broadcastAll( function (num, pile, top, cardtag, inpile2) { - if (ui.cardPileNumber) ui.cardPileNumber.innerHTML = "0轮 剩余牌: " + num; + if (ui.cardPileNumber) + ui.cardPileNumber.innerHTML = "0轮 剩余牌: " + num; lib.inpile = pile; _status.pileTop = top; _status.cardtag = cardtag; diff --git a/noname/ui/create/menu/pages/otherMenu.js b/noname/ui/create/menu/pages/otherMenu.js index 627c44a8b..c5092e6f3 100644 --- a/noname/ui/create/menu/pages/otherMenu.js +++ b/noname/ui/create/menu/pages/otherMenu.js @@ -439,11 +439,11 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM * @param { (value: T) => Promise } predicate */ const asyncFilter = async (arr, predicate) => { - //将arr每10个分为一个数组,分别使用Promise.all + //将arr每20个分为一个数组,分别使用Promise.all /** @type { boolean[] } */ const results = []; - for (let i = 0; i < arr.length; i += 10) { - const pushArr = arr.slice(i, i + 10); + for (let i = 0; i < arr.length; i += 20) { + const pushArr = arr.slice(i, i + 20); results.push( ...await Promise.all(pushArr.map(predicate)) ); @@ -453,8 +453,11 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM const result = await asyncFilter(files.flat(), async v => { return game.promises.readFile(v.path).then(data => { + // 有设置就不进行对比直接返回false + if (lib.config.asset_notReplaceExistingFiles) return false; return v.size != data.byteLength; - }).catch(()=>true) + // 报错了就是没有文件 + }).catch(() => true); }).then(arr => arr.map((v) => v.path)); console.log("需要更新的文件有:", result); @@ -463,6 +466,22 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM await lib.init.promises.js("game", "asset"); if (Array.isArray(window.noname_asset_list)) { game.saveConfig("asset_version", window.noname_asset_list[0]); + try { + // 动态更新素材版本显示 + if ( + li2 instanceof HTMLLIElement && + li2.childNodes[0] && + // nodeType = 3为text + li2.childNodes[0].nodeType === 3 && + li2.childNodes[0].textContent.startsWith( + "素材版本" + ) + ) { + li2.childNodes[0].textContent = `素材版本:${window.noname_asset_list[0]}`; + } + } catch (error) { + console.error("动态更新素材版本显示失败:", error); + } delete window.noname_asset_list; } if (confirm("更新完成,是否重启?")) { @@ -655,7 +674,9 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM if (!this.classList.toggle("on")) { game.saveConfig("asset_toggle_off", true); [ - /* span2, span2_br, span2_check,*/ + span7, + span7_br, + span7_check, span3, span3_br, span3_check, @@ -674,7 +695,9 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM } else { game.saveConfig("asset_toggle_off"); [ - /* span2, span2_br, span2_check,*/ + span7, + span7_br, + span7_check, span3, span3_br, span3_check, @@ -699,6 +722,23 @@ export const otherMenu = function (/** @type { boolean | undefined } */ connectM // li2.lastChild.appendChild(span6_br); // var span2_br = ui.create.node('br'); + var span7 = ui.create.div("", `不替换已有素材`); + span7.style.fontSize = "small"; + span7.style.lineHeight = "16px"; + li2.lastChild.appendChild(span7); + var span7_check = document.createElement("input"); + span7_check.type = "checkbox"; + span7_check.style.marginLeft = "5px"; + if (lib.config.asset_notReplaceExistingFiles) { + span7_check.checked = true; + } + span7_check.onchange = function () { + game.saveConfig("asset_notReplaceExistingFiles", this.checked); + }; + li2.lastChild.appendChild(span7_check); + var span7_br = ui.create.node("br"); + li2.lastChild.appendChild(span7_br); + var span4 = ui.create.div("", `字体素材(${lib.config.asset_font_size || "23.4MB"})`); span4.style.fontSize = "small"; span4.style.lineHeight = "16px"; diff --git a/noname/ui/index.js b/noname/ui/index.js index 638e0ca9d..aedd06936 100644 --- a/noname/ui/index.js +++ b/noname/ui/index.js @@ -136,6 +136,14 @@ export class UI { * @type {HTMLDivElement} */ tempnowuxie; + /** + * @type {HTMLDivElement[]} + */ + toastQueue = []; + + * @type {HTMLDivElement} + */ + cardPile; refresh(node) { void window.getComputedStyle(node, null).getPropertyValue("opacity"); }