继续进行一部分垃圾分类

This commit is contained in:
Spmario233 2024-04-23 22:10:02 +08:00
parent 1f96b1f3ee
commit 34dee77fa8
11 changed files with 59 additions and 48 deletions

View File

@ -5867,7 +5867,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
return target.isMin(); return target.isMin();
}, },
content: function () { content: function () {
target.clearSkills(); target.clearSkills(true);
target.init("stone_qingwa"); target.init("stone_qingwa");
target.noPhaseDelay = true; target.noPhaseDelay = true;
}, },

View File

@ -85,9 +85,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
lib.mechlist.push(i); lib.mechlist.push(i);
} }
lib.character[i] = lib.characterPack.mode_tafang[i]; lib.character[i] = lib.characterPack.mode_tafang[i];
if (!lib.character[i][4]) {
lib.character[i][4] = [];
}
} }
ui.create.cardsAsync(); ui.create.cardsAsync();
game.finishCards(); game.finishCards();

View File

@ -717,9 +717,6 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
ui.arena.classList.add("choose-character"); ui.arena.classList.add("choose-character");
for (var i in lib.characterPack.mode_versus) { for (var i in lib.characterPack.mode_versus) {
lib.character[i] = lib.characterPack.mode_versus[i]; 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_liedixuande = lib.characterIntro.liubei;
lib.characterIntro.boss_gongshenyueying = lib.characterIntro.huangyueying; lib.characterIntro.boss_gongshenyueying = lib.characterIntro.huangyueying;
@ -753,7 +750,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
event.list = list; event.list = list;
if (lib.characterPack.boss) { if (lib.characterPack.boss) {
for (var i in lib.characterPack.boss) { for (var i in lib.characterPack.boss) {
if (!lib.character[i] && lib.characterPack.boss[i][4]) { if (!lib.character[i]) {
if ( if (
get.convertedCharacter(lib.characterPack.boss[i]).isJiangeBoss || get.convertedCharacter(lib.characterPack.boss[i]).isJiangeBoss ||
get.convertedCharacter(lib.characterPack.boss[i]).isJiangeMech 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) { for (var i in lib.character) {
if (lib.character[i][4]) { if (lib.character[i].isJiangeBoss) {
if (lib.character[i].isJiangeBoss) { list[lib.character[i].group + "boss"].push(i);
list[lib.character[i].group + "boss"].push(i); continue;
continue; } else if (lib.character[i].isJiangeMech) {
} else if (lib.character[i].isJiangeMech) { list[lib.character[i].group + "mech"].push(i);
list[lib.character[i].group + "mech"].push(i); continue;
continue;
}
} }
if (lib.filter.characterDisabled(i)) continue; if (lib.filter.characterDisabled(i)) continue;
if (get.is.double(i)) continue; if (get.is.double(i)) continue;
if (lib.character[i][1] == "wei") { if (lib.character[i].group == "wei") {
list.weilist.push(i); list.weilist.push(i);
} else if (lib.character[i][1] == "shu") { } else if (lib.character[i].group == "shu") {
list.shulist.push(i); list.shulist.push(i);
} }
} }
@ -821,10 +816,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
}; };
var createCharacterDialog = function () { var createCharacterDialog = function () {
event.dialogxx = ui.create.characterDialog("heightset", function (name) { event.dialogxx = ui.create.characterDialog("heightset", function (name) {
if (lib.character[name][4]) { if (lib.character[name].isJiangeBoss) return true;
if (lib.character[name][4].includes("jiangeboss")) return true; if (lib.character[name].isJiangeMech) return true;
if (lib.character[name][4].includes("jiangemech")) return true;
}
if (lib.character[name][1] != game.me.identity) return true; if (lib.character[name][1] != game.me.identity) return true;
}); });
if (ui.cheat2) { if (ui.cheat2) {

View File

@ -4702,6 +4702,7 @@ export class Game {
* @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information
*/ */
addCharacter(name, information) { addCharacter(name, information) {
//TODO: 这一坨也要改
const extensionName = _status.extension || information.extension, const extensionName = _status.extension || information.extension,
character = [ character = [
information.sex, information.sex,

View File

@ -625,10 +625,8 @@ export class Get {
} }
characterInitFilter(name) { characterInitFilter(name) {
const info = get.character(name); const info = get.character(name);
if (!info || !info[4]) return []; if (!info) return [];
const filter = info[4].find((tag) => tag.startsWith("InitFilter")); return info.initFilters || [];
if (!filter) return [];
return filter.split(":").slice(1);
} }
characterIntro(name) { characterIntro(name) {
if (lib.characterIntro[name]) return lib.characterIntro[name]; if (lib.characterIntro[name]) return lib.characterIntro[name];
@ -2612,12 +2610,10 @@ export class Get {
gainableSkillsName(name, func) { gainableSkillsName(name, func) {
var list = []; var list = [];
if (name && lib.character[name]) { if (name && lib.character[name]) {
if (lib.character[name][4]) { if (lib.character[name].isBoss) return list;
if (lib.character[name].isBoss) return list; if (lib.character[name].isHiddenBoss) return list;
if (lib.character[name].isHiddenBoss) return list; if (lib.character[name].isMinskin) return list;
if (lib.character[name].isMinskin) return list; if (lib.character[name].isUnseen) return list;
if (lib.character[name].isUnseen) return list;
}
for (var skill of lib.character[name].skills) { for (var skill of lib.character[name].skills) {
var info = lib.skill[skill]; var info = lib.skill[skill];
if (lib.filter.skillDisabled(skill)) continue; if (lib.filter.skillDisabled(skill)) continue;
@ -3604,7 +3600,7 @@ export class Get {
if (avatar2) { if (avatar2) {
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
node.node.avatar2.setBackground(nameskin2, "character"); node.node.avatar2.setBackground(nameskin2, "character");
@ -3612,7 +3608,7 @@ export class Get {
} else { } else {
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
node.node.avatar.setBackground(nameskin2, "character"); node.node.avatar.setBackground(nameskin2, "character");
@ -3627,7 +3623,7 @@ export class Get {
} else { } else {
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
button.setBackground(nameskin2, "character", "noskin"); button.setBackground(nameskin2, "character", "noskin");
@ -4230,7 +4226,7 @@ export class Get {
delete lib.config.skin[nameskin]; delete lib.config.skin[nameskin];
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
node.setBackground(nameskin2, "character"); node.setBackground(nameskin2, "character");
@ -4244,7 +4240,7 @@ export class Get {
} else { } else {
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
button.setBackground(nameskin2, "character", "noskin"); button.setBackground(nameskin2, "character", "noskin");

View File

@ -150,7 +150,7 @@ Reflect.defineProperty(HTMLDivElement.prototype, "setBackground", {
if ( if (
lib.config.mode_config.guozhan.guozhanSkin && lib.config.mode_config.guozhan.guozhanSkin &&
lib.character[name] && lib.character[name] &&
lib.character[name][4].includes("gzskin") lib.character[name].hasSkinInGuozhan
) )
gzbool = true; gzbool = true;
name = name.slice(3); name = name.slice(3);

View File

@ -111,7 +111,7 @@ export class Character {
**/ **/
isHiddenInStoneMode = false; isHiddenInStoneMode = false;
/** /**
* 武将牌是否为炉石模式下的特殊随从可以使用装备和锦囊 * 武将牌是否为炉石模式下的特殊随从可以使用装备和法术
* @type { boolean } * @type { boolean }
**/ **/
isSpecialInStoneMode = false; isSpecialInStoneMode = false;
@ -135,11 +135,21 @@ export class Character {
* @type { boolean } * @type { boolean }
**/ **/
isJiangeMech = false; isJiangeMech = false;
/**
* 武将牌是否在国战模式下拥有独立的皮肤
* @type { boolean }
**/
hasSkinInGuozhan = false;
/** /**
* 武将牌对应的全部宗族 * 武将牌对应的全部宗族
* @type { string[] } * @type { string[] }
**/ **/
clans = []; clans = [];
/**
* 武将牌无法享受到的主公/地主红利
* @type { string[] }
**/
initFilters = [];
/** /**
* @param { Array|Object } [data] * @param { Array|Object } [data]
*/ */
@ -177,6 +187,8 @@ export class Character {
character.isUnseen = true; character.isUnseen = true;
} else if (item === "minskin") { } else if (item === "minskin") {
character.isMinskin = true; character.isMinskin = true;
} else if (item === "gzskin") {
character.hasSkinInGuozhan = true;
} else if (item === "boss") { } else if (item === "boss") {
character.isBoss = true; character.isBoss = true;
} else if (item === "chessboss") { } else if (item === "chessboss") {
@ -207,6 +219,8 @@ export class Character {
character.doubleGroup = item.slice(12).split(":"); character.doubleGroup = item.slice(12).split(":");
} else if (item.startsWith("clan:")) { } else if (item.startsWith("clan:")) {
clans.push(item.slice(5)); clans.push(item.slice(5));
} else if (item.startsWith("InitFilter:")) {
character.initFilters = item.slice(11).split(":");
} else { } else {
keptTrashes.push(item); keptTrashes.push(item);
} }
@ -277,6 +291,9 @@ export class Character {
if (character.isMinskin) { if (character.isMinskin) {
trashes.push("minskin"); trashes.push("minskin");
} }
if (character.hasSkinInGuozhan) {
trashes.push("gzskin");
}
if (character.isBoss) { if (character.isBoss) {
trashes.push("boss"); trashes.push("boss");
} }
@ -322,6 +339,9 @@ export class Character {
if (character.clans.length > 0) { if (character.clans.length > 0) {
character.clans.forEach((item) => trashes.push(`clan:${item}`)); character.clans.forEach((item) => trashes.push(`clan:${item}`));
} }
if (character.initFilters.length > 0) {
trashes.push(`InitFilters:${character.initFilters.join(":")}`);
}
return trashes.concat(character.trashBin); return trashes.concat(character.trashBin);
} }

View File

@ -131,7 +131,7 @@ export const Content = {
game.log( game.log(
player, player,
"获得了技能", "获得了技能",
...event.addSkill.map((i) => { ...event.addSkill.filter(i => i in lib.translate).map((i) => {
return "#g【" + get.translation(i) + "】"; return "#g【" + get.translation(i) + "】";
}) })
); );
@ -141,7 +141,7 @@ export const Content = {
game.log( game.log(
player, player,
"失去了技能", "失去了技能",
...event.removeSkill.map((i) => { ...event.removeSkill.filter(i => i in lib.translate).map((i) => {
return "#g【" + get.translation(i) + "】"; return "#g【" + get.translation(i) + "】";
}) })
); );

View File

@ -2562,6 +2562,7 @@ export class Player extends HTMLDivElement {
* @param { string } character * @param { string } character
*/ */
changeSkin(map, character) { changeSkin(map, character) {
//TODO: 这一坨改不动了 谁爱改谁改
if (!map || !character) { if (!map || !character) {
console.warn("error: no sourceMap or character to changeSkin", get.translation(this)); console.warn("error: no sourceMap or character to changeSkin", get.translation(this));
return; return;
@ -7597,6 +7598,7 @@ export class Player extends HTMLDivElement {
} }
} }
game.broadcastAll( game.broadcastAll(
//TODO: 这里直接修改trashBin部分后续需要修改为新写法
function (player, skill, cfg) { function (player, skill, cfg) {
lib.skill[skill] = { lib.skill[skill] = {
intro: { intro: {
@ -7612,9 +7614,9 @@ export class Player extends HTMLDivElement {
if (Array.isArray(cfg.image)) { if (Array.isArray(cfg.image)) {
cfg.image.forEach((image) => lib.character[skill][4].push(image)); cfg.image.forEach((image) => lib.character[skill][4].push(image));
} else if (typeof cfg.image == "string") { } else if (typeof cfg.image == "string") {
lib.character[skill][4].push(cfg.image); lib.character[skill].trashBin.push(cfg.image);
} else { } 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); lib.translate[skill] = cfg.caption || get.rawName(cfg.name);
player.storage[skill] = cfg; player.storage[skill] = cfg;
@ -9301,7 +9303,7 @@ export class Player extends HTMLDivElement {
const player = this; const player = this;
for (const name of [player.name, player.name1, player.name2]) { for (const name of [player.name, player.name1, player.name2]) {
if (name && lib.character[name]) { if (name && lib.character[name]) {
const filter = get.characterInitFilter(name); const filter = lib.character[name].initFilters;
if (!filter.includes(tag)) continue; if (!filter.includes(tag)) continue;
if (lib.characterInitFilter[name] && lib.characterInitFilter[name](tag) === false) continue; if (lib.characterInitFilter[name] && lib.characterInitFilter[name](tag) === false) continue;
return true; return true;

View File

@ -347,7 +347,7 @@ export class Click {
uiintro.listen(function () { uiintro.listen(function () {
_status.clicked = true; _status.clicked = true;
}); });
uiintro.style.zIndex = 21; uiintro.style.zIndex = "21";
uiintro.classList.add("popped"); uiintro.classList.add("popped");
uiintro.classList.add("static"); uiintro.classList.add("static");
uiintro.classList.add("onlineclient"); uiintro.classList.add("onlineclient");
@ -3186,7 +3186,7 @@ export class Click {
delete lib.config.skin[nameskin]; delete lib.config.skin[nameskin];
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) { ) {
bg.setBackground(nameskin2, "character"); bg.setBackground(nameskin2, "character");
@ -3206,7 +3206,7 @@ export class Click {
} else { } else {
if ( if (
gzbool && gzbool &&
lib.character[nameskin2][4].includes("gzskin") && lib.character[nameskin2].hasSkinInGuozhan &&
lib.config.mode_config.guozhan.guozhanSkin lib.config.mode_config.guozhan.guozhanSkin
) )
button.setBackground(nameskin2, "character", "noskin"); button.setBackground(nameskin2, "character", "noskin");
@ -3483,6 +3483,7 @@ export class Click {
}; };
} else { } else {
// 样式一 // 样式一
//TODO: 这里的数据也暂时没有改成新格式,需要后续的修改
const introduction = ui.create.div(".characterintro", uiintro), const introduction = ui.create.div(".characterintro", uiintro),
showCharacterNamePinyin = lib.config.show_characternamepinyin; showCharacterNamePinyin = lib.config.show_characternamepinyin;
if (showCharacterNamePinyin != "doNotShow") { if (showCharacterNamePinyin != "doNotShow") {
@ -3490,7 +3491,7 @@ export class Click {
span = document.createElement("span"); span = document.createElement("span");
span.style.fontWeight = "bold"; span.style.fontWeight = "bold";
const nameInfo = get.character(name), const nameInfo = get.character(name),
exInfo = nameInfo[4], exInfo = nameInfo.trashBin,
characterName = characterName =
exInfo && exInfo.includes("ruby") ? lib.translate[name] : get.rawName2(name); exInfo && exInfo.includes("ruby") ? lib.translate[name] : get.rawName2(name);
span.innerHTML = characterName; span.innerHTML = characterName;

View File

@ -370,6 +370,7 @@ export const extensionMenu = function (connectMenu) {
",package:" + ",package:" +
get.stringify({ get.stringify({
//替换die audio加上扩展名 //替换die audio加上扩展名
//TODO: 创建扩展这部分更是重量级
character: ((pack) => { character: ((pack) => {
var character = pack.character; var character = pack.character;
for (var key in character) { for (var key in character) {