演武台:军团演武台血量
This commit is contained in:
@@ -17,6 +17,7 @@ import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { GUILDACTIVITY } from '../pubUtils/dicParam';
|
||||
import { ServerRecordModel } from '../db/ServerRecords';
|
||||
import { sendMessageToGuildWithSuc, sendMessageToUsersWithSuc } from './pushService';
|
||||
import { AttributeCal } from '../domain/roleField/attribute';
|
||||
|
||||
/**
|
||||
* 获得boss界面
|
||||
@@ -41,10 +42,10 @@ export async function getBossInstanceInfoByData(bossInstance: BossInstanceType,
|
||||
let bossInfo = null;
|
||||
|
||||
if(bossInstance) {
|
||||
let { code, warId, ranks, bossHp, bossTotalHp, bossLv, encourageCnt } = bossInstance;
|
||||
let { code, warId, ranks, bossHp, bossTotalHp, ratio, bossLv, encourageCnt } = bossInstance;
|
||||
let dicBossBase = gameData.bossBaseByBossLv.get(bossLv);
|
||||
let rankInfo = getRanks(ranks, userGuild.roleId);
|
||||
bossInfo = { bossCode: code, warId, ...rankInfo, bossHp, bossTotalHp, bossLv, encourageCnt, encourageMax: dicBossBase.encourageSum };
|
||||
bossInfo = { bossCode: code, warId, ...rankInfo, bossHp, bossTotalHp, bossLv, encourageCnt, encourageMax: dicBossBase.encourageSum, ratio };
|
||||
}
|
||||
return { status, bossInfo, ...refObj }
|
||||
}
|
||||
@@ -178,11 +179,21 @@ export async function removeBossRank(guildCode: string, roleId: string) {
|
||||
await BossInstanceModel.removeBossRank(guildCode, roleId);
|
||||
}
|
||||
|
||||
export async function getBossHp(serverId: number, guildCode: string, dicBossBaseWar: {warId: number, bossHp: number, bossHpRatio: number }) {
|
||||
function getBossSubAttrCe(secondAttrLevel: number, bossLevel: number) {
|
||||
let newAttribute = new AttributeCal();
|
||||
newAttribute.setLv(bossLevel);
|
||||
let subAttr = gameData.towerPvpSubAttr.get(secondAttrLevel);
|
||||
if(subAttr) newAttribute.setByWarJson(subAttr.secondAtr);
|
||||
let newCe = newAttribute.calCe();
|
||||
return newCe * bossLevel;
|
||||
}
|
||||
|
||||
export async function getBossHp(serverId: number, guildCode: string, dicBossBaseWar: {warId: number, bossHp: number, bossHpRatio: number }, bossLv: number) {
|
||||
let { warId, bossHp: minBossHp, bossHpRatio } = dicBossBaseWar;
|
||||
console.log('getBossHp', warId, minBossHp, bossHpRatio)
|
||||
|
||||
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
||||
if(!serverRecord) return minBossHp;
|
||||
if(!serverRecord) return { ratio: 1, bossHp: minBossHp };
|
||||
|
||||
let dicWar = gameData.war.get(warId);
|
||||
let dicWarJson = gameData.warJson.get(dicWar.dispatchJsonId);
|
||||
@@ -203,11 +214,13 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
|
||||
activeCe += activePlayers[i].topLineupCe;
|
||||
}
|
||||
}
|
||||
console.log(`getBossHp activeCe ${activeCe}`);
|
||||
let B = activeCe/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
||||
let subCe = getBossSubAttrCe(dicWar.secondAttrLevel, bossLv)
|
||||
console.log(`getBossHp activeCe ${activeCe} subCe ${subCe}`);
|
||||
let B = (activeCe - subCe)/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
||||
if(B <= 0) B = 1;
|
||||
console.log(`getBossHp B ${B}`);
|
||||
let bossBaseHp = B * hp;
|
||||
let bossHp = Math.floor(bossBaseHp * bossHpRatio);
|
||||
if(bossHp == 0) return minBossHp;
|
||||
return bossHp;
|
||||
if(bossHp <= 0) bossHp = minBossHp;
|
||||
return { ratio: B, bossHp };
|
||||
}
|
||||
Reference in New Issue
Block a user