fix 合成装备bug

This commit is contained in:
luying
2020-12-21 11:45:16 +08:00
parent e05577bae8
commit dc527cae2e
11 changed files with 759 additions and 713 deletions

View File

@@ -6,7 +6,7 @@ export const HERO_SYSTEM_TYPE = {
SKIN:7,
FAVOUR:8,
CONNECT:9,
EPLACE_STRENGTHEN: 10
EQUIP: 10
};
// 武将上限

View File

@@ -24,7 +24,7 @@ export const CONSUME_TYPE = {
FAVOUR: 6, // 好感度道具
SKIN: 7, // 时装
PIECE: 8, // 装备碎片
JEWEL: 9,//宝石
JEWEL: 9, //宝石
};
export enum EQUIP_TYPE {
@@ -91,6 +91,7 @@ const itid_array = [
{ id: 34, name: '代币', table: 'item', type: CONSUME_TYPE.POINT },
{ id: 39, name: '时装', table: 'hero', type: CONSUME_TYPE.SKIN },
{ id: 40, name: '装备碎片', table: 'item', type: CONSUME_TYPE.PIECE },
{ id: 41, name: '图纸', table: 'item', type: CONSUME_TYPE.CONSUME },
{ id: 42, name: '宝石', table: 'item', type: CONSUME_TYPE.JEWEL }
];

View File

@@ -3,6 +3,7 @@ import { index, getModelForClass, prop, DocumentType, modelOptions } from '@type
import { COUNTER } from '../consts';
import { CounterModel } from './Counter';
import { HeroModel } from './Hero';
import { CeAttrNumber } from './generalField';
export class RandSe {
@prop({ required: true })
@@ -69,6 +70,9 @@ export default class Equip extends BaseModel {
@prop({ required: true, type: Holes, default: [] })
holes: Holes[];
@prop({required: true, default: new CeAttrNumber() })
ceAttr: CeAttrNumber; // 影响战力的属性
public static async findbyRole(roleId: string, lean = true) {
const equips: EquipType[] = await EquipModel.find({ roleId }).lean(lean);
return equips;

View File

@@ -144,6 +144,11 @@ export default class Hero extends BaseModel {
return hero;
}
public static async findByHidAndRoleWithEquip(hid: number, roleId: string, lean = true) {
const hero: HeroType = await HeroModel.findOne({ hid, roleId }).populate('ePlace.equip').lean(lean);
return hero;
}
public static async addEquip(roleId: string, hid: number, ePlaceId: number, equipId: string, lean = true) {
const hero: HeroType = await HeroModel.findOneAndUpdate(
{ roleId, hid, 'ePlace.id': ePlaceId },

View File

@@ -168,7 +168,7 @@ function parseSpecialMaterial(str: string) {
let decodeArr = decodeArrayStr(str);
if(decodeArr.length >= 2) {
let ids = parseNumberList(decodeArr[0]);
let count = parseInt(decodeArr[0]);
let count = parseInt(decodeArr[1]);
if(isNaN(count)) return specialAttr;
specialAttr.ids = ids;
specialAttr.count = count;

View File

@@ -26,7 +26,7 @@ export const dicRefine = new Map<number, DicRefine>();
arr.forEach(o => {
o.material = parseReward(o.material)
dicRefine.set(o.id, o);
dicRefine.set(o.level, o);
});
arr = undefined;

View File

@@ -2,7 +2,7 @@
* 体力系统
*/
import { HERO_SYSTEM_TYPE } from '../consts';
import { HERO_SYSTEM_TYPE, ABI_TYPE } from '../consts';
import { deepCopy } from './util';
import { HeroModel, HeroType } from '../db/Hero';
@@ -12,6 +12,8 @@ import { getAttrNameByJobStage, getAttrCeRatio, getAtrrNameById, ABI_TYPE_TO_STA
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById } from './data';
import { Attributes } from './interface';
import { DicSe } from './dictionary/DicSe';
import { EquipType } from '../db/Equip';
const HERO_CE_RATIO = 100;
const _ = require('underscore');
//战力计算TODO
@@ -35,6 +37,8 @@ export function calPlayerCe(hero: HeroType, type: number, args: Array<number>) {
reIncAttr = calHeroFavourUpIncAttr(hero, args);
} else if (type == HERO_SYSTEM_TYPE.CONNECT) {
reIncAttr = calHeroConectIncAttr(hero, args);
} else if (type == HERO_SYSTEM_TYPE.EQUIP) {
reIncAttr = calHeroEquipIncAttr(hero, args);
}
addSeidEffect(reIncAttr, addSeidList, removeSeidList); // 处理加值
@@ -225,6 +229,36 @@ export function calHeroFavourUpIncAttr(hero: HeroType, args: Array<number>) {
return res;
}
export function calHeroEquipIncAttr(hero: HeroType, args: Array<number>) {
let res: CeAttr = {};
let {ePlace} = hero;
for(let {equip, lv, refineLv} of ePlace) {
if(equip) {
let e = <EquipType>equip;
console.log(e.id, e._id);
let dicGoods = gameData.goods.get(e.id);
let {goodsAbility, goodsAbilityUp} = dicGoods;
let dicRefine = gameData.refine.get(refineLv);
for(let i = ABI_TYPE.ABI_HP; i < ABI_TYPE.ABI_MAX; i++) {
let jewel = 0;
for(let j = 0; j < e.holes.length; i++) {
}
let attr = (goodsAbility.get(i) + lv * goodsAbilityUp.get(i)) * ( 1 + dicRefine.upPercent);
console.log(jewel, attr, args);
}
// 基础属性
// 装备栏强化
// 精炼
// 宝石
}
}
return res;
}
// 根据存在升星表等的stage字段的id对应17维id
function getFieldByStage(stage: number, jobid: number) {
let targetAttrId = ABI_TYPE_TO_STAGE.get(stage);

File diff suppressed because it is too large Load Diff