feat(宝物): 添加宝物系统

This commit is contained in:
luying
2022-12-07 10:55:30 +08:00
parent b684307818
commit a83deeff5f
46 changed files with 15656 additions and 54 deletions

View File

@@ -19,6 +19,7 @@ import { AttributeCal } from '../domain/roleField/attribute';
import { sendMessageToUserWithSuc } from './pushService';
import { SkinType } from '../db/Skin';
import { LadderMatchModel } from '../db/LadderMatch';
import { ArtifactModelType } from '../db/Artifact';
interface Param {
isInitRole?: boolean,
@@ -44,6 +45,8 @@ interface Param {
skins?: SkinType[],
stonesId?: number,
talentId?: number,
artifact?: ArtifactModelType,
job?: number,
}
export async function calculateCeWithHero(type: HERO_SYSTEM_TYPE, roleId: string, serverId: number, sid: string, hid: number, heroUpdate: HeroUpdate, param: Param = {}) {
@@ -130,7 +133,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
case HERO_SYSTEM_TYPE.SKIN: // 7. 穿皮肤
{
let { hero: { quality, star, starStage, colorStar, colorStarStage, jobStage } } = param;
let { hero: { quality, star, starStage, colorStar, colorStarStage, jobStage }, artifact } = param;
for(let [hid, { skinId, job, ePlace, skins }] of heroUpdates) {
ceChangeTxt.push(`武将 ${hid} 穿上了皮肤 ${skinId}`);
calCe.setHeroBase(hid, skinId);
@@ -143,6 +146,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
calCe.setEquipSuit(hid, skinId, ePlace);
calCe.setTalent(hid, skins);
if(artifact) calCe.setArtifactSeid(hid, skinId, job, artifact.artifactId);
}
break;
}
@@ -309,7 +313,7 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
}
case HERO_SYSTEM_TYPE.TALENT_UNLOCK: // 30. 天赋解锁
case HERO_SYSTEM_TYPE.TALENT_LV: // 32. 天赋升级
case HERO_SYSTEM_TYPE.TALENT_RESET: // 30. 天赋洗点
case HERO_SYSTEM_TYPE.TALENT_RESET: // 33. 天赋洗点
{
let { talentId } = param;
for(let [hid, { skins }] of heroUpdates) {
@@ -354,6 +358,60 @@ export async function calculateCes(type: HERO_SYSTEM_TYPE, roleId: string, serve
ceChangeTxt.push(`后台重新计算`);
break;
}
case HERO_SYSTEM_TYPE.PUT_ARTIFACT: // 34. 装备宝物
{
let { artifact, job, skinId } = param;
if(!artifact) break;
for(let [hid ] of heroUpdates) {
calCe.setPutArtifact(hid, skinId, job, artifact);
calCe.setArtifactQuality(hid, artifact.artifactId);
calCe.setArtifactSeid(hid, skinId, job, artifact.artifactId);
ceChangeTxt.push(`武将 ${hid} 装备宝物 ${artifact.artifactId}`);
}
break;
}
case HERO_SYSTEM_TYPE.PUT_OFF_ARTIFACT: // 35. 卸下
{
for(let [hid ] of heroUpdates) {
calCe.setPutOffArtifact(hid);
ceChangeTxt.push(`武将 ${hid} 卸下宝物`);
}
break;
}
case HERO_SYSTEM_TYPE.ARTIFACT_LV: // 36.宝物升级
{
let { artifact } = param;
if(!artifact) break;
for(let [hid ] of heroUpdates) {
calCe.setArtifactLv(hid, artifact.artifactId, artifact.lv);
ceChangeTxt.push(`武将 ${hid} 装备的宝物 ${artifact.seqId} ${artifact.artifactId} 升至 ${artifact.lv}`);
}
break;
}
case HERO_SYSTEM_TYPE.ARTIFACT_QUALITY: // 37. 宝物升品
{
let { artifact, job, skinId } = param;
if(!artifact) break;
for(let [hid ] of heroUpdates) {
calCe.setArtifactQuality(hid, artifact.artifactId);
calCe.setArtifactSeid(hid, skinId, job, artifact.artifactId);
ceChangeTxt.push(`武将 ${hid} 装备的宝物 ${artifact.seqId} 升至 ${artifact.artifactId}`);
}
break;
}
case HERO_SYSTEM_TYPE.ARTIFACT_TRANSFER: // 38. 宝物转换
{
let { artifact, job, skinId } = param;
if(!artifact) break;
for(let [hid ] of heroUpdates) {
calCe.setArtifactLv(hid, artifact.artifactId, artifact.lv);
calCe.setArtifactQuality(hid, artifact.artifactId);
calCe.setArtifactSeid(hid, skinId, job, artifact.artifactId);
ceChangeTxt.push(`武将 ${hid} 装备的宝物 ${artifact.seqId} 转换至 ${artifact.artifactId}`);
}
break;
}
}
let { heroCe, roleInc } = calCe.getCeInc(); // 计算战力,获得有变化的武将战力
let changeHids: number[] = [];