🐞 fix(军团): 修复boss和城门血条计算错误
This commit is contained in:
@@ -204,13 +204,13 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
|
||||
if (!playerAtkResult) return { ratio: 1, bossHp: zoomInDamage(minBossHp) };
|
||||
// *军团的玩家人数=开启前一天军团内登录的玩家数
|
||||
// *单个玩家的平均攻击力=军团前一天活跃玩家中最强6人排名前10的玩家的最强6人的攻击之和/10
|
||||
let { playerAtkAvg, playerCnt, activeCe } = playerAtkResult;
|
||||
let { playerAtkAvg, playerCnt, activeCe, activePlayerCnt, playerAtkSum } = playerAtkResult;
|
||||
// 倍数按开服天数变化
|
||||
let ratio = await getBossHpRatioByServer(BOSS_HP_RATIO_TYPE.BOSS_RATIO, serverId);
|
||||
// *单个玩家10回合造成的总伤害=单个玩家的平均攻击力*倍数*10
|
||||
let player10Damage = playerAtkAvg * ratio * 10;
|
||||
// boss血量=单个玩家10回合造成的总伤害*军团的玩家人数*2
|
||||
let bossHp = Math.floor(player10Damage * playerCnt * 2);
|
||||
let bossHp = Math.floor(player10Damage * activePlayerCnt * 2);
|
||||
let B = getB(warId, bossLv, activeCe, playerCnt);
|
||||
if(B < 1) {
|
||||
B = 1;
|
||||
@@ -220,7 +220,7 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
|
||||
B = 1;
|
||||
bossHp = minBossHp;
|
||||
}
|
||||
saveGuildBossHpLog(serverId, warId, guildCode, { minBossHp, bossHpRatio, ratio, playerAtkAvg, player10Damage, activeCe, playerCnt, B, bossHp })
|
||||
saveGuildBossHpLog(serverId, warId, guildCode, { minBossHp, bossHpRatio, ratio, playerAtkAvg, player10Damage, activeCe, activePlayerCnt, playerAtkSum, playerCnt, B, bossHp })
|
||||
return { ratio: B, bossHp: zoomInDamage(bossHp) };
|
||||
}
|
||||
|
||||
@@ -236,9 +236,10 @@ function getB(warId: number, bossLv: number, activeCe: number, playerCnt: number
|
||||
|
||||
async function getPlayerAtkAvg(myGuild: GuildRecord) {
|
||||
if (!myGuild) return false;
|
||||
let playerAtkSum = 0, playerCnt = 0, activeCe = 0;
|
||||
let playerAtkSum = 0, playerCnt = 0, activeCe = 0, activePlayerCnt = 0;
|
||||
if (myGuild) {
|
||||
let activePlayers = myGuild.players || [];
|
||||
activePlayerCnt = activePlayers.length;
|
||||
activePlayers.sort((a, b) => b.ce - a.ce);
|
||||
for (let i = 0; i < 10; i++) {
|
||||
if (!activePlayers[i]) break;
|
||||
@@ -252,13 +253,13 @@ async function getPlayerAtkAvg(myGuild: GuildRecord) {
|
||||
}
|
||||
if (heroCnt == 0) continue; // 基本不可能,但是以防NaN
|
||||
playerAtkSum += onePlayerAtkSum / heroCnt * 6;
|
||||
playerCnt++;
|
||||
activeCe += topLineupCe;
|
||||
playerCnt ++;
|
||||
}
|
||||
}
|
||||
if (playerCnt == 0) return false;
|
||||
let playerAtkAvg = playerAtkSum / playerCnt * 10;
|
||||
return { playerAtkAvg, playerCnt, activeCe };
|
||||
let playerAtkAvg = playerAtkSum / playerCnt;
|
||||
return { playerAtkAvg, playerCnt, activeCe, activePlayerCnt, playerAtkSum };
|
||||
}
|
||||
|
||||
export async function getBossHpRatioByServer(type: BOSS_HP_RATIO_TYPE, serverId: number) {
|
||||
|
||||
Reference in New Issue
Block a user