fix 修复远征当前血量和最大血量无法匹配bug

This commit is contained in:
luying
2020-11-19 10:37:39 +08:00
parent f07109d11c
commit 225d55f98f
6 changed files with 55 additions and 31 deletions

View File

@@ -203,7 +203,7 @@ export const EVENT_QUIZ_NUM = 3;
export const DEFAULT_HEROES = [ 312, 314, 311, 309, 315];
export const FIX_SMS_CODE_TELS = ['18855953630', '13911134885', '15167549151', '15618654010'];
export const FIX_SMS_CODE_TELS = ['18855953630', '13911134885', '15167549151', '15618654010', '15167549151'];
export const GONGSHI = {
"TOWER_HANG_UP_SPEED_COST": "50",
@@ -251,4 +251,4 @@ export const COM_BATTLE_ROBOT_HURT_RAND_RATE = 0.05;
// 每日情谊点上限
export const COM_BATTLE_FRDCNT_MAX = 100;
// 情谊点掉落数量
export const COM_BATTLE_FRDCNT_DROP = 10;
export const COM_BATTLE_FRDCNT_DROP = 10;

View File

@@ -40,6 +40,15 @@ class Enemies {
}
class EnemiesCurHPAP {
@prop({ required: true })
dataId: number; // 战场中唯一指向武将的代码
@prop({ required: true })
hp: number; // 生命
@prop({ required: true })
ap: number; // 怒气
}
/**
* 远征记录
*/
@@ -64,6 +73,8 @@ export default class ExpeditionWarRecord extends BaseModel {
enemyId: string; // 敌军队伍id或玩家id
@prop({ required: true, type: Enemies, default: [] })
enemies: Array<Enemies>; // 敌军数据
@prop({ required: true, type: EnemiesCurHPAP, default: [] })
enemiesCurHpAp: Array<EnemiesCurHPAP>; // 敌军数据
@prop({ required: true, default: 0 })
ce: number; // 敌军战力
@@ -73,14 +84,14 @@ export default class ExpeditionWarRecord extends BaseModel {
}
public static async getRecordByCodeAndId(expeditionCode: string, expeditionId: number, lean = true) {
const result = await ExpeditionWarRecordModel.findOne({ expeditionCode, expeditionId }).select('expeditionId battleId battleCode battleStatus enemyFrom enemies ce').lean(lean);
const result = await ExpeditionWarRecordModel.findOne({ expeditionCode, expeditionId }).select('expeditionId battleId battleCode battleStatus enemyFrom enemies enemiesCurHpAp ce').lean(lean);
return result;
}
public static async saveRecord(expeditionCode: string, expeditionId: number, params: {roleId: string, battleId: number, enemyFrom: number, enemyId: string, enemies: Array<any>, battleStatus: number}, lean = true) {
const doc = new ExpeditionWarRecordModel();
const update = Object.assign(doc.toJSON(), params, {expeditionCode, expeditionId});
const result = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, update, {new: true, upsert: true}).select('expeditionId battleId battleCode battleStatus enemyFrom enemies ce').lean(lean);
const result = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, update, {new: true, upsert: true}).select('expeditionId battleId battleCode battleStatus enemyFrom enemies enemiesCurHpAp ce').lean(lean);
return result;
}
@@ -96,15 +107,9 @@ export default class ExpeditionWarRecord extends BaseModel {
public static async updateEnemiesStatus(expeditionCode: string, expeditionId: number, battleStatus: number, enemies: Array<{dataId: number, hp: number, ap: number}>, lean = true) {
for(let {dataId, hp, ap} of enemies) {
await ExpeditionWarRecordModel.findOneAndUpdate(
{expeditionCode, expeditionId, 'enemies.dataId': dataId },
{$set: {'enemies.$.attribute.hp': hp, 'enemies.$.attribute.ap': ap}}
)
}
const result = ExpeditionWarRecordModel.findOneAndUpdate(
{expeditionCode, expeditionId},
{$set: {battleStatus}},
{$set: {battleStatus}, enemiesCurHpAp: enemies},
{new: true}
).lean(lean);
return result;

View File

@@ -4,7 +4,7 @@
"dispatchJsonId": 10001,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&3",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -27,7 +27,7 @@
"dispatchJsonId": 10002,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&3",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -50,7 +50,7 @@
"dispatchJsonId": 10003,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&3",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -73,7 +73,7 @@
"dispatchJsonId": 10004,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&3",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -96,7 +96,7 @@
"dispatchJsonId": 10005,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13010&1|17003&30|17006&20|17006&20",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -119,7 +119,7 @@
"dispatchJsonId": 10006,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13010&1|17003&30|17006&20|17006&20",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -142,7 +142,7 @@
"dispatchJsonId": 10007,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&8",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -165,7 +165,7 @@
"dispatchJsonId": 10008,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&9",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -188,7 +188,7 @@
"dispatchJsonId": 10009,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&10",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -211,7 +211,7 @@
"dispatchJsonId": 10010,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13005&1|17002&10|17006&2|17006&11",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -234,7 +234,7 @@
"dispatchJsonId": 10011,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13015&1|17004&30|17006&30|17006&30",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -257,7 +257,7 @@
"dispatchJsonId": 10012,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13015&1|17004&30|17006&30|17006&30",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,
@@ -280,7 +280,7 @@
"dispatchJsonId": 10013,
"bg_img_id": 504,
"script_id": 0,
"fixReward": "13015&1|17004&30|17006&30|17006&30",
"fixReward": "&",
"conditionReward": "&",
"RandomReward": "&",
"warType": 8,