🐞 fix(战力): pvp等机器人数据的战力生成修改为新算法

This commit is contained in:
luying
2023-02-17 14:26:31 +08:00
parent b0e0c83fcd
commit 52701f7e11
8 changed files with 64 additions and 29 deletions
+21 -6
View File
@@ -5,6 +5,7 @@ import { ATTRIBUTE } from '../../pubUtils/dicParam';
export class AttributeCal {
attrs: Map<number, number> = new Map<number, number>();
ceAttrs: Map<number, number> = new Map<number, number>();
ce?: number = 0;
lv: number = 1;
@@ -12,12 +13,19 @@ export class AttributeCal {
this.lv = lv;
}
public setByWarJson(attributes: {id: number, val: number}[], ratio: number = 1) {
public setByWarJson(hid: number, attributes: {id: number, val: number}[], ratio: number = 1) {
let dicHero = gameData.hero.get(hid);
let dicJob = gameData.job.get(dicHero?.jobid);
for(let {id, val} of attributes) {
if(ABI_TYPE_MAIN.includes(id)) {
this.attrs.set(id, Math.floor(val * ratio));
this.ceAttrs.set(id, Math.floor(val * ratio));
} else {
this.attrs.set(id, Math.floor(val));
let baseSubAttr = dicJob?.baseSubAttr?.find(cur => cur.id == id);
let result = val - (baseSubAttr?.val||0);
if(result < 0) result = 0;
this.ceAttrs.set(id, Math.floor(result));
}
}
}
@@ -25,19 +33,26 @@ export class AttributeCal {
public setByCeArr(attributes: {id: number, ceVal: number}[], ratio: number = 1) {
for(let {id, ceVal} of attributes) {
if(ABI_TYPE_MAIN.includes(id)) {
this.attrs.set(id, Math.floor(ceVal * ratio));
this.ceAttrs.set(id, Math.floor(ceVal * ratio));
} else {
this.attrs.set(id, Math.floor(ceVal));
this.ceAttrs.set(id, Math.floor(ceVal));
}
}
}
public setByMap( attributes: Map<number, number>, ratio: number = 1 ) {
public setByMap(hid: number, attributes: Map<number, number>, ratio: number = 1 ) {
let dicHero = gameData.hero.get(hid);
let dicJob = gameData.job.get(dicHero?.jobid);
for(let [id, val] of attributes) {
if(ABI_TYPE_MAIN.includes(id)) {
this.attrs.set(id, Math.floor(val * ratio));
this.ceAttrs.set(id, Math.floor(val * ratio));
} else {
this.attrs.set(id, Math.floor(val));
let baseSubAttr = dicJob?.baseSubAttr?.find(cur => cur.id == id);
let result = val - (baseSubAttr?.val||0);
if(result < 0) result = 0;
this.ceAttrs.set(id, Math.floor(result));
}
}
}
@@ -83,13 +98,13 @@ export class AttributeCal {
if(calType == 3) {
return 0
} else {
return pre + val * (this.attrs.get(type)|| 0)
return pre + val * (this.ceAttrs.get(type)|| 0)
}
} else {
if(calType == 2) {
return 0
} else {
return pre + val * (this.attrs.get(type)|| 0) * this.lv / ATTRIBUTE.ATTRIBUTE_POWER_DIVISOR;
return pre + val * (this.ceAttrs.get(type)|| 0) * this.lv / ATTRIBUTE.ATTRIBUTE_POWER_DIVISOR;
}
}
}, 0);
+1 -1
View File
@@ -416,7 +416,7 @@ export function getBossHpByWarId(warId: number) {
let { attribute, dataId, relation, actorId } = hero;
if (relation === 2) {
let newAttr = new AttributeCal();
newAttr.setByWarJson(attribute, 1);
newAttr.setByWarJson(actorId, attribute, 1);
let attrJson = newAttr.getAttributes();
const hp = attrJson.hp || 0;
+29 -9
View File
@@ -2641,7 +2641,7 @@
},
{
"jobid": 14,
"name": "载具",
"name": "军械",
"grade": 1,
"isPlayer": 0,
"unlockLevel": 1,
@@ -2652,7 +2652,7 @@
"atkid": 1,
"seid": "&",
"effect": 0,
"info": "用于运输人、物的设备",
"info": "用于特殊作用的军用器械",
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "1&0|2&0|4&0|5&0",
@@ -2816,7 +2816,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
@@ -2836,7 +2836,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
@@ -2856,7 +2856,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
@@ -2876,7 +2876,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
@@ -2896,7 +2896,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 1
},
{
@@ -2916,7 +2916,7 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
@@ -2936,7 +2936,27 @@
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "&",
"baseAttr": "&",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
},
{
"jobid": 29,
"name": "载具",
"grade": 1,
"isPlayer": 0,
"unlockLevel": 1,
"job_class": 29,
"type": 1,
"imgid": 10,
"spe": 2,
"atkid": 1,
"seid": "&",
"effect": 0,
"info": "用于运输人、物的设备",
"trainingConsume": "&",
"upGradeConsume": "&",
"attr": "1&0|2&0|4&0|5&0",
"baseAttr": "9&100000|10&5000|11&10000|18&50000|28&50000",
"talentPoint": 0
}
]