关卡:星级结算

This commit is contained in:
luying
2021-11-10 16:39:20 +08:00
parent 3b2624bda2
commit b15a9088e8
3 changed files with 19 additions and 14 deletions
@@ -15,6 +15,7 @@ import { setAp } from './actionPointService';
import { resResult } from '../pubUtils/util';
import { LineupParam } from '../domain/rank';
import { WarStar } from '../domain/dbGeneral';
import { uniq } from 'underscore';
export async function roleLevelup(type: KING_EXP_RATIO_TYPE, roleId: string, kingExp: number = 0, session: BackendSession) {
const serverId = session.get('serverId');
@@ -121,11 +122,8 @@ export function calculateWarStar(warStar: WarStar[] = [], battleId: number, star
let hasFound = false;
for(let curWarStar of warStar) {
if(curWarStar.id == battleId) {
for(let i = 0; i < 3; i++) {
let isOn = (curWarStar.stars && curWarStar.stars[i] == 1)||(stars[i] == 1);
newStars.push(isOn? 1: 0);
if(isOn) newStar++;
}
newStars = uniq([...stars, ...curWarStar.stars]);
newStar = newStars.filter(cur => cur > 0).length;
newWarStars.push({...curWarStar, star: newStar, stars: newStars});
hasFound = true;
} else {
@@ -133,7 +131,7 @@ export function calculateWarStar(warStar: WarStar[] = [], battleId: number, star
}
}
if(!hasFound) {
newStar = stars.filter(cur => cur == 1).length;
newStar = stars.filter(cur => cur > 0).length;
newStars = stars;
let dicWar = gameData.war.get(battleId);
newWarStars.push({ id: battleId, warType: dicWar.warType, star: newStar, stars: newStars});