使队伍觉醒效果的潜觉也显示高亮指示

This commit is contained in:
枫谷剑仙 2025-05-12 20:31:10 +08:00
parent 369cb2d1a8
commit f4d8a048a1
3 changed files with 42 additions and 13 deletions

View File

@ -48,12 +48,13 @@ const localStorage_getBoolean = function(name, defaultValue = false) {
else return Boolean(Number(value)); else return Boolean(Number(value));
} }
// 将字符串转为二进制字符串 // 将字符串转为 Blob
String.prototype.toUTF8Blob = function() { String.prototype.toUTF8Blob = function() {
return new Blob([this.valueOf()], { return new Blob([this.valueOf()], {
type: 'text/plain' type: 'text/plain'
}); });
} }
//将 Blob 转为 Base64
Blob.prototype.toBase64 = function() { Blob.prototype.toBase64 = function() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const fileReader = new FileReader(); const fileReader = new FileReader();
@ -120,12 +121,12 @@ const Base64 = {
strToBase64: function(str) { strToBase64: function(str) {
const encoder = new TextEncoder() const encoder = new TextEncoder()
const view = encoder.encode(str); const view = encoder.encode(str);
const base64 = Base64.encodeFromUint8Array(view); const base64 = view.toBase64(view);
return base64; return base64;
}, },
base64ToStr: function(base64) { base64ToStr: function(base64) {
const decoder = new TextDecoder() const decoder = new TextDecoder()
const view = Base64.decodeToUint8Array(base64); const view = Uint8Array.fromBase64(base64);
const str = decoder.decode(view); const str = decoder.decode(view);
return str; return str;
}, },

View File

@ -4101,7 +4101,7 @@ function initialize() {
const t = document.body.querySelector('#template-team-awoken-effect'); const t = document.body.querySelector('#template-team-awoken-effect');
const clone = document.importNode(t.content, true); const clone = document.importNode(t.content, true);
const akIcons = clone.querySelectorAll(".awoken-icon"); const akIcons = clone.querySelectorAll(":where(.awoken-icon,.latent-icon.show-enabling-awokwn)");
akIcons.forEach(icon=>{ akIcons.forEach(icon=>{
icon.onmouseenter = highlightAwokenMemberForIcon; icon.onmouseenter = highlightAwokenMemberForIcon;
icon.onmouseleave = removeAllHighlightOnAwokenMenber; icon.onmouseleave = removeAllHighlightOnAwokenMenber;
@ -7197,20 +7197,48 @@ function refreshTeamAwokenEfeect(awokenEffectDom, team, ti, option) {
targetValue.setAttribute(dataAttrName, count * 5); targetValue.setAttribute(dataAttrName, count * 5);
} }
} }
function highlightAwokenMember(inputAwoken, teamDom) { function highlightAwokenMember(event, teamIndex) {
if (!teamDom) return; //每次只生效一个队伍,没有目标队伍就退出 if (teamIndex<0) return; //没有目标队伍就退出
const teamBox = formationBox.querySelector(`.teams .team-bigbox:nth-of-type(${teamIndex+1})`);
if (!teamBox) return; //没有目标队伍就退出
const icon = this;
const akId = (icon=>{ const akId = (icon=>{
if (Number.isInteger(icon)) { if (Number.isInteger(icon)) {
return icon; return icon;
} else if (icon instanceof HTMLElement && icon.hasAttribute("data-awoken-icon")) { } else if (icon instanceof HTMLElement && icon.hasAttribute("data-awoken-icon")) {
return parseInt(icon.getAttribute("data-awoken-icon"), 10); return parseInt(icon.getAttribute("data-awoken-icon"), 10);
} else if (icon instanceof HTMLElement && icon.hasAttribute("data-latent-icon")) {
const latentId = parseInt(icon.getAttribute("data-latent-icon"), 10);
switch(latentId) {
case 39: return 62; //豆荚破伤吸
case 40: return 20; //心横消转转
case 41: return 27; //U消禁消
case 46: return 45; //心追解云封
case 47: return 59; //心L SB+
case 48: return 60; //L解封武器
default: return;
}
} else { } else {
throw new TypeError("输入的不是 整数 或者含 data-awoken-icon 的 HTML 元素"); throw new TypeError("输入的不是 整数 或者含 data-awoken-icon 的 HTML 元素");
} }
})(inputAwoken); })(icon);
if (!akId) return;
const eqak = equivalent_awoken.find(obj=>akId === obj.big || akId === obj.small); const eqak = equivalent_awoken.find(obj=>akId === obj.big || akId === obj.small);
const akIcons = [...teamDom.querySelectorAll(":where(.team-member-awoken,.team-assist-awoken) .awoken-icon")]; let findArea = [];
if (icon.classList.contains("latent-icon") && icon.hasAttribute("data-latent-icon")) {
const latentId = parseInt(icon.getAttribute("data-latent-icon"), 10);
formation.teams[teamIndex][0]
.forEach((member,idx)=>{
if (member.latent.includes(latentId)) {
findArea.push(...teamBox.querySelectorAll(`:where(.team-member-awoken,${latentId === 48 ? "" : ".team-assist-awoken"}) .member-awoken[data-index="${idx}"]`));
}
});
} else {
findArea.push(...teamBox.querySelectorAll(":where(.team-member-awoken,.team-assist-awoken)"));
}
const akIcons = findArea.flatMap(node=>Array.from(node.querySelectorAll(".awoken-icon")));
akIcons.filter(icon=>{ akIcons.filter(icon=>{
const iconId = parseInt(icon?.dataset?.awokenIcon, 10); const iconId = parseInt(icon?.dataset?.awokenIcon, 10);
return eqak ? (iconId === eqak.big || iconId === eqak.small) : iconId === akId; return eqak ? (iconId === eqak.big || iconId === eqak.small) : iconId === akId;
@ -7219,13 +7247,13 @@ function highlightAwokenMember(inputAwoken, teamDom) {
} }
function highlightAwokenMemberForIcon(event) { function highlightAwokenMemberForIcon(event) {
const teamBigBoxs = [...formationBox.querySelectorAll(".teams .team-bigbox")]; const teamBigBoxs = [...formationBox.querySelectorAll(".teams .team-bigbox")];
const teamBigBox = teamBigBoxs.find(box=>box.contains(this)); const teamIndex = teamBigBoxs.findIndex(box=>box.contains(this));
highlightAwokenMember(this, teamBigBox); highlightAwokenMember.call(this, event, teamIndex);
} }
function removeAllHighlightOnAwokenMenber() { function removeAllHighlightOnAwokenMenber() {
const teamBigBoxs = [...formationBox.querySelectorAll(".teams .team-bigbox")]; const teamBigBoxs = [...formationBox.querySelectorAll(".teams .team-bigbox")];
teamBigBoxs.forEach(teamDom=>{ teamBigBoxs.forEach(teamDom=>{
const akIcons = [...teamDom.querySelectorAll(":where(.team-member-awoken,.team-assist-awoken) .awoken-icon")]; const akIcons = [...teamDom.querySelectorAll(":where(.team-member-awoken,.team-assist-awoken) .awoken-icon.hightlight")];
akIcons.forEach(icon=>icon.classList.remove("hightlight")); akIcons.forEach(icon=>icon.classList.remove("hightlight"));
}); });
} }

View File

@ -48283,11 +48283,11 @@ const cachesMap = new Map([
], ],
[ [
"script-universal_function.js", "script-universal_function.js",
"15a5aecb568b504ca6e63a84748cd964" "a1fb4b6badef8b98e89665bb74c1c0a5"
], ],
[ [
"script.js", "script.js",
"9b67e5961d34e6e19da13a7ec1ef73fb" "57f70ae19d087eaf6c75ab9fef44b30c"
], ],
[ [
"solo.html", "solo.html",