fix 刷新bug,机器人属性bug
This commit is contained in:
@@ -98,10 +98,9 @@ export async function refreshEnemies(role: RoleType, score: number, pLv: number)
|
|||||||
let opp = dicPvpOpponent.values()
|
let opp = dicPvpOpponent.values()
|
||||||
for(let dicOpp of opp) {
|
for(let dicOpp of opp) {
|
||||||
let flag = false; // 是否筛选成功
|
let flag = false; // 是否筛选成功
|
||||||
if(score > 3000) { // TODO 将这个放到const
|
if(score >= PVP_CONST.SCORE_LINE) { // TODO 将这个放到const
|
||||||
flag = await matchPlayer(oppPlayers, roleId, pLv, dicOpp);
|
flag = await matchPlayer(oppPlayers, roleId, pLv, dicOpp);
|
||||||
// TODO 当前后分数段没有时,返回前一名的玩家
|
if(!flag) flag = await matchPlayerByRank(oppPlayers, roleId, dicOpp.id); // 当前后分数段没有时,返回前一名的玩家
|
||||||
if(!flag) flag = await matchPlayerByRank(oppPlayers, roleId, dicOpp.id);
|
|
||||||
if(!flag) flag = matchRobot(oppPlayers, topFiveCe, pLv, dicOpp);
|
if(!flag) flag = matchRobot(oppPlayers, topFiveCe, pLv, dicOpp);
|
||||||
} else {
|
} else {
|
||||||
flag = matchRobot(oppPlayers, topFiveCe, pLv, dicOpp);
|
flag = matchRobot(oppPlayers, topFiveCe, pLv, dicOpp);
|
||||||
@@ -113,7 +112,13 @@ export async function refreshEnemies(role: RoleType, score: number, pLv: number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function matchPlayerByRank(oppPlayers: OppPlayers[], roleId: string, pos: number) {
|
export async function matchPlayerByRank(oppPlayers: OppPlayers[], roleId: string, pos: number) {
|
||||||
|
let ridRanks = new Array<number>(); // 已经被使用了的排名
|
||||||
|
for(let { roleId: curRoleId } of oppPlayers) {
|
||||||
|
let rankLv = await getMyRank(REDIS_KEY.PVP_RANK, 0, curRoleId);
|
||||||
|
ridRanks.push(rankLv);
|
||||||
|
}
|
||||||
let myRank = await getMyRank(REDIS_KEY.PVP_RANK, 0, roleId);
|
let myRank = await getMyRank(REDIS_KEY.PVP_RANK, 0, roleId);
|
||||||
|
ridRanks.push(myRank);
|
||||||
let oppRoleId = '';
|
let oppRoleId = '';
|
||||||
let oppRank = 0;
|
let oppRank = 0;
|
||||||
if(myRank == 1) { // 第一名
|
if(myRank == 1) { // 第一名
|
||||||
@@ -127,8 +132,14 @@ export async function matchPlayerByRank(oppPlayers: OppPlayers[], roleId: string
|
|||||||
} else {
|
} else {
|
||||||
if(pos == 1 || pos == 2) { // 刷新我前一名
|
if(pos == 1 || pos == 2) { // 刷新我前一名
|
||||||
oppRank = myRank - 1;
|
oppRank = myRank - 1;
|
||||||
|
while(ridRanks.includes(oppRank)) {
|
||||||
|
oppRank --;
|
||||||
|
}
|
||||||
} else { // 刷新我后一名
|
} else { // 刷新我后一名
|
||||||
oppRank = myRank + 1;
|
oppRank = myRank + 1;
|
||||||
|
while(ridRanks.includes(oppRank)) {
|
||||||
|
oppRank ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let result = await getFieldByRank(REDIS_KEY.PVP_RANK, 0, oppRank);
|
let result = await getFieldByRank(REDIS_KEY.PVP_RANK, 0, oppRank);
|
||||||
@@ -362,7 +373,7 @@ export async function getRobotLineup(mapWarJson: DicWarJson[], curOpp: OppPlayer
|
|||||||
if(relation == 2 && actorId > 0) { // 默认格子
|
if(relation == 2 && actorId > 0) { // 默认格子
|
||||||
let newAttribute = new CeAttrNumber();
|
let newAttribute = new CeAttrNumber();
|
||||||
for(let attrName in newAttribute) {
|
for(let attrName in newAttribute) {
|
||||||
newAttribute[attrName] = Math.floor(attribute[attrName] * topFiveCe / 10000 * dicOpp.ratio);
|
newAttribute[attrName] = Math.floor(attribute[attrName] * reduceCe(topFiveCe) / PVP_CONST.ENEMY_CE * dicOpp.ratio);
|
||||||
}
|
}
|
||||||
newAttribute['speed'] = 0;
|
newAttribute['speed'] = 0;
|
||||||
newAttribute['ap'] = 0;
|
newAttribute['ap'] = 0;
|
||||||
@@ -384,24 +395,26 @@ export async function getPlayerLineup(mapWarJson: DicWarJson[], curOpp: OppPlaye
|
|||||||
let role = <RoleType>oppDef.role;
|
let role = <RoleType>oppDef.role;
|
||||||
let { globalCeAttr } = role;
|
let { globalCeAttr } = role;
|
||||||
for(let { actorId, hero, dataId, order } of oppDef.heroes) {
|
for(let { actorId, hero, dataId, order } of oppDef.heroes) {
|
||||||
let curDicMapJson = mapWarJson.find(cur => cur.dataId == dataId);
|
if(actorId > 0) {
|
||||||
let dicHero = gameData.hero.get(actorId);
|
let curDicMapJson = mapWarJson.find(cur => cur.dataId == dataId);
|
||||||
let h = <HeroType>hero;
|
let dicHero = gameData.hero.get(actorId);
|
||||||
let { ceAttr } = h;
|
let h = <HeroType>hero;
|
||||||
let newAttribute = new CeAttrNumber();
|
let { ceAttr } = h;
|
||||||
for(let attrName in newAttribute) {
|
let newAttribute = new CeAttrNumber();
|
||||||
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
for(let attrName in newAttribute) {
|
||||||
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
let { base, ratioUp, fixUp, equipUp } = ceAttr[attrName];
|
||||||
let result = base * ( 1 + ratioUp + ratioUp2) + fixUp + fixUp2 + equipUp;
|
let { ratioUp: ratioUp2, fixUp: fixUp2 } = globalCeAttr[attrName];
|
||||||
newAttribute[attrName] += reduceCe(result);
|
let result = base * ( 1 + ratioUp + ratioUp2) + fixUp + fixUp2 + equipUp;
|
||||||
}
|
newAttribute[attrName] += reduceCe(result);
|
||||||
newAttribute['speed'] = 0;
|
}
|
||||||
newAttribute['ap'] = 0;
|
newAttribute['speed'] = 0;
|
||||||
|
newAttribute['ap'] = 0;
|
||||||
|
|
||||||
let heroInfo = { outIndex: order, actorId, actorName: dicHero.name, skill:0, seid:'&', star: h.star, spine: 0, attribute: newAttribute, lv: h.lv };
|
let heroInfo = { outIndex: order, actorId, actorName: dicHero.name, skill:0, seid:'&', star: h.star, spine: 0, attribute: newAttribute, lv: h.lv };
|
||||||
heroes.push({
|
heroes.push({
|
||||||
...curDicMapJson, ...heroInfo
|
...curDicMapJson, ...heroInfo
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return heroes
|
return heroes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ export const DUNGEON_CONST = {
|
|||||||
|
|
||||||
export const PVP_CONST = {
|
export const PVP_CONST = {
|
||||||
REFRESH_TIME: 5, // 每天加点刷新
|
REFRESH_TIME: 5, // 每天加点刷新
|
||||||
|
SCORE_LINE: 3000, // 超过这个分数之后可以刷人类对手
|
||||||
|
ENEMY_CE: 10000 // 对手战力
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EXPEDITION_CONST = {
|
export const EXPEDITION_CONST = {
|
||||||
|
|||||||
Reference in New Issue
Block a user