至少在组队界面,不起用的潜在觉醒变为半透明灰色。

This commit is contained in:
枫谷剑仙 2022-12-15 23:23:44 +08:00
parent 5cf60063f8
commit 2e825db4f1
4 changed files with 102 additions and 72 deletions

View File

@ -415,26 +415,30 @@ const typekiller_for_type = [
{type:9,awoken:null,latent:null,typeKiller:[]}, //特殊保护 {type:9,awoken:null,latent:null,typeKiller:[]}, //特殊保护
]; ];
//类型允许的潜觉杀 //类型允许的潜觉杀
const type_allowable_latent = [];
typekiller_for_type.forEach(t=> typekiller_for_type.forEach(t=>
{ {
t.allowableLatent = t.typeKiller.concat([0,12,14,15]) //补充4种特殊杀 t.allowableLatent = t.typeKiller.concat([0,12,14,15]) //补充4种特殊杀
.map(tn=> .map(tn=>
typekiller_for_type.find(_t=>_t.type == tn).latent typekiller_for_type.find(_t=>_t.type == tn).latent
); );
type_allowable_latent[t.type] = t.allowableLatent;
} }
); );
//一般共同能打的潜觉 const allowable_latent = {
const common_allowable_latent = [ common: [ //一般能打的潜觉
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
28,29,30,31,32,33,34,35,36,37,38, 28,29,30,31,32,33,34,35,36,37,38
39,40,41,46,47,48 //需要拥有觉醒的才能打,但是有武器 ],
]; killer: [16,17,18,19,20,21,22,23,24,25,26,27], //杀潜觉
//120级才能打的潜觉 v120: [42,43,44,45], //120才能打的潜觉
const v120_allowable_latent = [ needAwoken: [ //需要觉醒才能打的潜觉
42,43,44,45 {latent:39,awoken:62}, //C珠破吸
]; {latent:40,awoken:20}, //心横解转转
{latent:41,awoken:27}, //U解禁消
{latent:46,awoken:45}, //心追解云封
{latent:47,awoken:59}, //心L大SB
{latent:48,awoken:60}, //L解禁武器
]
}
//等效觉醒列表 //等效觉醒列表
const equivalent_awoken = [ const equivalent_awoken = [
{small:10,big:52,times:2}, //防封 {small:10,big:52,times:2}, //防封
@ -3726,7 +3730,7 @@ const specialSearchFunctions = (function() {
const isAllowLatent = card.types.filter(i=> const isAllowLatent = card.types.filter(i=>
i>=0 //去掉-1的type i>=0 //去掉-1的type
).map(type=> ).map(type=>
type_allowable_latent[type] //得到允许打的潜觉杀 typekiller_for_type.find(t=>t.type==type).allowableLatent //得到允许打的潜觉杀
).some(ls=> ).some(ls=>
ls.includes(hasAwokenKiller.latent) //判断是否有这个潜觉杀 ls.includes(hasAwokenKiller.latent) //判断是否有这个潜觉杀
); );

View File

@ -982,17 +982,6 @@ function parseBigNumber(number) {
function isReincarnated(card) { function isReincarnated(card) {
return card.is8Latent && !card.isUltEvo && (card.evoBaseId || card.evoRootId) != card.id && (card.awakenings.includes(49) ? isReincarnated(Cards[card.evoBaseId]) : true); return card.is8Latent && !card.isUltEvo && (card.evoBaseId || card.evoRootId) != card.id && (card.awakenings.includes(49) ? isReincarnated(Cards[card.evoBaseId]) : true);
} }
//获取类型允许的潜觉
function getAllowLatent(card) {
const latentSet = new Set(common_allowable_latent);
card.types.filter(i => i >= 0)
.map(type => type_allowable_latent[type])
.forEach(tA => tA.forEach(t => latentSet.add(t)));
if (card.limitBreakIncr) {
v120_allowable_latent.forEach(t => latentSet.add(t));
}
return Array.from(latentSet);
}
//计算队伍中有多少血量 //计算队伍中有多少血量
function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) { function countTeamHp(team, leader1id, leader2id, solo, noAwoken = false) {
let memberArr = team[0], assistArr = team[1]; let memberArr = team[0], assistArr = team[1];

116
script.js
View File

@ -144,8 +144,8 @@ DBOpenRequest.onupgradeneeded = function(event) {
}*/ }*/
//队员基本的留空 //队员基本的留空
var Member = function() { var Member = function(id = 0) {
this.id = 0; this.id = id;
this.ability = [0, 0, 0]; this.ability = [0, 0, 0];
this.abilityNoAwoken = [0, 0, 0]; this.abilityNoAwoken = [0, 0, 0];
}; };
@ -153,6 +153,19 @@ var Member = function() {
Object.defineProperty(Member.prototype, "card", { Object.defineProperty(Member.prototype, "card", {
get() { return Cards[this.id]; } get() { return Cards[this.id]; }
}) })
Member.prototype.effectiveAwokens = function(assist) {
const memberCard = this.card;
let enableAwoken = memberCard?.awakenings?.slice(0, this.awoken) || [];
//单人、3人时,大于等于100级且297时增加超觉醒
if ((solo || teamsCount === 3) && this.sawoken > 0 && this.level >= 100 && this.plus.every(p=>p>=99)) {
enableAwoken.push(this.sawoken);
}
//添加武器
if (assist instanceof Member && assist.card.awakenings.includes(49)) {
enableAwoken.push(...assist.card.awakenings.slice(0, assist.awoken));
}
return enableAwoken;
}
Member.prototype.getAttrsTypesWithWeapon = function(assist) { Member.prototype.getAttrsTypesWithWeapon = function(assist) {
let memberCard = this.card, assistCard = assist?.card; let memberCard = this.card, assistCard = assist?.card;
if (this.id <= 0 || !memberCard) return null; //跳过 id 0 if (this.id <= 0 || !memberCard) return null; //跳过 id 0
@ -3915,14 +3928,11 @@ function initialize() {
const monEditRcvValue = rowMonAbility.querySelector(".m-rcv-li .ability-value"); const monEditRcvValue = rowMonAbility.querySelector(".m-rcv-li .ability-value");
//加蛋 //加蛋
const rowMonPlus = settingBox.querySelector(".row-mon-plus"); const rowMonPlus = settingBox.querySelector(".row-mon-plus");
const monEditAddHpLi = rowMonPlus.querySelector(".m-hp-li"); const monEditAddHp = rowMonPlus.querySelector(".m-plus-hp");
const monEditAddAtkLi = rowMonPlus.querySelector(".m-atk-li");
const monEditAddRcvLi = rowMonPlus.querySelector(".m-rcv-li");
const monEditAddHp = monEditAddHpLi.querySelector(".m-plus-hp");
monEditAddHp.onchange = reCalculateAbility; monEditAddHp.onchange = reCalculateAbility;
const monEditAddAtk = monEditAddAtkLi.querySelector(".m-plus-atk"); const monEditAddAtk = rowMonPlus.querySelector(".m-plus-atk");
monEditAddAtk.onchange = reCalculateAbility; monEditAddAtk.onchange = reCalculateAbility;
const monEditAddRcv = monEditAddRcvLi.querySelector(".m-plus-rcv"); const monEditAddRcv = rowMonPlus.querySelector(".m-plus-rcv");
monEditAddRcv.onchange = reCalculateAbility; monEditAddRcv.onchange = reCalculateAbility;
//297按钮 //297按钮
const monEditPlusFastSettings = Array.from(rowMonPlus.querySelectorAll(".m-plus-fast-setting")); const monEditPlusFastSettings = Array.from(rowMonPlus.querySelectorAll(".m-plus-fast-setting"));
@ -3947,7 +3957,7 @@ function initialize() {
if (event instanceof MouseEvent) localStorage.setItem(cfgPrefix + 'hide-latent', Number(!this.open)); if (event instanceof MouseEvent) localStorage.setItem(cfgPrefix + 'hide-latent', Number(!this.open));
} }
editBox.refreshLatent = function(latent, monid) {//刷新潜觉 editBox.refreshLatent = function(latent, monid) {//刷新潜觉
refreshLatent(latent, monid, monEditLatentUl); refreshLatent(latent, new Member(monid), monEditLatentUl);
}; };
const rowSkill = settingBox.querySelector(".row-mon-skill"); const rowSkill = settingBox.querySelector(".row-mon-skill");
@ -4135,7 +4145,10 @@ function initialize() {
if (skillLevelNum < skill.maxLevel) { if (skillLevelNum < skill.maxLevel) {
mon.skilllevel = skillLevelNum; mon.skilllevel = skillLevelNum;
} }
changeid(mon, editBox.monsterHead, editBox.memberIdx[1] ? null : editBox.latentBox); changeid(mon, editBox.monsterHead,
editBox.memberIdx[1] ? null : editBox.latentBox, //潜觉Node
editBox.memberIdx[1] ? null : teamData[1][editBox.memberIdx[2]] //assist数据
);
const teamAbilityDom = teamBigBox.querySelector(".team-ability"); const teamAbilityDom = teamBigBox.querySelector(".team-ability");
refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值 refreshAbility(teamAbilityDom, teamData, editBox.memberIdx[2]); //本人能力值
@ -4457,7 +4470,7 @@ function changeid(mon, monDom, latentDom, assist) {
if (latent.length < 1) { if (latent.length < 1) {
latentDom.classList.add(className_displayNone); latentDom.classList.add(className_displayNone);
} else { } else {
refreshLatent(latent, mon.id, latentDom, {sort:true}); refreshLatent(latent, mon, latentDom, {sort:true, assist});
latentDom.classList.remove(className_displayNone); latentDom.classList.remove(className_displayNone);
} }
latentDom.classList.toggle("level-super-break", level > 110);; //切换潜觉为120级 latentDom.classList.toggle("level-super-break", level > 110);; //切换潜觉为120级
@ -4512,14 +4525,15 @@ function changeid(mon, monDom, latentDom, assist) {
//parentNode.appendChild(fragment); //parentNode.appendChild(fragment);
} }
//刷新潜觉 //刷新潜觉
function refreshLatent(latents, monid, latentsNode, option) { function refreshLatent(latents, member, latentsNode, option) {
const maxLatentCount = getMaxLatentCount(monid); //最大潜觉数量 const maxLatentCount = getMaxLatentCount(member.id); //最大潜觉数量
const iconArr = latentsNode.querySelectorAll('.latent-icon'); const iconArr = latentsNode.querySelectorAll('.latent-icon');
latentsNode.classList.toggle("block-8", maxLatentCount>6); latentsNode.classList.toggle("block-8", maxLatentCount>6);
latents = latents.concat(); latents = latents.concat();
if (option?.sort) latents.sort((a, b) => latentUseHole(b) - latentUseHole(a)); if (option?.sort) latents.sort((a, b) => latentUseHole(b) - latentUseHole(a));
let latentIndex = 0, let effectiveAwokens = option?.assist instanceof Member ? member.effectiveAwokens(option.assist) : null;
usedHoleN = 0; let latentIndex = 0, usedHoleN = 0;
//如果传入了武器,就添加有效觉醒
for (let ai = 0; ai < iconArr.length; ai++) { for (let ai = 0; ai < iconArr.length; ai++) {
const icon = iconArr[ai], latent = latents[latentIndex]; const icon = iconArr[ai], latent = latents[latentIndex];
if (latent != undefined && ai >= usedHoleN && ai < maxLatentCount) //有潜觉 if (latent != undefined && ai >= usedHoleN && ai < maxLatentCount) //有潜觉
@ -4527,6 +4541,12 @@ function refreshLatent(latents, monid, latentsNode, option) {
const thisHoleN = latentUseHole(latent); const thisHoleN = latentUseHole(latent);
icon.setAttribute("data-latent-icon", latent); icon.setAttribute("data-latent-icon", latent);
icon.setAttribute("data-latent-hole", thisHoleN); icon.setAttribute("data-latent-hole", thisHoleN);
let enableLatent = true;
if (effectiveAwokens) {
let obj = allowable_latent.needAwoken.find(obj=>obj.latent == latent);
if (obj && !effectiveAwokens.includes(obj.awoken)) enableLatent = false;
}
icon.classList.toggle('unallowable-latent', !enableLatent);
usedHoleN += thisHoleN; usedHoleN += thisHoleN;
latentIndex++; latentIndex++;
} else { } else {
@ -4792,17 +4812,33 @@ function editBoxChangeMonId(id) {
const mCost = settingBox.querySelector(".monster-cost"); const mCost = settingBox.querySelector(".monster-cost");
mCost.textContent = card.cost; mCost.textContent = card.cost;
const rowPlus = settingBox.querySelector(".row-mon-plus"); const rowMonPlus = settingBox.querySelector(".row-mon-plus");
const rowLatent = settingBox.querySelector(".row-mon-latent"); const rowMonLatent = settingBox.querySelector(".row-mon-latent");
const monLatentAllowUl = rowLatent.querySelector(".m-latent-allowable-ul"); const monLatentAllowUl = rowMonLatent.querySelector(".m-latent-allowable-ul");
//该宠Type允许的杀set不会出现重复的
const allowLatent = getAllowLatent(card);
const latentIcons = Array.from(monLatentAllowUl.querySelectorAll(`.latent-icon[data-latent-icon]`)); let allowLatent = [];
latentIcons.forEach(icon => { //显示允许的潜觉,隐藏不允许的潜觉 if (!editBox.isAssist) {
const ltId = parseInt(icon.getAttribute("data-latent-icon"),10); //该宠Type允许的杀set不会出现重复的
icon.classList.toggle("unallowable-latent", !allowLatent.includes(ltId));;
}); //获取类型允许的潜觉
function getAllowLatent(card) {
const latentSet = new Set(allowable_latent.common);
allowable_latent.needAwoken.forEach(obj=>latentSet.add(obj.latent));
card.types.filter(i => i >= 0)
.map(type => typekiller_for_type.find(t=>t.type==type).allowableLatent)
.forEach(tA => tA.forEach(t => latentSet.add(t)));
if (card.limitBreakIncr) {
allowable_latent.v120.forEach(t => latentSet.add(t));
}
return Array.from(latentSet);
}
allowLatent = getAllowLatent(card);
const latentIcons = Array.from(monLatentAllowUl.querySelectorAll(`.latent-icon[data-latent-icon]`));
latentIcons.forEach(icon => { //显示允许的潜觉,隐藏不允许的潜觉
const ltId = parseInt(icon.getAttribute("data-latent-icon"),10);
icon.classList.toggle("unallowable-latent", !allowLatent.includes(ltId));;
});
}
//怪物主动技能 //怪物主动技能
const rowSkill = settingBox.querySelector(".row-mon-skill"); const rowSkill = settingBox.querySelector(".row-mon-skill");
@ -4851,30 +4887,20 @@ function editBoxChangeMonId(id) {
rowSkill.appendChild(frg1); rowSkill.appendChild(frg1);
rowLederSkill.appendChild(frg2); rowLederSkill.appendChild(frg2);
if (card.stacking || card.types.some(t=>[0,12,14,15].includes(t)) && let noPowerup = card.stacking || card.types.some(t=>[0,12,14,15].includes(t)) && card.maxLevel <= 1
card.maxLevel <= 1) { //当可以叠加时不能打297和潜觉 skillLevel.readOnly = noPowerup;
rowPlus.classList.add("disabled"); rowMonPlus.classList.toggle("disabled", noPowerup);
rowPlus.querySelector(".m-plus-hp").value = 0; rowMonLatent.classList.toggle("disabled", noPowerup);
rowPlus.querySelector(".m-plus-atk").value = 0; if (noPowerup) { //当可以叠加时不能打297和潜觉
rowPlus.querySelector(".m-plus-rcv").value = 0; rowMonPlus.querySelector(".m-plus-hp").value = 0;
rowMonPlus.querySelector(".m-plus-atk").value = 0;
rowLatent.classList.add("disabled"); rowMonPlus.querySelector(".m-plus-rcv").value = 0;
skillLevel.setAttribute("readonly", true);
} else {
rowPlus.classList.remove("disabled");
rowLatent.classList.remove("disabled");
skillLevel.removeAttribute("readonly");
} }
if (editBox.isAssist) { if (editBox.isAssist) {
const btnDone = editBox.querySelector(".button-done"); const btnDone = editBox.querySelector(".button-done");
if (!card.canAssist) { btnDone.classList.toggle("cant-assist", !card.canAssist);
btnDone.classList.add("cant-assist"); btnDone.disabled = !card.canAssist;
btnDone.disabled = true;
} else {
btnDone.classList.remove("cant-assist");
btnDone.disabled = false;
}
} }
//去除所有不能再打的潜觉 //去除所有不能再打的潜觉

View File

@ -1212,6 +1212,14 @@ icon.inflicts::after
transform: scale(1.50); transform: scale(1.50);
margin: calc(32px / 4); margin: calc(32px / 4);
} }
.team-latents .latent-icon.unallowable-latent {
opacity: unset;
filter: unset;
}
.team-latents .latent-icon.unallowable-latent::before {
opacity: var(--search-icon-unchecked);
filter: grayscale(1);
}
/*队长的边框*/ /*队长的边框*/
.team-members .team-leader .monster .team-members .team-leader .monster
@ -2179,9 +2187,6 @@ icon.inflicts::after
content: "▼怪物觉醒"; content: "▼怪物觉醒";
} }
*/ */
.row-mon-awoken{
margin-right: 20px;
}
.row-mon-awoken .awoken-count-num{ .row-mon-awoken .awoken-count-num{
display: inline-block; display: inline-block;
transform: scale(0.84) translateY(-2px); transform: scale(0.84) translateY(-2px);
@ -2219,10 +2224,16 @@ icon.inflicts::after
box-sizing: border-box; box-sizing: border-box;
vertical-align: top; vertical-align: top;
} }
.row-mon-super-awoken::before {
content: "+";
vertical-align: top;
}
.row-mon-awoken .awoken-ul, .row-mon-awoken .awoken-ul,
.row-mon-super-awoken .awoken-ul .row-mon-super-awoken .awoken-ul
{ {
grid-template-columns: repeat(10, 32px); grid-template-columns: repeat(10, 32px);
display: inline grid;
vertical-align: bottom;
} }
.row-mon-awoken .awoken-count-num, .row-mon-awoken .awoken-count-num,
.row-mon-awoken .awoken-icon, .row-mon-awoken .awoken-icon,