Skip to content

Commit

Permalink
属性选择预览处,加入随机变动动画。
Browse files Browse the repository at this point in the history
修订心属性第四属性的1像素错位。
技能阶段语音技能的显示方式修订。
  • Loading branch information
Mapaler committed Oct 6, 2024
1 parent 6fe6702 commit 3c854e8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 20 deletions.
Binary file modified images/CARDFRAME2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/project file/CARDFRAME2.fw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion languages/zh-hans.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const _localTranslating = {
board_size_change: tp`板面大小改变为${'icon'}${'size'}`,
remove_assist: tp`${'icon'}移除自身的辅助宠物(直到地下城结束)`,
prediction_falling: tp`盘面上可以${'icon'}预知宝珠掉落`,
play_voice: tp`使用技能时播放另一段语音 ${'icon'}`,
play_voice: tp`播放第 ${'stage'} 阶段的语音 ${'icon'}`,
},
power: {
unknown: tp`[ 未知能力提升: ${'type'} ]`,
Expand Down
2 changes: 1 addition & 1 deletion languages/zh-hant.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const _localTranslating = {
board_size_change: tp`板面大小改變為${'icon'}${'size'}`,
remove_assist: tp`${'icon'}移除自身的輔助寵物(直到地下城結束)`,
prediction_falling: tp`盤面上可以${'icon'}預知寶珠掉落`,
play_voice: tp`使用技能時播放另一段語音 ${'icon'}`,
play_voice: tp`播放第 ${'stage'} 階段的語音 ${'icon'}`,
},
power: {
unknown: tp`[ 未知能力提升: ${'type'} ]`,
Expand Down
3 changes: 2 additions & 1 deletion script-json_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ let localTranslating = {
board_size_change: tp`Board size changed to ${'icon'}${'size'}`,
remove_assist: tp`${'icon'}Remove this assist card (until end of dungeon)`,
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: {
unknown: tp`[ Unkonwn power up: ${'type'} ]`,
Expand Down Expand Up @@ -465,6 +465,7 @@ let localTranslating = {
[128]: tp`${'icon'}Yang Protection`,
[129]: tp`${'icon'}Yin Protection`,
[130]: tp`${'icon'}Aging`,
[131]: tp`${'icon'}Part Break`,
}
},
};
Expand Down
16 changes: 11 additions & 5 deletions script-skill-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,8 @@ function henshin(id, random = false) {
random: random
};
}
function skillPlayVoice(id) {
return { kind: SkillKinds.PlayVoice, id };
function skillPlayVoice(skillStage, VoiceId) {
return { kind: SkillKinds.PlayVoice, stage: skillStage, id: VoiceId };
}
function voidPoison() { return { kind: SkillKinds.VoidPoison }; }
function skillProviso(cond) { return { kind: SkillKinds.SkillProviso, cond: cond }; }
Expand Down Expand Up @@ -1727,7 +1727,7 @@ const skillObjectParsers = {
);
},
[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'); },
[1000](type, pos, ...ids) {
const posType = (type=>{
Expand Down Expand Up @@ -2807,13 +2807,16 @@ function renderSkill(skill, option = {})
break;
}
case SkillKinds.PlayVoice: { //播放技能语音
const { id } = skill;
const { stage, id } = skill;
const icon = document.createElement("icon");
icon.className = "awoken-icon";
icon.setAttribute("data-awoken-icon", 63);
icon.onclick = ()=>playVoiceById(id);
icon.dataset.voiceId = id || Cards[editBox.mid].voiceId;
icon.onclick = playOwnVoiceId;

let dict = {
stage,
id,
icon,
};
frg.ap(tsp.skill.play_voice(dict));
Expand All @@ -2827,6 +2830,9 @@ function renderSkill(skill, option = {})
}
return frg;
};
function playOwnVoiceId(){
playVoiceById(parseInt(this.dataset.voiceId,10));
}

function renderStat(stat, option) {
const frg = document.createDocumentFragment();
Expand Down
4 changes: 4 additions & 0 deletions script-universal_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,10 @@ Array.prototype.nodeJoin = function(separator)
});
return frg;
}
//数组随机选择一个元素
Array.prototype.randomItem = function(){
return this[Math.randomInteger(this.length-1)];
};

Math.randomInteger = function(max, min = 0) {
let _max = Math.max(max, min),
Expand Down
27 changes: 22 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4545,15 +4545,30 @@ function initialize() {
const s_attr_preview_attrs = Array.from(attrPreview.querySelectorAll(".attrs .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){
event?.preventDefault();
const formData = new FormData(this);
for (let i = 0; i < s_attr_preview_attrs.length; i++) {
const attr = parseInt(formData.get(`attr-${i+1}`),10);
s_attr_preview_attrs[i].dataset.attr = Number.isNaN(attr) ? "any" : attr;
attrsMatrix[i] = formData.getAll(`attr-${i+1}`).map(v=>parseInt(v,10));
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){
clearInterval(attrAnimeHook);
s_attr_preview_attrs.forEach(node=>node.dataset.attr = "any");
};

Expand Down Expand Up @@ -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));
}
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) {
Cards.forEach(card=>{
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; //如果第一属性是无属性,第二属性就不可以是无属性
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属性开始,一旦出现了无属性,就不需要再继续了
}
});
}
Expand Down
14 changes: 7 additions & 7 deletions service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36155,19 +36155,19 @@ const cachesMap = new Map([
],
[
"script-json_data.js",
"720ea9bd491b412e8394615817e360f0"
"4350b4b335a157ac288679ed38ab0348"
],
[
"script-skill-parser.js",
"7eb75bb6cc99901755f7936e32ee985e"
"5e7e4e67bad2eebc0e57567b12934c6a"
],
[
"script-universal_function.js",
"f01a8abf20339eed9bbed18881a84dbf"
"ce92b110d47442e699eab7ce59d1bdfc"
],
[
"script.js",
"09b2d8e669f53c8e0b66aed5c27cc022"
"1ad3f288192a83141d6731842240f2bb"
],
[
"solo.html",
Expand Down Expand Up @@ -36227,15 +36227,15 @@ const cachesMap = new Map([
],
[
"languages/zh-hans.js",
"e17c9e42e1def0ea098b2726dde7809a"
"71138b459d0d9851f2554e6336f32a98"
],
[
"languages/zh-hant.css",
"14630847a22449fe2780f8e154d8d7c7"
],
[
"languages/zh-hant.js",
"78f6a3649d0be85e6936b30e7f2dac96"
"677bd55683bbe9f7055523ed462db5b9"
],
[
"images/attrs.png",
Expand Down Expand Up @@ -36275,7 +36275,7 @@ const cachesMap = new Map([
],
[
"images/CARDFRAME2.png",
"06dbd71f7237c5effd645c4ebbe647ca"
"4d98541e37b80195d59fb59832c1f189"
],
[
"images/CARDFRAMEW.png",
Expand Down

0 comments on commit 3c854e8

Please sign in to comment.