远征:添加随机地图buff
This commit is contained in:
@@ -94,7 +94,7 @@ export class ExpeditionBattleHandler {
|
||||
if (!curExpeditionWarRecord) {
|
||||
return resResult(STATUS.EXPEDITION_MATCH_NO_PLAYER);
|
||||
}
|
||||
let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
|
||||
let { battleId, mapseid, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
|
||||
let nextCe = 0; // 下一关战力
|
||||
|
||||
if (gameData.expedition.has(expeditionId + 1)) {
|
||||
@@ -103,7 +103,7 @@ export class ExpeditionBattleHandler {
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
expeditionCode, expeditionId, battleId,
|
||||
expeditionCode, expeditionId, battleId, mapseid,
|
||||
battleStatus,
|
||||
enemyFrom,
|
||||
enemies,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ExpeditionPointModel } from '../db/ExpeditionPoint';
|
||||
import Role, { RoleModel, RoleType } from '../db/Role';
|
||||
import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
|
||||
import { shouldRefresh, calculateSumCE } from '../pubUtils/util';
|
||||
import { shouldRefresh, calculateSumCE, getRandSingleEelm } from '../pubUtils/util';
|
||||
import { EXPEDITION_CONST, LINEUP_NUM, EXPEDITION_WAR_RECORD_STATUS, ABI_TYPE } from '../consts';
|
||||
import { ExpeditionWarRecordModel } from '../db/ExpeditionWarRecord';
|
||||
import { HeroType } from '../db/Hero';
|
||||
@@ -88,9 +88,10 @@ export async function findOrCreateEnemies(roleId: string, myCe: number, expediti
|
||||
}
|
||||
if(flag) {
|
||||
// 保存
|
||||
let {warId} = curDicExpedition;
|
||||
let { warId } = curDicExpedition;
|
||||
let { mapseid } = gameData.war.get(warId);
|
||||
expeditionWarRecord = await ExpeditionWarRecordModel.saveRecord(expeditionCode, expeditionId, {
|
||||
roleId, battleId: warId, ...enemyObj, battleStatus
|
||||
roleId, battleId: warId, mapseid: getRandSingleEelm(mapseid), ...enemyObj, battleStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
expeditionId: number; // 远征序号
|
||||
@prop({ required: true, default: 0 })
|
||||
battleId: number; // 相关关卡id
|
||||
@prop({ required: true, default: 0 })
|
||||
mapseid: number; // 关卡随机buff
|
||||
@prop({ required: true, default: '' })
|
||||
battleCode: string; // 关联关卡唯一值
|
||||
@prop({ required: true, default: 0 })
|
||||
@@ -48,14 +50,14 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
}
|
||||
|
||||
public static async getRecordByCodeAndId(expeditionCode: string, expeditionId: number, lean = true) {
|
||||
const result: ExpeditionWarRecordType = await ExpeditionWarRecordModel.findOne({ expeditionCode, expeditionId }).select('expeditionId battleId battleCode battleStatus enemyFrom enemies enemiesCurHpAp ce').lean(lean);
|
||||
const result: ExpeditionWarRecordType = await ExpeditionWarRecordModel.findOne({ expeditionCode, expeditionId }).select('expeditionId battleId battleCode battleStatus enemyFrom enemies enemiesCurHpAp ce mapseid').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) {
|
||||
public static async saveRecord(expeditionCode: string, expeditionId: number, params: ExpeditionWarRecordUpdate, lean = true) {
|
||||
const doc = new ExpeditionWarRecordModel();
|
||||
const update = Object.assign(doc.toJSON(), params, {expeditionCode, expeditionId});
|
||||
console.log('*****', JSON.stringify(update));
|
||||
// console.log('*****', JSON.stringify(update));
|
||||
const result: ExpeditionWarRecordType = await ExpeditionWarRecordModel.findOneAndUpdate({ expeditionCode, expeditionId }, update, {new: true, upsert: true}).select('expeditionId battleId battleCode battleStatus enemyFrom enemies enemiesCurHpAp ce').lean(lean);
|
||||
return result;
|
||||
}
|
||||
@@ -89,3 +91,4 @@ export default class ExpeditionWarRecord extends BaseModel {
|
||||
export const ExpeditionWarRecordModel = getModelForClass(ExpeditionWarRecord);
|
||||
|
||||
export interface ExpeditionWarRecordType extends Pick<DocumentType<ExpeditionWarRecord>, keyof ExpeditionWarRecord>{};
|
||||
export type ExpeditionWarRecordUpdate = Partial<ExpeditionWarRecordType>; // 将所有字段变成可选项
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 关卡表
|
||||
import {decodeArrayListStr, decodeArrayStr, readFileAndParse} from '../util'
|
||||
import {decodeArrayListStr, decodeArrayStr, parseNumberList, readFileAndParse} from '../util'
|
||||
import { WAR_RELATE_TABLES, WAR_TYPE } from '../../consts';
|
||||
|
||||
export interface DicWar {
|
||||
@@ -36,6 +36,8 @@ export interface DicWar {
|
||||
readonly teammateReward: Array<{id: number, count: number}>;
|
||||
// 镇念塔禁用角色
|
||||
readonly fobiddenCharactor: Array<{type: number, id: number}>;
|
||||
// 远征随机buff
|
||||
readonly mapseid: number[];
|
||||
}
|
||||
|
||||
export const dicWar = new Map<number, DicWar>();
|
||||
@@ -55,6 +57,7 @@ export function loadWar() {
|
||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||
o.teammateReward = parseFixReward(o.teammateReward);
|
||||
o.fobiddenCharactor = parseForbiddenChara(o.fobiddenCharactor);
|
||||
o.mapseid = parseNumberList(o.mapseid);
|
||||
|
||||
dicWar.set(o.war_id, o);
|
||||
if(o.warType == WAR_TYPE.PVP) {
|
||||
|
||||
Reference in New Issue
Block a user