装备:套装属性修改
This commit is contained in:
@@ -9,7 +9,7 @@ import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
|
||||
import { RoleModel, RoleType, RoleUpdate } from '../db/Role';
|
||||
import { CeAttrData, CeAttrDataRole, Attribute } from '../domain/roleField/attribute';
|
||||
import { ABI_STAGE, SEID_TYPE } from '../consts';
|
||||
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getTeraph } from './data';
|
||||
import { gameData, getJobByGradeAndClass, getHeroWakeByQuality, getHeroStarByQuality, getFriendShipById, getSchoolRateByStar, getScollByStar, getTeraph, getDicSuitByTypeAndLv } from './data';
|
||||
import { DicSe } from './dictionary/DicSe';
|
||||
import { EquipType } from '../db/Equip';
|
||||
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||
@@ -19,6 +19,7 @@ import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
import { findIndex } from 'underscore';
|
||||
import { GuildModel } from '../db/Guild';
|
||||
import { DicJob } from './dictionary/DicJob';
|
||||
import { DicSuit } from './dictionary/DicSuit';
|
||||
|
||||
// 修改并下发战力
|
||||
export async function calPlayerCeAndSave(type: number, roleId: string, originHero: HeroType, update: HeroUpdate, args?: Array<number>) {
|
||||
@@ -646,34 +647,11 @@ export function calEquipPutOnOffIncAttr(hero: HeroType, seids: Array<number>, ad
|
||||
let heroAttrs = calHeroEquipIncAttr(hero);
|
||||
|
||||
// 计算被动技能
|
||||
let { ePlace } = hero;
|
||||
let suits = new Map<number, number>();
|
||||
|
||||
for (let { equip } of ePlace) {
|
||||
if (equip) {
|
||||
let e = <EquipType>equip;
|
||||
for (let { seid, rand } of e.randSe) {
|
||||
addSeidList.push(seid, rand);
|
||||
}
|
||||
if (e.suitId > 0) {
|
||||
if (suits.has(e.suitId)) {
|
||||
suits.set(e.suitId, suits.get(e.suitId) + 1);
|
||||
} else {
|
||||
suits.set(e.suitId, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
let resultSeid = calEquipSeids(hero);
|
||||
for(let seid of resultSeid) {
|
||||
addSeidList.push(seid);
|
||||
}
|
||||
|
||||
suits.forEach((count, suitId) => {
|
||||
let { effect } = gameData.suit.get(suitId);
|
||||
for (let e of effect) {
|
||||
if (count >= e.count) {
|
||||
addSeidList.push(e.seid, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (let seid of seids) {
|
||||
removeSeidList.push(seid)
|
||||
}
|
||||
@@ -689,7 +667,7 @@ export function calEquipSeids(hero: HeroType) {
|
||||
let seids: number[] = [];
|
||||
// 计算被动技能
|
||||
let { ePlace } = hero;
|
||||
let suits = new Map<number, number>();
|
||||
let suits = new Map<number, Map<number, { dic: DicSuit, count: number }>>(); // suitType => starLevel => DicSuit
|
||||
|
||||
for (let { equip } of ePlace) {
|
||||
if (equip) {
|
||||
@@ -700,22 +678,43 @@ export function calEquipSeids(hero: HeroType) {
|
||||
}
|
||||
}
|
||||
if (e.suitId > 0) {
|
||||
if (suits.has(e.suitId)) {
|
||||
suits.set(e.suitId, suits.get(e.suitId) + 1);
|
||||
} else {
|
||||
suits.set(e.suitId, 1);
|
||||
let { suitType, starLevel } = gameData.suit.get(e.suitId);
|
||||
if (!suits.has(suitType)) {
|
||||
suits.set(suitType, new Map<number, { dic: DicSuit, count: number }>());
|
||||
}
|
||||
for(let lv = 1; lv <= starLevel; lv++) {
|
||||
let dicSuit = getDicSuitByTypeAndLv(suitType, lv); // 计算同type的低阶套装
|
||||
if(dicSuit) {
|
||||
if(!suits.get(suitType).has(lv)) {
|
||||
suits.get(suitType).set(lv, { dic: dicSuit, count: 0 });
|
||||
}
|
||||
suits.get(suitType).get(lv).count ++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
suits.forEach((count, suitId) => {
|
||||
let { effect } = gameData.suit.get(suitId);
|
||||
for (let e of effect) {
|
||||
if (count >= e.count) {
|
||||
seids.push(e.seid, 0);
|
||||
console.log('################')
|
||||
console.log('#####1', JSON.stringify([...suits]));
|
||||
|
||||
for(let [ _suitType, map ] of suits) {
|
||||
console.log('#####2', _suitType, JSON.stringify([...map]));
|
||||
let effectSeid = new Map<number, { starLevel: number, seid: number }>(); // count => { starLevel, seid }
|
||||
for(let [ starLevel, { dic: { effect }, count } ] of map) {
|
||||
for(let { count: effectCount, seid} of effect) {
|
||||
if(count >= effectCount ) { // 生效
|
||||
if(!effectSeid.has(effectCount) || effectSeid.get(effectCount).starLevel < starLevel) { // 没有同数量效果
|
||||
effectSeid.set(effectCount, { starLevel, seid });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
for(let [_count, { seid }] of effectSeid) {
|
||||
seids.push(seid, 0);
|
||||
}
|
||||
console.log('#####3', _suitType, JSON.stringify([...effectSeid]));
|
||||
}
|
||||
return seids;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user