演武台:boss血量修改
This commit is contained in:
@@ -27,7 +27,7 @@ import { UserGuildModel } from "../../db/UserGuild";
|
||||
import { raceActivityEnd } from "../timeTaskService";
|
||||
import { addActive } from "../guildService";
|
||||
import { checkTask, checkActivityTask } from "../taskService";
|
||||
import { ActivePlayer, ServerRecordModel } from "../../db/ServerRecords";
|
||||
import { ActivePlayer, GuildRecord, ServerRecordModel } from "../../db/ServerRecords";
|
||||
import { Attack } from "../../domain/battleField/pvp";
|
||||
|
||||
let gateActivityObj: GateActivityObject;
|
||||
@@ -63,13 +63,27 @@ export async function setPreDayActiveData() {
|
||||
for (let server of servers) {
|
||||
let roles = await RoleModel.getActivePlayers(server.id);
|
||||
let activePlayerCnt = roles.length;
|
||||
let activePlayerCe = 0, activePlayers: ActivePlayer[] = []
|
||||
for(let i = 0; i < 10; i++) {
|
||||
if(!roles[i]) break;
|
||||
activePlayerCe += roles[i].topLineupCe;
|
||||
activePlayers.push(new ActivePlayer(roles[i]));
|
||||
}
|
||||
await ServerRecordModel.updateData(server.id, { activePlayerCnt, activePlayerCe: reduceCe(activePlayerCe), activePlayers });
|
||||
let activePlayerCe = 0, activePlayers: ActivePlayer[] = [];
|
||||
let activeGuilds: GuildRecord[] = [];
|
||||
|
||||
for(let i = 0; i < roles.length; i++) {
|
||||
let role = roles[i];
|
||||
let activePlayer = new ActivePlayer(role);
|
||||
if(i < 10) {
|
||||
activePlayerCe += role.topLineupCe;
|
||||
activePlayers.push(activePlayer);
|
||||
}
|
||||
if(role.hasGuild) {
|
||||
let guildRecord = activeGuilds.find(cur => cur.guildCode == role.guildCode);
|
||||
if(!guildRecord) {
|
||||
activeGuilds.push({ guildCode: role.guildCode, players: [activePlayer] });
|
||||
} else {
|
||||
guildRecord.players.push(activePlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await ServerRecordModel.updateData(server.id, { activePlayerCnt, activePlayerCe: reduceCe(activePlayerCe), activePlayers, activeGuilds });
|
||||
}
|
||||
return servers;
|
||||
}
|
||||
|
||||
@@ -4,16 +4,18 @@ import { findIndex } from 'underscore';
|
||||
import { sismemberAsync, smembersAsync, saddAsync, delAsync, getRoleOnlineInfo } from '../services/redisService';
|
||||
import { pinus } from 'pinus';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { reduceCe, resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { BattleRecordModel } from '../db/BattleRecord';
|
||||
import { getArmyBossRank, gameData, getAuctionRewardByPoolId } from '../pubUtils/data';
|
||||
import { sendMailToGuildByContent } from '../services/mailService';
|
||||
import { MAIL_TYPE, AUCTION_SOURCE } from '../consts';
|
||||
import { MAIL_TYPE, AUCTION_SOURCE, ABI_TYPE } from '../consts';
|
||||
import { GUILD_BOSS_STATUS } from '../consts/constModules/guildConst';
|
||||
import { genAuction } from './auctionService';
|
||||
import { GuildModel, GuildType } from '../db/Guild';
|
||||
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { GUILDACTIVITY } from '../pubUtils/dicParam';
|
||||
import { ServerRecordModel } from '../db/ServerRecords';
|
||||
|
||||
/**
|
||||
* 获得boss界面
|
||||
@@ -170,3 +172,34 @@ export async function checkBossBattleMemberExists(code: string, serverId:number,
|
||||
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 }) {
|
||||
let { warId, bossHp: minBossHp, bossHpRatio } = dicBossBaseWar;
|
||||
|
||||
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
||||
if(!serverRecord) return minBossHp;
|
||||
|
||||
let dicWarJson = gameData.warJson.get(warId);
|
||||
let actorId = gameData.heroIdByWar.get(warId);
|
||||
let dicBoss = dicWarJson.find(cur => cur.bossStage == actorId);
|
||||
let attribute = dicBoss?.attribute||[];
|
||||
let hp = attribute.find(cur => cur.id == ABI_TYPE.ABI_HP)?.val||0;
|
||||
|
||||
let activeGuilds = serverRecord.activeGuilds||[];
|
||||
let myGuild = activeGuilds.find(cur => cur.guildCode == guildCode);
|
||||
let activeCe = 0;
|
||||
if(myGuild) {
|
||||
let activePlayers = myGuild.players||[];
|
||||
activePlayers.sort((a, b) => b.ce - a.ce);
|
||||
for(let i = 0; i < 10; i++) {
|
||||
if(!activePlayers[i]) break;
|
||||
activeCe += activePlayers[i].topLineupCe;
|
||||
}
|
||||
}
|
||||
activeCe = reduceCe(activeCe);
|
||||
let B = activeCe/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
||||
let bossBaseHp = B * hp;
|
||||
let bossHp = Math.floor(bossBaseHp * bossHpRatio);
|
||||
|
||||
return bossHp;
|
||||
}
|
||||
Reference in New Issue
Block a user