fix: 修复远征部分编译错误
This commit is contained in:
@@ -182,7 +182,7 @@ export function decodeWarJsonAttribute(attribute) {
|
||||
export async function getPointRewardStatus(roleId: string) {
|
||||
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let {expeditionPoint} = role;
|
||||
let {expeditionPoint = 0} = role;
|
||||
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
||||
let pointRewards = {
|
||||
expeditionPoint,
|
||||
|
||||
@@ -329,7 +329,7 @@ export class ExpeditionBattleHandler {
|
||||
let goods = await rewardObject.saveReward();
|
||||
|
||||
return {
|
||||
code: 202,
|
||||
code: 200,
|
||||
data: {
|
||||
pointRewards,
|
||||
goods
|
||||
@@ -352,11 +352,11 @@ export class ExpeditionBattleHandler {
|
||||
}
|
||||
let { rewards } = pointStatusInDatabase;
|
||||
let dicExpeditionPoint = getGamedata('dic_expedition_point');
|
||||
let flag: boolean, maxPoint = 0;
|
||||
let flag = true, maxPoint = 0;
|
||||
for(let dic of dicExpeditionPoint) {
|
||||
let curReward = rewards.find(cur => cur.point == dic.point);
|
||||
if(curReward && curReward.received) {
|
||||
flag = true;
|
||||
if(!curReward || !curReward.received) {
|
||||
flag = false;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
let ce = ctx.service.utils.calculateCE({hid: hid, lv: hlv});
|
||||
|
||||
const heroInfo = {
|
||||
roleId,
|
||||
@@ -173,7 +174,8 @@ export default class GMUsers extends Service {
|
||||
hid: hid,
|
||||
hName: dicHero.name,
|
||||
seqId,
|
||||
lv: hlv
|
||||
lv: hlv,
|
||||
ce
|
||||
}
|
||||
await HeroModel.createHero(heroInfo);
|
||||
} else {
|
||||
|
||||
@@ -66,7 +66,7 @@ export default class ExpeditionRecord extends BaseModel {
|
||||
const result = await ExpeditionRecordModel.findOneAndUpdate(
|
||||
{ expeditionCode },
|
||||
{ $push: {heroes: {$each: pushArr} } }
|
||||
)
|
||||
).lean(lean)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
{expeditionCode, expeditionId},
|
||||
{$set: {battleStatus}},
|
||||
{new: true}
|
||||
);
|
||||
).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user