演武台:boss血量修改
This commit is contained in:
@@ -25,6 +25,9 @@ import { getExpByLv } from '../../../pubUtils/data';
|
||||
import { reportTAUserSet } from '../../../services/sdkService';
|
||||
import { saveLoginAndOutLog } from '../../../pubUtils/logUtil';
|
||||
import { JewelModel } from '../../../db/Jewel';
|
||||
import { GuildModel } from '../../../db/Guild';
|
||||
import { GuildRecModel } from '../../../db/GuildRec';
|
||||
import { ServerRecordModel } from '../../../db/ServerRecords';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
|
||||
@@ -4,7 +4,7 @@ import { AUCTION_SOURCE, DEBUG_MAGIC_WORD, ITEM_CHANGE_REASON, MAIL_TYPE, STATUS
|
||||
import { BossInstanceModel } from '../../../db/BossInstance';
|
||||
import { BattleRecordModel } from '../../../db/BattleRecord';
|
||||
import { nowSeconds, getZeroPoint, getSeconds } from '../../../pubUtils/timeUtil';
|
||||
import { getBossInstanceInfo, checkBossBattleMemberExists, pushBossHpMessage, addBossInstance, refreshUserGuildOfBoss, refreshGuildOfBoss, getRanks, getBossInstanceInfoByData } from '../../../services/guildBossService';
|
||||
import { getBossInstanceInfo, checkBossBattleMemberExists, pushBossHpMessage, addBossInstance, refreshUserGuildOfBoss, refreshGuildOfBoss, getBossHp, getBossInstanceInfoByData } from '../../../services/guildBossService';
|
||||
import { findWhere } from 'underscore'
|
||||
import { GUILD_STRUCTURE, GUILD_BOSS_STATUS, GUILD_POINT_WAYS } from '../../../consts/constModules/guildConst';
|
||||
import { DATA_NAME } from '../../../consts/dataName';
|
||||
@@ -62,13 +62,10 @@ export class GuildHandler {
|
||||
return resResult(STATUS.GUILD_STRUCTURE_NOT_FOUND);
|
||||
}
|
||||
let bossBase = getBossByLv(curStructure.lv);
|
||||
let { bossHp: minBossHp, warId } = getRandSingleEelm(bossBase.wars);
|
||||
let medianCe = await getPreDayActiveData(serverId);
|
||||
let dicBossBaseWar = getRandSingleEelm(bossBase.wars);
|
||||
// let bossHp = Math.ceil(medianCe * bossBase.ratio);
|
||||
let bossHp = 10000;
|
||||
let bossHp = await getBossHp(serverId, code, dicBossBaseWar);
|
||||
|
||||
console.log('******* openBossInstance', medianCe, bossHp, minBossHp)
|
||||
if(bossHp < minBossHp) bossHp = minBossHp;
|
||||
let resGuild = await GuildModel.costFund(code, bossBase.opencost);
|
||||
if (!resGuild) {
|
||||
res.releaseCallback();
|
||||
@@ -87,7 +84,7 @@ export class GuildHandler {
|
||||
}
|
||||
await refreshGuildOfBoss(guild, 1);
|
||||
|
||||
bossInstance = await BossInstanceModel.openBossInstance(code, bossHp, warId, bossBase.bossLevel);
|
||||
bossInstance = await BossInstanceModel.openBossInstance(code, bossHp, dicBossBaseWar.warId, bossBase.bossLevel);
|
||||
res.releaseCallback();
|
||||
|
||||
let result = await getBossInstanceInfoByData(bossInstance, userGuild, guild);
|
||||
|
||||
@@ -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