使新的超觉醒操作逻辑能够使用

This commit is contained in:
枫谷剑仙 2022-12-19 19:11:14 +08:00
parent 4431b8f097
commit 5046100f39
12 changed files with 104 additions and 110 deletions

View File

@ -641,6 +641,10 @@ label[for="qr-data-type-pdchu"]::before {
{
content: "Effective Collab ID";
}
.dialog-dungeon-enchance .gacha-list::before
{
content: "Effective Gacha ID";
}
.dialog-dungeon-enchance .stats-list::before
{
content: "Enhancement Rate:";

View File

@ -604,6 +604,10 @@ label[for="qr-data-type-pdchu"]::before {
{
content: "有効コラボID";
}
.dialog-dungeon-enchance .gacha-list::before
{
content: "有効ガチャID";
}
.dialog-dungeon-enchance .stats-list::before
{
content: "強化倍率:";

View File

@ -585,6 +585,10 @@ label[for="qr-data-type-pdchu"]::before {
{
content: "유효한 콜라보 ID";
}
.dialog-dungeon-enchance .gacha-list::before
{
content: "유효한 가챠 ID";
}
.dialog-dungeon-enchance .stats-list::before
{
content: "배율을 강화합니다:";

View File

@ -592,6 +592,10 @@ label[for="qr-data-type-pdchu"]::before {
{
content: "生效合作ID";
}
.dialog-dungeon-enchance .gacha-list::before
{
content: "生效抽蛋ID";
}
.dialog-dungeon-enchance .stats-list::before
{
content: "強化倍率:";

View File

@ -176,6 +176,7 @@
leader_self: tp`左邊隊長`,
leader_helper: tp`右邊隊長`,
collab_id: tp`合作ID為${'id'}的角色`,
gacha_id: tp`抽蛋ID為${'id'}的角色`,
enemy: tp`敵人`,
enemy_all: tp`敵方全體`,
enemy_one: tp`敵方1體`,

View File

@ -590,6 +590,10 @@ label[for="qr-data-type-pdchu"]::before {
{
content: "生效合作ID";
}
.dialog-dungeon-enchance .gacha-list::before
{
content: "生效抽蛋ID";
}
.dialog-dungeon-enchance .stats-list::before
{
content: "強化倍率:";

View File

@ -177,6 +177,7 @@
leader_self: tp`左边队长`,
leader_helper: tp`右边队长`,
collab_id: tp`合作ID为${'id'}的角色`,
gacha_id: tp`抽蛋ID为${'id'}的角色`,
enemy: tp`敌人`,
enemy_all: tp`敌方全体`,
enemy_one: tp`敌方1体`,

View File

@ -193,6 +193,7 @@ let localTranslating = {
leader_self: tp`left leader`,
leader_helper: tp`right leader`,
collab_id: tp`card with collab ID of ${'id'} `,
gacha_id: tp`card with gacha ID of ${'id'} `,
enemy: tp`Enemy`,
enemy_all: tp`all enemys`,
enemy_one: tp`1 enemy`,

View File

@ -560,7 +560,8 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) {
const isDge = dge.rarities.includes(memberCard.rarity) || //符合星级
memberCard.attrs.some(attr=>dge.attrs.includes(attr)) || //符合属性
memberCard.types.some(type=>dge.types.includes(type)) || //符合类型
dge.collabs.includes(memberCard.collabId); //符合合作
dge?.collabs?.includes(memberCard.collabId) || //符合合作
dge?.gachas?.includes(memberCard.gachaId); //符合抽蛋桶
//储存点亮的觉醒
let awokenList = memberCard.awakenings.slice(0, member.awoken);

154
script.js
View File

@ -305,6 +305,7 @@ var Formation = function(teamCount, memberCount) {
types: [],
rarities: [],
collabs: [],
gachas: [],
rate: {
hp: 1,
atk: 1,
@ -2815,14 +2816,13 @@ function initialize() {
//设置地下城倍率
const dungeonEnchanceDialog = document.body.querySelector(".dialog-dungeon-enchance");
dungeonEnchanceDialog.initialing = function(formation)
{
const dialogContent = this.querySelector(".dialog-content");
const rareDoms = Array.from(dialogContent.querySelectorAll(".rare-list .rare-check"));
const attrDoms = Array.from(dialogContent.querySelectorAll(".attr-list .attr-check"));
const typeDoms = Array.from(dialogContent.querySelectorAll(".type-list .type-check"));
const collabIdIpt = dialogContent.querySelector("#dungeon-collab-id");
const dialogContent = dungeonEnchanceDialog.querySelector(".dialog-content");
const rareDoms = Array.from(dialogContent.querySelectorAll(".rare-list .rare-check"));
const attrDoms = Array.from(dialogContent.querySelectorAll(".attr-list .attr-check"));
const typeDoms = Array.from(dialogContent.querySelectorAll(".type-list .type-check"));
const collabIdIpt = dialogContent.querySelector("#dungeon-collab-id");
const gachaIdIpt = dialogContent.querySelector("#dungeon-gacha-id");
dungeonEnchanceDialog.initialing = function(formation){
const dge = formation.dungeonEnchance;
function runCheck(checkBox){
checkBox.checked = this.includes(parseInt(checkBox.value));
@ -2831,6 +2831,7 @@ function initialize() {
attrDoms.forEach(runCheck,dge.attrs);
typeDoms.forEach(runCheck,dge.types);
collabIdIpt.value = dge.collabs.join();
gachaIdIpt.value = dge.gachas.join();
const {hp, atk, rcv} = dge.rate;
dialogContent.querySelector("#dungeon-hp").value = hp;
@ -2842,16 +2843,7 @@ function initialize() {
//初始化Dialog
dialogInitialing(dungeonEnchanceDialog);
const dungeonEnchanceDialogConfirm = dungeonEnchanceDialog.querySelector(".dialog-confirm");
dungeonEnchanceDialogConfirm.onclick = function(){
const dialogContent = dungeonEnchanceDialog.querySelector(".dialog-content");
const rareDoms = Array.from(dialogContent.querySelectorAll(".rare-list .rare-check"));
const attrDoms = Array.from(dialogContent.querySelectorAll(".attr-list .attr-check"));
const typeDoms = Array.from(dialogContent.querySelectorAll(".type-list .type-check"));
const rarities = returnCheckBoxsValues(rareDoms).map(Str2Int);
const attrs = returnCheckBoxsValues(attrDoms).map(Str2Int);
const types = returnCheckBoxsValues(typeDoms).map(Str2Int);
const collabIdIpt = dialogContent.querySelector("#dungeon-collab-id");
dungeonEnchanceDialogConfirm.onclick = function(){
const dge = formation.dungeonEnchance;
dge.rarities = rarities;
dge.attrs = attrs;
@ -2860,17 +2852,14 @@ function initialize() {
dge.rate.atk = Number(dialogContent.querySelector("#dungeon-atk").value);
dge.rate.rcv = Number(dialogContent.querySelector("#dungeon-rcv").value);
dge.collabs = collabIdIpt.value.split(',').map(str=>Number(str)).filter(Boolean);
dge.gachas = gachaIdIpt.value.split(',').map(str=>Number(str)).filter(Boolean);
dungeonEnchanceDialog.close();
creatNewUrl();
refreshAll(formation);
};
const dungeonEnchanceDialogClear = dungeonEnchanceDialog.querySelector(".dialog-clear");
dungeonEnchanceDialogClear.onclick = function(){
const dialogContent = dungeonEnchanceDialog.querySelector(".dialog-content");
const rareDoms = Array.from(dialogContent.querySelectorAll(".rare-list .rare-check"));
const attrDoms = Array.from(dialogContent.querySelectorAll(".attr-list .attr-check"));
const typeDoms = Array.from(dialogContent.querySelectorAll(".type-list .type-check"));
const collabIdIpt = dialogContent.querySelector("#dungeon-collab-id");
function unchecked(checkBox) {
checkBox.checked = false;
}
@ -2878,6 +2867,7 @@ function initialize() {
attrDoms.forEach(unchecked);
typeDoms.forEach(unchecked);
collabIdIpt.value = '';
gachaIdIpt.value = '';
dialogContent.querySelector("#dungeon-hp").value = 1;
dialogContent.querySelector("#dungeon-atk").value = 1;
dialogContent.querySelector("#dungeon-rcv").value = 1;
@ -3865,6 +3855,7 @@ function initialize() {
showSearch(searchByString(monstersID.value));
};
//觉醒
const monEditOuterAwokensRow = editBox.querySelector(".row-awoken-sawoken");
const monEditAwokensRow = monInfoBox.querySelector(".row-mon-awoken");
const awokenCountLabel = monEditAwokensRow.querySelector(".awoken-count-num");
const monEditAwokens = Array.from(monEditAwokensRow.querySelectorAll(".awoken-ul input[name='awoken-number']"));
@ -3893,7 +3884,10 @@ function initialize() {
monEditAwokensLabel.forEach(akDom => akDom.onclick = playVoiceAwoken);
//超觉醒
const monEditSAwokensRow = monInfoBox.querySelector(".row-mon-super-awoken");
const mSAwokenIcon = monEditOuterAwokensRow.querySelector("#current-super-awoken-icon");
mSAwokenIcon.onclick = function(){
this.setAttribute("data-awoken-icon", 0);
}
//3个快速设置this.ipt为自己的value
function setIptToMyValue() {
@ -4137,10 +4131,7 @@ function initialize() {
mon.awoken = mAwokenNumIpt ? parseInt(mAwokenNumIpt.value, 10) : 0;
if (card.superAwakenings.length) //如果支持超觉醒
{
const mSAwokenChoIpt = monEditSAwokensRow.querySelector("input[name='sawoken-choice']:checked");
mon.sawoken = parseInt(mSAwokenChoIpt?.value, 10) || 0;
// const mSAwokenIcon = monEditSAwokensRow.querySelector("#current-super-awoken-icon");
// mon.sawoken = parseInt(mSAwokenIcon.getAttribute("data-awoken-icon"), 10) || 0;
mon.sawoken = parseInt(mSAwokenIcon.getAttribute("data-awoken-icon"), 10) || 0;
}
if (card.stacking || card.types.some(t=>[0,12,14,15].includes(t)) &&
@ -4601,14 +4592,13 @@ function editMember(teamNum, isAssist, indexInTeam) {
monstersID.value = mon.id > 0 ? mon.id : 0;
monstersID.onchange();
//觉醒
const monEditAwokens = editBox.querySelectorAll(".row-mon-awoken .awoken-ul input[name='awoken-number']");
const monEditOuterAwokensRow = editBox.querySelector(".row-awoken-sawoken");
const monEditAwokens = monEditOuterAwokensRow.querySelectorAll(".row-mon-awoken .awoken-ul input[name='awoken-number']");
//if (mon.awoken > 0 && monEditAwokens[mon.awoken]) monEditAwokens[mon.awoken].click(); //涉及到觉醒数字的显示,所以需要点一下,为了减少计算次数,把这一条移动到了最后面
//超觉醒
const monEditSAwokensRow = editBox.querySelector(".row-mon-super-awoken");
const monEditSAwokens = Array.from(monEditSAwokensRow.querySelectorAll(".awoken-ul input[name='sawoken-choice']")); //单选框0号是隐藏的
const noSAwokenRadio = editBox.querySelector("#sawoken-choice-nosawoken"); //不选超觉醒的选项
(monEditSAwokens.find(ipt=>mon.sawoken === parseInt(ipt.value,10)) || noSAwokenRadio).checked = true;
monEditSAwokensRow.swaoken = mon.sawoken;
//const monEditCurrentSAwokenRow = monEditOuterAwokensRow.querySelector(".current-super-awoken");
const mSAwokenIcon = monEditOuterAwokensRow.querySelector("#current-super-awoken-icon");
mSAwokenIcon.setAttribute("data-awoken-icon", mon.sawoken);
const monEditLv = settingBox.querySelector(".row-mon-level .m-level");
monEditLv.value = mon.level || 1;
@ -4748,70 +4738,55 @@ function editBoxChangeMonId(id) {
mAwokenIpt[card.awakenings.length].click(); //选择最后一个觉醒
//超觉醒
const mSAwokenIcon = monEditOuterAwokensRow.querySelector("#current-super-awoken-icon");
const monEditSAwokensRow = monEditOuterAwokensRow.querySelector(".row-mon-super-awoken");
const monEditSAwokensUl = monEditSAwokensRow.querySelector(".awoken-ul");
const monEditSAwokensIcons = Array.from(monEditSAwokensUl.querySelectorAll(".awoken-icon"));
const noSAwokenRadio = editBox.querySelector("#sawoken-choice-nosawoken"); //不选超觉醒的选项
//获得之前的所有超觉醒
const prevSAwokens = monEditSAwokensIcons.map(icon=>parseInt(icon.getAttribute("data-awoken-icon") || 0, 10)).filter(Boolean);
const prevSAwoken = parseInt(mSAwokenIcon.getAttribute("data-awoken-icon"), 10) || 0;
function notCheckMyself() {
const sawoken = parseInt(this.value, 10);
if (monEditSAwokensUl.swaoken === sawoken && this != noSAwokenRadio) {
noSAwokenRadio.click();
monEditSAwokensUl.swaoken = 0;
return false;
} else {
monEditSAwokensUl.swaoken = sawoken;
const level = settingBox.querySelector(".row-mon-level .m-level");
const plusArr = [...settingBox.querySelectorAll(".row-mon-plus input[type='number']")];
if (sawoken > 0)
function setSAwoken() {
const sawoken = parseInt(this.getAttribute("data-awoken-icon"), 10) || 0;
mSAwokenIcon.setAttribute("data-awoken-icon", sawoken);
const level = settingBox.querySelector(".row-mon-level .m-level");
const plusArr = [...settingBox.querySelectorAll(".row-mon-plus input[type='number']")];
if (sawoken > 0)
{
let recalFlag = false;
//自动100级
if (parseInt(level.value, 10)<100)
{
let recalFlag = false;
//自动100级
if (parseInt(level.value, 10)<100)
{
console.debug("点亮超觉醒自动设定100级");
level.value = 100;
recalFlag = true;
}
//自动打上297
if (plusArr.some(ipt=>parseInt(ipt.value, 10)<99))
{
console.debug("点亮超觉醒自动设定297");
plusArr.forEach(ipt=>ipt.value=99);
recalFlag = true;
}
if (recalFlag) editBox.reCalculateAbility();
console.debug("点亮超觉醒自动设定100级");
level.value = 100;
recalFlag = true;
}
//自动打上297
if (plusArr.some(ipt=>parseInt(ipt.value, 10)<99))
{
console.debug("点亮超觉醒自动设定297");
plusArr.forEach(ipt=>ipt.value=99);
recalFlag = true;
}
if (recalFlag) editBox.reCalculateAbility();
}
}
//怪物没有超觉醒时隐藏超觉醒
const monEditCurrentSAwokenRow = monEditOuterAwokensRow.querySelector(".current-super-awoken");
monEditCurrentSAwokenRow.classList.toggle(className_displayNone, card.superAwakenings.length == 0);
monEditSAwokensRow.classList.toggle(className_displayNone, card.superAwakenings.length == 0);
if (card.superAwakenings.length == prevSAwokens.length &&
card.superAwakenings.every((sak, idx)=>sak===prevSAwokens[idx])
)
{
//切换前后超觉相同,什么都不做
//console.debug('与上一个超觉醒完全相同,不用修改超觉醒');
} else {
const optionIconTemplate = editBox.querySelector('#sawoken-option-icon');
monEditSAwokensUl.innerHTML = ''; //清空旧的超觉醒
monEditSAwokensUl.swaoken = 0;
card.superAwakenings.forEach((sak,idx)=>{
const clone = document.importNode(optionIconTemplate.content, true);
const input = clone.querySelector('input');
const label = clone.querySelector('label');
input.value = sak;
input.onclick = notCheckMyself;
label.setAttribute("data-awoken-icon", sak);
const id = `sawoken-choice-${idx}`;
input.id = id;
label.setAttribute('for', id);
monEditSAwokensUl.append(clone);
});
noSAwokenRadio.click(); //选中隐藏的空超觉
if (!card.superAwakenings.includes(prevSAwoken)){
mSAwokenIcon.setAttribute("data-awoken-icon", 0);
//切换后没有相同超觉,则直接撤销这个超觉
}
monEditSAwokensUl.innerHTML = ''; //清空旧的超觉醒
card.superAwakenings.forEach((sak,idx)=>{
const btn = document.createElement("button");
btn.className = "awoken-icon";
btn.setAttribute("data-awoken-icon", sak);
btn.onclick = setSAwoken;
monEditSAwokensUl.append(btn);
});
const monEditLvMax = settingBox.querySelector(".m-level-btn-max");
//monEditLvMax.textContent = monEditLvMax.value = card.maxLevel;
@ -4961,9 +4936,12 @@ function refreshAll(formationData) {
icon.setAttribute("data-rare-icon", rarity);
})
}
if (dge.collabs.length) { //添加合作的ID名称
if (dge?.collabs?.length) { //添加合作的ID名称
dungeonEnchanceDom.appendChild(localTranslating?.skill_parse?.target?.collab_id({id:dge.collabs.join()}));
}
if (dge?.gachas?.length) { //添加抽蛋的ID名称
dungeonEnchanceDom.appendChild(localTranslating?.skill_parse?.target?.gacha_id({id:dge.gachas.join()}));
}
let skill = powerUp(dge.attrs, dge.types, p.mul({hp: dge.rate.hp * 100, atk: dge.rate.atk * 100, rcv: dge.rate.rcv * 100}));
dungeonEnchanceDom.appendChild(renderSkill(skill));

View File

@ -975,15 +975,12 @@ var formation = new Formation(teamsCount,6);
</div>
</div>
<div class="current-super-awoken">
<icon id="current-super-awoken-icon" class="awoken-icon"></icon>
<!--怪物当前超觉醒-->
<button id="current-super-awoken-icon" class="awoken-icon"></button>
</div>
<div class="row-mon-super-awoken">
<!--怪物超觉醒-->
<input type="radio" name="sawoken-choice" class="sawoken-choice" value="0" id="sawoken-choice-nosawoken" />
<div class="awoken-ul">
<input type="radio" name="sawoken-choice" class="sawoken-choice" id="sawoken-choice-1" /><label for="sawoken-choice-1" class="awoken-icon"></label>
</div>
<template id="sawoken-option-icon"><input type="radio" name="sawoken-choice" class="sawoken-choice" /><label class="awoken-icon"></label></template>
<!--怪物超觉醒选择列表-->
<div class="awoken-ul"></div>
</div>
</div>
<div class="monsterinfo-groupId">
@ -1235,6 +1232,9 @@ var formation = new Formation(teamsCount,6);
<ul class="collab-list">
<li><label for="dungeon-collab-id"></label><input id="dungeon-collab-id" type="text" /></li>
</ul>
<ul class="gacha-list display-none">
<li><label for="dungeon-gacha-id"></label><input id="dungeon-gacha-id" type="text" /></li>
</ul>
<ul class="stats-list">
<li><label for="dungeon-hp"></label><input id="dungeon-hp" type="number" min=0 step=1 value=1 /></li>
<li><label for="dungeon-atk"></label><input id="dungeon-atk" type="number" min=0 step=1 value=1 /></li>

View File

@ -1896,7 +1896,8 @@ icon.inflicts::after
.types-div .type-icon:active,
.rare-div .rare-icon:active,
.selected-awokens .awoken-icon:active,
.awoken-div .awoken-icon:active
.awoken-div .awoken-icon:active,
.row-awoken-sawoken .awoken-icon:active
{
animation: icon-active 0.2s;
}
@ -2223,26 +2224,17 @@ icon.inflicts::after
/*.edit-box .setting-box .row-mon-super-awoken::before{
content: "▼超觉醒";
}*/
.row-mon-awoken,
.row-mon-super-awoken
{
display: inline-block;
}
.row-mon-super-awoken::before {
/* content: "+"; */
}
.row-awoken-sawoken .awoken-count-num,
.row-awoken-sawoken .awoken-icon
{
grid-column: span 1;
grid-row: span 1;
}
.current-super-awoken {
margin-right: 5px;
}
/*未选中的超觉醒半透明,选中的不透明*/
.row-mon-super-awoken .sawoken-choice{display:none;}
.row-mon-super-awoken .sawoken-choice:not(:checked)+label
{
.row-mon-super-awoken .awoken-icon{
opacity: var(--search-icon-unchecked);
}
/*怪物能力横条*/