神像强化十次

This commit is contained in:
mamengke01
2020-12-26 12:14:56 +08:00
parent bfa0755739
commit 667c85e686
4 changed files with 97 additions and 23 deletions

View File

@@ -10,7 +10,8 @@ import { getTeraphAttr } from '../../../consts/constModules/abilityConst'
const _ = require('underscore');
import { SclResultInter, SclPosInter } from '../../../pubUtils/interface';
import { SchoolModel } from '../../../db/School';
import { TERAPH_RANDOM } from '../../../consts/consts';
import { checkMaterialEnough } from '../../../services/roleService'
export default function(app: Application) {
return new RoleHandler(app);
}
@@ -105,23 +106,18 @@ export class RoleHandler {
let teraphInfo = getTeraph(id, teraph.grade);
if (!teraphInfo)
return resResult(STATUS.DIC_DATA_NOT_FOUND)
let falg = true;
let attrs = [];
for (let attrName in getTeraphAttr()) {
if (teraph[attrName] != teraphInfo[attrName]) {
falg = false;
break;
let attrNameMax = attrName+'Max';
if (teraph[attrName] < teraphInfo[attrNameMax]) {
attrs.push(attrName);
}
}
if (!!falg)
if (!attrs.length)
return resResult(STATUS.ROLE_TERAPH_NOT_STRENGTHEN);
//TODO强化属性
let consumes;
if (type == 1) {
consumes = teraphInfo.upMaterial;
} else if (type == 2) {
consumes = teraphInfo.upMaterial;
} else {
return resResult(STATUS.WRONG_PARMS);
let {attr, consumes} = checkMaterialEnough(type, attrs, teraphInfo, teraph);
for (let key in attr) {
teraph[key] += attr[key];
}
let result = await handleCost(roleId, sid, consumes);
if (!result)
@@ -144,17 +140,12 @@ export class RoleHandler {
if (!teraphInfo)
return resResult(STATUS.DIC_DATA_NOT_FOUND)
for (let attrName in getTeraphAttr()) {
if (teraph[attrName] != teraphInfo[attrName])
if (teraph[attrName] != teraphInfo[attrName +'Max'])
return resResult(STATUS.ROLE_TERAPH_NOT_QUILITY);
teraph[attrName] = 0;
}
teraph.grade++;
teraph.atk = 0;
teraph.agi = 0;
teraph.def = 0;
teraph.hp = 0;
teraph.luk = 0;
teraph.mdef = 0;
if (getTeraph(index, teraph.grade))
teraph.grade++;
if (!getTeraph(index, teraph.grade))
return resResult(STATUS.DIC_DATA_NOT_FOUND)
let consumes = teraphInfo.upGradeMaterial;
let result = await handleCost(roleId, sid, consumes);