🐞 fix(稷下学宫): 点亮法阵更新最大hp

This commit is contained in:
luying
2023-09-06 21:03:33 +08:00
parent 6707c51234
commit 62d86dfd66
2 changed files with 24 additions and 3 deletions
@@ -938,17 +938,17 @@ export async function getMaxHp(roleId: string, gameCode: string, charaId: number
return Math.floor(maxHp);
}
export async function updateMaxHp(roleId: string, gameCode: string, type: number, grade: number, updateCharasMap) {
export async function updateMaxHp(roleId: string, gameCode: string, type: number, grade: number, updateCharasMap?: Map<string,RougelikeCharaType[]>) {
let dbCharas = await RougelikeCharaModel.findByGameCode(gameCode);
if (dbCharas.length == 0) return [];
let result: RougelikeCharaType[] = [];
for (let val of dbCharas) {
if (updateCharasMap.has(val.charaCode)) {
if (updateCharasMap && updateCharasMap.has(val.charaCode)) {
val = { ...val, ...updateCharasMap.get(val.charaCode) }
}
let tempMaxHp = await getMaxHp(roleId, gameCode, val.charaId, type, grade);
if (tempMaxHp == val.maxHp && !updateCharasMap.has(val.charaCode)) continue;
if (tempMaxHp == val.maxHp && updateCharasMap && !updateCharasMap.has(val.charaCode)) continue;
val.maxHp = tempMaxHp;
result.push(val);
}