神像:添加暴击
This commit is contained in:
@@ -137,7 +137,7 @@ export class RoleHandler {
|
|||||||
return resResult(STATUS.ROLE_TERAPH_NOT_STRENGTHEN);
|
return resResult(STATUS.ROLE_TERAPH_NOT_STRENGTHEN);
|
||||||
|
|
||||||
// 随机神像中的一条属性并检查道具是否足够,以及更新teraph
|
// 随机神像中的一条属性并检查道具是否足够,以及更新teraph
|
||||||
let { consumes } = checkTeraphMaterialEnough(count, attrs, dicTeraph, teraph);
|
let { consumes, criAttr } = checkTeraphMaterialEnough(count, attrs, dicTeraph, teraph);
|
||||||
|
|
||||||
let result = await handleCost(roleId, sid, consumes);
|
let result = await handleCost(roleId, sid, consumes);
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -148,7 +148,7 @@ export class RoleHandler {
|
|||||||
// 任务
|
// 任务
|
||||||
await checkTask(roleId, sid, funcs, TASK_TYPE.ROLE_TERAPH_STRENGTHEN, count, true, {});
|
await checkTask(roleId, sid, funcs, TASK_TYPE.ROLE_TERAPH_STRENGTHEN, count, true, {});
|
||||||
|
|
||||||
return resResult(STATUS.SUCCESS, { roleId, teraphs: calResult.role.teraphs });
|
return resResult(STATUS.SUCCESS, { roleId, teraphs: calResult.role.teraphs, criAttr });
|
||||||
}
|
}
|
||||||
|
|
||||||
//神像进阶
|
//神像进阶
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ const TERAPH_STRENGTHEN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|||||||
*/
|
*/
|
||||||
export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphInfo: DicTeraph, teraph: Teraph) {
|
export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphInfo: DicTeraph, teraph: Teraph) {
|
||||||
let consumes = [];
|
let consumes = [];
|
||||||
|
let criAttr: number[] = [];
|
||||||
let times = 0;
|
let times = 0;
|
||||||
if (count < 10) {
|
if (count < 10) {
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
@@ -28,8 +29,9 @@ export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphI
|
|||||||
let num = getRandValueByMinMax(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX); // 强化时随机增加 2-4 属性
|
let num = getRandValueByMinMax(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX); // 强化时随机增加 2-4 属性
|
||||||
let arr = getRandEelm(attrs, num); // 随机出的属性id
|
let arr = getRandEelm(attrs, num); // 随机出的属性id
|
||||||
let critical = getRandValueByMinMax(0, 100);//属性暴击率
|
let critical = getRandValueByMinMax(0, 100);//属性暴击率
|
||||||
|
let isCritical = critical <= teraphInfo.criRate;
|
||||||
let criEffect = 1; // 暴击效果
|
let criEffect = 1; // 暴击效果
|
||||||
if (critical <= teraphInfo.criRate)
|
if (isCritical)
|
||||||
criEffect = teraphInfo.criEffect;
|
criEffect = teraphInfo.criEffect;
|
||||||
for (let attrId of arr) {
|
for (let attrId of arr) {
|
||||||
let val = teraph.attr.get(attrId); // 已有的强化值
|
let val = teraph.attr.get(attrId); // 已有的强化值
|
||||||
@@ -41,6 +43,7 @@ export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphI
|
|||||||
attrs.splice(attrIndex, 1);
|
attrs.splice(attrIndex, 1);
|
||||||
}
|
}
|
||||||
teraph.attr.set(attrId, val);
|
teraph.attr.set(attrId, val);
|
||||||
|
if(isCritical) criAttr.push(attrId);
|
||||||
}
|
}
|
||||||
times++;
|
times++;
|
||||||
}
|
}
|
||||||
@@ -51,8 +54,9 @@ export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphI
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let criEffect = 1;
|
let criEffect = 1;
|
||||||
let index = criticalArrTimes.indexOf(item)
|
let index = criticalArrTimes.indexOf(item);
|
||||||
if (index > 0) {
|
let isCritical = index >= 0;
|
||||||
|
if (isCritical) {
|
||||||
criEffect = teraphInfo.criEffect;//本次是暴击 item 在 criticalArrTimes 中
|
criEffect = teraphInfo.criEffect;//本次是暴击 item 在 criticalArrTimes 中
|
||||||
}
|
}
|
||||||
let num = getRandValueByMinMax(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX);
|
let num = getRandValueByMinMax(TERAPH_RANDOM.MIN, TERAPH_RANDOM.MAX);
|
||||||
@@ -68,6 +72,7 @@ export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphI
|
|||||||
attrs.splice(attrIndex, 1);
|
attrs.splice(attrIndex, 1);
|
||||||
}
|
}
|
||||||
teraph.attr.set(attrId, val);
|
teraph.attr.set(attrId, val);
|
||||||
|
if(isCritical) criAttr.push(attrId);
|
||||||
}
|
}
|
||||||
times++;
|
times++;
|
||||||
}
|
}
|
||||||
@@ -76,7 +81,7 @@ export function checkTeraphMaterialEnough(count: number, attrs:number[], teraphI
|
|||||||
for (let {id, count} of teraphInfo.upMaterial) {
|
for (let {id, count} of teraphInfo.upMaterial) {
|
||||||
consumes.push({ id, count: count * times});
|
consumes.push({ id, count: count * times});
|
||||||
}
|
}
|
||||||
return { consumes};
|
return { consumes, criAttr };
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user