初步建立lib.character类,修改部分读取

This commit is contained in:
Spmario233 2024-04-23 00:23:44 +08:00
parent d47f8ce1b1
commit c7209ee903
8 changed files with 198 additions and 187 deletions

View File

@ -1,5 +1,11 @@
const characters = { const characters = {
sp_key_yuri: ["female", "qun", 4, ["mubing", "ziqu", "diaoling"], ["border:key"]], sp_key_yuri: {
sex: "female",
group: "qun",
hp: 4,
skills: ["mubing", "ziqu", "diaoling"],
groupBorder: "key",
},
key_lucia: ["female", "key", "2/3", ["lucia_duqu", "lucia_zhenren"]], key_lucia: ["female", "key", "2/3", ["lucia_duqu", "lucia_zhenren"]],
key_kyousuke: ["male", "key", 4, ["nk_shekong", "key_huanjie"]], key_kyousuke: ["male", "key", 4, ["nk_shekong", "key_huanjie"]],
key_yuri: ["female", "key", 3, ["yuri_xingdong", "key_huanjie", "yuri_wangxi"], ["zhu"]], key_yuri: ["female", "key", 3, ["yuri_xingdong", "key_huanjie", "yuri_wangxi"], ["zhu"]],

View File

@ -7,7 +7,7 @@ import translates from "./translate.js";
game.import("character", function () { game.import("character", function () {
return { return {
name: "key/index", name: "key",
character: { ...characters }, character: { ...characters },
characterFilter: { characterFilter: {
key_jojiro(mode) { key_jojiro(mode) {

View File

@ -1051,7 +1051,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
list.push(group); list.push(group);
} }
map[group].push(i); map[group].push(i);
if (lib.character[i][4] && lib.character[i][4].includes("zhu")) { if (lib.character[i].isZhugong) {
if (!map_zhu[group]) { if (!map_zhu[group]) {
map_zhu[group] = []; map_zhu[group] = [];
} }
@ -1230,7 +1230,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
list.push(group); list.push(group);
} }
map[group].push(i); map[group].push(i);
if (lib.character[i][4] && lib.character[i][4].includes("zhu")) { if (lib.character[i].isZhugong) {
if (!map_zhu[group]) { if (!map_zhu[group]) {
map_zhu[group] = []; map_zhu[group] = [];
} }
@ -1496,8 +1496,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
if ( if (
get.is.double(result[i][0]) || get.is.double(result[i][0]) ||
(lib.character[result[i][0]] && (lib.character[result[i][0]] &&
lib.character[result[i][0]][1] == "shen" && lib.character[result[i][0]].group == "shen" &&
!lib.character[result[i][0]][4].includes("hiddenSkill")) !lib.character[result[i][0]].hasHiddenSkill)
) )
shen.push(lib.playerOL[i]); shen.push(lib.playerOL[i]);
} }
@ -2098,7 +2098,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
} else { } else {
var bool = false; var bool = false;
for (var j of ix) { for (var j of ix) {
if (lib.character[j][4] && lib.character[j][4].includes("zhu")) { if (lib.character[j].isZhugong) {
bool = true; bool = true;
break; break;
} }
@ -2113,7 +2113,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
if (lib.filter.characterDisabled(i)) continue; if (lib.filter.characterDisabled(i)) continue;
event.list.push(i); event.list.push(i);
list4.push(i); list4.push(i);
if (!stratagemMode && lib.character[i][4] && lib.character[i][4].includes("zhu")) { if (!stratagemMode && lib.character[i].isZhugong) {
list2.push(i); list2.push(i);
} else { } else {
list3.push(i); list3.push(i);
@ -2366,8 +2366,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
game.me._groupChosen = true; game.me._groupChosen = true;
game.me.chooseControl(get.is.double(name, true)).set("prompt", "请选择你的势力"); game.me.chooseControl(get.is.double(name, true)).set("prompt", "请选择你的势力");
} else if ( } else if (
lib.character[name][1] == "shen" && lib.character[name].group == "shen" &&
!lib.character[name][4].includes("hiddenSkill") && !lib.character[name].hasHiddenSkill &&
get.config("choose_group") get.config("choose_group")
) { ) {
var list = lib.group.slice(0); var list = lib.group.slice(0);
@ -2560,7 +2560,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
var pack = lib.characterPack[lib.configOL.characterPack[i]]; var pack = lib.characterPack[lib.configOL.characterPack[i]];
for (var j in pack) { for (var j in pack) {
// if(j=='zuoci') continue; // if(j=='zuoci') continue;
if (lib.character[j]) libCharacter[j] = pack[j]; if (lib.character[j]) libCharacter[j] = lib.character[j];
} }
} }
for (i in lib.characterReplace) { for (i in lib.characterReplace) {
@ -2575,7 +2575,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
list4.addArray(ix); list4.addArray(ix);
var bool = false; var bool = false;
for (var j of ix) { for (var j of ix) {
if (libCharacter[j][4] && libCharacter[j][4].includes("zhu")) { if (libCharacter[j].isZhugong) {
bool = true; bool = true;
break; break;
} }
@ -2597,7 +2597,7 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
event.list.push(i); event.list.push(i);
event.list2.push(i); event.list2.push(i);
list4.push(i); list4.push(i);
if (libCharacter[i][4] && libCharacter[i][4].includes("zhu")) { if (libCharacter[i].isZhugong) {
list2.push(i); list2.push(i);
} else { } else {
list3.push(i); list3.push(i);
@ -2772,8 +2772,8 @@ game.import("mode", function (lib, game, ui, get, ai, _status) {
if ( if (
get.is.double(result[i][0]) || get.is.double(result[i][0]) ||
(lib.character[result[i][0]] && (lib.character[result[i][0]] &&
lib.character[result[i][0]][1] == "shen" && lib.character[result[i][0]].group == "shen" &&
!lib.character[result[i][0]][4].includes("hiddenSkill")) !lib.character[result[i][0]].hasHiddenSkill)
) )
shen.push(lib.playerOL[i]); shen.push(lib.playerOL[i]);
} }

View File

@ -638,15 +638,8 @@ export class Get {
return "暂无武将介绍"; return "暂无武将介绍";
} }
bordergroup(info, raw) { bordergroup(info, raw) {
if (!Array.isArray(info)) { if(info.groupBorder) return info.groupBorder;
info = lib.character[info]; return raw ? "" : info.group || "";
if (!info) return "";
}
if (Array.isArray(info[4]))
for (const str of info[4]) {
if (typeof str == "string" && str.startsWith("border:")) return str.slice(7);
}
return raw ? "" : info[1] || "";
} }
groupnature(group, method) { groupnature(group, method) {
var nature = lib.groupnature[group]; var nature = lib.groupnature[group];
@ -2938,15 +2931,7 @@ export class Get {
} }
skillintro(name, learn, learn2) { skillintro(name, learn, learn2) {
var str = ""; var str = "";
var infoitem = lib.character[name]; var infoitem = get.character(name);
if (!infoitem) {
for (var itemx in lib.characterPack) {
if (lib.characterPack[itemx][name]) {
infoitem = lib.characterPack[itemx][name];
break;
}
}
}
var skills = infoitem[3]; var skills = infoitem[3];
var opacity; var opacity;
for (var i = 0; i < skills.length; i++) { for (var i = 0; i < skills.length; i++) {

View File

@ -307,20 +307,27 @@ export async function onload(resetGameTimeout) {
} }
for (k in character[i][j]) { for (k in character[i][j]) {
if (j == "character") { if (j == "character") {
if (!character[i][j][k][4]) {
character[i][j][k][4] = [];
}
if (
character[i][j][k][4].includes("boss") ||
character[i][j][k][4].includes("hiddenboss")
) {
lib.config.forbidai.add(k);
}
if (lib.config.forbidai_user && lib.config.forbidai_user.includes(k)) { if (lib.config.forbidai_user && lib.config.forbidai_user.includes(k)) {
lib.config.forbidai.add(k); lib.config.forbidai.add(k);
} }
for (var l = 0; l < character[i][j][k][3].length; l++) { if (Array.isArray(character[i][j][k])) {
lib.skilllist.add(character[i][j][k][3][l]); if (!character[i][j][k][4]) {
character[i][j][k][4] = [];
}
if (
character[i][j][k][4].includes("boss") ||
character[i][j][k][4].includes("hiddenboss")
) {
lib.config.forbidai.add(k);
}
for (var l = 0; l < character[i][j][k][3].length; l++) {
lib.skilllist.add(character[i][j][k][3][l]);
}
}
else{
for (var l = 0; l < character[i][j][k].skills.length; l++) {
lib.skilllist.add(character[i][j][k].skills[l]);
}
} }
} }
if ( if (
@ -346,6 +353,8 @@ export async function onload(resetGameTimeout) {
nopop: character[i][j][k].nopop, nopop: character[i][j][k].nopop,
derivation: character[i][j][k].derivation, derivation: character[i][j][k].derivation,
}; };
} else if (j === 'character') {
lib.character[k] = character[i][j][k];
} else { } else {
Object.defineProperty( Object.defineProperty(
lib[j], lib[j],
@ -649,8 +658,7 @@ export async function onload(resetGameTimeout) {
console.log(`加载《${lib.extensions[i][0]}》扩展的content时出现错误。`, e); console.log(`加载《${lib.extensions[i][0]}》扩展的content时出现错误。`, e);
if (!lib.config.extension_alert) if (!lib.config.extension_alert)
alert( alert(
`加载《${ `加载《${lib.extensions[i][0]
lib.extensions[i][0]
}扩展的content时出现错误\n该错误本身可能并不影响扩展运行您可以在设置通用无视扩展报错中关闭此弹窗\n${decodeURI( }扩展的content时出现错误\n该错误本身可能并不影响扩展运行您可以在设置通用无视扩展报错中关闭此弹窗\n${decodeURI(
e.stack e.stack
)}` )}`

View File

@ -12,13 +12,23 @@ export class Character {
/** @type { number } */ /** @type { number } */
maxHp; maxHp;
/** @type { number } */ /** @type { number } */
hujia; hujia = 0;
/** @type { string } */ /** @type { string } */
group; group;
/** @type { string } */
groupBorder;
/** @type { string } */
groupInGuozhan;
/** @type { string[] } */ /** @type { string[] } */
skills; skills = [];
/** @type { boolean } */
isZhugong = false;
/** @type { boolean } */
isUnseen = false;
/** @type { boolean } */
hasHiddenSkill = false;
/** @type { Array } */ /** @type { Array } */
trashBin; trashBin = [];
/** /**
* @param { Array|Object } [data] * @param { Array|Object } [data]
*/ */
@ -31,15 +41,35 @@ export class Character {
this.hujia = get.infoHujia(data[2]); this.hujia = get.infoHujia(data[2]);
this.skills = get.copy(data[3] || []); this.skills = get.copy(data[3] || []);
this.trashBin = get.copy(data[4] || []); this.trashBin = get.copy(data[4] || []);
Character.convertTrashToProperties(this, this.trashBin);
} }
else if (get.is.object(data)) { else if (get.is.object(data)) {
this.sex = data.sex; Object.assign(this, data);
this.group = data.group || ''; if(typeof this.maxHp !== 'number') this.maxHp = this.hp;
this.hp = data.hp || 1; }
this.maxHp = data.maxHp || this.hp; };
this.hujia = data.hujia || 0; /**
this.skills = get.copy(data.skills || []); * @param { Character } character
this.trashBin = get.copy(data.trashBin || []); * @param { Array } trash
*/
static convertTrashToProperties(character, trash){
for(let i = 0; i < trash.length; i++){
let item = trash[i];
if (i === 0 && lib.group.includes(item)){
character.groupInGuozhan = item;
}
else if(item === 'zhu'){
character.isZhugong = true;
}
else if(item === 'unseen'){
character.isUnseen = true;
}
else if(item === 'hiddenSkill'){
character.hasHiddenSkill = true;
}
else if(item.startsWith('border:')){
character.groupBorder = item.slice(7);
}
} }
}; };
/** /**

View File

@ -2358,17 +2358,14 @@ export class Player extends HTMLDivElement {
} }
var info = lib.character[character]; var info = lib.character[character];
if (!info) { if (!info) {
info = ["", "", 1, [], []]; info = new lib.element.Character(["", "", 1, [], []]);
} }
if (!info[4]) { var skills = info.skills.slice(0);
info[4] = [];
}
var skills = info[3].slice(0);
this.clearSkills(true); this.clearSkills(true);
var hp1 = get.infoHp(info[2]); var hp1 = info.hp;
var maxHp1 = get.infoMaxHp(info[2]); var maxHp1 = info.maxHp;
var hujia1 = get.infoHujia(info[2]); var hujia1 = info.hujia;
this.name = character; this.name = character;
this.name1 = character; this.name1 = character;
@ -2377,8 +2374,8 @@ export class Player extends HTMLDivElement {
name: character, name: character,
name2: character2, name2: character2,
}; };
this.sex = info[0]; this.sex = info.sex;
this.group = info[1]; this.group = info.group;
this.hp = hp1; this.hp = hp1;
this.maxHp = maxHp1; this.maxHp = maxHp1;
this.hujia = hujia1; this.hujia = hujia1;
@ -2389,7 +2386,7 @@ export class Player extends HTMLDivElement {
if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) { if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) {
this.node.name.classList.add("long"); this.node.name.classList.add("long");
} }
if (info[4].includes("hiddenSkill") && !this.noclick) { if (info.hasHiddenSkill && !this.noclick) {
if (!this.hiddenSkills) this.hiddenSkills = []; if (!this.hiddenSkills) this.hiddenSkills = [];
this.hiddenSkills.addArray(skills); this.hiddenSkills.addArray(skills);
skills = []; skills = [];
@ -2401,16 +2398,13 @@ export class Player extends HTMLDivElement {
if (character2 && lib.character[character2]) { if (character2 && lib.character[character2]) {
var info2 = lib.character[character2]; var info2 = lib.character[character2];
if (!info2) { if (!info2) {
info2 = ["", "", 1, [], []]; info2 = new lib.element.Character(["", "", 1, [], []]);
}
if (!info2[4]) {
info2[4] = [];
} }
this.name2 = character2; this.name2 = character2;
var hp2 = get.infoHp(info2[2]); var hp2 = info2.hp;
var maxHp2 = get.infoMaxHp(info2[2]); var maxHp2 = info2.maxHp;
var hujia2 = get.infoHujia(info2[2]); var hujia2 = info2.hujia;
this.hujia += hujia2; this.hujia += hujia2;
var double_hp; var double_hp;
if (_status.connectMode || get.mode() == "single") { if (_status.connectMode || get.mode() == "single") {
@ -2445,12 +2439,12 @@ export class Player extends HTMLDivElement {
this.hp = hp1 + hp2 - 3; this.hp = hp1 + hp2 - 3;
} }
} }
if (info2[4].includes("hiddenSkill") && !this.noclick) { if (info2.hasHiddenSkill && !this.noclick) {
if (!this.hiddenSkills) this.hiddenSkills = []; if (!this.hiddenSkills) this.hiddenSkills = [];
this.hiddenSkills.addArray(info2[3]); this.hiddenSkills.addArray(info2.skills);
hidden = true; hidden = true;
skills.add("g_hidden_ai"); skills.add("g_hidden_ai");
} else skills = skills.concat(info2[3]); } else skills = skills.concat(info2.skills);
} }
if (this.storage.nohp || hidden) { if (this.storage.nohp || hidden) {
this.storage.rawHp = this.hp; this.storage.rawHp = this.hp;
@ -2493,10 +2487,7 @@ export class Player extends HTMLDivElement {
this.classList.add("fullskin"); this.classList.add("fullskin");
var info = lib.character[character]; var info = lib.character[character];
if (!info) { if (!info) {
info = ["", "", 1, [], []]; info = new lib.element.Character(["", "", 1, [], []]);
}
if (!info[4]) {
info[4] = [];
} }
if (!game.minskin && get.is.newLayout() && !info[4].includes("minskin")) { if (!game.minskin && get.is.newLayout() && !info[4].includes("minskin")) {
@ -2524,7 +2515,7 @@ export class Player extends HTMLDivElement {
if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) { if (this.classList.contains("minskin") && this.node.name.querySelectorAll("br").length >= 4) {
this.node.name.classList.add("long"); this.node.name.classList.add("long");
} }
if (info[4].includes("hiddenSkill") && !this.noclick) { if (info.hasHiddenSkill && !this.noclick) {
if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen_show"); if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen_show");
this.classList.add(_status.video ? "unseen_v" : "unseen"); this.classList.add(_status.video ? "unseen_v" : "unseen");
if (!this.node.name_seat && !_status.video) { if (!this.node.name_seat && !_status.video) {
@ -2539,10 +2530,7 @@ export class Player extends HTMLDivElement {
if (character2 && lib.character[character2]) { if (character2 && lib.character[character2]) {
var info2 = lib.character[character2]; var info2 = lib.character[character2];
if (!info2) { if (!info2) {
info2 = ["", "", 1, [], []]; info2 = new lib.element.Character(["", "", 1, [], []]);
}
if (!info2[4]) {
info2[4] = [];
} }
this.classList.add("fullskin2"); this.classList.add("fullskin2");
this.node.avatar2.setBackground(character2, "character"); this.node.avatar2.setBackground(character2, "character");
@ -2550,7 +2538,7 @@ export class Player extends HTMLDivElement {
this.name2 = character2; this.name2 = character2;
this.node.count.classList.add("p2"); this.node.count.classList.add("p2");
if (info2[4].includes("hiddenSkill") && !this.noclick) { if (info2.hasHiddenSkill && !this.noclick) {
if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen2_show"); if (!_status.video && get.mode() != "guozhan") this.classList.add("unseen2_show");
this.classList.add(_status.video ? "unseen2_v" : "unseen2"); this.classList.add(_status.video ? "unseen2_v" : "unseen2");
} }

View File

@ -44,7 +44,7 @@ export class Library {
characterDefaultPicturePath = characterDefaultPicturePath; characterDefaultPicturePath = characterDefaultPicturePath;
compatibleEdition = Boolean( compatibleEdition = Boolean(
typeof nonameInitialized == "string" && typeof nonameInitialized == "string" &&
nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//) nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)
); );
changeLog = []; changeLog = [];
updates = []; updates = [];
@ -342,19 +342,19 @@ export class Library {
typeof yingbianZhuzhanAI == "function" typeof yingbianZhuzhanAI == "function"
? yingbianZhuzhanAI(player, card, source, targets) ? yingbianZhuzhanAI(player, card, source, targets)
: (cardx) => { : (cardx) => {
var info = get.info(card); var info = get.info(card);
if (info && info.ai && info.ai.yingbian) { if (info && info.ai && info.ai.yingbian) {
var ai = info.ai.yingbian( var ai = info.ai.yingbian(
card, card,
source, source,
targets, targets,
player player
); );
if (!ai) return 0; if (!ai) return 0;
return ai - get.value(cardx); return ai - get.value(cardx);
} else if (get.attitude(player, source) <= 0) return 0; } else if (get.attitude(player, source) <= 0) return 0;
return 5 - get.value(cardx); return 5 - get.value(cardx);
}, },
}); });
if (!game.online) return; if (!game.online) return;
_status.event._resultid = id; _status.event._resultid = id;
@ -1170,8 +1170,7 @@ export class Library {
unfrequent: true, unfrequent: true,
item: {}, item: {},
intro: () => intro: () =>
`获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${ `获取在线扩展时的地址。当前地址:${document.createElement("br").outerHTML}${lib.config.extension_sources[lib.config.extension_source]
lib.config.extension_sources[lib.config.extension_source]
}`, }`,
}, },
extension_create: { extension_create: {
@ -1837,7 +1836,7 @@ export class Library {
} else { } else {
this.lastChild.innerHTML = this.lastChild.innerHTML =
lib.configMenu.appearence.config.image_background.item[ lib.configMenu.appearence.config.image_background.item[
lib.config.image_background lib.config.image_background
]; ];
return; return;
} }
@ -1860,7 +1859,7 @@ export class Library {
} else { } else {
this.lastChild.innerHTML = this.lastChild.innerHTML =
lib.configMenu.appearence.config.image_background.item[ lib.configMenu.appearence.config.image_background.item[
lib.config.image_background lib.config.image_background
]; ];
return; return;
} }
@ -2064,8 +2063,8 @@ export class Library {
} }
ui.css.card_stylesheet = lib.init.sheet( ui.css.card_stylesheet = lib.init.sheet(
".card:not(*:empty){background-image:url(" + ".card:not(*:empty){background-image:url(" +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2234,8 +2233,8 @@ export class Library {
} }
ui.css.cardback_stylesheet = lib.init.sheet( ui.css.cardback_stylesheet = lib.init.sheet(
".card:empty,.card.infohidden{background-image:url(" + ".card:empty,.card.infohidden{background-image:url(" +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
game.getDB("image", "cardback_style2", function (fileToLoad) { game.getDB("image", "cardback_style2", function (fileToLoad) {
if (!fileToLoad) return; if (!fileToLoad) return;
@ -2246,8 +2245,8 @@ export class Library {
} }
ui.css.cardback_stylesheet2 = lib.init.sheet( ui.css.cardback_stylesheet2 = lib.init.sheet(
".card.infohidden:not(.infoflip){background-image:url(" + ".card.infohidden:not(.infoflip){background-image:url(" +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2404,8 +2403,8 @@ export class Library {
} }
ui.css.hp_stylesheet1 = lib.init.sheet( ui.css.hp_stylesheet1 = lib.init.sheet(
'.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url(' + '.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url(' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2419,8 +2418,8 @@ export class Library {
} }
ui.css.hp_stylesheet2 = lib.init.sheet( ui.css.hp_stylesheet2 = lib.init.sheet(
'.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url(' + '.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url(' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2434,8 +2433,8 @@ export class Library {
} }
ui.css.hp_stylesheet3 = lib.init.sheet( ui.css.hp_stylesheet3 = lib.init.sheet(
'.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url(' + '.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url(' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2449,8 +2448,8 @@ export class Library {
} }
ui.css.hp_stylesheet4 = lib.init.sheet( ui.css.hp_stylesheet4 = lib.init.sheet(
".hp:not(.text):not(.actcount)>.lost{background-image:url(" + ".hp:not(.text):not(.actcount)>.lost{background-image:url(" +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
")}" ")}"
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2571,8 +2570,8 @@ export class Library {
} }
ui.css.player_stylesheet = lib.init.sheet( ui.css.player_stylesheet = lib.init.sheet(
'#window .player{background-image:url("' + '#window .player{background-image:url("' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
'");background-size:100% 100%;}' '");background-size:100% 100%;}'
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2709,8 +2708,8 @@ export class Library {
ui.css.border_stylesheet.id = "ui.css.border"; ui.css.border_stylesheet.id = "ui.css.border";
ui.css.border_stylesheet.sheet.insertRule( ui.css.border_stylesheet.sheet.insertRule(
'#window .player>.framebg{display:block;background-image:url("' + '#window .player>.framebg{display:block;background-image:url("' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
'")}', '")}',
0 0
); );
ui.css.border_stylesheet.sheet.insertRule( ui.css.border_stylesheet.sheet.insertRule(
@ -2730,18 +2729,18 @@ export class Library {
} }
ui.css.border_stylesheet.sheet.insertRule( ui.css.border_stylesheet.sheet.insertRule(
'#window .player>.framebg,#window #arena.long.mobile:not(.fewplayer) .player[data-position="0"]>.framebg{display:block;background-image:url("' + '#window .player>.framebg,#window #arena.long.mobile:not(.fewplayer) .player[data-position="0"]>.framebg{display:block;background-image:url("' +
lib.assetURL + lib.assetURL +
"theme/style/player/" + "theme/style/player/" +
layout + layout +
'1.png")}', '1.png")}',
0 0
); );
ui.css.border_stylesheet.sheet.insertRule( ui.css.border_stylesheet.sheet.insertRule(
'#window #arena.long:not(.fewplayer) .player>.framebg, #arena.oldlayout .player>.framebg{background-image:url("' + '#window #arena.long:not(.fewplayer) .player>.framebg, #arena.oldlayout .player>.framebg{background-image:url("' +
lib.assetURL + lib.assetURL +
"theme/style/player/" + "theme/style/player/" +
layout + layout +
'3.png")}', '3.png")}',
0 0
); );
ui.css.border_stylesheet.sheet.insertRule( ui.css.border_stylesheet.sheet.insertRule(
@ -2924,8 +2923,8 @@ export class Library {
} }
ui.css.menu_stylesheet = lib.init.sheet( ui.css.menu_stylesheet = lib.init.sheet(
'html #window>.dialog.popped,html .menu,html .menubg{background-image:url("' + 'html #window>.dialog.popped,html .menu,html .menubg{background-image:url("' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
'");background-size:cover}' '");background-size:cover}'
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -2947,8 +2946,8 @@ export class Library {
} }
ui.css.menu_stylesheet = lib.init.sheet( ui.css.menu_stylesheet = lib.init.sheet(
"html #window>.dialog.popped,html .menu,html .menubg{background-image:" + "html #window>.dialog.popped,html .menu,html .menubg{background-image:" +
str + str +
"}" "}"
); );
} }
}, },
@ -3062,8 +3061,8 @@ export class Library {
} }
ui.css.control_stylesheet = lib.init.sheet( ui.css.control_stylesheet = lib.init.sheet(
'#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:url("' + '#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:url("' +
fileLoadedEvent.target.result + fileLoadedEvent.target.result +
'")}' '")}'
); );
}; };
fileReader.readAsDataURL(fileToLoad, "UTF-8"); fileReader.readAsDataURL(fileToLoad, "UTF-8");
@ -3086,14 +3085,14 @@ export class Library {
if (layout == "wood") { if (layout == "wood") {
ui.css.control_stylesheet = lib.init.sheet( ui.css.control_stylesheet = lib.init.sheet(
"#window .control,#window .menubutton,#window #system>div>div,#window #system>div>.pressdown2{background-image:" + "#window .control,#window .menubutton,#window #system>div>div,#window #system>div>.pressdown2{background-image:" +
str + str +
"}" "}"
); );
} else { } else {
ui.css.control_stylesheet = lib.init.sheet( ui.css.control_stylesheet = lib.init.sheet(
"#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:" + "#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:" +
str + str +
"}" "}"
); );
} }
} }
@ -3128,20 +3127,20 @@ export class Library {
} }
ui.css.buttonsheet = lib.init.sheet( ui.css.buttonsheet = lib.init.sheet(
"#system>div>div, .caption>div>.tdnode{padding-top:" + "#system>div>div, .caption>div>.tdnode{padding-top:" +
cbnum1 + cbnum1 +
"px !important;padding-bottom:" + "px !important;padding-bottom:" +
cbnum2 + cbnum2 +
"px !important}", "px !important}",
"#control>.control>div{padding-top:" + "#control>.control>div{padding-top:" +
cbnum3 + cbnum3 +
"px;padding-bottom:" + "px;padding-bottom:" +
cbnum4 + cbnum4 +
"px}", "px}",
"#control>.control{padding-top:" + "#control>.control{padding-top:" +
cbnum5 + cbnum5 +
"px;padding-bottom:" + "px;padding-bottom:" +
cbnum6 + cbnum6 +
"px}" "px}"
); );
} }
}, },
@ -8484,10 +8483,10 @@ export class Library {
genAwait(item) { genAwait(item) {
return gnc.is.generator(item) return gnc.is.generator(item)
? gnc.of(function* () { ? gnc.of(function* () {
for (const content of item) { for (const content of item) {
yield content; yield content;
} }
})() })()
: Promise.resolve(item); : Promise.resolve(item);
} }
gnc = { gnc = {
@ -9209,9 +9208,9 @@ export class Library {
log("键:" + (f - sf) + "/" + f); log("键:" + (f - sf) + "/" + f);
log( log(
"已启用:" + "已启用:" +
(a + b + c + d + e + f - (sa + sb + sc + sd + se + sf)) + (a + b + c + d + e + f - (sa + sb + sc + sd + se + sf)) +
"/" + "/" +
(a + b + c + d + e + f) (a + b + c + d + e + f)
); );
})(); })();
(function () { (function () {
@ -11139,9 +11138,8 @@ export class Library {
content: (storage, player) => { content: (storage, player) => {
const stratagemFuryMax = _status.stratagemFuryMax, const stratagemFuryMax = _status.stratagemFuryMax,
fury = storage || 0; fury = storage || 0;
return `当前怒气值:${ return `当前怒气值:${typeof stratagemFuryMax == "number" ? `${fury}/${stratagemFuryMax}` : fury
typeof stratagemFuryMax == "number" ? `${fury}/${stratagemFuryMax}` : fury }`;
}`;
}, },
}, },
}, },
@ -11214,7 +11212,7 @@ export class Library {
return ( return (
((zhibi && !zhibi.includes(current)) || ((zhibi && !zhibi.includes(current)) ||
get.effect(current, card, player, player) >= get.effect(current, card, player, player) >=
2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) &&
current.mayHaveShan( current.mayHaveShan(
player, player,
"use", "use",
@ -11268,16 +11266,16 @@ export class Library {
const cardName = get.name(cards[0], player); const cardName = get.name(cards[0], player);
return cardName return cardName
? new lib.element.VCard({ ? new lib.element.VCard({
name: cardName, name: cardName,
nature: get.nature(cards[0], player), nature: get.nature(cards[0], player),
suit: get.suit(cards[0], player), suit: get.suit(cards[0], player),
number: get.number(cards[0], player), number: get.number(cards[0], player),
isCard: true, isCard: true,
cards: [cards[0]], cards: [cards[0]],
storage: { storage: {
stratagem_buffed: 1, stratagem_buffed: 1,
}, },
}) })
: new lib.element.VCard(); : new lib.element.VCard();
} }
return null; return null;
@ -11295,9 +11293,8 @@ export class Library {
)}点怒气${prompt()}`; )}点怒气${prompt()}`;
span.appendChild(li); span.appendChild(li);
}); });
return `当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。${ return `当你需要使用位于“强化表”内的非虚拟卡牌时,你可以消耗对应数量的怒气将其强化并使用。${document.createElement("hr").outerHTML
document.createElement("hr").outerHTML }${span.outerHTML}`;
}${span.outerHTML}`;
}, },
onuse: (result, player) => { onuse: (result, player) => {
player.logSkill(result.skill); player.logSkill(result.skill);
@ -11332,7 +11329,7 @@ export class Library {
return ( return (
((zhibi && !zhibi.includes(current)) || ((zhibi && !zhibi.includes(current)) ||
get.effect(current, card, player, player) >= get.effect(current, card, player, player) >=
2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) &&
current.mayHaveShan( current.mayHaveShan(
player, player,
"use", "use",
@ -12778,15 +12775,12 @@ export class Library {
}, },
}, },
}; };
character = new Proxy( character = new Proxy({}, {
{}, set(target, prop, newValue) {
{ if(!(newValue instanceof Element.Character)) newValue = new Element.Character(newValue);
set(target, prop, newValue){ return Reflect.set(target, prop, newValue);
newValue = new lib.element.Character(newValue);
return Reflect.set(target, prop, newValue);
}
} }
); });
perfectPair = {}; perfectPair = {};
cardPile = {}; cardPile = {};
message = { message = {
@ -13379,7 +13373,7 @@ export class Library {
navigator.clipboard navigator.clipboard
.readText() .readText()
.then(read) .then(read)
.catch((_) => {}); .catch((_) => { });
} else { } else {
var input = ui.create.node("textarea", ui.window, { opacity: "0" }); var input = ui.create.node("textarea", ui.window, { opacity: "0" });
input.select(); input.select();