添加最强五人战力
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
import { STATUS } from './../consts/statusCode';
|
||||
|
||||
import { getGamedata } from './gamedata';
|
||||
import { HeroModel, HeroType } from '../db/Hero';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
import Actor from './actor';
|
||||
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
@@ -170,26 +166,6 @@ export async function calculateSumCE(roleId: string, type: number, param: { num?
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
// 计算当前武将战力
|
||||
export function calculateCE(heroInfo: { hid: number, lv: number }) {
|
||||
let { hid, lv } = heroInfo;
|
||||
// 假设所有属性和等级的关系是简单的线性关系
|
||||
let dicHero = getGamedata('dic_zyz_hero');
|
||||
let curDicHero = dicHero.find(cur => cur.heroId == hid);
|
||||
|
||||
let { atk, matk, def, mdef, agi, luk, atk_up, matk_up, def_up, mdef_up, agi_up, luk_up } = curDicHero;
|
||||
atk += lv * atk_up;
|
||||
matk += lv * matk_up;
|
||||
def += lv * def_up;
|
||||
mdef += lv * mdef_up;
|
||||
agi += lv * agi_up;
|
||||
luk += lv * luk_up;
|
||||
|
||||
// 假设战力为所有属性的简单加法
|
||||
|
||||
let ce = atk + matk + def + mdef + agi + luk;
|
||||
return ce;
|
||||
}
|
||||
|
||||
export function getRandomByLen(arr: Array<number>): number
|
||||
export function getRandomByLen(arr: Array<DicRandomEffectPool>): DicRandomEffectPool
|
||||
@@ -405,21 +381,6 @@ export function setLocalHours(hour: number, curTime = new Date()) {
|
||||
return localTime.getTime() - 8 * 60 * 60 * 1000; // 回到格林威治时间
|
||||
}
|
||||
|
||||
export async function updateCe(roleId: string, hero: any) {
|
||||
let { hid, ce: oldCe, historyCe } = hero;
|
||||
let actor = new Actor();
|
||||
actor.initHero(hero);
|
||||
let ce = actor.calculateCE();
|
||||
if (ce != oldCe) {
|
||||
// 更新总战力&最强五人战力
|
||||
await RoleModel.updateSumCe(roleId, hid, ce, oldCe);
|
||||
// 更新pvp防守阵容战力
|
||||
await PvpDefenseModel.updateCe(roleId, hid, ce, oldCe);
|
||||
// 更新武将战力,历史最高战力
|
||||
await HeroModel.updateCe(roleId, hid, ce, oldCe, historyCe);
|
||||
}
|
||||
}
|
||||
|
||||
export function ratioReward(rewardStr: string, ratio: number): string {
|
||||
let rewards = decodeIdCntArrayStr(rewardStr, ratio);
|
||||
let res = '';
|
||||
|
||||
Reference in New Issue
Block a user