Browse Source

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

tags/v8.0
枫谷剑仙 5 years ago
parent
commit
7b173c8c71
2 changed files with 23 additions and 10 deletions
  1. +17
    -0
      script-universal_function.js
  2. +6
    -10
      script.js

+ 17
- 0
script-universal_function.js 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)
{


+ 6
- 10
script.js 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();


Loading…
Cancel
Save