战力
This commit is contained in:
@@ -14,6 +14,8 @@ import { Attributes } from './interface';
|
||||
import { DicSe } from './dictionary/DicSe';
|
||||
import { EquipType } from '../db/Equip';
|
||||
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
import { getGoodById } from './gamedata';
|
||||
import { JEWEL_ATTR } from '../consts/constModules/abilityConst';
|
||||
|
||||
const HERO_CE_RATIO = 100;
|
||||
const _ = require('underscore');
|
||||
@@ -44,6 +46,10 @@ export function calPlayerCe(globalCeAttr: CeAttr, hero: HeroType, type: number,
|
||||
reIncAttr = calHeroEquipIncAttr(hero);
|
||||
} else if (type == HERO_SYSTEM_TYPE.RESTRENGTHEN) {
|
||||
reIncAttr = calRestrengthenIncAttr(hero, args.shift(), args, addSeidList, removeSeidList);
|
||||
} else if (type == HERO_SYSTEM_TYPE.JEWEL_ON) {//宝石穿戴
|
||||
reIncAttr = calHeroCeWhenJewelOn(hero, args);
|
||||
} else if (type == HERO_SYSTEM_TYPE.JEWEL_OFF) {//宝石卸下
|
||||
reIncAttr = calHeroCeWhenJewelOff(hero, args);
|
||||
}
|
||||
|
||||
addSeidEffect(reIncAttr, hero.ceAttr, addSeidList, removeSeidList); // 处理加值
|
||||
@@ -431,6 +437,38 @@ function addSeid(effectList: Array<any>, seidId:number, rand: number, seidValue
|
||||
}
|
||||
effectList.push(seid);
|
||||
}
|
||||
|
||||
function calHeroCeWhenJewelOn(hero: HeroType, args: Array<number>) {
|
||||
let res: CeAttr = {};
|
||||
let id = args[0];
|
||||
let oldId = args[1];
|
||||
let goodInfo = getGoodById(id);
|
||||
let oldGoodInfo;
|
||||
if (!!oldId)
|
||||
oldGoodInfo = getGoodById(oldId);
|
||||
for (let attrName in JEWEL_ATTR) {
|
||||
if (!!goodInfo[attrName]) {
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += goodInfo[attrName];
|
||||
if (oldGoodInfo)
|
||||
res[attrName].fixUp -= oldGoodInfo[attrName];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function calHeroCeWhenJewelOff(hero: HeroType, args: Array<number>) {
|
||||
let res: CeAttr = {};
|
||||
for (let id of args) {
|
||||
let goodInfo = getGoodById(id);
|
||||
for (let attrName in JEWEL_ATTR) {
|
||||
if (!!goodInfo[attrName]) {
|
||||
res[attrName] = {fixUp: hero.ceAttr[attrName].fixUp, base: hero.ceAttr[attrName].base, ratioUp: hero.ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp -= goodInfo[attrName];
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//全局属性加成
|
||||
export async function reCalAllHeroCe(roleId: string, type: number, args:Array<number>) {
|
||||
let reIncAttr: CeAttr = {};
|
||||
@@ -470,8 +508,9 @@ function calHeroAddSkin(args:Array<number>, ceAttr: CeAttr){
|
||||
for (let attr of addSkin.globalAttr) {
|
||||
attrName = getAtrrNameById(attr.id);
|
||||
res[attrName] = {fixUp: ceAttr[attrName].fixUp, ratioUp: ceAttr[attrName].ratioUp};
|
||||
res[attrName].fixUp += attr.number * HERO_CE_RATIO;
|
||||
res[attrName].fixUp += attr.number * HERO_CE_RATIO;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user