加入地下城强化支持
This commit is contained in:
parent
1e2ac519a6
commit
42ce89e9fc
|
@ -131,6 +131,10 @@ function flags(num) {
|
|||
}
|
||||
return arr;
|
||||
}
|
||||
//将二进制flag转为数组
|
||||
function reflags(arr) {
|
||||
return arr.reduce((pre,cur)=>pre | 1 << cur, 0);
|
||||
}
|
||||
|
||||
//带标签的模板字符串
|
||||
function tp(strings, ...keys) {
|
||||
|
@ -464,8 +468,16 @@ function calculateAbility(member, assist = null, solo = true, teamsCount = 1) {
|
|||
reValue = reValue * latterAwokenScale[idx].reduce(calculateAwokenScale, 1);
|
||||
|
||||
//都要做四舍五入
|
||||
reValue = Math.round(reValue);
|
||||
reValueNoAwoken = Math.round(reValueNoAwoken);
|
||||
if (formation.dungeonEnchance.rate !== 1)
|
||||
{
|
||||
let rate = (memberCard.attrs.some(attr=>formation.dungeonEnchance.attrs.includes(attr)) || memberCard.types.some(type=>formation.dungeonEnchance.types.includes(type))) ? formation.dungeonEnchance.rate : 1;
|
||||
reValue = Math.round(reValue * rate);
|
||||
reValueNoAwoken = Math.round(reValueNoAwoken * rate);
|
||||
}else
|
||||
{
|
||||
reValue = Math.round(reValue);
|
||||
reValueNoAwoken = Math.round(reValueNoAwoken);
|
||||
}
|
||||
if (idx < 2) //idx顺序为HP、ATK、RCV
|
||||
{ //HP和ATK最低为1
|
||||
reValue = Math.max(reValue, 1);
|
||||
|
@ -713,17 +725,12 @@ function countTeamHp(memberArr, leader1id, leader2id, solo, noAwoken = false) {
|
|||
let hp = ability ? ability[0] : 0;
|
||||
if (!hp) return 0;
|
||||
const card = Cards[m.id] || Cards[0];
|
||||
hp = hp1 = Math.round(hp * memberHpMul(card, ls2, memberArr, solo)); //战友队长技
|
||||
hp = hp2 = Math.round(hp * memberHpMul(card, ls1, memberArr, solo)); //我方队长技
|
||||
let hp1 = hp = Math.round(hp * memberHpMul(card, ls2, memberArr, solo)); //战友队长技
|
||||
let hp2 = hp = Math.round(hp * memberHpMul(card, ls1, memberArr, solo)); //我方队长技
|
||||
|
||||
/* 演示用代码
|
||||
let hp1,hp2;
|
||||
hp1 = hp * memberHpMul(card,ls2,memberArr,solo);
|
||||
hp = Math.round(hp1);
|
||||
hp2 = hp * memberHpMul(card,ls1,memberArr,solo);
|
||||
hp = Math.round(hp2);
|
||||
console.log("%s 第1次倍率血量:%s(%s),第2次倍率血量:%s(%s)",Cards[m.id].otLangName["chs"],Math.round(hp1),hp1,Math.round(hp2),hp2);
|
||||
*/
|
||||
//演示用代码
|
||||
console.log("%s 第1次倍率血量:%s,第2次倍率血量:%s",Cards[m.id].otLangName["chs"],hp1,hp2);
|
||||
|
||||
return hp;
|
||||
|
||||
});
|
||||
|
|
19
script.js
19
script.js
|
@ -249,6 +249,11 @@ var Formation = function(teamCount, memberCount) {
|
|||
this.title = "";
|
||||
this.detail = "";
|
||||
this.teams = [];
|
||||
this.dungeonEnchance = {
|
||||
attrs: [],
|
||||
types: [],
|
||||
rate: 1,
|
||||
}
|
||||
for (let ti = 0; ti < teamCount; ti++) {
|
||||
const team = [
|
||||
[], //队员
|
||||
|
@ -279,6 +284,11 @@ Formation.prototype.outObj = function() {
|
|||
if (t[3]) teamArr[3] = t[3];
|
||||
return teamArr;
|
||||
});
|
||||
if (this.dungeonEnchance.rate != 1) obj.r = [
|
||||
this.dungeonEnchance.rate, //比例
|
||||
reflags(this.dungeonEnchance.types) //优先添加Type
|
||||
];
|
||||
if (this.dungeonEnchance.attrs.length) obj.r.push(reflags(this.dungeonEnchance.attrs)); //有Attr.才添加
|
||||
obj.v = dataStructure;
|
||||
/*if (obj.f.every(team=>team[0].length == 0 && team[1].length == 0 && team[2] == undefined) &&
|
||||
!obj.t &&
|
||||
|
@ -301,6 +311,9 @@ Formation.prototype.loadObj = function(f) {
|
|||
t[2] = 0;
|
||||
t[3] = 0;
|
||||
});
|
||||
this.dungeonEnchance.rate = 1;
|
||||
this.dungeonEnchance.attrs.length = 0;
|
||||
this.dungeonEnchance.types.length = 0;
|
||||
return;
|
||||
}
|
||||
const dataVeision = f.v ? f.v : (f.f ? 2 : 1); //是第几版格式
|
||||
|
@ -322,6 +335,12 @@ Formation.prototype.loadObj = function(f) {
|
|||
t[3] = tf[3] || 0; //队长
|
||||
}
|
||||
});
|
||||
if (f.r)
|
||||
{
|
||||
this.dungeonEnchance.rate = f.r[0] ?? 1;
|
||||
this.dungeonEnchance.types = flags(f.r[1] ?? 0);
|
||||
this.dungeonEnchance.attrs = flags(f.r[2] ?? 0);
|
||||
}
|
||||
if (f.b)
|
||||
this.teams[0][2] = f.b; //原来模式的徽章
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue