添加获取对手阵容,开始战斗,结算

This commit is contained in:
luying
2021-01-07 17:38:07 +08:00
parent edc45932da
commit 5bfac1723c
12 changed files with 299 additions and 20 deletions
@@ -60,6 +60,18 @@ export async function checkBattleHeroes(roleId: string, heroes: Array<number>) {
return flag;
}
export async function checkBattleHeroesByHid(roleId: string, heroes: Array<number>) {
let flag = true;
if(heroes.length <= 0) flag = false;
const findHeroes = await HeroModel.findByHidRange(heroes, roleId);
if(findHeroes.length != heroes.length) flag = false;
for(let hid of heroes) {
let hero = findHeroes.find(cur => cur.hid == hid);
if(!hero) flag = false;
}
return flag;
}
export async function updateWarStar(roleId: string, battleId: number, warType: number, star: number) {
let role = await RoleModel.findByRoleId(roleId);