属性选择预览处,加入随机变动动画。

修订心属性第四属性的1像素错位。
技能阶段语音技能的显示方式修订。
This commit is contained in:
枫谷剑仙 2024-10-06 23:02:10 +08:00
parent 6fe6702ed0
commit 3c854e819a
9 changed files with 48 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 161 KiB

View File

@ -137,7 +137,7 @@ const _localTranslating = {
board_size_change: tp`板面大小改变为${'icon'}${'size'}`, board_size_change: tp`板面大小改变为${'icon'}${'size'}`,
remove_assist: tp`${'icon'}移除自身的辅助宠物(直到地下城结束)`, remove_assist: tp`${'icon'}移除自身的辅助宠物(直到地下城结束)`,
prediction_falling: tp`盘面上可以${'icon'}预知宝珠掉落`, prediction_falling: tp`盘面上可以${'icon'}预知宝珠掉落`,
play_voice: tp`使用技能时播放另一段语音 ${'icon'}`, play_voice: tp`播放第 ${'stage'} 阶段的语音 ${'icon'}`,
}, },
power: { power: {
unknown: tp`[ 未知能力提升: ${'type'} ]`, unknown: tp`[ 未知能力提升: ${'type'} ]`,

View File

@ -137,7 +137,7 @@ const _localTranslating = {
board_size_change: tp`板面大小改變為${'icon'}${'size'}`, board_size_change: tp`板面大小改變為${'icon'}${'size'}`,
remove_assist: tp`${'icon'}移除自身的輔助寵物(直到地下城結束)`, remove_assist: tp`${'icon'}移除自身的輔助寵物(直到地下城結束)`,
prediction_falling: tp`盤面上可以${'icon'}預知寶珠掉落`, prediction_falling: tp`盤面上可以${'icon'}預知寶珠掉落`,
play_voice: tp`使用技能時播放另一段語音 ${'icon'}`, play_voice: tp`播放第 ${'stage'} 階段的語音 ${'icon'}`,
}, },
power: { power: {
unknown: tp`[ 未知能力提升: ${'type'} ]`, unknown: tp`[ 未知能力提升: ${'type'} ]`,

View File

@ -152,7 +152,7 @@ let localTranslating = {
board_size_change: tp`Board size changed to ${'icon'}${'size'}`, board_size_change: tp`Board size changed to ${'icon'}${'size'}`,
remove_assist: tp`${'icon'}Remove this assist card (until end of dungeon)`, remove_assist: tp`${'icon'}Remove this assist card (until end of dungeon)`,
prediction_falling: tp`${'icon'}Prediction of falling on board`, prediction_falling: tp`${'icon'}Prediction of falling on board`,
play_voice: tp`Play another voice while using the skill ${'icon'}`, play_voice: tp`Play voice of the phase ${'stage'} of active skill ${'icon'}`,
}, },
power: { power: {
unknown: tp`[ Unkonwn power up: ${'type'} ]`, unknown: tp`[ Unkonwn power up: ${'type'} ]`,
@ -465,6 +465,7 @@ let localTranslating = {
[128]: tp`${'icon'}Yang Protection`, [128]: tp`${'icon'}Yang Protection`,
[129]: tp`${'icon'}Yin Protection`, [129]: tp`${'icon'}Yin Protection`,
[130]: tp`${'icon'}Aging`, [130]: tp`${'icon'}Aging`,
[131]: tp`${'icon'}Part Break`,
} }
}, },
}; };

View File

