✨ feat(宝物): 添加宝物系统
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { ABI_STAGE, ABI_STAGE_TO_TYPE, ABI_TYPE, ABI_TYPE_MAIN, LINEUP_NUM, SEID_TYPE, TALENT_RELATION_TYPE } from "../../consts";
|
||||
import { ArtifactModelType } from "../../db/Artifact";
|
||||
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, ScrollAttr } from "../../db/RoleCe";
|
||||
import { TopHero } from "../../domain/dbGeneral";
|
||||
import { AttributeCal } from "../../domain/roleField/attribute";
|
||||
import { gameData, getEquipQualityIdByEquipIdAndPoint, getEquipStarAttrByStage, getEquipStrenthenAttr, getEquipSuitByHero, getFriendShipByIdAndLv, getHeroStarByQuality, getHeroWakeByQuality, getJewelConditionByLvAndSeId, getJobByGradeAndClass, getSchoolRateByStar, getScollByStar, getTeraph } from "../../pubUtils/data";
|
||||
import { gameData, getDicArtifactLvByPlanId, 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 +46,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, mainBaseUp = 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 { mainBase = 0, mainBaseUp = 0, subBase = 0, job = 0, starUp = 0, connect = 0, talent = 0, equipQuality = 0, equipStrength = 0, equipStar = 0, equipSuit = 0, jewel = 0, stone = 0, artifactLv = 0, artifactQuality = 0, artifactSeid = 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 ] * ( 1 + hp5 ) + [( hp6 + hp7 ) * ( 1 + hp8 )]} * ( 1 + hp9 ) + hp10 + hp11
|
||||
val = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 ) + stone + teraph + title + scroll;
|
||||
str += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100 )+${stone}+${teraph}+${title}+${scroll}`;
|
||||
// {[ hp1 + lv * hp2 ] * ( 1 + hp5 ) + [( hp6 + hp7 ) * ( 1 + hp8 )]} * ( 1 + hp9 ) + hp10 + hp11 + hp14
|
||||
val = (( mainBase + job + lv * ( starUp + mainBaseUp ) ) * ( 1 + connect/100 ) + (( equipQuality + equipStrength ) * ( 1 + ( equipStar/100 + equipSuit/100 )))) * ( 1 + jewel/100 + school/100 + talent/100 + skin/100 + artifactSeid/100) + stone + teraph + title + scroll + artifactLv + artifactQuality;
|
||||
str += `{[${mainBase}+${job}+${lv}*(${starUp}+${mainBaseUp})]* ( 1 + ${connect}/100) + [(${equipQuality}+${equipStrength}) * ( 1 + ${equipStar}/100+${equipSuit}/100)]} * (1+${jewel}/100+${school}/100+${talent}/100+${skin}/100+${artifactSeid}/100)+${stone}+${teraph}+${title}+${scroll}+${artifactLv}+${artifactQuality}`;
|
||||
} else {
|
||||
// attr1 + attr2 + attr4 + attr5 + attr6 + attr7 + attr9
|
||||
val = subBase + job + teraph + school + title + jewel + equipStar;
|
||||
@@ -511,6 +512,86 @@ export class CalCe {
|
||||
}
|
||||
}
|
||||
|
||||
// 卸下宝物
|
||||
public setPutOffArtifact(hid: number) {
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactLv');
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactQuality');
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactSeid');
|
||||
}
|
||||
|
||||
// 装备宝物
|
||||
public setPutArtifact(hid: number, skinId: number, job: number, artifact: ArtifactModelType) {
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactLv');
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactQuality');
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactSeid');
|
||||
|
||||
if(artifact) {
|
||||
this.setArtifactLv(hid, artifact.artifactId, artifact.lv);
|
||||
this.setArtifactQuality(hid, artifact.artifactId);
|
||||
this.setArtifactSeid(hid, skinId, job, artifact.lv);
|
||||
}
|
||||
}
|
||||
|
||||
// 宝物等级
|
||||
public setArtifactLv(hid: number, artifactId: number, lv: number) {
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactLv');
|
||||
let dicArtifact = gameData.artifact.get(artifactId);
|
||||
if(!dicArtifact) return;
|
||||
|
||||
let dicArtifactLv = getDicArtifactLvByPlanId(dicArtifact.lvAttrPlan, lv);
|
||||
if(!dicArtifactLv) return;
|
||||
|
||||
let ceAttr = dicArtifactLv.attr||[];
|
||||
for(let { id, attr } of ceAttr) {
|
||||
let heroAttr = this.data.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.artifactLv = attr;
|
||||
}
|
||||
}
|
||||
|
||||
// 宝物品质
|
||||
public setArtifactQuality(hid: number, artifactId: number) {
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactQuality');
|
||||
|
||||
let dicArtifact = gameData.artifact.get(artifactId);
|
||||
if(!dicArtifact) return;
|
||||
|
||||
// 基础属性
|
||||
let dicArtifactQualityPlan = gameData.artifactQualityPlan.get(dicArtifact.qualityAttrPlan);
|
||||
if(!dicArtifactQualityPlan) return;
|
||||
|
||||
let ceAttr = dicArtifactQualityPlan.attr||[];
|
||||
for(let { id, attr } of ceAttr) {
|
||||
let heroAttr = this.data.getHeroAttrByHidAndId(hid, id);
|
||||
heroAttr.artifactQuality = attr;
|
||||
}
|
||||
}
|
||||
|
||||
// 宝物词条
|
||||
public setArtifactSeid(hid: number, skinId: number, job: number, artifactId: number) {
|
||||
this.data.clearHeroAttrByHid(hid, 'artifactSeid');
|
||||
|
||||
let dicArtifact = gameData.artifact.get(artifactId);
|
||||
if(!dicArtifact) return;
|
||||
let dicJob = gameData.job.get(job);
|
||||
if(!dicJob) return;
|
||||
|
||||
let seids: number[] = []; // id, seids
|
||||
for(let seid of dicArtifact.seids) {
|
||||
let dicArtifactSeid = gameData.artifactSeid.get(seid);
|
||||
if(!dicArtifactSeid) continue;
|
||||
if(dicArtifactSeid.jobClass != 0 && dicArtifactSeid.jobClass != dicJob.job_class) continue;
|
||||
if(dicArtifactSeid.hid != 0 && dicArtifactSeid.hid != skinId) continue;
|
||||
if(dicArtifactSeid.quality > dicArtifact.quality) continue;
|
||||
seids.push(dicArtifactSeid.seid);
|
||||
}
|
||||
|
||||
let { ratioUp } = this.addSeidEffect(seids);
|
||||
for(let [attrId, val] of ratioUp) {
|
||||
let heroAttr = this.data.getHeroAttrByHidAndId(hid, attrId);
|
||||
heroAttr.artifactSeid = val;
|
||||
}
|
||||
}
|
||||
|
||||
// 添加技能增加的被动属性
|
||||
private addSeidEffect(seidList: number[]) {
|
||||
let fixUp = new Map<number, number>(), ratioUp = new Map<number, number>();
|
||||
@@ -991,6 +1072,9 @@ abstract class HeroAllAttr {
|
||||
jewel: number = 0; // hp9 & attr7,天晶随机属性值(jewel的ranSe,对应dic_zyz_randomEffectPool)
|
||||
stone: number = 0; // hp10, 地玉增加的固定值(dic_zyz_stone的attribute)
|
||||
mainBaseUp: number = 0; // hp2, 基础成长(dic_zyz_hero的hp_up)
|
||||
artifactLv: number = 0; // hp14 宝物等级(dic_zyz_artifactLvPlan的attr)
|
||||
artifactQuality: number = 0; // hp14 宝物品质(dic_zyz_artifactQualityPlan的attr)
|
||||
artifactSeid: number = 0; // hp9 宝物词条(dic_zyz_artifactSeid算出来的)
|
||||
|
||||
constructor(hid: number, attrId: number, ) {
|
||||
this.hid = hid;
|
||||
@@ -1041,6 +1125,12 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
this.stone = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.BASE_UP:
|
||||
this.mainBaseUp = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_LV:
|
||||
this.artifactLv = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_QUALITY:
|
||||
this.artifactQuality = value; break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_SEID:
|
||||
this.artifactSeid = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1089,6 +1179,15 @@ class HeroMainAttr extends HeroAllAttr {
|
||||
case HERO_MAIN_ATTR_INDEX.BASE_UP:
|
||||
values.push(this.mainBaseUp);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_LV:
|
||||
values.push(this.artifactLv);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_QUALITY:
|
||||
values.push(this.artifactQuality);
|
||||
break;
|
||||
case HERO_MAIN_ATTR_INDEX.ARTIFACT_SEID:
|
||||
values.push(this.artifactSeid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return values;
|
||||
@@ -1278,6 +1377,9 @@ enum HERO_MAIN_ATTR_INDEX {
|
||||
JEWEL = 10, // hp9,天晶随机属性值(jewel的ranSe,对应dic_zyz_randomEffectPool)
|
||||
STONE = 11, // hp10, 地玉增加的固定值(dic_zyz_stone的attribute)
|
||||
BASE_UP = 12, // hp2, 角色基础属性成长(dic_zyz_hero的hp_up)
|
||||
ARTIFACT_LV = 13, // hp14, 宝物等级
|
||||
ARTIFACT_QUALITY = 14, // hp14, 宝物品质
|
||||
ARTIFACT_SEID = 15, // hp9,宝物词条
|
||||
END
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user