养成:修复觉醒bug

This commit is contained in:
luying
2021-09-02 19:59:02 +08:00
parent 3815a6e01d
commit cf7a767d0f

View File

@@ -229,13 +229,13 @@ export class HeroHandler {
let newStarStage = oldStarStage;
let max = isOneClick ? ABI_STAGE.END : oldStarStage + 1;
let check = new CheckMeterial(roleId);
for (let i = 0; i < max; i++) {
for (let i = oldStarStage; i < max; i++) {
let isEnough = await check.decrease([{ id: pieceId, count: curDicHeroStar.advanceUpFragmentNum }]);
if(!isEnough) break; // 消耗不足
newStarStage++;
}
if (newStarStage == 0) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
if (newStarStage == oldStarStage) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let consumes = check.getConsume();
let result = await handleCost(roleId, sid, consumes);
if (!result)
@@ -359,13 +359,13 @@ export class HeroHandler {
let newColorStarStage = oldColorStarStage;
let max = isOneClick ? ABI_STAGE.END : oldColorStarStage + 1;
let check = new CheckMeterial(roleId);
for (let i = 0; i < max; i++) {
for (let i = oldColorStarStage; i < max; i++) {
let { fragmentNum, consume } = curDicHeroStar;
let isEnough = await check.decrease([{ id: pieceId, count: fragmentNum }, ...consume]);
if(!isEnough) break; // 消耗不足
newColorStarStage++;
}
if (newColorStarStage == 0) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
if (newColorStarStage == oldColorStarStage) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let consumes = check.getConsume();
let result = await handleCost(roleId, sid, consumes);
if (!result)
@@ -425,7 +425,7 @@ export class HeroHandler {
let newJobStage = hero.jobStage;
let max = isOneClick ? dicJob.maxStage: hero.jobStage + 1;
let check = new CheckMeterial(roleId);
for(let i = 0; i < max; i++) {
for(let i = hero.jobStage; i < max; i++) {
let singleConsume = dicJob.trainingConsume[hero.jobStage];
if(!singleConsume) break; // 每天消耗不可训练
@@ -433,7 +433,7 @@ export class HeroHandler {
if(!isEnough) break; // 消耗不足
newJobStage ++;
}
if (newJobStage == 0) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
if (newJobStage == hero.jobStage) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let consumes = check.getConsume();
let result = await handleCost(roleId, sid, consumes);
if (!result)