将变身的计算改到数据预处理阶段

This commit is contained in:
枫谷剑仙 2020-12-15 03:29:48 +08:00
parent c6f3d3e1f7
commit 3601d9a953
12 changed files with 95 additions and 14 deletions

View File

@ -458,4 +458,14 @@
.henshin .evo-type::after
{
content: "Henshin";
}
.henshin-loop .evo-type::before,
.henshin-loop .evo-type::after
{
content: "Loop Henshin";
}
.henshin-loop .evo-type
{
transform: scaleX(0.6);
margin: calc(-100px * (1 - 0.6) / 2);
}

View File

@ -429,4 +429,9 @@
.henshin .evo-type::after
{
content: "変身";
}
.henshin-loop .evo-type::before,
.henshin-loop .evo-type::after
{
content: "ループ変身";
}

View File

@ -419,5 +419,10 @@
.henshin .evo-type::before,
.henshin .evo-type::after
{
content: "화장";
content: "변신";
}
.henshin-loop .evo-type::before,
.henshin-loop .evo-type::after
{
content: "루프 변신";
}

View File

@ -422,4 +422,9 @@
.henshin .evo-type::after
{
content: "變身";
}
.henshin-loop .evo-type::before,
.henshin-loop .evo-type::after
{
content: "循環變身";
}

View File

@ -422,4 +422,9 @@
.henshin .evo-type::after
{
content: "変身";
}
.henshin-loop .evo-type::before,
.henshin-loop .evo-type::after
{
content: "循環変身";
}

View File

@ -1 +1 @@
[{"code":"ja","ckey":{"card":"ccaba156d47add7a6efacf7b7c7fae7d","skill":"6a9c3bfe493bb6a25e4baa4f4ebdab33"},"updateTime":1607706679065},{"code":"en","ckey":{"card":"13c53ec60b057b7a6547b8d9659a9664","skill":"40b9acf5827237c5c4a450bd8289c4f9"},"updateTime":1607595293431},{"code":"ko","ckey":{"card":"7d4e3027765ad46bc6d45843f9d909be","skill":"908399019cc34e9a73b5344855093243"},"updateTime":1607595293431}]
[{"code":"ja","ckey":{"card":"271cc65f3273c767feb0c0330197e499","skill":"6a9c3bfe493bb6a25e4baa4f4ebdab33"},"updateTime":1607973033948},{"code":"en","ckey":{"card":"cb867f09cd557597d1c1a9caa12c98f9","skill":"40b9acf5827237c5c4a450bd8289c4f9"},"updateTime":1607973033948},{"code":"ko","ckey":{"card":"2147468c23a860987c70a59935ceef23","skill":"908399019cc34e9a73b5344855093243"},"updateTime":1607973033948}]

View File

@ -73,6 +73,25 @@ officialAPI.forEach(function(lang) {
const skillJsonObj = JSON.parse(skillJson);
const oSkills = lang.skillOriginal = skillJsonObj.skill;//将字符串转换为json对象
lang.skills = oSkills.map((oc,idx)=>new Skill(idx,oc)); //每一项生成分析对象
lang.cards.forEach((m,idx,arr)=>{
const skill = lang.skills[m.activeSkillId];
let henshinTo = null;
const searchType = 202;
if (skill.type == searchType)
henshinTo = skill.params[0];
else if (skill.type == 116 || skill.type == 118){
const subskill = skill.params.map(id=>lang.skills[id]).find(subskill=>subskill.type == searchType);
if (subskill)
henshinTo = subskill.params[0];
}
if (henshinTo)
{
m.henshinTo = henshinTo;
arr[henshinTo].henshinFrom = idx;
}
});
});
//加入其他服务器相同角色的名字

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -318,12 +318,27 @@ class EvoTree
this.parent = parent;
if (parent == null)
{
mid = Cards[mid].evoRootId;
//mid = Cards[mid].evoRootId;
function returnRootId(mid)
{
mid = Cards[mid].evoRootId;
const m = Cards[mid];
if (m.henshinFrom && m.henshinFrom < m.id)
{ //只有变身来源小于目前id的才继续找base
mid = returnRootId(m.henshinFrom);
}
return mid;
}
mid = returnRootId(mid);
}
const card = Cards[mid];
this.id = mid;
this.idArr = parent ? parent.idArr : [];
this.card = card;
this.children = [];
this.evoType = null;
if (parent == null)
{
this.evoType = "Base";
@ -366,8 +381,19 @@ class EvoTree
}
}
}
this.children = [];
if (card.henshinTo && card.henshinTo != card.evoRootId)
if (this.idArr.includes(mid))
{
if (card.henshinFrom == parent.id)
{
this.evoType = "Henshin Loop";
}
return this;
}else
{
this.idArr.push(mid);
}
if (card.henshinTo)
this.children.push(new EvoTree(card.henshinTo,_this));
if (this.evoType != "Henshin")
this.children.push(...Cards.filter(scard=>scard.evoBaseId == mid && scard.id != mid).map(scard=>new EvoTree(scard.id,_this)));
@ -395,6 +421,7 @@ class EvoTree
const monName = evotPanel_R.appendChild(document.createElement("div"));
monName.className = "monster-name";
monName.textContent = returnMonsterNameArr(this.card, currentLanguage.searchlist, currentDataSource.code)[0];
console.log(monName.offsetWidth);
const evotMaterials = evotPanel_R.appendChild(document.createElement("ul"));
evotMaterials.className = "evo-materials";
@ -409,6 +436,7 @@ class EvoTree
const li = evoSubEvo.appendChild(document.createElement("li"));
li.appendChild(subEvo.toListNode());
});
console.log(monName.scrollWidth);
return tBox;
};
}
@ -472,6 +500,7 @@ function swapHenshin(self)
team[0].forEach(member=>{
const mid = member.id;
const card = Cards[mid];
console.log(card.henshinFrom && member.level <= 99)
if (card.henshinFrom && member.level <= 99)
{ //要变身后的才进行操作
const _card = Cards[card.evoRootId];
@ -731,7 +760,7 @@ function loadData(force = false)
opt.value = m.id;
opt.label = m.id + " - " + returnMonsterNameArr(m, currentLanguage.searchlist, currentDataSource.code).join(" | ");
const linkRes = new RegExp("link:(\\d+)", "ig").exec(m.specialAttribute);
/*const linkRes = new RegExp("link:(\\d+)", "ig").exec(m.specialAttribute);
if (linkRes) { //每个有链接的符卡,把它们被链接的符卡的进化根修改到链接前的
const toId = parseInt(linkRes[1], 10);
const _m = Cards[toId];
@ -740,7 +769,7 @@ function loadData(force = false)
// _m.evoRootId = m.evoRootId;
m.henshinTo = toId;
_m.henshinFrom = m.id;
}
}*/
});
monstersList.appendChild(fragment);
}

View File

@ -2535,15 +2535,18 @@ ul{
{
border-color: #DBE721;
}
.henshin .evo-type::after
.henshin .evo-type::after,
.henshin-loop .evo-type::after
{ /*變身*/
background-image: linear-gradient(#FFFF00 30%, #FF00FF);
background-image: linear-gradient(#00FFFF 30%, #FF00FF);
}
.henshin
.henshin,
.henshin-loop
{
background-image: linear-gradient(#BFFFCF,#FFFFBF,#FFBFBF);
}
.henshin .evo-panel-right
.henshin .evo-panel-right,
.henshin-loop .evo-panel-right
{
border-color: #7F00FF;
}