diff --git a/mode/stone.js b/mode/stone.js index f51f9ae92..3add5cd4c 100644 --- a/mode/stone.js +++ b/mode/stone.js @@ -5867,7 +5867,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { return target.isMin(); }, content: function () { - target.clearSkills(); + target.clearSkills(true); target.init("stone_qingwa"); target.noPhaseDelay = true; }, diff --git a/mode/tafang.js b/mode/tafang.js index 7fce5424f..c0e133f0e 100644 --- a/mode/tafang.js +++ b/mode/tafang.js @@ -85,9 +85,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { lib.mechlist.push(i); } lib.character[i] = lib.characterPack.mode_tafang[i]; - if (!lib.character[i][4]) { - lib.character[i][4] = []; - } } ui.create.cardsAsync(); game.finishCards(); diff --git a/mode/versus.js b/mode/versus.js index ca91191ab..e1e2bda39 100644 --- a/mode/versus.js +++ b/mode/versus.js @@ -717,9 +717,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { ui.arena.classList.add("choose-character"); for (var i in lib.characterPack.mode_versus) { lib.character[i] = lib.characterPack.mode_versus[i]; - if (!lib.character[i][4]) { - lib.character[i][4] = []; - } } lib.characterIntro.boss_liedixuande = lib.characterIntro.liubei; lib.characterIntro.boss_gongshenyueying = lib.characterIntro.huangyueying; @@ -753,7 +750,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { event.list = list; if (lib.characterPack.boss) { for (var i in lib.characterPack.boss) { - if (!lib.character[i] && lib.characterPack.boss[i][4]) { + if (!lib.character[i]) { if ( get.convertedCharacter(lib.characterPack.boss[i]).isJiangeBoss || get.convertedCharacter(lib.characterPack.boss[i]).isJiangeMech @@ -764,20 +761,18 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { } } for (var i in lib.character) { - if (lib.character[i][4]) { - if (lib.character[i].isJiangeBoss) { - list[lib.character[i].group + "boss"].push(i); - continue; - } else if (lib.character[i].isJiangeMech) { - list[lib.character[i].group + "mech"].push(i); - continue; - } + if (lib.character[i].isJiangeBoss) { + list[lib.character[i].group + "boss"].push(i); + continue; + } else if (lib.character[i].isJiangeMech) { + list[lib.character[i].group + "mech"].push(i); + continue; } if (lib.filter.characterDisabled(i)) continue; if (get.is.double(i)) continue; - if (lib.character[i][1] == "wei") { + if (lib.character[i].group == "wei") { list.weilist.push(i); - } else if (lib.character[i][1] == "shu") { + } else if (lib.character[i].group == "shu") { list.shulist.push(i); } } @@ -821,10 +816,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) { }; var createCharacterDialog = function () { event.dialogxx = ui.create.characterDialog("heightset", function (name) { - if (lib.character[name][4]) { - if (lib.character[name][4].includes("jiangeboss")) return true; - if (lib.character[name][4].includes("jiangemech")) return true; - } + if (lib.character[name].isJiangeBoss) return true; + if (lib.character[name].isJiangeMech) return true; if (lib.character[name][1] != game.me.identity) return true; }); if (ui.cheat2) { diff --git a/noname/game/index.js b/noname/game/index.js index bfac1e54d..5dbc0ac86 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -4702,6 +4702,7 @@ export class Game { * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information */ addCharacter(name, information) { + //TODO: 这一坨也要改 const extensionName = _status.extension || information.extension, character = [ information.sex, diff --git a/noname/get/index.js b/noname/get/index.js index dd20e705e..78a450857 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -625,10 +625,8 @@ export class Get { } characterInitFilter(name) { const info = get.character(name); - if (!info || !info[4]) return []; - const filter = info[4].find((tag) => tag.startsWith("InitFilter")); - if (!filter) return []; - return filter.split(":").slice(1); + if (!info) return []; + return info.initFilters || []; } characterIntro(name) { if (lib.characterIntro[name]) return lib.characterIntro[name]; @@ -2612,12 +2610,10 @@ export class Get { gainableSkillsName(name, func) { var list = []; if (name && lib.character[name]) { - if (lib.character[name][4]) { - if (lib.character[name].isBoss) return list; - if (lib.character[name].isHiddenBoss) return list; - if (lib.character[name].isMinskin) return list; - if (lib.character[name].isUnseen) return list; - } + if (lib.character[name].isBoss) return list; + if (lib.character[name].isHiddenBoss) return list; + if (lib.character[name].isMinskin) return list; + if (lib.character[name].isUnseen) return list; for (var skill of lib.character[name].skills) { var info = lib.skill[skill]; if (lib.filter.skillDisabled(skill)) continue; @@ -3604,7 +3600,7 @@ export class Get { if (avatar2) { if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) node.node.avatar2.setBackground(nameskin2, "character"); @@ -3612,7 +3608,7 @@ export class Get { } else { if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) node.node.avatar.setBackground(nameskin2, "character"); @@ -3627,7 +3623,7 @@ export class Get { } else { if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) button.setBackground(nameskin2, "character", "noskin"); @@ -4230,7 +4226,7 @@ export class Get { delete lib.config.skin[nameskin]; if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) node.setBackground(nameskin2, "character"); @@ -4244,7 +4240,7 @@ export class Get { } else { if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) button.setBackground(nameskin2, "character", "noskin"); diff --git a/noname/init/polyfill.js b/noname/init/polyfill.js index 471c087f5..72a18d34d 100644 --- a/noname/init/polyfill.js +++ b/noname/init/polyfill.js @@ -150,7 +150,7 @@ Reflect.defineProperty(HTMLDivElement.prototype, "setBackground", { if ( lib.config.mode_config.guozhan.guozhanSkin && lib.character[name] && - lib.character[name][4].includes("gzskin") + lib.character[name].hasSkinInGuozhan ) gzbool = true; name = name.slice(3); diff --git a/noname/library/element/character.js b/noname/library/element/character.js index 5f786dd88..772693efb 100644 --- a/noname/library/element/character.js +++ b/noname/library/element/character.js @@ -111,7 +111,7 @@ export class Character { **/ isHiddenInStoneMode = false; /** - * 武将牌是否为炉石模式下的特殊随从(可以使用装备和锦囊) + * 武将牌是否为炉石模式下的特殊随从(可以使用装备和法术) * @type { boolean } **/ isSpecialInStoneMode = false; @@ -135,11 +135,21 @@ export class Character { * @type { boolean } **/ isJiangeMech = false; + /** + * 武将牌是否在国战模式下拥有独立的皮肤 + * @type { boolean } + **/ + hasSkinInGuozhan = false; /** * 武将牌对应的全部宗族 * @type { string[] } **/ clans = []; + /** + * 武将牌“无法享受到的主公/地主红利” + * @type { string[] } + **/ + initFilters = []; /** * @param { Array|Object } [data] */ @@ -177,6 +187,8 @@ export class Character { character.isUnseen = true; } else if (item === "minskin") { character.isMinskin = true; + } else if (item === "gzskin") { + character.hasSkinInGuozhan = true; } else if (item === "boss") { character.isBoss = true; } else if (item === "chessboss") { @@ -207,6 +219,8 @@ export class Character { character.doubleGroup = item.slice(12).split(":"); } else if (item.startsWith("clan:")) { clans.push(item.slice(5)); + } else if (item.startsWith("InitFilter:")) { + character.initFilters = item.slice(11).split(":"); } else { keptTrashes.push(item); } @@ -277,6 +291,9 @@ export class Character { if (character.isMinskin) { trashes.push("minskin"); } + if (character.hasSkinInGuozhan) { + trashes.push("gzskin"); + } if (character.isBoss) { trashes.push("boss"); } @@ -322,6 +339,9 @@ export class Character { if (character.clans.length > 0) { character.clans.forEach((item) => trashes.push(`clan:${item}`)); } + if (character.initFilters.length > 0) { + trashes.push(`InitFilters:${character.initFilters.join(":")}`); + } return trashes.concat(character.trashBin); } diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 21b4e2638..32e1c762d 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -131,7 +131,7 @@ export const Content = { game.log( player, "获得了技能", - ...event.addSkill.map((i) => { + ...event.addSkill.filter(i => i in lib.translate).map((i) => { return "#g【" + get.translation(i) + "】"; }) ); @@ -141,7 +141,7 @@ export const Content = { game.log( player, "失去了技能", - ...event.removeSkill.map((i) => { + ...event.removeSkill.filter(i => i in lib.translate).map((i) => { return "#g【" + get.translation(i) + "】"; }) ); diff --git a/noname/library/element/player.js b/noname/library/element/player.js index db5a43df4..15a0bfbda 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -2562,6 +2562,7 @@ export class Player extends HTMLDivElement { * @param { string } character */ changeSkin(map, character) { + //TODO: 这一坨改不动了 谁爱改谁改 if (!map || !character) { console.warn("error: no sourceMap or character to changeSkin", get.translation(this)); return; @@ -7597,6 +7598,7 @@ export class Player extends HTMLDivElement { } } game.broadcastAll( + //TODO: 这里直接修改trashBin部分,后续需要修改为新写法 function (player, skill, cfg) { lib.skill[skill] = { intro: { @@ -7612,9 +7614,9 @@ export class Player extends HTMLDivElement { if (Array.isArray(cfg.image)) { cfg.image.forEach((image) => lib.character[skill][4].push(image)); } else if (typeof cfg.image == "string") { - lib.character[skill][4].push(cfg.image); + lib.character[skill].trashBin.push(cfg.image); } else { - lib.character[skill][4].push("character:" + cfg.name); + lib.character[skill].trashBin.push("character:" + cfg.name); } lib.translate[skill] = cfg.caption || get.rawName(cfg.name); player.storage[skill] = cfg; @@ -9301,7 +9303,7 @@ export class Player extends HTMLDivElement { const player = this; for (const name of [player.name, player.name1, player.name2]) { if (name && lib.character[name]) { - const filter = get.characterInitFilter(name); + const filter = lib.character[name].initFilters; if (!filter.includes(tag)) continue; if (lib.characterInitFilter[name] && lib.characterInitFilter[name](tag) === false) continue; return true; diff --git a/noname/ui/click/index.js b/noname/ui/click/index.js index c87c1d0cd..b07f17755 100644 --- a/noname/ui/click/index.js +++ b/noname/ui/click/index.js @@ -347,7 +347,7 @@ export class Click { uiintro.listen(function () { _status.clicked = true; }); - uiintro.style.zIndex = 21; + uiintro.style.zIndex = "21"; uiintro.classList.add("popped"); uiintro.classList.add("static"); uiintro.classList.add("onlineclient"); @@ -3186,7 +3186,7 @@ export class Click { delete lib.config.skin[nameskin]; if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) { bg.setBackground(nameskin2, "character"); @@ -3206,7 +3206,7 @@ export class Click { } else { if ( gzbool && - lib.character[nameskin2][4].includes("gzskin") && + lib.character[nameskin2].hasSkinInGuozhan && lib.config.mode_config.guozhan.guozhanSkin ) button.setBackground(nameskin2, "character", "noskin"); @@ -3483,6 +3483,7 @@ export class Click { }; } else { // 样式一 + //TODO: 这里的数据也暂时没有改成新格式,需要后续的修改 const introduction = ui.create.div(".characterintro", uiintro), showCharacterNamePinyin = lib.config.show_characternamepinyin; if (showCharacterNamePinyin != "doNotShow") { @@ -3490,7 +3491,7 @@ export class Click { span = document.createElement("span"); span.style.fontWeight = "bold"; const nameInfo = get.character(name), - exInfo = nameInfo[4], + exInfo = nameInfo.trashBin, characterName = exInfo && exInfo.includes("ruby") ? lib.translate[name] : get.rawName2(name); span.innerHTML = characterName; diff --git a/noname/ui/create/menu/pages/exetensionMenu.js b/noname/ui/create/menu/pages/exetensionMenu.js index df9bd3cb3..d0b8fce07 100644 --- a/noname/ui/create/menu/pages/exetensionMenu.js +++ b/noname/ui/create/menu/pages/exetensionMenu.js @@ -370,6 +370,7 @@ export const extensionMenu = function (connectMenu) { ",package:" + get.stringify({ //替换die audio,加上扩展名 + //TODO: 创建扩展这部分更是重量级 character: ((pack) => { var character = pack.character; for (var key in character) {