远征:模板计算
This commit is contained in:
@@ -199,9 +199,9 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
|
|||||||
let dicExpeditionSubAttr = gameData.expeditionSubAttr.get(lv);
|
let dicExpeditionSubAttr = gameData.expeditionSubAttr.get(lv);
|
||||||
for(let json of dicWarJson) {
|
for(let json of dicWarJson) {
|
||||||
if(json.relation == 2) {
|
if(json.relation == 2) {
|
||||||
const { attribute } = json;
|
const { attribute, enemyCount } = json;
|
||||||
|
|
||||||
let { attribute: newAttribute, ce } = getRobotAttribute(attribute, dicExpeditionSubAttr.attribute, dicExpeditionSubAttr.lv, myCe, robotCe, scale);
|
let { attribute: newAttribute, ce } = getRobotAttribute(attribute, enemyCount, dicExpeditionSubAttr.attribute, dicExpeditionSubAttr.lv, myCe, robotCe, scale);
|
||||||
enemyObj.enemies.push({...json, attribute: newAttribute, lv, ce});
|
enemyObj.enemies.push({...json, attribute: newAttribute, lv, ce});
|
||||||
allCe += ce;
|
allCe += ce;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ async function matchRobot(oppPlayers: OppPlayers[], mapWarJson: DicWarJson[], ro
|
|||||||
if (!dicHero) continue;
|
if (!dicHero) continue;
|
||||||
let heroInfo = new PvpHeroInfo();
|
let heroInfo = new PvpHeroInfo();
|
||||||
heroInfo.setRobotInfo(h, myLv, dicHero.initialStars, dicHero.quality);
|
heroInfo.setRobotInfo(h, myLv, dicHero.initialStars, dicHero.quality);
|
||||||
let { attribute, ce } = getRobotAttribute(h.attribute, [], pLv, myCe, PVP_CONST.ENEMY_CE, ratio);
|
let { attribute, ce } = getRobotAttribute(h.attribute, h.enemyCount, [], pLv, myCe, PVP_CONST.ENEMY_CE, ratio);
|
||||||
defCe += ce;
|
defCe += ce;
|
||||||
heroInfo.setAttribute(attribute);
|
heroInfo.setAttribute(attribute);
|
||||||
let enemy = new PvpEnemies(warJson, heroInfo, 0, ce);
|
let enemy = new PvpEnemies(warJson, heroInfo, 0, ce);
|
||||||
@@ -513,14 +513,14 @@ export async function findPvpDefAllByRoleId(roleId: string) {
|
|||||||
* @param enemyCe 出兵表对手战力
|
* @param enemyCe 出兵表对手战力
|
||||||
* @param ratio 系数
|
* @param ratio 系数
|
||||||
*/
|
*/
|
||||||
export function getRobotAttribute(mainAttrs: { id: number, val: number }[], subAttrs: {id: number, val: number}[], lv: number, ce: number, enemyCe: number, ratio: number) {
|
export function getRobotAttribute(mainAttrs: { id: number, val: number }[], enemyCount: number, subAttrs: {id: number, val: number}[], lv: number, ce: number, enemyCe: number, ratio: number) {
|
||||||
|
|
||||||
let newAttribute = new AttributeCal();
|
let newAttribute = new AttributeCal();
|
||||||
newAttribute.setLv(lv);
|
newAttribute.setLv(lv);
|
||||||
newAttribute.setByWarJson(subAttrs); // 次级属性
|
newAttribute.setByWarJson(subAttrs); // 次级属性
|
||||||
let subAttrCe = newAttribute.calSubAttrCeAndReduce();
|
let subAttrCe = newAttribute.calSubAttrCeAndReduce() * enemyCount;
|
||||||
let mainAttrCe = ce > subAttrCe? ce - subAttrCe: 0;
|
let mainAttrCe = ce * ratio > subAttrCe? ce * ratio - subAttrCe: 0;
|
||||||
newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe * ratio);
|
newAttribute.setByWarJson(mainAttrs, mainAttrCe / enemyCe);
|
||||||
let attrArr = newAttribute.getReduceAttributesToString();
|
let attrArr = newAttribute.getReduceAttributesToString();
|
||||||
let newCe = newAttribute.calCelAndReduce();
|
let newCe = newAttribute.calCelAndReduce();
|
||||||
return { attribute: attrArr, ce: newCe };
|
return { attribute: attrArr, ce: newCe };
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ export interface DicWarJson {
|
|||||||
readonly enemyType: number;
|
readonly enemyType: number;
|
||||||
// 召唤技能的召唤物
|
// 召唤技能的召唤物
|
||||||
readonly callSkillData: string;
|
readonly callSkillData: string;
|
||||||
|
// 敌军数量
|
||||||
|
readonly enemyCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dicWarJson = new Map<number, Array<DicWarJson>>();
|
export const dicWarJson = new Map<number, Array<DicWarJson>>();
|
||||||
@@ -54,9 +55,14 @@ export function loadWarJson() {
|
|||||||
|
|
||||||
let warjson = new Array<DicWarJson>();
|
let warjson = new Array<DicWarJson>();
|
||||||
let warid = 0;
|
let warid = 0;
|
||||||
|
let enemyCount = 0;
|
||||||
arr.forEach(o => {
|
arr.forEach(o => {
|
||||||
o.attribute = parseAttribute(o.attribute);
|
o.attribute = parseAttribute(o.attribute);
|
||||||
if(o.warId) warid = o.warId;
|
if(o.warId) warid = o.warId;
|
||||||
|
if(o.relation == 2) enemyCount++;
|
||||||
|
});
|
||||||
|
arr.forEach(o => {
|
||||||
|
o.enemyCount = enemyCount;
|
||||||
warjson.push(o);
|
warjson.push(o);
|
||||||
});
|
});
|
||||||
dicWarJson.set(warid, warjson);
|
dicWarJson.set(warid, warjson);
|
||||||
|
|||||||
Reference in New Issue
Block a user