战斗:远征&pvp,属性字段修改

This commit is contained in:
luying
2021-07-30 16:33:14 +08:00
parent a48706fb8d
commit 6ab6a381e2
9 changed files with 144 additions and 176 deletions

View File

@@ -16,7 +16,7 @@ import { changeEquip, dressEquip, checkMaterialEnough, takeOffEquipAndCalPlayerC
import { findIndex, pick } from 'underscore';
import { pushEquipRefineSucMsg, pushNormalEquipMsg, pushNormalItemMsg } from "../../../services/chatService";
import { checkTaskWithHero, checkTaskWithEquip, checkTask, checkTaskWithArgs, checkTaskConditionEquipSuitJewelStage, checkActivityTask } from "../../../services/taskService";
import { Attribute } from "../../../domain/roleField/attribute";
import { AttributeCal } from "../../../domain/roleField/attribute";
import { QuenchLogParam } from "../../../domain/roleField/equip";
export default function (app: Application) {
@@ -622,7 +622,7 @@ export class EquipHandler {
let sortEquips = allEquips.map(equip => {
let { id, quality, randRange, ePlaceId } = equip;
let { goodsAbility, lvLimited } = gameData.goods.get(id);
let attrObj = new Attribute();
let attrObj = new AttributeCal();
attrObj.setByMap(goodsAbility, HERO_CE_RATIO + randRange);
let ce = attrObj.calEquipCe();
return { id, quality, ce, equip, goodsAbility, lvLimited, ePlaceId }

View File

@@ -4,13 +4,14 @@ import Role, { RoleModel, RoleType } from '../db/Role';
import { PvpDefenseModel } from '../db/PvpDefense';
import { shouldRefresh, calculateSumCE } from '../pubUtils/util';
import { EXPEDITION_CONST, LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS } from '../consts';
import { EXPEDITION_CONST, LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS, ABI_TYPE } from '../consts';
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
import { HeroType } from '../db/Hero';
import { gameData } from '../pubUtils/data';
import { getPlayerAttribute, getRobotAttribute } from './pvpService';
import { getTimeFunD } from '../pubUtils/timeUtil';
import { ExpeditionRecordModel } from '../db/ExpeditionRecord';
import { Attribute } from '../domain/roleField/attribute';
/**
* 获取远征关卡列表
@@ -104,7 +105,9 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti
cur.hp = getHp.hp;
cur.ap = getHp.ap;
} else {
cur.hp = enemy.attribute.hp;
let attr = new Attribute();
attr.setByStr(enemy.attribute);
cur.hp = attr.hp;
cur.ap = 0;
}
enemy["cur"] = cur;
@@ -149,7 +152,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
if(h) {
let { star, lv, attr: heroAttrs, ce } = h;
let dicHero = gameData.hero.get(hero.actorId);
let newAttribute = getPlayerAttribute(heroAttrs, roleAttrs);
let { attribute } = getPlayerAttribute(heroAttrs, roleAttrs);
let heroInfo = {
actorId: hero.actorId,
actorName: dicHero.name,
@@ -157,7 +160,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
seid:'&',
star,
spine: 0,
attribute: newAttribute,
attribute,
lv,
ce
};
@@ -195,8 +198,7 @@ export async function matchRobots(scale: number, myCe: number, robotCe: number,
if(json.relation == 2) {
const { attribute } = json;
let newAttribute = getRobotAttribute(attribute, myCe, robotCe, scale);
let ce = newAttribute.ce;
let { attribute: newAttribute, ce } = getRobotAttribute(attribute, myCe, robotCe, scale);
enemyObj.enemies.push({...json, attribute: newAttribute, lv, ce});
allCe += ce;
}

View File

@@ -12,7 +12,7 @@ import { PVPConfigModel } from '../db/SystemConfig'
import { nowSeconds, getTimeFun } from '../pubUtils/timeUtil';
import { HeroesRecord } from '../db/PvpRecord';
import { HeroModel } from '../db/Hero';
import { MainAttrNumber, Attribute, CeAttrData, CeAttrDataRole } from '../domain/roleField/attribute';
import { CeAttrData, CeAttrDataRole, AttributeCal } from '../domain/roleField/attribute';
import { PvpEnemies, PvpHeroInfo, PvpOtherHeroes } from '../domain/dbGeneral';
import { DicWarJson } from '../pubUtils/dictionary/DicWarJson';
import { findWhere, findIndex } from 'underscore';
@@ -238,9 +238,9 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, mapWarJson: DicWarJ
let heroInfo = new PvpHeroInfo();
heroInfo.setHeroInfo(dbHero);
heroInfo.setOutIndex(h.order);
let attribute = getPlayerAttribute(dbHero.attr, role.attr);
let { attribute, ce } = getPlayerAttribute(dbHero.attr, role.attr);
heroInfo.setAttribute(attribute);
let enemy = new PvpEnemies(warJson, heroInfo, hs ? hs.score : 0, attribute.ce);
let enemy = new PvpEnemies(warJson, heroInfo, hs ? hs.score : 0, ce);
heroes.push(enemy);
}
} else {
@@ -282,10 +282,10 @@ async function matchRobot(oppPlayers: OppPlayers[], mapWarJson: DicWarJson[], ro
if (!dicHero) continue;
let heroInfo = new PvpHeroInfo();
heroInfo.setRobotInfo(h, myLv, dicHero.initialStars, dicHero.quality);
let attribute = getRobotAttribute(h.attribute, myCe, PVP_CONST.ENEMY_CE, ratio);
defCe += attribute.ce
let { attribute, ce } = getRobotAttribute(h.attribute, myCe, PVP_CONST.ENEMY_CE, ratio);
defCe += ce;
heroInfo.setAttribute(attribute);
let enemy = new PvpEnemies(warJson, heroInfo, 0, attribute.ce);
let enemy = new PvpEnemies(warJson, heroInfo, 0, ce);
heroes.push(enemy);
}
}
@@ -528,12 +528,11 @@ export async function findPvpDefAllByRoleId(roleId: string) {
*/
export function getRobotAttribute(attribute: { id: number, val: number }[], ce: number, enemyCe: number, ratio: number) {
let newAttribute = new Attribute();
let newAttribute = new AttributeCal();
newAttribute.setByWarJson(attribute, Math.sqrt(ce / enemyCe * ratio));
let attrJson = newAttribute.getReduceAttributes();
let resultCe = newAttribute.calCelAndReduce();
attrJson.ce = resultCe;
return attrJson;
let attrArr = newAttribute.getReduceAttributesToString();
let newCe = newAttribute.calCelAndReduce();
return { attribute: attrArr, ce: newCe };
}
/**
@@ -542,12 +541,11 @@ export function getRobotAttribute(attribute: { id: number, val: number }[], ce:
* @param globalCeAttr role表中的globalCeAttr
*/
export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAttrDataRole[] = []) {
let newAttribute = new Attribute();
let newAttribute = new AttributeCal();
newAttribute.setByDbData(roleAttrs, heroAttrs);
let attrJson = newAttribute.getReduceAttributes();
let resultCe = newAttribute.calCelAndReduce();
attrJson.ce = resultCe;
return attrJson;
let attribute = newAttribute.getReduceAttributesToString();
let ce = newAttribute.calCelAndReduce();
return { attribute, ce };
}
/**
@@ -556,9 +554,9 @@ export function getPlayerAttribute(heroAttrs: CeAttrData[] = [], roleAttrs: CeAt
* @param globalCeAttr
*/
export function getPlayerMainAttribute(heroAttrs: CeAttrData[], roleAttrs: CeAttrDataRole[]) {
let attribute = getPlayerAttribute(heroAttrs, roleAttrs);
let mainAttributes = new MainAttrNumber(attribute);
let newAttribute = new AttributeCal();
newAttribute.setByDbData(roleAttrs, heroAttrs);
let mainAttributes = newAttribute.getReduceMainAttributes();
return mainAttributes;
}