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

This commit is contained in:
luying
2021-02-05 13:35:01 +08:00
parent 98918b49db
commit 474eee3501
3 changed files with 20 additions and 15 deletions
@@ -142,7 +142,6 @@ export class ComBattleHandler {
let isFrd = await getFrd(roleId, goodData.quality); let isFrd = await getFrd(roleId, goodData.quality);
const st = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv); const st = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
await getComBattleFriendAdd(st, roleStatus);
roleStatus.push(st); roleStatus.push(st);
roleIds.push(roleInfo.roleId); roleIds.push(roleInfo.roleId);
@@ -359,9 +358,6 @@ export class ComBattleHandler {
teamStatus.roleIds.push(roleId); teamStatus.roleIds.push(roleId);
teamStatus.roleStatus.push(roleStatus); teamStatus.roleStatus.push(roleStatus);
// 好友加成
await getComBattleFriendAdd(roleStatus, teamStatus.roleStatus);
let users = channel.getMembers(); let users = channel.getMembers();
if (users.indexOf(roleId) === -1) { if (users.indexOf(roleId) === -1) {
channel.add(roleId, sid); channel.add(roleId, sid);
@@ -574,6 +570,8 @@ export class ComBattleHandler {
clearComBtlTimer(teamCode, this.teamDisTimer); // 战斗开始停止解散计时 clearComBtlTimer(teamCode, this.teamDisTimer); // 战斗开始停止解散计时
let channelService = this.app.get('channelService'); let channelService = this.app.get('channelService');
let channel = channelService.getChannel(teamCode, false); let channel = channelService.getChannel(teamCode, false);
await getComBattleFriendAdd(teamStatus.roleStatus);
channel.pushMessage('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: teamStatus.roleStatus})); channel.pushMessage('onComBtlStart', resResult(STATUS.SUCCESS, {teamCode, roleStatus: teamStatus.roleStatus}));
// 每场倒计时结算 // 每场倒计时结算
let thiz = this; let thiz = this;
+17 -10
View File
@@ -11,6 +11,7 @@ import { Channel } from 'pinus';
import { TREASURE } from '../pubUtils/dicParam'; import { TREASURE } from '../pubUtils/dicParam';
import { decreaseItems } from './rewardService'; import { decreaseItems } from './rewardService';
import { getFriendLvAdd } from './friendService'; import { getFriendLvAdd } from './friendService';
import { getRoleIds } from '../pubUtils/friendUtil';
/** /**
* 在给定的品质列表中随机返回一定数量的藏宝图Id * 在给定的品质列表中随机返回一定数量的藏宝图Id
@@ -427,17 +428,23 @@ export function randEquipPrintId(warInfo) {
/** /**
* 按照好友关系,新增加成 * 按照好友关系,新增加成
* *
* @param {RoleStatus} myRoleStatus 新增的队友
* @param {RoleStatus[]} roleStatus 队伍内的所有队友 * @param {RoleStatus[]} roleStatus 队伍内的所有队友
*/ */
export async function getComBattleFriendAdd(myRoleStatus: RoleStatus, roleStatus: RoleStatus[]) { export async function getComBattleFriendAdd(roleStatus: RoleStatus[]) {
let myAdd = 0; // 多好友,加成直接叠加 let hasAdd = new Array<string>(); //roleIds
for(let rs of roleStatus) { for(let myRoleStatus of roleStatus) {
if(myRoleStatus.roleId == rs.roleId) continue; for(let rs of roleStatus) {
if(myRoleStatus.isRobot || rs.isRobot) continue; if(myRoleStatus.roleId == rs.roleId) continue;
let add = await getFriendLvAdd(myRoleStatus.roleId, rs.roleId); if(myRoleStatus.isRobot || rs.isRobot) continue;
rs.addFrdRatio(add);
myAdd += add; 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);
} }
+1 -1
View File
@@ -1,7 +1,7 @@
export enum ROLE_SELECT { 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', SHOW_SIMPLE = 'roleId roleName ce headHid sHid lv title job quitTime vLv guildName serverId userInfo.serverType',
// 显示申请需要的信息 // 显示申请需要的信息