fix: 寻宝好友加成改为在开始战斗时加成

This commit is contained in:
luying
2021-02-05 13:34:45 +08:00
parent 98918b49db
commit 474eee3501
3 changed files with 20 additions and 15 deletions

View File

@@ -142,7 +142,6 @@ export class ComBattleHandler {
let isFrd = await getFrd(roleId, goodData.quality);
const st = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
await getComBattleFriendAdd(st, roleStatus);
roleStatus.push(st);
roleIds.push(roleInfo.roleId);
@@ -359,9 +358,6 @@ export class ComBattleHandler {
teamStatus.roleIds.push(roleId);
teamStatus.roleStatus.push(roleStatus);
// 好友加成
await getComBattleFriendAdd(roleStatus, teamStatus.roleStatus);
let users = channel.getMembers();
if (users.indexOf(roleId) === -1) {
channel.add(roleId, sid);
@@ -574,6 +570,8 @@ export class ComBattleHandler {
clearComBtlTimer(teamCode, this.teamDisTimer); // 战斗开始停止解散计时
let channelService = this.app.get('channelService');
let channel = channelService.getChannel(teamCode, false);
await getComBattleFriendAdd(teamStatus.roleStatus);
channel.pushMessage('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: teamStatus.roleStatus}));
// 每场倒计时结算
let thiz = this;

View File

@@ -11,6 +11,7 @@ import { Channel } from 'pinus';
import { TREASURE } from '../pubUtils/dicParam';
import { decreaseItems } from './rewardService';
import { getFriendLvAdd } from './friendService';
import { getRoleIds } from '../pubUtils/friendUtil';
/**
* 在给定的品质列表中随机返回一定数量的藏宝图Id
@@ -427,17 +428,23 @@ export function randEquipPrintId(warInfo) {
/**
* 按照好友关系,新增加成
*
* @param {RoleStatus} myRoleStatus 新增的队友
* @param {RoleStatus[]} roleStatus 队伍内的所有队友
*/
export async function getComBattleFriendAdd(myRoleStatus: RoleStatus, roleStatus: RoleStatus[]) {
let myAdd = 0; // 多好友,加成直接叠加
for(let rs of roleStatus) {
if(myRoleStatus.roleId == rs.roleId) continue;
if(myRoleStatus.isRobot || rs.isRobot) continue;
let add = await getFriendLvAdd(myRoleStatus.roleId, rs.roleId);
rs.addFrdRatio(add);
myAdd += add;
export async function getComBattleFriendAdd(roleStatus: RoleStatus[]) {
let hasAdd = new Array<string>(); //roleIds
for(let myRoleStatus of roleStatus) {
for(let rs of roleStatus) {
if(myRoleStatus.roleId == rs.roleId) continue;
if(myRoleStatus.isRobot || rs.isRobot) continue;
let {roleIds} = getRoleIds([myRoleStatus.roleId, rs.roleId]);
if(hasAdd.includes(roleIds)) continue;
let add = await getFriendLvAdd(myRoleStatus.roleId, rs.roleId);
rs.addFrdRatio(add);
myRoleStatus.addFrdRatio(add);
hasAdd.push(roleIds);
}
}
myRoleStatus.addFrdRatio(myAdd);
}

View File

@@ -1,7 +1,7 @@
export enum ROLE_SELECT {
// 初始登录数据
ENTRY = 'serverId userInfo.uid userInfo.tel userInfo.serverType ce topFiveCe teraphs roleId roleName tili lv exp gold coin vLv title hasGuild',
ENTRY = 'serverId userInfo.uid userInfo.tel userInfo.serverType ce topFiveCe teraphs roleId roleName tili lv exp gold coin vLv title hasGuild funcs',
// 玩家列表显示基础数据
SHOW_SIMPLE = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName serverId userInfo.serverType',
// 显示申请需要的信息