战力:修复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
@@ -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) {
@@ -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', () => { });
@@ -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);
+16 -12
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
}
}
}