From 1f96b1f3ee3e223297ab3b754109141ffc994104 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Tue, 23 Apr 2024 21:42:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E7=81=AD=E7=82=89=E7=9F=B3=E4=BC=A0?= =?UTF-8?q?=E8=AF=B4=E6=A8=A1=E5=BC=8F=E4=B8=8B[4]=E5=92=8C[5]=E7=9A=84?= =?UTF-8?q?=E5=9E=83=E5=9C=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mode/guozhan.js | 4 +-- mode/single.js | 14 +++------ mode/stone.js | 44 ++++++++++++++--------------- noname/library/element/character.js | 33 ++++++++++++++++++++++ 4 files changed, 60 insertions(+), 35 deletions(-) diff --git a/mode/guozhan.js b/mode/guozhan.js index dcc5fdf33..89853ddca 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -67,7 +67,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { delete lib.translate.shuiyanqijunx_info_guozhan; const pack = lib.yingbian_guozhan; for (const i in pack) { - if (!pack[i][4]) pack[i][4] = []; lib.character[i] = pack[i]; lib.characterPack.mode_guozhan[i] = pack[i]; if (!lib.translate[i]) lib.translate[i] = lib.translate[i.slice(3)]; @@ -120,7 +119,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { delete lib.translate.shuiyanqijunx_info_guozhan; const pack2 = lib.yingbian_guozhan; for (const i in pack2) { - if (!pack2[i][4]) pack2[i][4] = []; pack[i] = pack2[i]; } } @@ -22329,7 +22327,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { } } } - if (lib.character[button.link][4].includes("hiddenSkill")) return false; + if (lib.character[button.link].hasHiddenSkill) return false; var filterChoice = function (name1, name2) { if (_status.separatism) return true; var group1 = lib.character[name1][1]; diff --git a/mode/single.js b/mode/single.js index 94e4ba69f..10215e15b 100644 --- a/mode/single.js +++ b/mode/single.js @@ -307,9 +307,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { if (_status.mode != "normal") return; for (var i in lib.characterSingle) { lib.character[i] = lib.characterSingle[i]; - if (!lib.character[i][4]) { - lib.character[i][4] = []; - } } for (var j in lib.singleTranslate) lib.translate[j] = lib.singleTranslate[j]; }, @@ -352,11 +349,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { for (var j in singleTranslate) lib.translate[j] = singleTranslate[j]; _status.characterlist = []; for (var i in characterSingle) { - if (!jin && characterSingle[i][1] == "jin") continue; + if (!jin && get.convertedCharacter(characterSingle[i]) == "jin") continue; lib.character[i] = characterSingle[i]; - if (!lib.character[i][4]) { - lib.character[i][4] = []; - } _status.characterlist.push(i); } }, @@ -647,7 +641,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { [game.me, game.me.enemy].forEach((current) => { if ( current.storage.nohp || - (lib.character[current.name1][4].includes("hiddenSkill") && !current.noclick) + (lib.character[current.name1].hasHiddenSkil && !current.noclick) ) { current.storage.rawHp = 1; current.storage.rawMaxHp = 1; @@ -1116,7 +1110,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { current.init(result[i][0]); if ( current.storage.nohp || - (lib.character[current.name1][4].includes("hiddenSkill") && !current.noclick) + (lib.character[current.name1].hasHiddenSkil && !current.noclick) ) { current.storage.rawHp = 1; current.storage.rawMaxHp = 1; @@ -1134,7 +1128,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { current.init(result[i][0]); if ( current.storage.nohp || - (lib.character[current.name1][4].includes("hiddenSkill") && + (lib.character[current.name1].hasHiddenSkil && !current.noclick) ) { current.storage.rawHp = 1; diff --git a/mode/stone.js b/mode/stone.js index 1a5ebf5f5..f51f9ae92 100644 --- a/mode/stone.js +++ b/mode/stone.js @@ -2256,33 +2256,33 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var i, j, name; for (var i in lib.characterPack.mode_stone) { lib.character[i] = lib.characterPack.mode_stone[i]; - if (lib.characterPack.mode_stone[i][4].includes("stonespecial")) continue; - lib.character[i][3].add("stonesha"); - lib.character[i][3].add("stoneshan"); - lib.character[i][3].add("stonedraw"); + if (lib.character[i].isSpecialInStoneMode) continue; + lib.character[i].skills.add("stonesha"); + lib.character[i].skills.add("stoneshan"); + lib.character[i].skills.add("stonedraw"); name = i + "_stonecharacter"; lib.card[name] = { image: "mode/stone/character/" + i, - stoneact: lib.character[i][5][0], - career: lib.character[i][5][2] || null, + stoneact: lib.character[i].stoneModeData[0], + career: lib.character[i].stoneModeData[2] || null, }; for (j in lib.element.stonecharacter) { lib.card[name][j] = lib.element.stonecharacter[j]; } lib.translate[name] = get.translation(i); lib.translate[name + "_info"] = get.skillintro(i); - if (lib.character[i][4].includes("stonehidden")) { + if (lib.character[i].isHiddenInStoneMode) { lib.card[name].stonehidden = true; continue; } - if (!lib.character[i][5][2]) { - if (lib.character[i][5][0] < 3) { + if (!lib.character[i].stoneModeData[2]) { + if (lib.character[i].stoneModeData[0] < 3) { list.push(name); } else { list2.push(name); } } else { - list3[lib.character[i][5][2]].push(name); + list3[lib.character[i].stoneModeData[2]].push(name); } } if (_status.mode == "deck") { @@ -2415,8 +2415,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var list = []; event.list = list; for (i in lib.character) { - if (lib.character[i][4] && lib.character[i][4].includes("minskin")) continue; - if (lib.character[i][4] && lib.character[i][4].includes("stonehidden")) continue; + if (lib.character[i].isMinskin) continue; + if (lib.character[i].isHiddenInStoneMode) continue; if (lib.config.forbidstone.includes(i)) continue; if (lib.filter.characterDisabled(i)) continue; list.push(i); @@ -7232,10 +7232,10 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var list = []; for (var i in lib.character) { if ( - lib.character[i][4].includes("stone") && - !lib.character[i][4].includes("stonehidden") && - lib.character[i][5] && - lib.character[i][5][0] == num + lib.character[i].isFellowInStoneMode && + !lib.character[i].isHiddenInStoneMode && + lib.character[i].stoneModeData && + lib.character[i].stoneModeData[0] == num ) { list.push(i); } @@ -7787,10 +7787,10 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var list = []; for (var i in lib.character) { if ( - lib.character[i][4].includes("stone") && - !lib.character[i][4].includes("stonehidden") && - lib.character[i][5] && - lib.character[i][5][0] == 1 + lib.character[i].isFellowInStoneMode && + !lib.character[i].isHiddenInStoneMode && + lib.character[i].stoneModeData && + lib.character[i].stoneModeData[0] == 1 ) { list.push(i); } @@ -10366,9 +10366,9 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { var list = []; var list2 = []; for (var i in lib.character) { - if (lib.character[i][4].includes("stonelegend_" + player.career)) { + if (lib.character[i].trashBin.includes("stonelegend_" + player.career)) { list.push(i); - } else if (lib.character[i][4].includes("stonelegend")) { + } else if (lib.character[i].trashBin.includes("stonelegend")) { list2.push(i); } } diff --git a/noname/library/element/character.js b/noname/library/element/character.js index c17f75561..5f786dd88 100644 --- a/noname/library/element/character.js +++ b/noname/library/element/character.js @@ -95,11 +95,26 @@ export class Character { * @type { boolean } **/ isAiForbidden = false; + /** + * 武将牌在炉石模式下的特殊信息 + * @type { array|undefined } + **/ + stoneModeData; + /** + * 武将牌是否为炉石模式下的随从 + * @type { boolean } + **/ + isFellowInStoneMode = false; /** * 武将牌是否为炉石模式下的隐藏武将 * @type { boolean } **/ isHiddenInStoneMode = false; + /** + * 武将牌是否为炉石模式下的特殊随从(可以使用装备和锦囊) + * @type { boolean } + **/ + isSpecialInStoneMode = false; /** * 武将牌是否为bossallowed * @type { boolean } @@ -137,6 +152,7 @@ export class Character { this.hujia = get.infoHujia(data[2]); this.skills = get.copy(data[3] || []); if (data[4]) Character.convertTrashToProperties(this, data[4]); + if (data[5]) this.stoneModeData = data[5]; } else if (get.is.object(data)) { Object.assign(this, data); if (typeof this.maxHp !== "number") this.maxHp = this.hp; @@ -175,8 +191,12 @@ export class Character { character.isHiddenBoss = true; } else if (item === "forbidai") { character.isAiForbidden = true; + } else if (item === "stone") { + character.isFellowInStoneMode = true; } else if (item === "stonehidden") { character.isHiddenInStoneMode = true; + } else if (item === "stonespecial") { + character.isSpecialInStoneMode = true; } else if (item === "hiddenSkill") { character.hasHiddenSkill = true; } else if (item.startsWith("border:")) { @@ -278,9 +298,15 @@ export class Character { if (character.isAiForbidden) { trashes.push("forbidai"); } + if (character.isFellowInStoneMode) { + trashes.push("stone"); + } if (character.isHiddenInStoneMode) { trashes.push("stonehidden"); } + if (character.isSpecialInStoneMode) { + trashes.push("stonespecial"); + } if (character.hasHiddenSkill) { trashes.push("hiddenSkill"); } @@ -302,4 +328,11 @@ export class Character { set 4(trashBin) { console.warn("你set你🐎的废弃属性"); } + + get 5(){ + return this.stoneModeData; + } + set 5(stoneData){ + this.stoneModeData = stoneData; + } }