fix bug 远征显示下一关等

This commit is contained in:
luying
2020-11-17 17:37:05 +08:00
parent 0e2f043f93
commit 80b8f1bac7
13 changed files with 73 additions and 49 deletions

View File

@@ -256,14 +256,19 @@ export default class Actor {
return baseAbility
}
calculateCE() {
// 武将
getAttributeJson() {
let json = {hp: 0, atk: 0, matk: 0, def: 0, mdef: 0, agi: 0, speed: 0, luk: 0, hit: 0, cri: 0, flee: 0, antCri: 0, damageIncrease: 0, damageDecrease: 0, defIngnore: 0, bloodSuck: 0};
for(let i = ABI_TYPE.ABI_HP;i < ABI_TYPE.ABI_MAX;i++){
let field = WAR_JSON_ATTRIBUTE_TYPE[i];
json[field] = this.getRealAbility(i);
}
return json
}
calculateCE() {
// 武将
let json = this.getAttributeJson();
let ce = this.calculateCEByExpression(json);
// 装备

View File

@@ -61,6 +61,19 @@ const moment = require('moment');
result = { min: parseInt(min), max: parseInt(max) };
break;
}
case 'suitLevelSingle': {
let [min, max] = arr;
console.log(min, max)
if(max) {
if(isNaN(min) || isNaN(max)) throw new Error('data table format wrong');
result = { min: parseInt(min), max: parseInt(max) };
break;
} else {
if(isNaN(min)) throw new Error('data table format wrong');
result = { min: parseInt(min) };
break;
}
}
case 'attribute': {
let [id, value] = arr;
if(isNaN(id) || isNaN(value)) throw new Error('data table format wrong');
@@ -187,7 +200,7 @@ export function shouldRefresh(preTime: Date, now: Date, hour: number, deltaDay =
if(!preTime) return true;
let curTime = new Date(now.getTime());
let refeshTime = setLocalHours(hour, curTime);
console.log(refeshTime - preTime.getTime())
console.log(refeshTime - preTime.getTime(), (deltaDay>=1?deltaDay-1:0) * 24 * 60 * 60 * 1000, curTime.getTime(), refeshTime)
if (refeshTime - preTime.getTime() > (deltaDay>=1?deltaDay-1:0) * 24 * 60 * 60 * 1000 && curTime.getTime() >= refeshTime) {
return true;
}
@@ -324,7 +337,7 @@ export function setLocalHours(hour: number, curTime = new Date()) {
let offset = curTime.getTimezoneOffset(); // 格林威治时间和本地时间之间的时差(分)
let localTime = new Date(curTime.getTime() + offset * 60 * 1000 + 8 * 60 * 60 * 1000); // 中国时间
localTime.setUTCHours(hour, 0, 0, 0); // 中国的几点
return localTime.getTime() - offset * 60 * 1000 - 8 * 60 * 60 * 1000; // 回到格林威治时间
return localTime.getTime() - 8 * 60 * 60 * 1000; // 回到格林威治时间
}
export async function updateCe(roleId: string, hero: any ) {