战力:修复bug

This commit is contained in:
luying
2022-03-30 18:01:03 +08:00
parent 9adbd08d3c
commit 83dc974632
10 changed files with 2994 additions and 2844 deletions

View File

@@ -518,7 +518,7 @@ export class HeroHandler {
consumes: updateConsume
}
let isFavourLvUp = oldLv == newLv;
let isFavourLvUp = oldLv != newLv;
let { curHero } = await calculateCeWithHero(HERO_SYSTEM_TYPE.FAVOUR, roleId, serverId, sid, hero.hid, update, { isFavourLvUp, hero });
if(isFavourLvUp) {

View File

@@ -50,7 +50,7 @@ export class RoleHandler {
let checkName = await RoleModel.checkName(roleName, serverId);
if (checkName) return resResult(STATUS.NAME_HAS_USED);
let { resultHeroes: heroes } = await createHeroes(roleId, roleName, sid, serverId, DEFAULT_HEROES.map(hid => ({hid, count: 1})), { roleName, hasInit: true, title: role.title, teraphs: role.teraphs, lv: DEFAULT_LV });
let { resultHeroes: heroes } = await createHeroes(roleId, roleName, sid, serverId, DEFAULT_HEROES.map(hid => ({hid, count: 1})), { roleName, hasInit: true, title: role.title, teraphs: role.teraphs, lv: role.lv });
// role = await RoleModel.updateRoleInfo(roleId, { roleName, hasInit: true }); // 在算战力的时候一起更新
session.set('roleName', roleName);
session.push('roleName', () => { });

View File

@@ -131,6 +131,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
case HERO_SYSTEM_TYPE.FAVOUR: // 8. 好感度
{
let { hero: { connections }, isFavourLvUp } = param;
console.log('####', connections, isFavourLvUp, heroUpdates)
if(isFavourLvUp) {
for(let [hid, { favourLv }] of heroUpdates) {
calCe.setFavour(hid, favourLv, connections);

View File

@@ -2,7 +2,7 @@ import { ABI_STAGE, ABI_STAGE_TO_TYPE, ABI_TYPE_MAIN, LINEUP_NUM, SEID_TYPE, TAL
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Stone, Talent } from "../../db/Hero";
import { JewelType } from "../../db/Jewel";
import { RoleUpdate, Teraph } from "../../db/Role";
import { AttrCell, Attribute, EquipAttr, HeroAttr, RoleCeType, SchoolAttr } from "../../db/RoleCe";
import { AttrCell, Attribute, EquipAttr, HeroAttr, RoleCeType, SchoolAttr, ScrollAttr } from "../../db/RoleCe";
import { TopHero } from "../../domain/dbGeneral";
import { AttributeCal } from "../../domain/roleField/attribute";
import { gameData, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipById, getHeroStarByQuality, getHeroWakeByQuality, getJewelConditionByLvAndSeId, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
@@ -43,8 +43,8 @@ export class CalCe {
let val = 0, str = '';
if(ABI_TYPE_MAIN.indexOf(attrId) != -1) {
// {[hp1 + lv * hp2 + hp3 * ( 1 + hp4 )] * (1 + hp5 ) + [( hp6 + hp7 ) * ( 1 + hp8 )] } * ( 1 + hp9 ) + hp10 + hp11
val = ((mainBase + job + lv * starUp + connect * ( 1 + favour )) * ( 1 + school + talent ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar + equipSuit ))) ) * ( 1 + jewel ) + stone + teraph + title + scroll + skin;
str += `{[${mainBase}+${job}+${lv}*${starUp}+${connect}*(1+${favour})]*(1+${school}+${talent})+[(${equipQuality}+${equipStrength})*(1+${equipStar}+${equipSuit})]}*(1+${jewel})+${stone}+${teraph}+${title}+${scroll}+${skin}`;
val = ((mainBase + job + lv * starUp + connect * ( 1 + favour/100 )) * ( 1 + school + talent ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 ))) ) * ( 1 + jewel ) + stone + teraph + title + scroll + skin;
str += `{[${mainBase}+${job}+${lv}*${starUp}+${connect}*(1+${favour}/100)]*(1+${school}+${talent})+[(${equipQuality}+${equipStrength})*(1+${equipStar}/100+${equipSuit}/100)]}*(1+${jewel})+${stone}+${teraph}+${title}+${scroll}+${skin}`;
} else {
// attr1 + attr2 + attr3 + attr4 + attr5 + attr6 + attr7 + attr8 + attr9
val = subBase + job + talent + teraph + school + title + jewel + skin + equipStar;
@@ -135,11 +135,12 @@ export class CalCe {
// 星级相关
public setHeroStar(hid: number, job: number, quality: number, star: number, starStage: number, colorStar: number, colorStarStage: number) {
this.data.clearHeroAttrByHid(hid, 'starUp');
let dicHero = gameData.hero.get(hid);
let dicJob = gameData.job.get(job);
let jobClass = dicJob.job_class;
const isWake = colorStar > 0; // 是否觉醒,只要激活了觉醒,彩星就会 > 1
const dicStar = isWake ? getHeroWakeByQuality(jobClass, quality, colorStar) : getHeroStarByQuality(jobClass, quality, star); // 星级表
const dicPreStar = isWake? getHeroWakeByQuality(jobClass, quality, colorStar - 1): getHeroStarByQuality(jobClass, quality, star - 1);
const dicStar = isWake ? getHeroWakeByQuality(jobClass, dicHero.quality, colorStar) : getHeroStarByQuality(jobClass, quality, star); // 星级表
const dicPreStar = isWake? getHeroWakeByQuality(jobClass, dicHero.quality, colorStar - 1): getHeroStarByQuality(jobClass, quality, star - 1);
let curStage = isWake? colorStarStage: starStage;
for (let stage = ABI_STAGE.START + 1; stage <= ABI_STAGE.END; stage++) {
@@ -162,7 +163,7 @@ export class CalCe {
const dicJob = gameData.job.get(job);
let lastJob = getJobByGradeAndClass(dicJob.job_class, dicJob.grade - 1);
let dicLastJob = lastJob? gameData.job.get(lastJob.jobid): null;
for(let i = 1; i <= dicJob.maxStage; i++) {
for(let i = 1; i <= (dicJob.maxStage||dicLastJob.maxStage); i++) {
if(jobStage >= i) {
let { id, attr } = dicJob.ceAttr.get(i);
let heroAttr = this.data.getHeroAttrByHidAndId(hid, id);
@@ -186,7 +187,6 @@ export class CalCe {
this.data.clearHeroAttrByHid(hid, 'favour');
let currentFiendShipLevel = gameData.friendShipLevelMap.get(favourLv);
let add = currentFiendShipLevel.add;
for (let {shipId, level} of connections) {
let dicHeroFriendShip = getFriendShipById(shipId, level);
for (let { id } of dicHeroFriendShip.attributes) {
@@ -450,13 +450,13 @@ export class CalCe {
// console.log('effectList', JSON.stringify(effectList));
for (let { type, gainValueArr: [ability, value] } of effectList) {
if (type == SEID_TYPE.TYPE101) { // 加值
if (type == SEID_TYPE.FIX) { // 加值
addToMap(fixUp, ability, value);
} else if (type == SEID_TYPE.TYPE103) { // 主属性加百分比
} else if (type == SEID_TYPE.MAIN_RATIO||type == SEID_TYPE.MAIN_RATIO_2) { // 主属性加百分比
if(ABI_TYPE_MAIN.includes(ability)) {
addToMap(ratioUp, ability, value / 1000);
}
} else if (type == SEID_TYPE.TYPE104) { // 次级属性加百分比
} else if (type == SEID_TYPE.SUB_RATIO||type == SEID_TYPE.SUB_RATIO_2) { // 次级属性加百分比
if(!ABI_TYPE_MAIN.includes(ability)) {
addToMap(ratioUp, ability, value * 100);
}
@@ -473,7 +473,7 @@ export class CalCe {
if (!curSeid) { console.log("seidId not found:" + seidId); return; }
if (!seidValue) seidValue = curSeid.gainValueArr;
if (curSeid.type === SEID_TYPE.TYPE999) {
if (curSeid.type === SEID_TYPE.MIX) {
for (let i = 0; i < seidValue.length; i++) {
this.addSeid(effectList, seidValue[i], rand);
}
@@ -764,8 +764,12 @@ class CalCeData {
for(let [_, { hid, attrId, ce }] of this.schoolAttrs) {
schoolAttrs.push({ hid, attrId, value: ce });
}
let scrollAttrs: ScrollAttr[] = [];
for(let [_, { hid, attrId, ce }] of this.scrollAttrs) {
scrollAttrs.push({ hid, attrId, value: ce });
}
return {
roleLv: this.roleLv, roleId, globalAttrs, heroAttrs, equipAttrs, schoolAttrs, attributes
roleLv: this.roleLv, roleId, globalAttrs, heroAttrs, equipAttrs, schoolAttrs, scrollAttrs, attributes
}
}
}

View File

@@ -58,7 +58,7 @@ export default class Activity extends Service {
if(activity.type == ACTIVITY_TYPE.SIGN_IN || activity.type == ACTIVITY_TYPE.SIGN_IN_VIP) {
// 签到活动的不显示期内也可以编辑
let signInObj = new SignInData(activity, 0);
let signInObj = new SignInData(activity, 0, 0);
if(signInObj.beginTime < now.getTime() && signInObj.endTime > now.getTime() ) {
return this.ctx.service.utils.resResult(STATUS.GM_CAN_NOT_EDIT_ACT);
}

View File

@@ -1,12 +1,11 @@
import { UserModel } from '@db/User';
import { CeAttrDataRole, RoleModel } from '@db/Role';
import { RoleModel } from '@db/Role';
import { HeroModel } from '@db/Hero';
import { Service } from 'egg';
import { STATUS, REDIS_KEY, WAR_TYPE } from '@consts';
import { ItemModel } from '@db/Item';
import { gameData } from '@pubUtils/data';
import { AttributeCal } from '@domain/roleField/attribute';
import { smsModel } from '@db/Sms';
import { isString } from 'underscore';
import { GiftCodeModel } from '@db/GiftCode';
@@ -22,6 +21,7 @@ import { RedisClient } from 'redis';
import { UserGuildModel } from '@db/UserGuild';
import { TowerRecordModel } from '@db/TowerRecord';
import { nowSeconds } from '@pubUtils/timeUtil';
import { RoleCeModel, RoleCeType } from '@db/RoleCe';
// import { resResult } from '@pubUtils/util';
@@ -295,18 +295,18 @@ export default class GMUsers extends Service {
const heroes = await HeroModel.findByCondition(page, pageSize, sortField, sortOrder, form);
const total = await HeroModel.countByCondition( form )
let roleMap = new Map<string, CeAttrDataRole[]>();
let roleMap = new Map<string, RoleCeType>();
for(let { roleId } of heroes) {
if(!roleMap.has(roleId)) {
let role = await RoleModel.findByRoleId(roleId, 'attr');
roleMap.set(roleId, role.attr);
let roleCe = await RoleCeModel.findByRoleId(roleId);
roleMap.set(roleId, roleCe);
}
}
let list = heroes.map(cur => {
let cal = new AttributeCal();
cal.setByDbData(roleMap.get(cur.roleId), cur.attr);
return {...cur, calculatedAttr: cal.getAttributesToArr(), env: ctx.app.config.realEnv}
let roleCe = roleMap.get(cur.roleId);
let attr = roleCe.attributes.filter(ccur => ccur.hid == cur.hid);
return {...cur, calculatedAttr: attr, env: ctx.app.config.realEnv}
})
return ctx.service.utils.resResult(STATUS.SUCCESS, { list, total })

View File

@@ -99,13 +99,17 @@ export const ABI_TYPE_SUB = [
export enum SEID_TYPE {
/**属性固定值加成(数值) */
TYPE101 = 1,
/**基础属性加百分比除以1000以后加到ratioUp */
TYPE103 = 2,
/**次级属性的百分比加成乘以100后加到fixUp */
TYPE104 = 3,
FIX = 1,
/**基础属性加百分比除以1000 */
MAIN_RATIO = 2,
/**次级属性的百分比加成 */
SUB_RATIO = 3,
/**基础属性加百分比除以1000 */
MAIN_RATIO_2 = 4,
/**次级属性的百分比加成 */
SUB_RATIO_2 = 5,
/**复合属性 */
TYPE999 = 999,
MIX = 999,
}
export enum ABI_STAGE {

File diff suppressed because it is too large Load Diff

View File

@@ -1189,20 +1189,6 @@
"info": "法防",
"comment": "法防提高"
},
{
"id": 20011,
"type": 1,
"group": 10011,
"level": 10,
"gainValue": "1&0",
"index": 2,
"Min": 461,
"Max": 1150,
"gap": 1,
"count": "461&496&30|497&1065&35|1066&1150&35",
"info": "生命",
"comment": "生命值提高"
},
{
"id": 20012,
"type": 1,

View File

@@ -39278,5 +39278,20 @@
"rangeSeid": "&",
"seidNameImage": "&",
"passivespineName": "&"
},
{
"id": 20011,
"type": 2,
"group": 10011,
"level": 10,
"gainValue": "1&1000",
"index": 2,
"Min": 461,
"Max": 1150,
"gap": 1,
"count": "461&496&30|497&1065&35|1066&1150&35",
"info": "生命",
"comment": "生命值提高"
}
]