羁绊:修改武将羁绊格式

This commit is contained in:
luying
2022-07-08 18:29:53 +08:00
parent 4e12c6e389
commit 868bb07977
16 changed files with 119 additions and 226 deletions
+1 -12
View File
@@ -135,16 +135,6 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
break;
}
case HERO_SYSTEM_TYPE.FAVOUR: // 8. 好感度
{
let { hero: { connections }, isFavourLvUp } = param;
if(isFavourLvUp) {
for(let [hid, { favourLv }] of heroUpdates) {
calCe.setFavour(hid, favourLv, connections);
}
}
break;
}
case HERO_SYSTEM_TYPE.CONNECT: // 9. 羁绊
{
for(let [ hid, { connections } ] of heroUpdates) {
@@ -297,12 +287,11 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
{
let { role, schools, jewels, heroes, skins } = param;
calCe.clearRoleCe();
for(let { hid, skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, connections, favourLv, skins, scrollStar, scrollQuality, scrollColorStar, ePlace } of heroes) {
for(let { hid, skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, connections, skins, scrollStar, scrollQuality, scrollColorStar, ePlace } of heroes) {
calCe.setHeroBase(hid, skinId);
calCe.setHeroLv(hid, lv);
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
calCe.setJob(hid, job, jobStage);
calCe.setFavour(hid, favourLv, connections);
calCe.setConnection(hid, connections);
calCe.setTalent(hid, skins);
for(let { id, equipId, star, starStage, quality, qualityStage, lv: equipLv, stones, jewel } of ePlace) {
+6 -20
View File
@@ -5,7 +5,7 @@ import { RoleUpdate, Teraph } from "../../db/Role";
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";
import { gameData, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipByIdAndLv, getHeroStarByQuality, getHeroWakeByQuality, getJewelConditionByLvAndSeId, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
import { DicRandomEffectPool } from "../../pubUtils/dictionary/DicRandomEffectPool";
import { DicSe } from "../../pubUtils/dictionary/DicSe";
import { addToMap, deepCopy } from "../../pubUtils/util";
@@ -45,13 +45,13 @@ export class CalCe {
let lv = this.data.heroLv.get(hid)||1;
for(let attrId = ABI_TYPE.ABI_HP; attrId < ABI_TYPE.ABI_MAX; attrId++) {
if(!this.data.heroAttrs.has(`${hid}_${attrId}`) && !this.data.globalAttrs.has(attrId)) continue;
let { mainBase = 0, subBase = 0, job = 0, starUp = 0, connect = 0, favour = 0, talent = 0, equipQuality = 0, equipStrength = 0, equipStar = 0, equipSuit = 0, jewel = 0, stone = 0 } = this.data.heroAttrs.get(`${hid}_${attrId}`)||{};
let { mainBase = 0, subBase = 0, job = 0, starUp = 0, connect = 0, talent = 0, equipQuality = 0, equipStrength = 0, equipStar = 0, equipSuit = 0, jewel = 0, stone = 0 } = this.data.heroAttrs.get(`${hid}_${attrId}`)||{};
let { school = 0, teraph = 0, title = 0, scroll = 0, skin = 0 } = this.data.getGlobalAttrById(attrId)||{};
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/100 )) * ( 1 + school/100 + talent/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 ))) ) * ( 1 + jewel/100 ) + stone + teraph + title + scroll + skin;
str += `{[${mainBase}+${job}+${lv}*${starUp}+${connect}*(1+${favour}/100)]*(1+${school}/100+${talent}/100)+[(${equipQuality}+${equipStrength})*(1+${equipStar}/100+${equipSuit}/100)]}*(1+${jewel}/100)+${stone}+${teraph}+${title}+${scroll}+${skin}`;
val = ((mainBase + job + lv * starUp + connect ) * ( 1 + school/100 + talent/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 ))) ) * ( 1 + jewel/100 ) + stone + teraph + title + scroll + skin;
str += `{[${mainBase}+${job}+${lv}*${starUp}+${connect}]*(1+${school}/100+${talent}/100)+[(${equipQuality}+${equipStrength})*(1+${equipStar}/100+${equipSuit}/100)]}*(1+${jewel}/100)+${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;
@@ -191,26 +191,12 @@ export class CalCe {
}
}
// 好感度
public setFavour(hid: number, favourLv: number, connections: Connect[]) {
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) {
let heroAttr = this.data.getHeroAttrByHidAndId(hid, id);
heroAttr.favour = add;
}
}
}
// 羁绊
public setConnection(hid: number, connections: Connect[]) {
this.data.clearHeroAttrByHid(hid, 'connect');
let map = new Map<number, number>(); // attrId => val;
for(let { shipId, level = 0 } of connections) {
let currentShip = getFriendShipById(shipId, level);
let currentShip = getFriendShipByIdAndLv(hid, shipId, level);
if (currentShip) {
for (let { id, number: val } of currentShip.attributes) {
if(!map.has(id)) {
@@ -988,7 +974,7 @@ abstract class HeroAllAttr {
job: number = 0; // hp1 & attr2, 职业属性(dic_zyz_job的attr)
starUp: number = 0; // hp2, 角色升星成长(dic_zyz_hero_star的hp或dic_zyz_hero_wake的hp)
connect: number = 0; // hp3, 角色羁绊固定值(dic_zyz_friend_ship的attribute)
favour: number = 0; // hp4, 声望加成(dic_zyz_friend_ship_level的add)
favour: number = 0; // 删除-hp4, 声望加成(dic_zyz_friend_ship_level的add)
talent: number = 0; // hp5 & attr3, 天赋树百分比加成(dic_zyz_hero_talent的levelSeid,然后对应到dic_zyz_se)
equipQuality: number = 0; // hp6, 装备品质基础值(dic_zyz_equipQuality的attribute)
equipStrength: number = 0; // hp7, 装备强化值(dic_zyz_equipStrenthAttr的attr)
+18 -1
View File
@@ -7,7 +7,7 @@ import { SCHOOL } from '../pubUtils/dicParam';
import { gameData, getHeroInitTalent } from '../pubUtils/data';
import { SchoolModel } from '../db/School';
import { SclResultInter, SclPosInter, RewardInter, ItemInter } from '../pubUtils/interface';
import { HeroModel, HeroSkin, HeroUpdate, Talent } from '../db/Hero';
import { Connect, HeroModel, HeroSkin, HeroUpdate, Talent } from '../db/Hero';
import { SkinUpdate } from '../db/Skin';
import { Figure } from '../domain/dbGeneral';
import { pick } from 'underscore';
@@ -165,6 +165,23 @@ export function addConsumeToHero(oldConsume: Reward[] = [], consumes: ItemInter[
return newConsume;
}
export function addConnect(connections: Connect[], curConnect: Connect) {
let newConnections: Connect[] = [];
let index = -1;
for(let i = 0; i < connections.length; i++) {
if(connections[i].shipId == curConnect.shipId) {
index = i;
newConnections.push(curConnect);
} else {
newConnections.push(connections[i]);
}
}
if(index == -1) {
newConnections.push(curConnect);
}
return newConnections;
}
export function checkUnlockTalentCondition(hid: number, id: number, talents: Talent[], usedTalentPoint: number) {
let dicHero = gameData.hero.get(hid);
let dicHeroTalent = gameData.heroTalent.get(id);
+8 -8
View File
@@ -521,14 +521,14 @@ export class CheckSingleTask {
}
break;
}
case TASK_TYPE.HERO_FAVOUR_LV: // 15.
{
let { hero, oldFavourLv } = param;
if(dicTaskParam[1] > oldFavourLv && dicTaskParam[1] <= hero.favourLv) {
result = { inc: 1 };
}
break;
}
// case TASK_TYPE.HERO_FAVOUR_LV: // 15.
// {
// let { hero, oldFavourLv } = param;
// if(dicTaskParam[1] > oldFavourLv && dicTaskParam[1] <= hero.favourLv) {
// result = { inc: 1 };
// }
// break;
// }
case TASK_TYPE.HERO_CONNECT: // 16. 激活x次 x星 武将羁绊
{
let { connectLv } = param;