装备:套装属性修改
This commit is contained in:
@@ -24,7 +24,7 @@ export class ConnectorRemote {
|
|||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
let sid = session.get('sid');
|
let sid = session.get('sid');
|
||||||
let uids = [{ uid: roleId, sid }];
|
let uids = [{ uid: roleId, sid }];
|
||||||
this.channelService.pushMessageByUids('onRemoteLogin', resResult(STATUS.SERVER_MAINTENANCE), uids);
|
this.channelService.pushMessageByUids('onRemoteLogin', resResult(STATUS.LOGIN_ERR), uids);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await sessionService.akick(uid);
|
await sessionService.akick(uid);
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ export class EquipHandler {
|
|||||||
return resResult(STATUS.WRONG_PARMS);
|
return resResult(STATUS.WRONG_PARMS);
|
||||||
if (goodInfo.lvLimited > hero.lv)
|
if (goodInfo.lvLimited > hero.lv)
|
||||||
return resResult(STATUS.EQUIP_LEVEL_LIMIT);
|
return resResult(STATUS.EQUIP_LEVEL_LIMIT);
|
||||||
if(checkEquipCanPut(hid, equip.id))
|
if(!checkEquipCanPut(hid, equip.id))
|
||||||
return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
|
return resResult(STATUS.EQUIP_NOT_EQUIPED_HERO);
|
||||||
let index = findIndex(hero.ePlace, { id });
|
let index = findIndex(hero.ePlace, { id });
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
@@ -572,7 +572,9 @@ export class EquipHandler {
|
|||||||
let sortedAndSuitEquips = sortEquips.filter(equipInfos => { // 筛选可穿的
|
let sortedAndSuitEquips = sortEquips.filter(equipInfos => { // 筛选可穿的
|
||||||
let { id, lvLimited, ePlaceId } = equipInfos;
|
let { id, lvLimited, ePlaceId } = equipInfos;
|
||||||
return lv >= lvLimited && checkEquipCanPut(hid, id) && curEPlace.id == ePlaceId;
|
return lv >= lvLimited && checkEquipCanPut(hid, id) && curEPlace.id == ePlaceId;
|
||||||
}).sort((a, b) => { // 排序按:战力 => 根据位置看个别属性 => 品质
|
})
|
||||||
|
console.log('sortedAndSuitEquips', JSON.stringify(sortedAndSuitEquips, null, 4))
|
||||||
|
sortedAndSuitEquips = sortedAndSuitEquips.sort((a, b) => { // 排序按:战力 => 根据位置看个别属性 => 品质
|
||||||
if (b.ce - a.ce != 0) return b.ce - a.ce;
|
if (b.ce - a.ce != 0) return b.ce - a.ce;
|
||||||
let abilityA = a.goodsAbility.get(sortAttrId) || 0;
|
let abilityA = a.goodsAbility.get(sortAttrId) || 0;
|
||||||
let abilityB = b.goodsAbility.get(sortAttrId) || 0;
|
let abilityB = b.goodsAbility.get(sortAttrId) || 0;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { dicRandomEffectPool, loadRandomEffectPool } from './dictionary/DicRando
|
|||||||
import { dicStrengthenCost, loadStrengthenCost } from './dictionary/DicStrengthenCost';
|
import { dicStrengthenCost, loadStrengthenCost } from './dictionary/DicStrengthenCost';
|
||||||
import { dicRefine, loadRefine } from './dictionary/DicRefine';
|
import { dicRefine, loadRefine } from './dictionary/DicRefine';
|
||||||
import { dicHeroEquip, loadHeroEquip } from './dictionary/DicHeroEquip';
|
import { dicHeroEquip, loadHeroEquip } from './dictionary/DicHeroEquip';
|
||||||
import { dicSuit, loadSuit } from './dictionary/DicSuit';
|
import { dicSuit, dicSuitByTypeAndLv, loadSuit } from './dictionary/DicSuit';
|
||||||
import { dicTitle, loadTitle } from './dictionary/DicTitle';
|
import { dicTitle, loadTitle } from './dictionary/DicTitle';
|
||||||
import { dicTeraph, loadTeraph } from './dictionary/DicTeraph';
|
import { dicTeraph, loadTeraph } from './dictionary/DicTeraph';
|
||||||
import { dicSchool, loadSchool } from './dictionary/DicSchool';
|
import { dicSchool, loadSchool } from './dictionary/DicSchool';
|
||||||
@@ -133,6 +133,7 @@ export const gameData = {
|
|||||||
jewels: dicJewel,
|
jewels: dicJewel,
|
||||||
dicHeroEquip: dicHeroEquip,
|
dicHeroEquip: dicHeroEquip,
|
||||||
suit: dicSuit,
|
suit: dicSuit,
|
||||||
|
suitByTypeAndLv: dicSuitByTypeAndLv,
|
||||||
title: dicTitle,
|
title: dicTitle,
|
||||||
teraphs: dicTeraph,
|
teraphs: dicTeraph,
|
||||||
school: dicSchool,
|
school: dicSchool,
|
||||||
@@ -679,6 +680,7 @@ function getHeroTransPiece() {
|
|||||||
gameData.heroTransPiece = newMap
|
gameData.heroTransPiece = newMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 根据groupId获得当前大区名
|
// 根据groupId获得当前大区名
|
||||||
export function getServerGroupName(groupId: number) {
|
export function getServerGroupName(groupId: number) {
|
||||||
let name = gameData.serverGroupNames.get(groupId);
|
let name = gameData.serverGroupNames.get(groupId);
|
||||||
@@ -717,6 +719,10 @@ export function getDicApByLv(level: number) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDicSuitByTypeAndLv(suitType: number, starLevel: number) {
|
||||||
|
return gameData.suitByTypeAndLv.get(`${suitType}_${starLevel}`);
|
||||||
|
}
|
||||||
|
|
||||||
// 初始加载
|
// 初始加载
|
||||||
function initDatas() {
|
function initDatas() {
|
||||||
parseDicParam();
|
parseDicParam();
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import { FILENAME } from '../../consts';
|
|||||||
export interface DicSuit {
|
export interface DicSuit {
|
||||||
// 套装id
|
// 套装id
|
||||||
readonly id: number;
|
readonly id: number;
|
||||||
|
// 套装类型,相同suitType效果可跨级用
|
||||||
|
readonly suitType: number;
|
||||||
|
// 星级,相同suitType starLevel较高的套装可覆盖较低的效果
|
||||||
|
readonly starLevel: number;
|
||||||
// 包含关卡
|
// 包含关卡
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
// 总件数
|
// 总件数
|
||||||
@@ -16,6 +20,7 @@ export interface DicSuit {
|
|||||||
|
|
||||||
|
|
||||||
export const dicSuit = new Map<number, DicSuit>();
|
export const dicSuit = new Map<number, DicSuit>();
|
||||||
|
export const dicSuitByTypeAndLv = new Map<string, DicSuit>();
|
||||||
export function loadSuit() {
|
export function loadSuit() {
|
||||||
let arr = readFileAndParse(FILENAME.DIC_SUIT);
|
let arr = readFileAndParse(FILENAME.DIC_SUIT);
|
||||||
|
|
||||||
@@ -23,6 +28,7 @@ export function loadSuit() {
|
|||||||
o.effect = parseSuitEffect(o.effect);
|
o.effect = parseSuitEffect(o.effect);
|
||||||
o.tireInfo = parseNumberList(o.tireInfo);
|
o.tireInfo = parseNumberList(o.tireInfo);
|
||||||
dicSuit.set(o.id, o);
|
dicSuit.set(o.id, o);
|
||||||
|
dicSuitByTypeAndLv.set(`${o.suitType}_${o.starLevel}`, o);
|
||||||
});
|
});
|
||||||
arr = undefined;
|
arr = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-38
@@ -9,7 +9,7 @@ import { HeroModel, HeroType, HeroUpdate } from '../db/Hero';
|
|||||||
import { RoleModel, RoleType, RoleUpdate } from '../db/Role';
|
import { RoleModel, RoleType, RoleUpdate } from '../db/Role';
|
||||||
import { CeAttrData, CeAttrDataRole, Attribute } from '../domain/roleField/attribute';
|
import { CeAttrData, CeAttrDataRole, Attribute } from '../domain/roleField/attribute';
|
||||||
import { ABI_STAGE, SEID_TYPE } from '../consts';
|
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 { DicSe } from './dictionary/DicSe';
|
||||||
import { EquipType } from '../db/Equip';
|
import { EquipType } from '../db/Equip';
|
||||||
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
import { DicRandomEffectPool } from './dictionary/DicRandomEffectPool';
|
||||||
@@ -19,6 +19,7 @@ import { PvpDefenseModel } from '../db/PvpDefense';
|
|||||||
import { findIndex } from 'underscore';
|
import { findIndex } from 'underscore';
|
||||||
import { GuildModel } from '../db/Guild';
|
import { GuildModel } from '../db/Guild';
|
||||||
import { DicJob } from './dictionary/DicJob';
|
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>) {
|
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 heroAttrs = calHeroEquipIncAttr(hero);
|
||||||
|
|
||||||
// 计算被动技能
|
// 计算被动技能
|
||||||
let { ePlace } = hero;
|
let resultSeid = calEquipSeids(hero);
|
||||||
let suits = new Map<number, number>();
|
for(let seid of resultSeid) {
|
||||||
|
addSeidList.push(seid);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
for (let seid of seids) {
|
||||||
removeSeidList.push(seid)
|
removeSeidList.push(seid)
|
||||||
}
|
}
|
||||||
@@ -689,7 +667,7 @@ export function calEquipSeids(hero: HeroType) {
|
|||||||
let seids: number[] = [];
|
let seids: number[] = [];
|
||||||
// 计算被动技能
|
// 计算被动技能
|
||||||
let { ePlace } = hero;
|
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) {
|
for (let { equip } of ePlace) {
|
||||||
if (equip) {
|
if (equip) {
|
||||||
@@ -700,22 +678,43 @@ export function calEquipSeids(hero: HeroType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.suitId > 0) {
|
if (e.suitId > 0) {
|
||||||
if (suits.has(e.suitId)) {
|
let { suitType, starLevel } = gameData.suit.get(e.suitId);
|
||||||
suits.set(e.suitId, suits.get(e.suitId) + 1);
|
if (!suits.has(suitType)) {
|
||||||
} else {
|
suits.set(suitType, new Map<number, { dic: DicSuit, count: number }>());
|
||||||
suits.set(e.suitId, 1);
|
|
||||||
}
|
}
|
||||||
|
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) => {
|
console.log('################')
|
||||||
let { effect } = gameData.suit.get(suitId);
|
console.log('#####1', JSON.stringify([...suits]));
|
||||||
for (let e of effect) {
|
|
||||||
if (count >= e.count) {
|
for(let [ _suitType, map ] of suits) {
|
||||||
seids.push(e.seid, 0);
|
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;
|
return seids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user