@ -1053,8 +1053,8 @@ function henshin(id, random = false) {
random: random random: random
}; };
} }
function skillPlayVoice(id) { function skillPlayVoice(skillStage, VoiceId) {
return { kind: SkillKinds.PlayVoice, id }; return { kind: SkillKinds.PlayVoice, stage: skillStage, id: VoiceId };
} }
function voidPoison() { return { kind: SkillKinds.VoidPoison }; } function voidPoison() { return { kind: SkillKinds.VoidPoison }; }
function skillProviso(cond) { return { kind: SkillKinds.SkillProviso, cond: cond }; } function skillProviso(cond) { return { kind: SkillKinds.SkillProviso, cond: cond }; }
@ -1727,7 +1727,7 @@ const skillObjectParsers = {
); );
}, },
[259](percent) { return breakingShield(v.xShield(percent)); }, [259](percent) { return breakingShield(v.xShield(percent)); },
[260](_, voiceId) { return skillPlayVoice(voiceId); }, [260](skillStage, voiceId) { return skillPlayVoice(skillStage, voiceId); },
[261](percent) { return gravity(v.xCHP(percent), 'single'); }, [261](percent) { return gravity(v.xCHP(percent), 'single'); },
[1000](type, pos, ...ids) { [1000](type, pos, ...ids) {
const posType = (type=>{ const posType = (type=>{
@ -2807,13 +2807,16 @@ function renderSkill(skill, option = {})
break; break;
} }
case SkillKinds.PlayVoice: { //播放技能语音 case SkillKinds.PlayVoice: { //播放技能语音
const { id } = skill; const { stage, id } = skill;
const icon = document.createElement("icon"); const icon = document.createElement("icon");
icon.className = "awoken-icon"; icon.className = "awoken-icon";
icon.setAttribute("data-awoken-icon", 63); icon.setAttribute("data-awoken-icon", 63);
icon.onclick = ()=>playVoiceById(id); icon.dataset.voiceId = id || Cards[editBox.mid].voiceId;
icon.onclick = playOwnVoiceId;
let dict = { let dict = {
stage,
id,
icon, icon,
}; };
frg.ap(tsp.skill.play_voice(dict)); frg.ap(tsp.skill.play_voice(dict));
@ -2827,6 +2830,9 @@ function renderSkill(skill, option = {})
} }
return frg; return frg;
}; };
function playOwnVoiceId(){
playVoiceById(parseInt(this.dataset.voiceId,10));
}
function renderStat(stat, option) { function renderStat(stat, option) {
const frg = document.createDocumentFragment(); const frg = document.createDocumentFragment();

View File

@ -322,6 +322,10 @@ Array.prototype.nodeJoin = function(separator)
}); });
return frg; return frg;
} }
//数组随机选择一个元素
Array.prototype.randomItem = function(){
return this[Math.randomInteger(this.length-1)];
};
Math.randomInteger = function(max, min = 0) { Math.randomInteger = function(max, min = 0) {
let _max = Math.max(max, min), let _max = Math.max(max, min),

View File

@ -4545,15 +4545,30 @@ function initialize() {
const s_attr_preview_attrs = Array.from(attrPreview.querySelectorAll(".attrs .attr")); const s_attr_preview_attrs = Array.from(attrPreview.querySelectorAll(".attrs .attr"));
const s_AttrForm = document.getElementById("search-attr"); const s_AttrForm = document.getElementById("search-attr");
let attrAnimeHook = null; //储存动画钩子
const attrsMatrix = new Array(s_attr_preview_attrs.length);
function attrLoopAnime(){
for (let i = 0; i < s_attr_preview_attrs.length; i++) {
const attrs = attrsMatrix[i];
if (attrs.length) s_attr_preview_attrs[i].dataset.attr = attrs.randomItem();
}
}
s_AttrForm.onchange = function(event){ s_AttrForm.onchange = function(event){
event?.preventDefault(); event?.preventDefault();
const formData = new FormData(this); const formData = new FormData(this);
for (let i = 0; i < s_attr_preview_attrs.length; i++) { for (let i = 0; i < s_attr_preview_attrs.length; i++) {
const attr = parseInt(formData.get(`attr-${i+1}`),10); attrsMatrix[i] = formData.getAll(`attr-${i+1}`).map(v=>parseInt(v,10));
s_attr_preview_attrs[i].dataset.attr = Number.isNaN(attr) ? "any" : attr; const attrs = attrsMatrix[i];
if (attrs.length < 1) attrs.push("any");
} }
clearInterval(attrAnimeHook); //清除旧动画
attrLoopAnime();
if (attrsMatrix.some(attrs=>attrs.length > 1)) //如果某一个选择的属性大于 1
attrAnimeHook = setInterval(attrLoopAnime, 1000); //每秒做一次随机动画
} }
s_AttrForm.onchange(); //先跑一次,这样刷新前的属性也会显示出来
s_AttrForm.onreset = function(event){ s_AttrForm.onreset = function(event){
clearInterval(attrAnimeHook);
s_attr_preview_attrs.forEach(node=>node.dataset.attr = "any"); s_attr_preview_attrs.forEach(node=>node.dataset.attr = "any");
}; };
@ -4600,14 +4615,16 @@ function initialize() {
[...s_AttrForm.querySelectorAll(".attr-selecter-list .attr-list")].forEach(list=>list.querySelector("li.display-none").classList.remove(className_displayNone)); [...s_AttrForm.querySelectorAll(".attr-selecter-list .attr-list")].forEach(list=>list.querySelector("li.display-none").classList.remove(className_displayNone));
} }
editBox.changeMonId(monstersID.value); editBox.changeMonId(monstersID.value);
const spoof = confirm("你可以上传你的自定义图片以制作卡片头像。\nYou can upload your custom image to make a card avatar.\n\n是否启用😈恶搞功能?\n所有角色全部随机设定四种属性。\nEnable 😈Spoof function ?\nAll Cards set 4 random attrs. "); const spoof = confirm("你可以上传你的自定义图片以制作卡片头像。\nYou can upload your custom image to make a card avatar.\n\n是否启用🤡恶搞功能?\n所有角色全部随机设定四种属性。\nEnable 🤡Spoof function ?\nAll Cards set 4 random attrs. ");
if (spoof) { if (spoof) {
Cards.forEach(card=>{ Cards.forEach(card=>{
if (!card.enabled) return; if (!card.enabled) return;
for (let i = 0; i < 4; i++) { card.attrs.length = 0; //清除旧的属性
card.attrs[0] = Math.randomInteger(0, 6);
for (let i = 1; i < 4; i++) {
const maxAttr = (i === 1 && card.attrs[0] === 6) ? 5 : 6; //如果第一属性是无属性,第二属性就不可以是无属性 const maxAttr = (i === 1 && card.attrs[0] === 6) ? 5 : 6; //如果第一属性是无属性,第二属性就不可以是无属性
card.attrs[i] = Math.randomInteger(0, maxAttr); card.attrs[i] = Math.randomInteger(0, maxAttr);
if (i >= 1 && card.attrs[i] === 6) break; //如果第2属性开始出现了无属性,就不需要再继续了 if (i >= 1 && card.attrs[i] === 6) break; //如果第2属性开始,一旦出现了无属性,就不需要再继续了
} }
}); });
} }

View File

@ -36155,19 +36155,19 @@ const cachesMap = new Map([
], ],
[ [
"script-json_data.js", "script-json_data.js",
"720ea9bd491b412e8394615817e360f0" "4350b4b335a157ac288679ed38ab0348"
], ],
[ [
"script-skill-parser.js", "script-skill-parser.js",
"7eb75bb6cc99901755f7936e32ee985e" "5e7e4e67bad2eebc0e57567b12934c6a"
], ],
[ [
"script-universal_function.js", "script-universal_function.js",
"f01a8abf20339eed9bbed18881a84dbf" "ce92b110d47442e699eab7ce59d1bdfc"
], ],
[ [
"script.js", "script.js",
"09b2d8e669f53c8e0b66aed5c27cc022" "1ad3f288192a83141d6731842240f2bb"
], ],
[ [
"solo.html", "solo.html",
@ -36227,7 +36227,7 @@ const cachesMap = new Map([
], ],
[ [
"languages/zh-hans.js", "languages/zh-hans.js",
"e17c9e42e1def0ea098b2726dde7809a" "71138b459d0d9851f2554e6336f32a98"
], ],
[ [
"languages/zh-hant.css", "languages/zh-hant.css",
@ -36235,7 +36235,7 @@ const cachesMap = new Map([
], ],
[ [
"languages/zh-hant.js", "languages/zh-hant.js",
"78f6a3649d0be85e6936b30e7f2dac96" "677bd55683bbe9f7055523ed462db5b9"
], ],
[ [
"images/attrs.png", "images/attrs.png",
@ -36275,7 +36275,7 @@ const cachesMap = new Map([
], ],
[ [
"images/CARDFRAME2.png", "images/CARDFRAME2.png",
"06dbd71f7237c5effd645c4ebbe647ca" "4d98541e37b80195d59fb59832c1f189"
], ],
[ [
"images/CARDFRAMEW.png", "images/CARDFRAMEW.png",