战力:初步
This commit is contained in:
@@ -105,7 +105,7 @@ export class EquipHandler {
|
||||
ePlace: newEplace,
|
||||
consumes: addConsumeToHero(hero.consumes, consumes)
|
||||
}
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, serverId, sid, hid, update, { ePlaceId });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_STRENGTH, roleId, serverId, sid, hid, update, { ePlaceIds: [ePlaceId] });
|
||||
await checkTaskInEquipLvUp(serverId, roleId, sid, oldEplace, newEplace, [ePlaceId]);
|
||||
|
||||
const curHero = {
|
||||
@@ -343,7 +343,7 @@ export class EquipHandler {
|
||||
let canChange = originJewel && checkJewelCanPutOnEquip(originEquip, originJewel);
|
||||
if(canChange) canSentMineToOrigin = true;
|
||||
let { newEplace, updatedEplace } = updateEplace(originEplace, ePlaceId, { jewel: canChange? originJewel.seqId: 0 });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, oldJewel: jewel, newJewel: canChange? originJewel:null });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, jewel.hid, { ePlace: newEplace }, { ePlaceId, jewel: canChange? originJewel: null });
|
||||
await checkTaskInPutJewel(serverId, roleId, sid, originEplace, newEplace, ePlaceId, jewel, canChange? originJewel:null);
|
||||
|
||||
originHeroResult = { hid: originHero.hid, ePlace: updatedEplace };
|
||||
@@ -356,7 +356,7 @@ export class EquipHandler {
|
||||
// 目标镶嵌上
|
||||
let curJewel = await JewelModel.putOnOrOff(seqId, hid, ePlaceId);
|
||||
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: seqId });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, oldJewel: originJewel, newJewel: curJewel });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceIds: [ePlaceId], jewels: [curJewel] });
|
||||
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, originJewel, curJewel);
|
||||
|
||||
let curHero = {
|
||||
@@ -384,7 +384,7 @@ export class EquipHandler {
|
||||
|
||||
let curJewel = await JewelModel.putOnOrOff(curEquip.jewel, 0, 0);
|
||||
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, { jewel: 0 });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceId, oldJewel: curJewel });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.EQUIP_JEWEL, roleId, serverId, sid, hid, { ePlace: newEplace }, { ePlaceIds: [ePlaceId], jewels: [] });
|
||||
await checkTaskInPutJewel(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, null, curJewel);
|
||||
|
||||
let curHero = {
|
||||
@@ -557,7 +557,7 @@ export class EquipHandler {
|
||||
// 更新战力
|
||||
if(hid > 0) {
|
||||
const hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, hid, {}, { ePlaceId, oldJewel: jewel, newJewel, hero });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
|
||||
}
|
||||
|
||||
await checkTaskInEquipReset(serverId, roleId, sid);
|
||||
@@ -639,7 +639,7 @@ export class EquipHandler {
|
||||
// 更新战力
|
||||
if(isSuccess && hid > 0) {
|
||||
const hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_QUENCH, roleId, serverId, sid, hid, {}, { ePlaceId, oldJewel: jewel, newJewel, hero });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_QUENCH, roleId, serverId, sid, hid, { ePlace: hero.ePlace }, { ePlaceId, jewel: newJewel });
|
||||
}
|
||||
|
||||
await checkTaskInEquipQuench(serverId, roleId, sid, isSuccess);
|
||||
@@ -759,7 +759,7 @@ export class EquipHandler {
|
||||
// 更新战力
|
||||
if(targetJewel.hid > 0) {
|
||||
const hero = await HeroModel.findByHidAndRole(targetJewel.hid, roleId);
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, targetJewel.hid, {}, { hid: targetJewel.ePlaceId, ePlaceId: targetJewel.ePlaceId, oldJewel: originJewel, newJewel, hero });
|
||||
await calculateCeWithHero(HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE, roleId, serverId, sid, targetJewel.hid, { ePlace: hero.ePlace }, { ePlaceId: targetJewel.ePlaceId, jewel: newJewel });
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,7 @@ interface Param {
|
||||
isFavourLvUp?: boolean,
|
||||
ePlaceId?: number,
|
||||
ePlaceIds?: number[],
|
||||
oldJewel?: JewelType,
|
||||
newJewel?: JewelType,
|
||||
jewels?: JewelType[],
|
||||
jewel?: JewelType,
|
||||
teraphId?: number,
|
||||
schoolId?: number,
|
||||
@@ -113,19 +112,17 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.SKIN: // 7. 穿皮肤
|
||||
{
|
||||
let { hero: { quality, star, starStage, colorStar, colorStarStage } } = param;
|
||||
let { hero: { quality, star, starStage, colorStar, colorStarStage, skins } } = param;
|
||||
for(let [hid, { skinId, job, ePlace }] of heroUpdates) {
|
||||
calCe.setHeroBase(hid, skinId);
|
||||
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
|
||||
|
||||
// let eplaceIds = newEplace.map(cur => cur.id);
|
||||
// calEquipStrengthIncAttr(originHero, update, eplaceIds);
|
||||
// calEquipQualityIncAttr(originHero, update, eplaceIds);
|
||||
// calEquipStarIncAttr(originHero, update, eplaceIds, addSeidList, removeSeidList);
|
||||
// // 天赋点
|
||||
// calHeroTalent(originHero, update, addSeidList, removeSeidList);
|
||||
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
|
||||
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
|
||||
calCe.setEquipStrength(hid, id, equipId, lv);
|
||||
calCe.setEquipStar(hid, id, equipId, star, starStage);
|
||||
}
|
||||
calCe.setTalent(hid, skins);
|
||||
}
|
||||
// TODO 装备
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.FAVOUR: // 8. 好感度
|
||||
@@ -184,14 +181,101 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
|
||||
calCe.setTeraph(teraphs);
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.COMPOSE_EQUIP: // 21. 合成装备
|
||||
{
|
||||
let { ePlaceId } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
|
||||
if(ePlaceId == id) {
|
||||
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
|
||||
calCe.setEquipStrength(hid, id, equipId, lv);
|
||||
calCe.setEquipStar(hid, id, equipId, star, starStage);
|
||||
}
|
||||
}
|
||||
calCe.setEquipSuit(hid, ePlace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.EQUIP_STRENGTH: // 22. 装备强化
|
||||
{
|
||||
let { ePlaceIds } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, equipId, lv } of ePlace) {
|
||||
if(ePlaceIds.indexOf(id) != -1) {
|
||||
calCe.setEquipStrength(hid, id, equipId, lv);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.EQUIP_QUALITY: // 23. 装备升品
|
||||
{
|
||||
let { ePlaceId } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, equipId, quality, qualityStage } of ePlace) {
|
||||
if(ePlaceId == id) {
|
||||
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.EQUIP_STAR: // 24. 装备升星
|
||||
{
|
||||
let { ePlaceId } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, equipId, star, starStage } of ePlace) {
|
||||
if(ePlaceId == id) {
|
||||
calCe.setEquipStar(hid, id, equipId, star, starStage);
|
||||
}
|
||||
}
|
||||
calCe.setEquipSuit(hid, ePlace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.EQUIP_JEWEL: // 25. 装备天晶
|
||||
case HERO_SYSTEM_TYPE.JEWEL_RESET_RANDSE: // 27. 洗练
|
||||
case HERO_SYSTEM_TYPE.JEWEL_QUENCH: // 28. 淬炼
|
||||
{
|
||||
let { ePlaceId, jewel: curJewel } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, stones } of ePlace) {
|
||||
if(ePlaceId == id) {
|
||||
calCe.setJewel(hid, id, stones, curJewel);
|
||||
}
|
||||
}
|
||||
calCe.setEquipSuit(hid, ePlace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.EQUIP_STONE: // 26. 装备地玉
|
||||
{
|
||||
let { ePlaceId, jewel: curJewel } = param;
|
||||
for(let [hid, { ePlace = [] }] of heroUpdates) {
|
||||
for(let { id, stones } of ePlace) {
|
||||
if(ePlaceId == id) {
|
||||
calCe.setJewel(hid, id, stones, curJewel);
|
||||
}
|
||||
}
|
||||
calCe.setEquipSuit(hid, ePlace);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HERO_SYSTEM_TYPE.REBIRTH: // 29. 重生
|
||||
{
|
||||
for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, }] of heroUpdates) {
|
||||
for(let [hid, { skinId, lv, quality, star, starStage, colorStar, colorStarStage, job, jobStage, skins, ePlace, scrollStar, scrollQuality, scrollColorStar }] of heroUpdates) {
|
||||
calCe.setHeroBase(hid, skinId);
|
||||
calCe.setHeroLv(hid, lv);
|
||||
calCe.setHeroStar(hid, job, quality, star, starStage, colorStar, colorStarStage);
|
||||
calCe.setJob(hid, job, jobStage);
|
||||
// TODO 装备
|
||||
|
||||
for(let { id, equipId, quality, qualityStage, lv, star, starStage } of ePlace) {
|
||||
calCe.setEquipQuality(hid, id, equipId, quality, qualityStage);
|
||||
calCe.setEquipStrength(hid, id, equipId, lv);
|
||||
calCe.setEquipStar(hid, id, equipId, star, starStage);
|
||||
}
|
||||
calCe.setTalent(hid, skins);
|
||||
calCe.setScroll(hid, scrollStar, scrollQuality, scrollColorStar);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { ABI_STAGE, ABI_STAGE_TO_TYPE, ABI_TYPE_MAIN, LINEUP_NUM, SEID_TYPE, TALENT_RELATION_TYPE } from "../../consts";
|
||||
import { Connect, HeroSkin, HeroType, HeroUpdate, Talent } from "../../db/Hero";
|
||||
import { Connect, EPlace, HeroSkin, HeroType, HeroUpdate, Stone, Talent } from "../../db/Hero";
|
||||
import { JewelType } from "../../db/Jewel";
|
||||
import { RoleUpdate, Teraph } from "../../db/Role";
|
||||
import { AttrCell, EquipAttr, HeroAttr, RoleCeType, SchoolAttr } from "../../db/RoleCe";
|
||||
import { TopHero } from "../../domain/dbGeneral";
|
||||
import { AttributeCal } from "../../domain/roleField/attribute";
|
||||
import { gameData, getFriendShipById, getHeroStarByQuality, getHeroWakeByQuality, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
|
||||
import { gameData, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipById, 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";
|
||||
@@ -16,7 +17,8 @@ export class CalCe {
|
||||
heroAttrsByHid: Map<number, string[]> = new Map(); // hid => [hid+attrId]
|
||||
equipAttrs: Map<string, EquipMainAttr|EquipSubAttr> = new Map(); // hid+eplaceId+attrId => EquipAttr
|
||||
equipAttrsByHid: Map<number, string[]> = new Map(); // hid => [hid+eplaceId+attrId]
|
||||
equipAttrsByHidAndEplace: Map<string, { hid: number, eplaceId: number, keys: string[]}> = new Map(); // hid+eplaceId =>+eplaceId+attrId]
|
||||
equipAttrsByHidAndEplace: Map<string, { hid: number, eplaceId: number, keys: string[]}> = new Map(); // hid+eplaceId =>[hid+eplaceId+attrId]
|
||||
equipAttrsByHidAndAttrId: Map<string, { hid: number, attrId: number, keys: string[]}> = new Map(); // hid+attrId =>[hid+eplaceId+attrId]
|
||||
heroLv: Map<number, number> = new Map();
|
||||
heroHistoryCe: Map<number, number> = new Map();
|
||||
heroObjectId: Map<number, string> = new Map();
|
||||
@@ -25,8 +27,10 @@ export class CalCe {
|
||||
resultCes: Map<number, number> = new Map(); // hid => ce
|
||||
schoolAttrs: Map<string, { hid: number, attrId: number, ce: number }> = new Map(); // hid + attr => ratio
|
||||
schoolAttrsByAttrId: Map<number, string[]> = new Map(); // attrId => hid + attr
|
||||
schoolAttrsByHid: Map<number, string[]> = new Map(); // hid => hid + attr
|
||||
scrollAttrs: Map<string, { hid: number, attrId: number, ce: number }> = new Map(); // hid + attr => ratio
|
||||
scrollAttrsByAttrId: Map<number, string[]> = new Map(); // attrId => hid + attr
|
||||
scrollAttrsByHid: Map<number, string[]> = new Map(); // hid => hid + attr
|
||||
|
||||
constructor(roleId: string) {
|
||||
this.roleId = roleId;
|
||||
@@ -45,6 +49,11 @@ export class CalCe {
|
||||
return this.globalAttrs.get(attrId);
|
||||
}
|
||||
|
||||
private getHeroAttrsByHid(hid: number) {
|
||||
let keys = this.heroAttrsByHid.get(hid);
|
||||
return keys.map(key => this.heroAttrs.get(key));
|
||||
}
|
||||
|
||||
private getHeroAttrByHidAndId(hid: number, attrId: number) {
|
||||
let key = `${hid}_${attrId}`;
|
||||
if(!this.heroAttrs.has(key)) {
|
||||
@@ -88,6 +97,13 @@ export class CalCe {
|
||||
return this.equipAttrs.get(key);
|
||||
}
|
||||
|
||||
private getEquipAttrsByHidAndEplace(hid: number, eplaceId: number) {
|
||||
let key2 = `${hid}_${eplaceId}`;
|
||||
if(!this.equipAttrsByHidAndEplace.has(key2)) return []
|
||||
let { keys } = this.equipAttrsByHidAndEplace.get(key2);
|
||||
return keys.map(key => this.equipAttrs.get(key));
|
||||
}
|
||||
|
||||
private setSchoolAttrs(hid: number, attrId: number, value: number) {
|
||||
let key = `${hid}_${attrId}`;
|
||||
if(!this.schoolAttrs.has(key)) {
|
||||
@@ -96,11 +112,20 @@ export class CalCe {
|
||||
this.schoolAttrsByAttrId.set(attrId, []);
|
||||
}
|
||||
this.schoolAttrsByAttrId.get(attrId).push(key);
|
||||
if(!this.schoolAttrsByHid.has(attrId)) {
|
||||
this.schoolAttrsByHid.set(hid, []);
|
||||
}
|
||||
this.schoolAttrsByHid.get(hid).push(key);
|
||||
} else {
|
||||
this.schoolAttrs.get(key).ce = value;
|
||||
}
|
||||
}
|
||||
|
||||
private getSchoolAttrsByHid(hid: number) {
|
||||
let keys = this.schoolAttrsByHid.get(hid)||[];
|
||||
return keys.map(key => this.schoolAttrs.get(key));
|
||||
}
|
||||
|
||||
private calSchoolAttrsToGlobal(attrId: number) {
|
||||
let keys = this.schoolAttrsByAttrId.get(attrId)||[];
|
||||
let schoolResult = 0;
|
||||
@@ -120,11 +145,20 @@ export class CalCe {
|
||||
this.scrollAttrsByAttrId.set(attrId, []);
|
||||
}
|
||||
this.scrollAttrsByAttrId.get(attrId).push(key);
|
||||
if(!this.scrollAttrsByHid.has(attrId)) {
|
||||
this.scrollAttrsByHid.set(hid, []);
|
||||
}
|
||||
this.scrollAttrsByHid.get(hid).push(key);
|
||||
} else {
|
||||
this.scrollAttrs.get(key).ce = value;
|
||||
}
|
||||
}
|
||||
|
||||
private getScrollAttrsByHid(hid: number) {
|
||||
let keys = this.scrollAttrsByHid.get(hid)||[];
|
||||
return keys.map(key => this.scrollAttrs.get(key));
|
||||
}
|
||||
|
||||
private calScrollAttrsToGlobal(attrId: number) {
|
||||
let keys = this.scrollAttrsByAttrId.get(attrId)||[];
|
||||
let result = 0;
|
||||
@@ -141,14 +175,15 @@ export class CalCe {
|
||||
for(let [hid, keys] of this.heroAttrsByHid) {
|
||||
let lv = this.heroLv.get(hid)||1;
|
||||
for(let key of keys) {
|
||||
let { attrId, base = 0, job = 0, starUp = 0, connect = 0, favour = 0, talent = 0, equip = 0, equipUp = 0, equipStone = 0 } = this.heroAttrs.get(key);
|
||||
let { attrId, 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.heroAttrs.get(key);
|
||||
let { school = 0, teraph = 0, title = 0, scroll = 0, skin = 0 } = this.getGlobalAttrById(attrId);
|
||||
let val = 0;
|
||||
if(ABI_TYPE_MAIN.indexOf(attrId)) {
|
||||
// {[hp1 + lv * hp2 + hp3 * ( 1 + hp4 )] * (1 + hp5 ) + [( hp6+hp7)*(1+hp8)] } * ( 1 + hp9 ) + hp10 + hp11
|
||||
val = ((base + job + lv * starUp + connect * ( 1 + favour )) * ( 1 + school + talent ) + equip ) * ( 1 + equipUp ) + equipStone + teraph + title + scroll + skin;
|
||||
// {[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;
|
||||
} else {
|
||||
val = base + job + talent + teraph + school + title + equip + skin;
|
||||
// attr1 + attr2 + attr3 + attr4 + attr5 + attr6 + attr7 + attr8 + attr9
|
||||
val = subBase + job + talent + teraph + school + title + jewel + skin + equipStar;
|
||||
}
|
||||
if(!ces.has(hid)) ces.set(hid, []);
|
||||
ces.get(hid).push({ id: attrId, val });
|
||||
@@ -288,12 +323,55 @@ export class CalCe {
|
||||
return { topLineup, topLineupCe };
|
||||
}
|
||||
|
||||
private clearRoleAttr(field: string) {
|
||||
for(let globalAttr of this.globalAttrs) {
|
||||
globalAttr[field] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private clearHeroAttrByHid(hid: number, field: string) {
|
||||
let heroAttrs = this.getHeroAttrsByHid(hid);
|
||||
for(let heroAttr of heroAttrs) {
|
||||
heroAttr[field] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private clearEquipAttrByHidAndEplace(hid: number, eplaceId: number, field: string) {
|
||||
let equipAttrs = this.getEquipAttrsByHidAndEplace(hid, eplaceId);
|
||||
for(let equipAttr of equipAttrs) {
|
||||
let originNum = equipAttr[field]||0;
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, equipAttr.attrId);
|
||||
if(heroAttr && heroAttr[field]) {
|
||||
heroAttr[field] -= originNum;
|
||||
}
|
||||
equipAttr[field] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private clearSchoolAttr(hid: number) {
|
||||
let schoolAttrs = this.getSchoolAttrsByHid(hid);
|
||||
for(let schoolAttr of schoolAttrs) {
|
||||
schoolAttr.ce = 0;
|
||||
this.calSchoolAttrsToGlobal(schoolAttr.attrId);
|
||||
}
|
||||
}
|
||||
|
||||
private clearScrollAttr(hid: number) {
|
||||
let scrollAttrs = this.getScrollAttrsByHid(hid);
|
||||
for(let scrollAttr of scrollAttrs) {
|
||||
scrollAttr.ce = 0;
|
||||
this.calScrollAttrsToGlobal(scrollAttr.attrId);
|
||||
}
|
||||
}
|
||||
|
||||
// 武将基础&成长
|
||||
public setHeroBase(hid: number, skinId: number) {
|
||||
this.clearHeroAttrByHid(hid, 'mainBase');
|
||||
let dicHero = gameData.hero.get(skinId);
|
||||
|
||||
for(let [attrId, value] of dicHero.baseAbilityArr) {
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, attrId);
|
||||
heroAttr.base = value;
|
||||
heroAttr.mainBase = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,6 +382,7 @@ export class CalCe {
|
||||
|
||||
// 星级相关
|
||||
public setHeroStar(hid: number, job: number, quality: number, star: number, starStage: number, colorStar: number, colorStarStage: number) {
|
||||
this.clearHeroAttrByHid(hid, 'starUp');
|
||||
let dicJob = gameData.job.get(job);
|
||||
let jobClass = dicJob.job_class;
|
||||
const isWake = colorStar > 0; // 是否觉醒,只要激活了觉醒,彩星就会 > 1
|
||||
@@ -326,6 +405,8 @@ export class CalCe {
|
||||
|
||||
// 职业基础
|
||||
public setJob(hid: number, job: number, jobStage: number) {
|
||||
this.clearHeroAttrByHid(hid, 'job');
|
||||
this.clearHeroAttrByHid(hid, 'subBase');
|
||||
const dicJob = gameData.job.get(job);
|
||||
let lastJob = getJobByGradeAndClass(dicJob.job_class, dicJob.grade - 1);
|
||||
let dicLastJob = lastJob? gameData.job.get(lastJob.jobid): null;
|
||||
@@ -344,12 +425,13 @@ export class CalCe {
|
||||
}
|
||||
for(let { id, val } of dicJob.baseSubAttr) {
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.base = val;
|
||||
heroAttr.subBase = val;
|
||||
}
|
||||
}
|
||||
|
||||
// 好感度
|
||||
public setFavour(hid: number, favourLv: number, connections: Connect[]) {
|
||||
this.clearHeroAttrByHid(hid, 'favour');
|
||||
let currentFiendShipLevel = gameData.friendShipLevelMap.get(favourLv);
|
||||
let add = currentFiendShipLevel.add;
|
||||
|
||||
@@ -364,6 +446,7 @@ export class CalCe {
|
||||
|
||||
// 羁绊
|
||||
public setConnection(hid: number, shipId: number, connections: Connect[]) {
|
||||
this.clearHeroAttrByHid(hid, 'connect');
|
||||
let connect = connections.find(cur => cur.shipId == shipId);
|
||||
let level = connect?.level||0;
|
||||
|
||||
@@ -387,6 +470,7 @@ export class CalCe {
|
||||
|
||||
// 天赋
|
||||
public setTalent(hid: number, skins: HeroSkin[]) {
|
||||
this.clearHeroAttrByHid(hid, 'talent');
|
||||
let skin = skins.find(cur => cur.enable);
|
||||
let seids = this.getTalentSeid(skin.talent);
|
||||
let { ratioUp } = this.addSeidEffect(seids);
|
||||
@@ -421,8 +505,122 @@ export class CalCe {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 装备升品
|
||||
public setEquipQuality(hid: number, eplaceId: number, equipId: number, quality: number, qualityStage: number) {
|
||||
this.clearEquipAttrByHidAndEplace(hid, eplaceId, 'equipQuality');
|
||||
let dicEquipQuality = getEquipQualityIdByEquipIdAndPoint(equipId, quality, qualityStage);
|
||||
for(let { id, num } of dicEquipQuality.attribute) {
|
||||
let equipAttr = this.getEquipAttrByHidAndId(hid, eplaceId, id);
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.equipQuality += num - equipAttr.equipQuality;
|
||||
equipAttr.equipQuality = num;
|
||||
}
|
||||
}
|
||||
|
||||
// 装备强化
|
||||
public setEquipStrength(hid: number, eplaceId: number, equipId: number, lv: number) {
|
||||
this.clearEquipAttrByHidAndEplace(hid, eplaceId, 'equipStrengthen');
|
||||
let dicEquipStrenth = getEquipStrenthenAttr(equipId, lv);
|
||||
for(let { id, num } of dicEquipStrenth.attr) {
|
||||
let equipAttr = this.getEquipAttrByHidAndId(hid, eplaceId, id);
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.equipStrength = num - equipAttr.equipStrengthen;
|
||||
equipAttr.equipStrengthen = num;
|
||||
}
|
||||
}
|
||||
|
||||
// 装备精炼(升星)
|
||||
public setEquipStar(hid: number, eplaceId: number, equipId: number, star: number, starStage: number) {
|
||||
this.clearEquipAttrByHidAndEplace(hid, eplaceId, 'equipStar');
|
||||
let dicEquipStar = getEquipStarAttrByStage(equipId, star, starStage);
|
||||
if(dicEquipStar) {
|
||||
let { mainAttr, subAttr } = dicEquipStar;
|
||||
for(let { id, num } of [...mainAttr, ...subAttr]) {
|
||||
let equipAttr = this.getEquipAttrByHidAndId(hid, eplaceId, id);
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.equipStar = num - equipAttr.equipStar;
|
||||
equipAttr.equipStar = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 装备套装
|
||||
public setEquipSuit(hid: number, ePlace: EPlace[]) {
|
||||
this.clearHeroAttrByHid(hid, 'equipSuit');
|
||||
let dicEquipSuit = getEquipSuitByHero(hid);
|
||||
let suitStars: number[] = [];
|
||||
for(let equipId of dicEquipSuit.equips) {
|
||||
let equip = ePlace.find(cur => cur.equipId == equipId);
|
||||
suitStars.push(equip? equip.star: 0);
|
||||
}
|
||||
let minStar = Math.min(...suitStars);
|
||||
|
||||
let seids: number[] = [];
|
||||
for(let { star, seid } of dicEquipSuit.effect) {
|
||||
if(minStar >= star) seids.push(seid);
|
||||
}
|
||||
|
||||
let { ratioUp } = this.addSeidEffect(seids);
|
||||
for(let [attrId, val] of ratioUp) {
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, attrId);
|
||||
heroAttr.equipSuit = val;
|
||||
}
|
||||
}
|
||||
|
||||
// 天晶
|
||||
public setJewel(hid: number, eplaceId: number, stones: Stone[], jewel: JewelType) {
|
||||
this.clearEquipAttrByHidAndEplace(hid, eplaceId, 'jewel');
|
||||
let seids: number[] = [];
|
||||
if(jewel) {
|
||||
for(let { id, seid, rand } of jewel.randSe) {
|
||||
if(this.isRandSeUnLock(jewel.id, id, stones)) {
|
||||
seids.push(seid, rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
let { ratioUp } = this.addSeidEffect(seids);
|
||||
for(let [attrId, val] of ratioUp) {
|
||||
let equipAttr = this.getEquipAttrByHidAndId(hid, eplaceId, attrId);
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, attrId);
|
||||
heroAttr.jewel += val - equipAttr.jewel;
|
||||
equipAttr.jewel = val;
|
||||
}
|
||||
}
|
||||
|
||||
private isRandSeUnLock(jewelId: number, randSeId: number, stones: Stone[]) {
|
||||
let dicJewel = gameData.jewel.get(jewelId);
|
||||
let dicJewelCondition = getJewelConditionByLvAndSeId(dicJewel.lv, randSeId);
|
||||
let stoneCnt = 0, stoneLv = 0;
|
||||
for(let { stone } of stones) {
|
||||
let dicStone = gameData.stone.get(stone);
|
||||
if(dicStone) {
|
||||
stoneCnt++;
|
||||
stoneLv += dicStone.lv;
|
||||
}
|
||||
}
|
||||
return stoneCnt >= dicJewelCondition.stoneCnt && stoneLv >= dicJewelCondition.stoneLv;
|
||||
}
|
||||
|
||||
// 地玉
|
||||
public setStone(hid: number, eplaceId: number, stones: Stone[]) {
|
||||
this.clearEquipAttrByHidAndEplace(hid, eplaceId, 'stone');
|
||||
for(let { stone } of stones) {
|
||||
let dicStone = gameData.stone.get(stone);
|
||||
if(dicStone) {
|
||||
for(let { id, num } of dicStone.attribute) {
|
||||
let equipAttr = this.getEquipAttrByHidAndId(hid, eplaceId, id);
|
||||
let heroAttr = this.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.stone += num - equipAttr.stone;
|
||||
equipAttr.stone = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 爵位
|
||||
public setTitle(title: number) {
|
||||
this.clearRoleAttr('title');
|
||||
let dicTitle = gameData.title.get(title)||{ mainAttrValue: new Map(), assiAttrValue: new Map() };
|
||||
for(let [attrId, value] of dicTitle.mainAttrValue) {
|
||||
let globalAttr = this.getGlobalAttrById(attrId);
|
||||
@@ -436,6 +634,7 @@ export class CalCe {
|
||||
|
||||
// 神像相关
|
||||
public setTeraph(teraphs: Teraph[]) {
|
||||
this.clearRoleAttr('teraph');
|
||||
let teraphOfAttrId = new Map<number, number>();
|
||||
for(let teraph of teraphs) {
|
||||
for(let [attrId, value] of teraph.attr) { // 主属性
|
||||
@@ -454,6 +653,7 @@ export class CalCe {
|
||||
|
||||
// 名将谱
|
||||
public setScroll(hid: number, scrollStar: number, scrollQuality: number, scrollColorStar: number) {
|
||||
this.clearScrollAttr(hid);
|
||||
let dicHero =gameData.hero.get(hid);
|
||||
let dicHeroScroll = getScollByStar(dicHero.quality, scrollStar, scrollQuality, scrollColorStar);
|
||||
|
||||
@@ -467,7 +667,7 @@ export class CalCe {
|
||||
|
||||
// 百家学宫
|
||||
public setSchool(isPutOn: boolean, hid: number, schoolId: number, star: number, colorStar: number, quality: number) {
|
||||
|
||||
this.clearSchoolAttr(hid);
|
||||
let dicSchool = gameData.school.get(schoolId);
|
||||
let dicSchoolRate = getSchoolRateByStar(star, colorStar, quality);
|
||||
|
||||
@@ -651,15 +851,19 @@ class GlobalSubAttr extends GlobalAllAttr {
|
||||
abstract class HeroAllAttr {
|
||||
hid: number;
|
||||
attrId: number;
|
||||
base: number = 0;
|
||||
job: number = 0;
|
||||
starUp: number = 0;
|
||||
connect: number = 0;
|
||||
favour: number = 0;
|
||||
talent: number = 0;
|
||||
equip: number = 0;
|
||||
equipUp: number = 0;
|
||||
equipStone: number = 0;
|
||||
mainBase: number = 0; // hp1,武将基础属性(dic_zyz_hero的hp)
|
||||
subBase: number = 0; // attr1,职业基础(dic_zyz_job的baseSubAttr字段)
|
||||
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)
|
||||
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)
|
||||
equipStar: number = 0; // hp8 & attr9,装备升星(dic_zyz_equipStar的mainAttr和subAttr)
|
||||
equipSuit: number = 0; // hp8,套装(dic_zyz_equipSuit的effect,然后对应dic_zyz_se)
|
||||
jewel: number = 0; // hp9 & attr7,天晶随机属性值(jewel的ranSe,对应dic_zyz_randomEffectPool)
|
||||
stone: number = 0; // hp10, 地玉增加的固定值(dic_zyz_stone的attribute)
|
||||
|
||||
constructor(hid: number, attrId: number, ) {
|
||||
this.hid = hid;
|
||||
@@ -685,7 +889,7 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
if(value != undefined) {
|
||||
switch(i) {
|
||||
case HERO_MAIN_ATTR_INDEX.BASE:
|
||||
this.base = value; break;
|
||||
this.mainBase = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.JOB:
|
||||
this.job = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.STAR_UP:
|
||||
@@ -696,12 +900,18 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
this.favour = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.TALENT:
|
||||
this.talent = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP:
|
||||
this.equip = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_UP:
|
||||
this.equipUp = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STONE:
|
||||
this.equipStone = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_QUALITY:
|
||||
this.equipQuality = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STRENGTH:
|
||||
this.equipStrength = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STAR:
|
||||
this.equipStar = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_SUIT:
|
||||
this.equipSuit = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.JEWEL:
|
||||
this.jewel = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.STONE:
|
||||
this.stone = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,7 +922,7 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
for(let i = HERO_MAIN_ATTR_INDEX.START; i < HERO_MAIN_ATTR_INDEX.END; i++) {
|
||||
switch(i) {
|
||||
case HERO_MAIN_ATTR_INDEX.BASE:
|
||||
values.push(this.base);
|
||||
values.push(this.mainBase);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.JOB:
|
||||
values.push(this.job);
|
||||
@@ -729,14 +939,23 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
case HERO_MAIN_ATTR_INDEX.TALENT:
|
||||
values.push(this.talent);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP:
|
||||
values.push(this.equip);
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_QUALITY:
|
||||
values.push(this.equipQuality);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_UP:
|
||||
values.push(this.equipUp);
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STRENGTH:
|
||||
values.push(this.equipStrength);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STONE:
|
||||
values.push(this.equipStone);
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_STAR:
|
||||
values.push(this.equipStar);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.EQUIP_SUIT:
|
||||
values.push(this.equipSuit);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.JEWEL:
|
||||
values.push(this.jewel);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.STONE:
|
||||
values.push(this.stone);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -751,13 +970,15 @@ class HeroSubAttr extends HeroAllAttr {
|
||||
if(value != undefined) {
|
||||
switch(i) {
|
||||
case HERO_SUB_ATTR_INDEX.BASE:
|
||||
this.base = value; break;
|
||||
this.subBase = value; break;
|
||||
case HERO_SUB_ATTR_INDEX.JOB:
|
||||
this.job = value; break;
|
||||
case HERO_SUB_ATTR_INDEX.TALENT:
|
||||
this.talent = value; break;
|
||||
case HERO_SUB_ATTR_INDEX.EQUIP:
|
||||
this.equip = value; break;
|
||||
case HERO_SUB_ATTR_INDEX.JEWEL:
|
||||
this.jewel = value; break;
|
||||
case HERO_SUB_ATTR_INDEX.EQUIP_STAR:
|
||||
this.equipStar = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -768,7 +989,7 @@ class HeroSubAttr extends HeroAllAttr {
|
||||
for(let i = HERO_SUB_ATTR_INDEX.START; i < HERO_SUB_ATTR_INDEX.END; i++) {
|
||||
switch(i) {
|
||||
case HERO_SUB_ATTR_INDEX.BASE:
|
||||
values.push(this.base);
|
||||
values.push(this.subBase);
|
||||
break;
|
||||
case HERO_SUB_ATTR_INDEX.JOB:
|
||||
values.push(this.job);
|
||||
@@ -776,8 +997,11 @@ class HeroSubAttr extends HeroAllAttr {
|
||||
case HERO_SUB_ATTR_INDEX.TALENT:
|
||||
values.push(this.talent);
|
||||
break;
|
||||
case HERO_SUB_ATTR_INDEX.EQUIP:
|
||||
values.push(this.equip);
|
||||
case HERO_SUB_ATTR_INDEX.JEWEL:
|
||||
values.push(this.jewel);
|
||||
break;
|
||||
case HERO_SUB_ATTR_INDEX.EQUIP_STAR:
|
||||
values.push(this.equipStar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -792,14 +1016,12 @@ abstract class EquipAllAttr {
|
||||
equipQuality: number = 0;
|
||||
equipStrengthen: number = 0;
|
||||
equipStar: number = 0;
|
||||
equipSuit: number = 0;
|
||||
jewel: number = 0;
|
||||
stone: number = 0;
|
||||
|
||||
constructor(hid: number, attrId: number, ) {
|
||||
constructor(hid: number, attrId: number) {
|
||||
this.hid = hid;
|
||||
this.attrId = attrId;
|
||||
|
||||
}
|
||||
|
||||
abstract setByRoleCe(data: AttrCell): void;
|
||||
@@ -825,8 +1047,6 @@ class EquipMainAttr extends EquipAllAttr {
|
||||
this.equipStrengthen = value; break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.EQUIP_STAR:
|
||||
this.equipStar = value; break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.EQUIP_SUIT:
|
||||
this.equipSuit = value; break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.JEWEL:
|
||||
this.jewel = value; break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.STONE:
|
||||
@@ -849,9 +1069,6 @@ class EquipMainAttr extends EquipAllAttr {
|
||||
case EQUIP_MAIN_ATTR_INDEX.EQUIP_STAR:
|
||||
values.push(this.equipStar);
|
||||
break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.EQUIP_SUIT:
|
||||
values.push(this.equipSuit);
|
||||
break;
|
||||
case EQUIP_MAIN_ATTR_INDEX.JEWEL:
|
||||
values.push(this.jewel);
|
||||
break;
|
||||
@@ -922,9 +1139,12 @@ enum HERO_MAIN_ATTR_INDEX {
|
||||
CONNECT = 3, // hp3, 角色羁绊固定值(dic_zyz_friend_ship的attribute)
|
||||
FAVOUR = 4, // hp4, 声望加成(dic_zyz_friend_ship_level的add)
|
||||
TALENT = 5, // hp5, 天赋树百分比加成(dic_zyz_hero_talent的levelSeid,然后对应到dic_zyz_se)
|
||||
EQUIP = 6, // (hp6+hp7)*(1+hp8) 装备,equipAttr加成之后加到这里
|
||||
EQUIP_UP = 7, // hp9, 天晶洗练处的主属性百分比加成,equipAttr中计算好加和加入
|
||||
EQUIP_STONE = 8, // hp10, 地玉石增加的固定值,equipAttr中计算好和加入
|
||||
EQUIP_QUALITY = 6, // hp6, 装备品质基础值(dic_zyz_equipQuality的attribute)
|
||||
EQUIP_STRENGTH = 7, // hp7, 装备强化值(dic_zyz_equipStrenthAttr的attr)
|
||||
EQUIP_STAR = 8, // hp8,装备升星(dic_zyz_equipStar的mainAttr)
|
||||
EQUIP_SUIT = 9, // hp8,套装(dic_zyz_equipSuit的effect,然后对应dic_zyz_se)
|
||||
JEWEL = 10, // hp9,天晶随机属性值(jewel的ranSe,对应dic_zyz_randomEffectPool)
|
||||
STONE = 11, // hp10, 地玉增加的固定值(dic_zyz_stone的attribute)
|
||||
END
|
||||
}
|
||||
|
||||
@@ -933,7 +1153,8 @@ enum HERO_SUB_ATTR_INDEX {
|
||||
BASE = 0, // attr1,系统参数表中所有人
|
||||
JOB = 1, // attr2, 职业的attr
|
||||
TALENT = 2, // attr3, 天赋树百分比加成 (dic_zyz_hero_talent的levelSeid,然后对应到dic_zyz_se)
|
||||
EQUIP = 3, // attr7+attr9, 天晶加成和精炼加成,equipAttr加起来
|
||||
JEWEL = 3, // attr7, 天晶随机属性(随机出来的值在dic_zyz_randomEffectPool中读最终值)
|
||||
EQUIP_STAR = 4, // attr9, 精炼次级属性(dic_zyz_equipStar的subAttr)
|
||||
END
|
||||
}
|
||||
|
||||
@@ -942,15 +1163,14 @@ enum EQUIP_MAIN_ATTR_INDEX {
|
||||
EQUIP_QUALITY = 0, // hp6, 装备升品基础值加成(dic_zyz_equipQuality)
|
||||
EQUIP_STRENGTH = 1,// hp7, 装备强化值(需改表,改为键值对)
|
||||
EQUIP_STAR = 2, // hp8, 装备(dic_zyz_equipStar)
|
||||
EQUIP_SUIT = 3, // hp8, 装备套装加成(dic_zyz_equipSuit)
|
||||
JEWEL = 4, // hp9, 天晶洗练出的主属性百分比加成,equipAttr加起来
|
||||
STONE = 5, // hp10,地玉石增加的固定值,equipAttr加起来
|
||||
JEWEL = 3, // hp9, 天晶洗练出的主属性百分比加成,equipAttr加起来
|
||||
STONE = 4, // hp10,地玉石增加的固定值,equipAttr加起来
|
||||
END
|
||||
}
|
||||
|
||||
enum EQUIP_SUB_ATTR_INDEX {
|
||||
START,
|
||||
JEWEL = 0, // attr7, 天晶随机属性(随机出来的值在dic_zyz_randomEffectPool中读最终值)
|
||||
EQUIP_STAR = 1, // attr8, 精炼次级属性(dic_zyz_equipStar的subAttr)
|
||||
EQUIP_STAR = 1, // attr9, 精炼次级属性(dic_zyz_equipStar的subAttr)
|
||||
END
|
||||
}
|
||||
@@ -540,6 +540,7 @@ export const FILENAME = {
|
||||
DIC_STONE: 'dic_zyz_stone',
|
||||
DIC_JEWEL_CONDITION: 'dic_zyz_jewel_condition',
|
||||
DIC_MAIN_STAR_BOX: 'dic_zyz_main_star_reward',
|
||||
DIC_EQUIP_STRENGTH_ATTR: 'dic_zyz_equipStrengthAttr',
|
||||
}
|
||||
|
||||
export const WAR_RELATE_TABLES = [
|
||||
|
||||
@@ -111,7 +111,7 @@ export class EPlace {
|
||||
@prop({ required: true })
|
||||
equipId: number;
|
||||
@prop({ required: true })
|
||||
lv: number = 1;
|
||||
lv: number = 0;
|
||||
@prop({ required: true })
|
||||
quality: number = 1;
|
||||
@prop({ required: true })
|
||||
|
||||
@@ -103,6 +103,7 @@ import { dicJewelCondition, loadJewelCondition } from './dictionary/DicJewelCond
|
||||
import { dicMainStarBox, dicMainStarBoxByChapter, loadMainStarBox } from './dictionary/DicMainStarBox';
|
||||
import { dicHeroTalent, initTalents, loadHeroTalent } from './dictionary/DicHeroTalent';
|
||||
import { Talent } from "../db/Hero";
|
||||
import { dicEquipStrengthAttr, loadEquipStrengthAttr } from './dictionary/DicEquipStrengthAttr';
|
||||
|
||||
export const gameData = {
|
||||
daily: dicDaily,
|
||||
@@ -257,6 +258,7 @@ export const gameData = {
|
||||
heroTalent: dicHeroTalent,
|
||||
initTalents: initTalents,
|
||||
talentPointOfJob: talentPointOfJob,
|
||||
equipStrengthAttr: dicEquipStrengthAttr
|
||||
};
|
||||
|
||||
// 在此提供一些原先在gamedata中提供的方法,以便更方便获取gameData数据
|
||||
@@ -882,6 +884,11 @@ export function getHeroInitTalent(skinId: number) {
|
||||
return ids.map(id => (new Talent(id)));
|
||||
}
|
||||
|
||||
export function getEquipStrenthenAttr(equipId: number, lv: number) {
|
||||
let result = gameData.equipStrengthAttr.get(`${equipId}_${lv}`);
|
||||
return result
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
function initDatas() {
|
||||
parseDicParam();
|
||||
@@ -1049,6 +1056,7 @@ function loadDatas() {
|
||||
loadJewelCondition();
|
||||
loadMainStarBox();
|
||||
loadHeroTalent();
|
||||
loadEquipStrengthAttr();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
|
||||
39
shared/pubUtils/dictionary/DicEquipStrengthAttr.ts
Normal file
39
shared/pubUtils/dictionary/DicEquipStrengthAttr.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// 装备强化表
|
||||
import { readFileAndParse, parseGoodStr, decodeArrayListStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
|
||||
export interface DicEquipStrengthAttr {
|
||||
// id
|
||||
readonly id: number;
|
||||
// 装备id
|
||||
readonly equipId: number;
|
||||
// 等级
|
||||
readonly lv: number;
|
||||
// 属性
|
||||
readonly attr: {id: number, num: number}[];
|
||||
}
|
||||
|
||||
export const dicEquipStrengthAttr = new Map<string, DicEquipStrengthAttr>();
|
||||
export function loadEquipStrengthAttr() {
|
||||
dicEquipStrengthAttr.clear();
|
||||
let arr = readFileAndParse(FILENAME.DIC_EQUIP_STRENGTH_ATTR);
|
||||
|
||||
arr.forEach(o => {
|
||||
o.attr = parseAttr(o.attr);
|
||||
dicEquipStrengthAttr.set(`${o.equipId}_${o.lv}`, o);
|
||||
});
|
||||
arr = undefined;
|
||||
}
|
||||
|
||||
function parseAttr(str: string) {
|
||||
let result = new Array<{id: number, num: number}>();
|
||||
if(!str) return result;
|
||||
let decodeArr = decodeArrayListStr(str);
|
||||
for(let [id, num] of decodeArr) {
|
||||
if(isNaN(parseInt(id)) || isNaN(parseInt(num))) {
|
||||
throw new Error('data table format wrong');
|
||||
}
|
||||
result.push({id: parseInt(id), num: parseInt(num)});
|
||||
}
|
||||
return result
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
"jobClass": 1,
|
||||
"eplaceId": 1,
|
||||
"suitId": 1,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -16,8 +14,6 @@
|
||||
"jobClass": 1,
|
||||
"eplaceId": 2,
|
||||
"suitId": 1,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -27,8 +23,6 @@
|
||||
"jobClass": 1,
|
||||
"eplaceId": 3,
|
||||
"suitId": 1,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -38,8 +32,6 @@
|
||||
"jobClass": 1,
|
||||
"eplaceId": 4,
|
||||
"suitId": 1,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -49,8 +41,6 @@
|
||||
"jobClass": 2,
|
||||
"eplaceId": 1,
|
||||
"suitId": 2,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -60,8 +50,6 @@
|
||||
"jobClass": 2,
|
||||
"eplaceId": 2,
|
||||
"suitId": 2,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -71,8 +59,6 @@
|
||||
"jobClass": 2,
|
||||
"eplaceId": 3,
|
||||
"suitId": 2,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -82,8 +68,6 @@
|
||||
"jobClass": 2,
|
||||
"eplaceId": 4,
|
||||
"suitId": 2,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -93,8 +77,6 @@
|
||||
"jobClass": 3,
|
||||
"eplaceId": 1,
|
||||
"suitId": 3,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -104,8 +86,6 @@
|
||||
"jobClass": 3,
|
||||
"eplaceId": 2,
|
||||
"suitId": 3,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -115,8 +95,6 @@
|
||||
"jobClass": 3,
|
||||
"eplaceId": 3,
|
||||
"suitId": 3,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -126,8 +104,6 @@
|
||||
"jobClass": 3,
|
||||
"eplaceId": 4,
|
||||
"suitId": 3,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -137,8 +113,6 @@
|
||||
"jobClass": 4,
|
||||
"eplaceId": 1,
|
||||
"suitId": 4,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -148,8 +122,6 @@
|
||||
"jobClass": 4,
|
||||
"eplaceId": 2,
|
||||
"suitId": 4,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -159,8 +131,6 @@
|
||||
"jobClass": 4,
|
||||
"eplaceId": 3,
|
||||
"suitId": 4,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -170,8 +140,6 @@
|
||||
"jobClass": 4,
|
||||
"eplaceId": 4,
|
||||
"suitId": 4,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -181,8 +149,6 @@
|
||||
"jobClass": 5,
|
||||
"eplaceId": 1,
|
||||
"suitId": 5,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -192,8 +158,6 @@
|
||||
"jobClass": 5,
|
||||
"eplaceId": 2,
|
||||
"suitId": 5,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -203,8 +167,6 @@
|
||||
"jobClass": 5,
|
||||
"eplaceId": 3,
|
||||
"suitId": 5,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -214,8 +176,6 @@
|
||||
"jobClass": 5,
|
||||
"eplaceId": 4,
|
||||
"suitId": 5,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -225,8 +185,6 @@
|
||||
"jobClass": 6,
|
||||
"eplaceId": 1,
|
||||
"suitId": 6,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -236,8 +194,6 @@
|
||||
"jobClass": 6,
|
||||
"eplaceId": 2,
|
||||
"suitId": 6,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -247,8 +203,6 @@
|
||||
"jobClass": 6,
|
||||
"eplaceId": 3,
|
||||
"suitId": 6,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -258,8 +212,6 @@
|
||||
"jobClass": 6,
|
||||
"eplaceId": 4,
|
||||
"suitId": 6,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -269,8 +221,6 @@
|
||||
"jobClass": 7,
|
||||
"eplaceId": 1,
|
||||
"suitId": 7,
|
||||
"attribute": "2&10",
|
||||
"attributeUp": "2&10",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -280,8 +230,6 @@
|
||||
"jobClass": 7,
|
||||
"eplaceId": 2,
|
||||
"suitId": 7,
|
||||
"attribute": "4&20",
|
||||
"attributeUp": "4&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -291,8 +239,6 @@
|
||||
"jobClass": 7,
|
||||
"eplaceId": 3,
|
||||
"suitId": 7,
|
||||
"attribute": "5&20",
|
||||
"attributeUp": "5&20",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
},
|
||||
@@ -302,8 +248,6 @@
|
||||
"jobClass": 7,
|
||||
"eplaceId": 4,
|
||||
"suitId": 7,
|
||||
"attribute": "1&50",
|
||||
"attributeUp": "1&50",
|
||||
"composeMaterial": "50001&2",
|
||||
"imageId": "qingtongjian&bintiejian&wenshijian&jinggangjian&songwenjian"
|
||||
}
|
||||
|
||||
14002
shared/resource/jsons/dic_zyz_equipStrengthAttr.json
Normal file
14002
shared/resource/jsons/dic_zyz_equipStrengthAttr.json
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user