fix: 修复远征部分编译错误
This commit is contained in:
@@ -182,7 +182,7 @@ export function decodeWarJsonAttribute(attribute) {
|
|||||||
export async function getPointRewardStatus(roleId: string) {
|
export async function getPointRewardStatus(roleId: string) {
|
||||||
|
|
||||||
let role = await RoleModel.findByRoleId(roleId);
|
let role = await RoleModel.findByRoleId(roleId);
|
||||||
let {expeditionPoint} = role;
|
let {expeditionPoint = 0} = role;
|
||||||
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
||||||
let pointRewards = {
|
let pointRewards = {
|
||||||
expeditionPoint,
|
expeditionPoint,
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ export class ExpeditionBattleHandler {
|
|||||||
let goods = await rewardObject.saveReward();
|
let goods = await rewardObject.saveReward();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
code: 202,
|
code: 200,
|
||||||
data: {
|
data: {
|
||||||
pointRewards,
|
pointRewards,
|
||||||
goods
|
goods
|
||||||
@@ -352,11 +352,11 @@ export class ExpeditionBattleHandler {
|
|||||||
}
|
}
|
||||||
let { rewards } = pointStatusInDatabase;
|
let { rewards } = pointStatusInDatabase;
|
||||||
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
||||||
let flag: boolean, maxPoint = 0;
|
let flag = true, maxPoint = 0;
|
||||||
for(let dic of dicExpeditionPoint) {
|
for(let dic of dicExpeditionPoint) {
|
||||||
let curReward = rewards.find(cur => cur.point == dic.point);
|
let curReward = rewards.find(cur => cur.point == dic.point);
|
||||||
if(curReward && curReward.received) {
|
if(!curReward || !curReward.received) {
|
||||||
flag = true;
|
flag = false;
|
||||||
}
|
}
|
||||||
if(dic.point > maxPoint) maxPoint = dic.point;
|
if(dic.point > maxPoint) maxPoint = dic.point;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,4 +99,24 @@ export default class Utils extends Service {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public calculateCE(heroInfo: {hid: number, lv: number }) {
|
||||||
|
|
||||||
|
let { hid, lv } = heroInfo;
|
||||||
|
// 假设所有属性和等级的关系是简单的线性关系
|
||||||
|
let dicHero = this.getGamedata('dic_zyz_hero');
|
||||||
|
let curDicHero = dicHero.find(cur => cur.heroId == hid);
|
||||||
|
|
||||||
|
let { atk, matk, def, mdef, agi, luk, atk_up, matk_up, def_up, mdef_up, agi_up, luk_up } = curDicHero;
|
||||||
|
atk += lv * atk_up;
|
||||||
|
matk += lv * matk_up;
|
||||||
|
def += lv * def_up;
|
||||||
|
mdef += lv * mdef_up;
|
||||||
|
agi += lv * agi_up;
|
||||||
|
luk += lv * luk_up;
|
||||||
|
|
||||||
|
// 假设战力为所有属性的简单加法
|
||||||
|
|
||||||
|
let ce = atk + matk + def + mdef + agi + luk;
|
||||||
|
return ce;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ export default class GMUsers extends Service {
|
|||||||
flag = 1, msg = "未找到武将" + hid;
|
flag = 1, msg = "未找到武将" + hid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
let ce = ctx.service.utils.calculateCE({hid: hid, lv: hlv});
|
||||||
|
|
||||||
const heroInfo = {
|
const heroInfo = {
|
||||||
roleId,
|
roleId,
|
||||||
@@ -173,7 +174,8 @@ export default class GMUsers extends Service {
|
|||||||
hid: hid,
|
hid: hid,
|
||||||
hName: dicHero.name,
|
hName: dicHero.name,
|
||||||
seqId,
|
seqId,
|
||||||
lv: hlv
|
lv: hlv,
|
||||||
|
ce
|
||||||
}
|
}
|
||||||
await HeroModel.createHero(heroInfo);
|
await HeroModel.createHero(heroInfo);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default class ExpeditionRecord extends BaseModel {
|
|||||||
const result = await ExpeditionRecordModel.findOneAndUpdate(
|
const result = await ExpeditionRecordModel.findOneAndUpdate(
|
||||||
{ expeditionCode },
|
{ expeditionCode },
|
||||||
{ $push: {heroes: {$each: pushArr} } }
|
{ $push: {heroes: {$each: pushArr} } }
|
||||||
)
|
).lean(lean)
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default class ExpeditionWarRecord extends BaseModel {
|
|||||||
{expeditionCode, expeditionId},
|
{expeditionCode, expeditionId},
|
||||||
{$set: {battleStatus}},
|
{$set: {battleStatus}},
|
||||||
{new: true}
|
{new: true}
|
||||||
);
|
).lean(lean);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user