寻宝:奖励

This commit is contained in:
luying
2022-07-27 19:58:16 +08:00
parent 1cb41f2733
commit e1dc6307d2
11 changed files with 285 additions and 193 deletions
@@ -1,8 +1,10 @@
import { COM_TEAM_STATUS } from '../../consts';
import { getBossHpByBlueprtId, getDicBlueprtById } from '../../pubUtils/data';
import { COM_BTL_CONST, COM_TEAM_STATUS } from '../../consts';
import { gameData, getBossHpByBlueprtId, getDicBlueprtById } from '../../pubUtils/data';
import ComBattleTeam from './../../db/ComBattleTeam';
import { cloneDeep } from 'lodash'
import { FriendParams } from '../roleField/friend';
import { nowSeconds } from '../../pubUtils/timeUtil';
import moment = require('moment');
/**
* 拷贝敌军数组并添加当前血量字段
@@ -48,6 +50,13 @@ export class MemComBtlTeam extends ComBattleTeam {
findMemberByRoleId(roleId: string) {
return this.roleStatus.find(cur => cur.roleId == roleId);
}
startTeam() {
this.status = COM_TEAM_STATUS.FIGHTING;
this.startTime = nowSeconds();
this.endTime = nowSeconds() + COM_BTL_CONST.BTL_TIME_LMT/1000;
this.hasTimeExtraReward = isComBattleTimeLimit();
}
};
@@ -65,4 +74,19 @@ export class MemComBtlTeam extends ComBattleTeam {
this.roleCnt = comBattle.roleCnt;
this.status = comBattle.status;
}
}
}
/**
* 当前是否是有加成的特殊时间
*/
export function isComBattleTimeLimit() {
let arr = gameData.comBattleRewardTime;
for(let { from, to } of arr) {
let fromTime = moment(moment().format(`YYYY-MM-DD ${from}`)).valueOf();
let toTime = moment(moment().format(`YYYY-MM-DD ${to}`)).valueOf();
let now = moment().valueOf();
if(fromTime <= now && toTime >= now) return true;
}
return false;
}