变身后切换回变身前,清除不能打的潜觉和超觉

This commit is contained in:
枫谷剑仙 2020-10-13 19:24:29 +08:00
parent 90fb3f3340
commit 7b173c8c71
2 changed files with 23 additions and 10 deletions

View File

@ -481,6 +481,23 @@ function isReincarnated(card)
{
return card.is8Latent && !card.isUltEvo && (card.evoBaseId || card.evoRootId) != card.id && (card.awakenings.includes(49) ? isReincarnated(Cards[card.evoBaseId]) : true);
}
//获取类型允许的潜觉
function getAllowLatent(types)
{
const latentSet = new Set();
types.filter(i => i >= 0)
.map(type => type_allowable_latent[type])
.forEach(tA => tA.forEach(t => latentSet.add(t)));
return Array.from(latentSet);
}
//筛选出允许的潜觉
function filterAllowLatent(latent, allowLatent)
{
const allKillerLatent = typekiller_for_type.map(type => type.latent);
return latent.filter(lat =>
!allKillerLatent.includes(lat) || //保留不属于杀的潜觉
allKillerLatent.includes(lat) && allowLatent.includes(lat)); //属于杀的潜觉则只保留允许的
}
//计算队伍中有多少血量
function countTeamHp(memberArr, leader1id, leader2id, solo, noAwoken=false)
{

View File

@ -350,6 +350,9 @@ function swapHenshin(self)
const _card = Cards[card.evoRootId];
member.id = card.evoRootId;
member.awoken = _card.awakenings.length;
member.sawoken = null;
const allowLatent = getAllowLatent(_card.types);
member.latent = filterAllowLatent(member.latent,allowLatent);
}
});
});
@ -2138,16 +2141,12 @@ function editBoxChangeMonId(id) {
const rowLatent = settingBox.querySelector(".row-mon-latent");
const monLatentAllowUl = rowLatent.querySelector(".m-latent-allowable-ul");
//该宠Type允许的杀set不会出现重复的
const allowLatent = new Set();
card.types
.filter(i => i >= 0)
.map(type => type_allowable_latent[type])
.forEach(tA => tA.forEach(t => allowLatent.add(t)));
const allowLatent = getAllowLatent(card.types);
typekiller_for_type.forEach(type => { //显示允许的杀,隐藏不允许的杀
const latentDom = monLatentAllowUl.querySelector(`.latent-icon[data-latent-icon='${type.latent}']`);
if (!latentDom) return;
if (allowLatent.has(type.latent)) {
if (allowLatent.includes(type.latent)) {
latentDom.classList.remove("unallowable-latent");
} else {
latentDom.classList.add("unallowable-latent");
@ -2221,11 +2220,8 @@ function editBoxChangeMonId(id) {
}
}
const allKillerLatent = typekiller_for_type.map(type => type.latent);
//去除所有不能再打的潜觉
editBox.latent = editBox.latent.filter(lat =>
!allKillerLatent.includes(lat) ||
allKillerLatent.includes(lat) && allowLatent.has(lat));
editBox.latent = filterAllowLatent(editBox.latent,allowLatent);
editBox.refreshLatent(editBox.latent, id);
editBox.reCalculateExp();
editBox.reCalculateAbility();