✨ feat(军团): 修改boss和城门血条逻辑
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
import { ServerlistModel, ServerlistType } from "../../db/Serverlist";
|
import { ServerlistModel, ServerlistType } from "../../db/Serverlist";
|
||||||
import { RoleModel } from "../../db/Role";
|
import { RoleModel } from "../../db/Role";
|
||||||
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
|
import { GUILDACTIVITY } from "../../pubUtils/dicParam";
|
||||||
import { gameData, getCityActivityRewards } from "../../pubUtils/data";
|
import { gameData, getBossHpRatio, getCityActivityRewards } from "../../pubUtils/data";
|
||||||
import { getCurDay, nowSeconds, getTimeFun, getZeroPoint } from "../../pubUtils/timeUtil";
|
import { getCurDay, nowSeconds, getTimeFun, getZeroPoint, getZeroPointOfTime } from "../../pubUtils/timeUtil";
|
||||||
import { GUILD_ACTIVITY_STATUS, GET_POINT_WAYS, GUILD_ACTIVITY_TYPE, REDIS_KEY, AUCTION_SOURCE, MAIL_TYPE, CITY_STATUS, DEBUG_MAGIC_WORD, GUILD_POINT_WAYS, TASK_TYPE, AUCTION_TIME, CITY_ACTIVITY_DOOR, ABI_TYPE, PUSH_ROUTE, RACE_ACTIVITY_STATUS, SHOP_REFRESH_TYPE, COUNTER, RACE_EVENT_TYPE } from "../../consts";
|
import { GUILD_ACTIVITY_STATUS, GET_POINT_WAYS, GUILD_ACTIVITY_TYPE, REDIS_KEY, AUCTION_SOURCE, MAIL_TYPE, CITY_STATUS, DEBUG_MAGIC_WORD, GUILD_POINT_WAYS, TASK_TYPE, AUCTION_TIME, CITY_ACTIVITY_DOOR, ABI_TYPE, PUSH_ROUTE, RACE_ACTIVITY_STATUS, SHOP_REFRESH_TYPE, COUNTER, RACE_EVENT_TYPE, BOSS_HP_RATIO_TYPE } from "../../consts";
|
||||||
import { Record, UserGuildActivityRecModel } from "../../db/UserGuildActivityRec";
|
import { Record, UserGuildActivityRecModel } from "../../db/UserGuildActivityRec";
|
||||||
import { GateMembersRec, CityParam, WoodenHorse, RaceActivityRankParam } from "../../domain/battleField/guildActivity";
|
import { GateMembersRec, CityParam, WoodenHorse, RaceActivityRankParam } from "../../domain/battleField/guildActivity";
|
||||||
import { DicGuildActivity } from "../../pubUtils/dictionary/DicGuildActivity";
|
import { DicGuildActivity } from "../../pubUtils/dictionary/DicGuildActivity";
|
||||||
import { getAllServers, getRoleOnlineInfo, redisClient } from "../redisService";
|
import { getAllServers, getRoleOnlineInfo, getServerCreateTime, redisClient } from "../redisService";
|
||||||
import { SimpleGuildRankParam, SimpleRoleRankParam, GuildRankInfo, RoleRankInfo } from "../../domain/rank";
|
import { SimpleGuildRankParam, SimpleRoleRankParam, GuildRankInfo, RoleRankInfo } from "../../domain/rank";
|
||||||
import { pinus } from "pinus";
|
import { pinus } from "pinus";
|
||||||
import { GuildActivityRecordModel } from "../../db/GuildActivityRec";
|
import { GuildActivityRecordModel } from "../../db/GuildActivityRec";
|
||||||
@@ -30,6 +30,8 @@ import { setInterval } from "timers";
|
|||||||
import { dispatch } from "../../pubUtils/dispatcher";
|
import { dispatch } from "../../pubUtils/dispatcher";
|
||||||
import { GuildModel } from "../../db/Guild";
|
import { GuildModel } from "../../db/Guild";
|
||||||
import { getCityActivityObj, getGateActivityObj, getRaceActivityObj } from "../memoryCache/guildActivityData";
|
import { getCityActivityObj, getGateActivityObj, getRaceActivityObj } from "../memoryCache/guildActivityData";
|
||||||
|
import { getBossHpRatioByServer } from "../guildBossService";
|
||||||
|
import { getHeroesAttributes } from "../playerCeService";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -730,49 +732,89 @@ function formatTime(date: Date) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getCityActivityGateHp(serverId: number, cityId: number) {
|
export async function getCityActivityGateHp(serverId: number, cityId: number) {
|
||||||
console.log(`getCityActivityGateHp: serverId ${serverId}, cityId ${cityId}`);
|
|
||||||
let dicCityActivity = gameData.cityActivity.get(cityId);
|
let dicCityActivity = gameData.cityActivity.get(cityId);
|
||||||
|
let playerResult = await getPlayerCnt(serverId);
|
||||||
|
if (!playerResult) return dicCityActivity.hp
|
||||||
|
let { activePlayerCnt, activeGuildCnt, activePlayerCe, activeTopPlayerCnt, activePlayers } = playerResult;
|
||||||
|
|
||||||
|
// 倍数按开服天数变化
|
||||||
|
let ratio = await getBossHpRatioByServer(BOSS_HP_RATIO_TYPE.CITY_RATIO, serverId);
|
||||||
|
// 单个玩家的平均攻击力
|
||||||
|
let playerAtkResult = await getPlayerAtkAvg(activePlayers);
|
||||||
|
if (!playerAtkResult) return dicCityActivity.hp;
|
||||||
|
let { playerAtkAvg } = playerAtkResult;
|
||||||
|
|
||||||
|
// *单个玩家5回合造成的总伤害=单个玩家的平均攻击力*倍数*5(综合技能次级属性算出的倍数)
|
||||||
|
let player5Damage = playerAtkAvg * ratio * 5;
|
||||||
|
|
||||||
|
// *平均一个军团的玩家人数=前一天参与军团活动的玩家/前一天参与军团活动的军团数量,
|
||||||
|
let guildPlayerCntAvg = await getGuildPlayerCntAvg(serverId, activePlayerCnt, activeGuildCnt);
|
||||||
|
|
||||||
|
// 城池倍数
|
||||||
|
let cityRatio = Math.max(Math.floor(activeGuildCnt/6), dicCityActivity.hpN);
|
||||||
|
|
||||||
|
// 城门血量=单个玩家5回合造成的总伤害*平均一个军团的玩家人数*城池倍数
|
||||||
|
let gateHp = Math.floor(player5Damage * guildPlayerCntAvg * cityRatio);
|
||||||
|
if(gateHp <= dicCityActivity.hp) {
|
||||||
|
gateHp = dicCityActivity.hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveGuildGateHpLog(serverId, cityId, { activePlayerCnt, activePlayerCe, activeTopPlayerCnt, activeGuildCnt, ratio, playerAtkAvg, player5Damage, guildPlayerCntAvg, cityRatio, gateHp });
|
||||||
|
|
||||||
|
return gateHp;
|
||||||
|
}
|
||||||
|
|
||||||
|
// *单个玩家的平均攻击力=本服活跃玩家中最强6人排名前10的玩家的最强6人的攻击之和/10
|
||||||
|
async function getPlayerAtkAvg(activePlayers: ActivePlayer[]) {
|
||||||
|
if (!activePlayers || activePlayers.length <= 0) return false;
|
||||||
|
let playerAtkSum = 0, playerCnt = 0;
|
||||||
|
activePlayers.sort((a, b) => b.ce - a.ce);
|
||||||
|
for (let i = 0; i < 10; i++) {
|
||||||
|
if (!activePlayers[i]) break;
|
||||||
|
let onePlayerAtkSum = 0, heroCnt = 0;
|
||||||
|
let { roleId, topLineup = [] } = activePlayers[i];
|
||||||
|
let attrByHid = await getHeroesAttributes(roleId);
|
||||||
|
for (let { hid } of topLineup) {
|
||||||
|
let atk = attrByHid.get(hid)?.getAtk() || 0;
|
||||||
|
onePlayerAtkSum += atk;
|
||||||
|
heroCnt++;
|
||||||
|
}
|
||||||
|
if (heroCnt == 0) continue; // 基本不可能,但是以防NaN
|
||||||
|
playerAtkSum += onePlayerAtkSum / heroCnt * 6;
|
||||||
|
playerCnt++;
|
||||||
|
}
|
||||||
|
if (playerCnt == 0) return false;
|
||||||
|
let playerAtkAvg = playerAtkSum / playerCnt * 10;
|
||||||
|
return { playerAtkAvg, playerCnt };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getGuildPlayerCntAvg (serverId: number, activePlayerCnt: number, activeGuildCnt: number) {
|
||||||
|
let minRatio = await getBossHpRatioByServer(BOSS_HP_RATIO_TYPE.CITY_PLAYER_RATIO, serverId);
|
||||||
|
let guildPlayerCntAvg = Math.floor(activePlayerCnt / activeGuildCnt);
|
||||||
|
if (guildPlayerCntAvg < minRatio) return minRatio;
|
||||||
|
return guildPlayerCntAvg
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPlayerCnt(serverId: number) {
|
||||||
|
|
||||||
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
||||||
if(!serverRecord) return dicCityActivity.hp;
|
if(!serverRecord) return false;
|
||||||
|
|
||||||
let activePlayerCnt = 50; // 前一天参与军团活动的玩家
|
let activePlayerCnt = 50; // 前一天参与军团活动的玩家
|
||||||
let activeGuildCnt = 5; // 前一天参与军团活动的军团
|
let activeGuildCnt = 5; // 前一天参与军团活动的军团
|
||||||
let activePlayerCe = 0; // 前一天前十玩家的最强战力和
|
let activePlayerCe = 0; // 前一天前十玩家的最强战力和
|
||||||
let activeTopPlayerCnt = 1; // 前一天最强玩家数量
|
let activeTopPlayerCnt = 1; // 前一天最强玩家数量
|
||||||
|
let activePlayers: ActivePlayer[] = [];
|
||||||
if(serverRecord) {
|
if(serverRecord) {
|
||||||
if(serverRecord.activePlayerCe > 0) activePlayerCe = serverRecord.activePlayerCe;
|
if(serverRecord.activePlayerCe > 0) activePlayerCe = serverRecord.activePlayerCe;
|
||||||
if(serverRecord.activePlayers?.length > 0) activeTopPlayerCnt = serverRecord.activePlayers?.length;
|
if(serverRecord.activePlayers?.length > 0) {
|
||||||
|
activeTopPlayerCnt = serverRecord.activePlayers?.length;
|
||||||
|
activePlayers = serverRecord.activePlayers||[];
|
||||||
|
}
|
||||||
if(serverRecord.activeGuildCodes?.length > 0) activeGuildCnt = serverRecord.activeGuildCodes?.length;
|
if(serverRecord.activeGuildCodes?.length > 0) activeGuildCnt = serverRecord.activeGuildCodes?.length;
|
||||||
if(serverRecord.activeGuildMembers?.length > 0) activePlayerCnt = serverRecord.activeGuildMembers?.length;
|
if(serverRecord.activeGuildMembers?.length > 0) activePlayerCnt = serverRecord.activeGuildMembers?.length;
|
||||||
}
|
}
|
||||||
console.log(`getCityActivityGateHp: activePlayerCnt ${activePlayerCnt}, activePlayerCe ${activePlayerCe}, activeTopPlayerCnt ${activeTopPlayerCnt} activeGuildCnt ${activeGuildCnt}`);
|
return { activePlayerCnt, activeGuildCnt, activePlayerCe, activeTopPlayerCnt, activePlayers }
|
||||||
|
|
||||||
let atk = dicCityActivity.atkTemplate||0;
|
|
||||||
console.log(`getCityActivityGateHp: atk ${atk}`);
|
|
||||||
|
|
||||||
let A = activePlayerCe/activeTopPlayerCnt/6/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
|
||||||
if(A < 1) A = 1;
|
|
||||||
console.log(`getCityActivityGateHp: A ${A}`);
|
|
||||||
|
|
||||||
let gateHpBase = A * atk;
|
|
||||||
let N = dicCityActivity.hpN;
|
|
||||||
|
|
||||||
console.log(`getCityActivityGateHp: gateHpBase ${gateHpBase}, N ${N}`);
|
|
||||||
|
|
||||||
let playerGuildRatio = activePlayerCnt/activeGuildCnt;
|
|
||||||
if(playerGuildRatio < dicCityActivity.playerCount) playerGuildRatio = dicCityActivity.playerCount;
|
|
||||||
|
|
||||||
let gateHp = Math.floor(gateHpBase * playerGuildRatio * N);
|
|
||||||
console.log(`getCityActivityGateHp: gateHp ${gateHp}`);
|
|
||||||
|
|
||||||
|
|
||||||
saveGuildGateHpLog(serverId, cityId, { activePlayerCnt, activePlayerCe, activeTopPlayerCnt, activeGuildCnt, atk, A, hpBase: gateHpBase, N, gateHp, playerGuildRatio });
|
|
||||||
|
|
||||||
if(gateHp <= dicCityActivity.hp) {
|
|
||||||
gateHp = dicCityActivity.hp;
|
|
||||||
}
|
|
||||||
return gateHp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function declareCity(serverId: number, roleId: string, guildCode: string, cityId: number, isAutoDeclare: boolean, declareIndex: number) {
|
export async function declareCity(serverId: number, roleId: string, guildCode: string, cityId: number, isAutoDeclare: boolean, declareIndex: number) {
|
||||||
|
|||||||
@@ -1,24 +1,25 @@
|
|||||||
import { BossInstanceType, BossInstanceModel } from '../db/BossInstance';
|
import { BossInstanceType, BossInstanceModel } from '../db/BossInstance';
|
||||||
import { lockData } from '../services/redLockService';
|
import { lockData } from '../services/redLockService';
|
||||||
import { findIndex, pick } from 'underscore';
|
import { findIndex, pick } from 'underscore';
|
||||||
import { sismemberAsync, smembersAsync, saddAsync, delAsync, getRoleOnlineInfo } from '../services/redisService';
|
import { sismemberAsync, smembersAsync, saddAsync, delAsync, getRoleOnlineInfo, getServerCreateTime } from '../services/redisService';
|
||||||
import { pinus } from 'pinus';
|
import { pinus } from 'pinus';
|
||||||
import { STATUS } from '../consts/statusCode';
|
import { STATUS } from '../consts/statusCode';
|
||||||
import { resResult, shouldRefresh } from '../pubUtils/util';
|
import { resResult, shouldRefresh } from '../pubUtils/util';
|
||||||
import { BattleRecordModel } from '../db/BattleRecord';
|
import { BattleRecordModel } from '../db/BattleRecord';
|
||||||
import { getArmyBossRank, gameData } from '../pubUtils/data';
|
import { getArmyBossRank, gameData, getBossHpRatio } from '../pubUtils/data';
|
||||||
import { sendMailToGuildByContent } from '../services/mailService';
|
import { sendMailToGuildByContent } from '../services/mailService';
|
||||||
import { MAIL_TYPE, AUCTION_SOURCE, ABI_TYPE, PUSH_ROUTE } from '../consts';
|
import { MAIL_TYPE, AUCTION_SOURCE, ABI_TYPE, PUSH_ROUTE, BOSS_HP_RATIO_TYPE } from '../consts';
|
||||||
import { GUILD_BOSS_STATUS } from '../consts/constModules/guildConst';
|
import { GUILD_BOSS_STATUS } from '../consts/constModules/guildConst';
|
||||||
import { genAuction } from './auctionService';
|
import { genAuction } from './auctionService';
|
||||||
import { GuildModel, GuildType } from '../db/Guild';
|
import { GuildModel, GuildType } from '../db/Guild';
|
||||||
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
import { UserGuildModel, UserGuildType } from '../db/UserGuild';
|
||||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
import { getZeroPoint, getZeroPointOfTime, nowSeconds } from '../pubUtils/timeUtil';
|
||||||
import { GUILDACTIVITY } from '../pubUtils/dicParam';
|
import { GUILDACTIVITY } from '../pubUtils/dicParam';
|
||||||
import { ServerRecordModel } from '../db/ServerRecords';
|
import { GuildRecord, ServerRecordModel } from '../db/ServerRecords';
|
||||||
import { sendMessageToGuildWithSuc, sendMessageToUsersWithSuc } from './pushService';
|
import { sendMessageToGuildWithSuc, sendMessageToUsersWithSuc } from './pushService';
|
||||||
import { AttributeCal } from '../domain/roleField/attribute';
|
import { AttributeCal } from '../domain/roleField/attribute';
|
||||||
import { saveGuildBossHpLog } from '../pubUtils/logUtil';
|
import { saveGuildBossHpLog } from '../pubUtils/logUtil';
|
||||||
|
import { getHeroesAttributes } from './playerCeService';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得boss界面
|
* 获得boss界面
|
||||||
@@ -196,33 +197,21 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
|
|||||||
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
let serverRecord = await ServerRecordModel.findTodayData(serverId);
|
||||||
if(!serverRecord) return { ratio: 1, bossHp: zoomInDamage(minBossHp) };
|
if(!serverRecord) return { ratio: 1, bossHp: zoomInDamage(minBossHp) };
|
||||||
|
|
||||||
let dicWar = gameData.war.get(warId);
|
|
||||||
let dicWarJson = gameData.warJson.get(dicWar.dispatchJsonId);
|
|
||||||
let actorId = gameData.heroIdByWar.get(warId);
|
|
||||||
let dicBoss = dicWarJson.find(cur => cur.actorId == actorId);
|
|
||||||
let attribute = dicBoss?.attribute||[];
|
|
||||||
let hp = attribute.find(cur => cur.id == ABI_TYPE.ABI_HP)?.val||0;
|
|
||||||
console.log(`getBossHp warId ${warId} hp ${hp}`);
|
|
||||||
|
|
||||||
let activeGuilds = serverRecord.activeGuilds||[];
|
let activeGuilds = serverRecord.activeGuilds||[];
|
||||||
let myGuild = activeGuilds.find(cur => cur.guildCode == guildCode);
|
let myGuild = activeGuilds.find(cur => cur.guildCode == guildCode);
|
||||||
let activeCe = 0, playerCnt = 0;
|
|
||||||
if(myGuild) {
|
let playerAtkResult = await getPlayerAtkAvg(myGuild);
|
||||||
let activePlayers = myGuild.players||[];
|
if (!playerAtkResult) return { ratio: 1, bossHp: zoomInDamage(minBossHp) };
|
||||||
activePlayers.sort((a, b) => b.ce - a.ce);
|
// *军团的玩家人数=开启前一天军团内登录的玩家数
|
||||||
for(let i = 0; i < 10; i++) {
|
// *单个玩家的平均攻击力=军团前一天活跃玩家中最强6人排名前10的玩家的最强6人的攻击之和/10
|
||||||
if(!activePlayers[i]) break;
|
let { playerAtkAvg, playerCnt, activeCe } = playerAtkResult;
|
||||||
activeCe += activePlayers[i].topLineupCe;
|
// 倍数按开服天数变化
|
||||||
playerCnt ++;
|
let ratio = await getBossHpRatioByServer(BOSS_HP_RATIO_TYPE.BOSS_RATIO, serverId);
|
||||||
}
|
// *单个玩家10回合造成的总伤害=单个玩家的平均攻击力*倍数*10
|
||||||
}
|
let player10Damage = playerAtkAvg * ratio * 10;
|
||||||
if(playerCnt == 0) return { ratio: 1, bossHp: zoomInDamage(minBossHp) };
|
// boss血量=单个玩家10回合造成的总伤害*军团的玩家人数*2
|
||||||
|
let bossHp = Math.floor(player10Damage * playerCnt * 2);
|
||||||
let subCe = getBossSubAttrCe(actorId, dicWar.secondAttrLevel, bossLv)
|
let B = getB(warId, bossLv, activeCe, playerCnt);
|
||||||
console.log(`getBossHp activeCe ${activeCe} playerCnt ${playerCnt} subCe ${subCe}`);
|
|
||||||
let B = (activeCe/playerCnt/6 - subCe)/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
|
||||||
let bossBaseHp = B * hp;
|
|
||||||
let bossHp = Math.floor(bossBaseHp * bossHpRatio);
|
|
||||||
if(B < 1) {
|
if(B < 1) {
|
||||||
B = 1;
|
B = 1;
|
||||||
bossHp = minBossHp;
|
bossHp = minBossHp;
|
||||||
@@ -231,11 +220,55 @@ export async function getBossHp(serverId: number, guildCode: string, dicBossBase
|
|||||||
B = 1;
|
B = 1;
|
||||||
bossHp = minBossHp;
|
bossHp = minBossHp;
|
||||||
}
|
}
|
||||||
console.log(`getBossHp B ${B}`);
|
saveGuildBossHpLog(serverId, warId, guildCode, { minBossHp, bossHpRatio, ratio, playerAtkAvg, player10Damage, activeCe, playerCnt, B, bossHp })
|
||||||
saveGuildBossHpLog(serverId, warId, guildCode, { minBossHp, bossHpRatio, hp, activeCe, playerCnt, subCe, B, bossHp })
|
|
||||||
return { ratio: B, bossHp: zoomInDamage(bossHp) };
|
return { ratio: B, bossHp: zoomInDamage(bossHp) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getB(warId: number, bossLv: number, activeCe: number, playerCnt: number) {
|
||||||
|
let dicWar = gameData.war.get(warId);
|
||||||
|
if (!dicWar) return 1;
|
||||||
|
let actorId = gameData.heroIdByWar.get(warId);
|
||||||
|
|
||||||
|
let subCe = getBossSubAttrCe(actorId, dicWar.secondAttrLevel, bossLv)
|
||||||
|
let B = (activeCe/playerCnt/6 - subCe)/GUILDACTIVITY.GATEACTIVITY_ENEMYCE;
|
||||||
|
return B;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPlayerAtkAvg(myGuild: GuildRecord) {
|
||||||
|
if (!myGuild) return false;
|
||||||
|
let playerAtkSum = 0, playerCnt = 0, 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;
|
||||||
|
let onePlayerAtkSum = 0, heroCnt = 0;
|
||||||
|
let { roleId, topLineup = [], topLineupCe = 0 } = activePlayers[i];
|
||||||
|
let attrByHid = await getHeroesAttributes(roleId);
|
||||||
|
for (let { hid } of topLineup) {
|
||||||
|
let atk = attrByHid.get(hid)?.getAtk() || 0;
|
||||||
|
onePlayerAtkSum += atk;
|
||||||
|
heroCnt++;
|
||||||
|
}
|
||||||
|
if (heroCnt == 0) continue; // 基本不可能,但是以防NaN
|
||||||
|
playerAtkSum += onePlayerAtkSum / heroCnt * 6;
|
||||||
|
playerCnt++;
|
||||||
|
activeCe += topLineupCe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (playerCnt == 0) return false;
|
||||||
|
let playerAtkAvg = playerAtkSum / playerCnt * 10;
|
||||||
|
return { playerAtkAvg, playerCnt, activeCe };
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getBossHpRatioByServer(type: BOSS_HP_RATIO_TYPE, serverId: number) {
|
||||||
|
let serverOpenTime = await getServerCreateTime(serverId);
|
||||||
|
let serverZeroPoint = getZeroPointOfTime(serverOpenTime);
|
||||||
|
let todayZeroPoint = getZeroPoint();
|
||||||
|
let n = Math.floor((todayZeroPoint - serverZeroPoint)/86400) + 1;
|
||||||
|
return getBossHpRatio(type, n);
|
||||||
|
}
|
||||||
|
|
||||||
export function zoomInDamage(damage: number, ratio = 100) {
|
export function zoomInDamage(damage: number, ratio = 100) {
|
||||||
return Math.floor(damage * ratio);
|
return Math.floor(damage * ratio);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -693,6 +693,7 @@ export const FILENAME = {
|
|||||||
DIC_ROUGE_TECH: "dic_rougeTech",
|
DIC_ROUGE_TECH: "dic_rougeTech",
|
||||||
DIC_ROUGE_TECH_CIRCLE: "dic_rougeTechCircle",
|
DIC_ROUGE_TECH_CIRCLE: "dic_rougeTechCircle",
|
||||||
DIC_ROUGE_TECH_LEVEL: "dic_rougeTechLevel",
|
DIC_ROUGE_TECH_LEVEL: "dic_rougeTechLevel",
|
||||||
|
DIC_GUILD_HP_RATIO: "dic_army_hpRatio",
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WAR_RELATE_TABLES = [
|
export const WAR_RELATE_TABLES = [
|
||||||
@@ -1419,4 +1420,10 @@ export enum TEAM_TYPE {
|
|||||||
export enum CHECT_BLOCK_TYPE {
|
export enum CHECT_BLOCK_TYPE {
|
||||||
OPEN = 0, //开
|
OPEN = 0, //开
|
||||||
CLOSE = 1, //关
|
CLOSE = 1, //关
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum BOSS_HP_RATIO_TYPE {
|
||||||
|
BOSS_RATIO = 1, // 演武台按开服天数
|
||||||
|
CITY_RATIO = 2, // 诸侯混战按开服天数
|
||||||
|
CITY_PLAYER_RATIO = 3, // 最低玩家人数
|
||||||
}
|
}
|
||||||
@@ -19,17 +19,18 @@ export class GateHpLog {
|
|||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
activeGuildCnt: number;
|
activeGuildCnt: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
atk: number;
|
ratio: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
A: number;
|
playerAtkAvg: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
hpBase: number;
|
player5Damage: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
N: number;
|
guildPlayerCntAvg: number;
|
||||||
|
@prop({ required: false })
|
||||||
|
cityRatio: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
gateHp: number;
|
gateHp: number;
|
||||||
@prop({ required: false })
|
|
||||||
playerGuildRatio: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BossHpLog {
|
export class BossHpLog {
|
||||||
@@ -38,14 +39,16 @@ export class BossHpLog {
|
|||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
bossHpRatio: number;
|
bossHpRatio: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
hp: number;
|
ratio: number;
|
||||||
|
@prop({ required: false })
|
||||||
|
playerAtkAvg: number;
|
||||||
|
@prop({ required: false })
|
||||||
|
player10Damage: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
activeCe: number;
|
activeCe: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
playerCnt: number;
|
playerCnt: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
subCe: number;
|
|
||||||
@prop({ required: false })
|
|
||||||
B: number;
|
B: number;
|
||||||
@prop({ required: false })
|
@prop({ required: false })
|
||||||
bossHp: number;
|
bossHp: number;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getAtrrNameById, ABI_TYPE_MAIN } from '../../consts';
|
import { getAtrrNameById, ABI_TYPE_MAIN, ABI_TYPE } from '../../consts';
|
||||||
import { gameData } from '../../pubUtils/data';
|
import { gameData } from '../../pubUtils/data';
|
||||||
import { decodeArrayListStr } from '../../pubUtils/util';
|
import { decodeArrayListStr } from '../../pubUtils/util';
|
||||||
import { ATTRIBUTE } from '../../pubUtils/dicParam';
|
import { ATTRIBUTE } from '../../pubUtils/dicParam';
|
||||||
@@ -116,6 +116,10 @@ export class AttributeCal {
|
|||||||
public calSubAttrCe() {
|
public calSubAttrCe() {
|
||||||
return Math.floor(this.calCe(3));
|
return Math.floor(this.calCe(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getAtk() {
|
||||||
|
return this.attrs.get(ABI_TYPE.ABI_ATK)||0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Attribute {
|
export class Attribute {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { dicTower, loadTower } from "./dictionary/DicTower";
|
|||||||
import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
|
import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
|
||||||
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar, dicHeroIdByWar, dicComBattleReward } from "./dictionary/DicWar";
|
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar, dicHeroIdByWar, dicComBattleReward } from "./dictionary/DicWar";
|
||||||
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
|
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
|
||||||
import { AUCTION_TIME } from "../consts";
|
import { AUCTION_TIME, BOSS_HP_RATIO_TYPE } from "../consts";
|
||||||
import { dicFashions, dicFashionsByHeroId, loadFashions } from "./dictionary/DicFashions";
|
import { dicFashions, dicFashionsByHeroId, loadFashions } from "./dictionary/DicFashions";
|
||||||
import { friendShips, friendShipsByLv, friendShipsMax, loadFriendShip } from "./dictionary/DicFriendShip";
|
import { friendShips, friendShipsByLv, friendShipsMax, loadFriendShip } from "./dictionary/DicFriendShip";
|
||||||
import { dicHeroQualityUp, loadHeroQualityUp } from "./dictionary/DicHeroQualityUp";
|
import { dicHeroQualityUp, loadHeroQualityUp } from "./dictionary/DicHeroQualityUp";
|
||||||
@@ -172,6 +172,7 @@ import { dicSpiritPlan, loadSpiritPlan } from "./dictionary/DicSpiritPlan";
|
|||||||
import { dicRougePassiveWeight, loadRougePassiveWeight } from "./dictionary/DicRougePassiveWeight";
|
import { dicRougePassiveWeight, loadRougePassiveWeight } from "./dictionary/DicRougePassiveWeight";
|
||||||
import { dicRougeCharaCardPlan, loadRougeCharaCardPlan } from "./dictionary/DicRougeCharaCardPlan";
|
import { dicRougeCharaCardPlan, loadRougeCharaCardPlan } from "./dictionary/DicRougeCharaCardPlan";
|
||||||
import { dicRougeHolyCardPlan, loadRougeHolyCardPlan } from "./dictionary/DicRougeHolyCardPlan";
|
import { dicRougeHolyCardPlan, loadRougeHolyCardPlan } from "./dictionary/DicRougeHolyCardPlan";
|
||||||
|
import { dicBossHpRatio, loadBossHpRatio } from "./dictionary/DicBossHpRatio";
|
||||||
|
|
||||||
export const gameData = {
|
export const gameData = {
|
||||||
daily: dicDaily,
|
daily: dicDaily,
|
||||||
@@ -431,6 +432,7 @@ export const gameData = {
|
|||||||
rougeCircleByTech: dicRougeTechCircleByTechId,
|
rougeCircleByTech: dicRougeTechCircleByTechId,
|
||||||
rougeTechByRow: dicRougeTechIdByRow,
|
rougeTechByRow: dicRougeTechIdByRow,
|
||||||
rougeTechLevel: dicRougeTechLevel,
|
rougeTechLevel: dicRougeTechLevel,
|
||||||
|
bossHpRatio: dicBossHpRatio,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||||
@@ -1378,6 +1380,16 @@ export function getRougeEffectTypeKind(effectTypes: number[]) {
|
|||||||
return kinds;
|
return kinds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBossHpRatio(type: BOSS_HP_RATIO_TYPE, day: number) {
|
||||||
|
let arr = gameData.bossHpRatio.get(type)||[];
|
||||||
|
let bossHpRatio = 1;
|
||||||
|
for(let { serverOpen, ratio } of arr) {
|
||||||
|
bossHpRatio = ratio;
|
||||||
|
if (serverOpen != -1 && serverOpen >= day) break;
|
||||||
|
}
|
||||||
|
return bossHpRatio;
|
||||||
|
}
|
||||||
|
|
||||||
// 初始加载
|
// 初始加载
|
||||||
function initDatas() {
|
function initDatas() {
|
||||||
parseDicParam();
|
parseDicParam();
|
||||||
@@ -1790,8 +1802,10 @@ function loadDatas(type?: string) {
|
|||||||
if (type == undefined || type == 'loadRougeTech') loadRougeTech();
|
if (type == undefined || type == 'loadRougeTech') loadRougeTech();
|
||||||
if (type == undefined || type == 'loadRougeTechCircle') loadRougeTechCircle();
|
if (type == undefined || type == 'loadRougeTechCircle') loadRougeTechCircle();
|
||||||
if (type == undefined || type == 'loadRougeTechLevel') loadRougeTechLevel();
|
if (type == undefined || type == 'loadRougeTechLevel') loadRougeTechLevel();
|
||||||
|
if (type == undefined || type == 'loadBossHpRatio') loadBossHpRatio();
|
||||||
|
|
||||||
console.log('loadDatas type: ', type || 'all');
|
console.log('loadDatas type: ', type || 'all');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 后台调用重载资源
|
// 后台调用重载资源
|
||||||
|
|||||||
24
shared/pubUtils/dictionary/DicBossHpRatio.ts
Normal file
24
shared/pubUtils/dictionary/DicBossHpRatio.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
// 演武台&诸侯混战
|
||||||
|
import { readFileAndParse } from '../util'
|
||||||
|
import { FILENAME } from '../../consts'
|
||||||
|
|
||||||
|
export interface DicBossHpRatio {
|
||||||
|
// 类型 1-演武台按开服天数 2-诸侯混战按开服天数 3-最低玩家人数
|
||||||
|
readonly type: number;
|
||||||
|
// 开服时间
|
||||||
|
readonly serverOpen: number;
|
||||||
|
// 倍率
|
||||||
|
readonly ratio: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dicBossHpRatio = new Map<number, DicBossHpRatio[]>();
|
||||||
|
export function loadBossHpRatio() {
|
||||||
|
dicBossHpRatio.clear();
|
||||||
|
let arr = readFileAndParse(FILENAME.DIC_GUILD_HP_RATIO);
|
||||||
|
|
||||||
|
arr.forEach(o => {
|
||||||
|
if(!dicBossHpRatio.has(o.type)) dicBossHpRatio.set(o.type, []);
|
||||||
|
dicBossHpRatio.get(o.type)?.push(o);
|
||||||
|
});
|
||||||
|
arr = undefined;
|
||||||
|
}
|
||||||
@@ -22,8 +22,6 @@ export interface DicCityActivity {
|
|||||||
readonly hp: number;
|
readonly hp: number;
|
||||||
// 城门倍率
|
// 城门倍率
|
||||||
readonly hpN: number;
|
readonly hpN: number;
|
||||||
// 城门用于计算血量的攻击值模板
|
|
||||||
readonly atkTemplate: number;
|
|
||||||
// 玩家和军团比例
|
// 玩家和军团比例
|
||||||
readonly playerCount: number;
|
readonly playerCount: number;
|
||||||
}
|
}
|
||||||
|
|||||||
116
shared/resource/jsons/dic_army_hpRatio.json
Normal file
116
shared/resource/jsons/dic_army_hpRatio.json
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 7,
|
||||||
|
"ratio": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 14,
|
||||||
|
"ratio": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 30,
|
||||||
|
"ratio": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 60,
|
||||||
|
"ratio": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 90,
|
||||||
|
"ratio": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 120,
|
||||||
|
"ratio": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 150,
|
||||||
|
"ratio": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"type": 1,
|
||||||
|
"serverOpen": 180,
|
||||||
|
"ratio": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 7,
|
||||||
|
"ratio": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 14,
|
||||||
|
"ratio": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 11,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 30,
|
||||||
|
"ratio": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 60,
|
||||||
|
"ratio": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 90,
|
||||||
|
"ratio": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 14,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 120,
|
||||||
|
"ratio": 6
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 15,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 150,
|
||||||
|
"ratio": 7
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 16,
|
||||||
|
"type": 2,
|
||||||
|
"serverOpen": 180,
|
||||||
|
"ratio": 8
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"type": 3,
|
||||||
|
"serverOpen": 7,
|
||||||
|
"ratio": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 18,
|
||||||
|
"type": 3,
|
||||||
|
"serverOpen": 30,
|
||||||
|
"ratio": 15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 19,
|
||||||
|
"type": 3,
|
||||||
|
"serverOpen": -1,
|
||||||
|
"ratio": 20
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
"warid": 7002,
|
"warid": 7002,
|
||||||
"hp": 20000000,
|
"hp": 20000000,
|
||||||
"week": "2&4&6",
|
"week": "2&4&6",
|
||||||
"hpN": 80,
|
"hpN": 1,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 10
|
"playerCount": 10
|
||||||
},
|
},
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
"warid": 7003,
|
"warid": 7003,
|
||||||
"hp": 25000000,
|
"hp": 25000000,
|
||||||
"week": "4&6",
|
"week": "4&6",
|
||||||
"hpN": 100,
|
"hpN": 2,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 15
|
"playerCount": 15
|
||||||
},
|
},
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
"warid": 7003,
|
"warid": 7003,
|
||||||
"hp": 25000000,
|
"hp": 25000000,
|
||||||
"week": "4&6",
|
"week": "4&6",
|
||||||
"hpN": 100,
|
"hpN": 2,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 15
|
"playerCount": 15
|
||||||
},
|
},
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
"warid": 7003,
|
"warid": 7003,
|
||||||
"hp": 25000000,
|
"hp": 25000000,
|
||||||
"week": "4&6",
|
"week": "4&6",
|
||||||
"hpN": 100,
|
"hpN": 2,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 15
|
"playerCount": 15
|
||||||
},
|
},
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
"warid": 7004,
|
"warid": 7004,
|
||||||
"hp": 30000000,
|
"hp": 30000000,
|
||||||
"week": "6&",
|
"week": "6&",
|
||||||
"hpN": 120,
|
"hpN": 3,
|
||||||
"atkTemplate": 3000,
|
"atkTemplate": 3000,
|
||||||
"playerCount": 20
|
"playerCount": 20
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user