寻宝:修改掉落逻辑
This commit is contained in:
@@ -15,7 +15,7 @@ import { RoleStatus, ComBattleTeamModel, ComBattleTeamType, BossHp } from '../..
|
|||||||
import { ItemModel, ItemType } from '../../../db/Item';
|
import { ItemModel, ItemType } from '../../../db/Item';
|
||||||
import { addItems, handleCost } from '../../../services/rewardService';
|
import { addItems, handleCost } from '../../../services/rewardService';
|
||||||
import { checkRoleInQueue, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
import { checkRoleInQueue, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
||||||
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, incEquipPrintDrop, randEquipPrintId, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, createComTeamData, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt } from '../../../services/comBattleService';
|
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, createComTeamData, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt } from '../../../services/comBattleService';
|
||||||
import { setAp } from '../../../services/actionPointService';
|
import { setAp } from '../../../services/actionPointService';
|
||||||
import { roleLevelup } from '../../../services/normalBattleService';
|
import { roleLevelup } from '../../../services/normalBattleService';
|
||||||
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
|
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
|
||||||
@@ -555,13 +555,13 @@ export class ComBattleHandler {
|
|||||||
return resResult(STATUS.BATTLE_ACTION_POINT_LACK);
|
return resResult(STATUS.BATTLE_ACTION_POINT_LACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { dropResult } = await incEquipPrintDrop(roleSt);
|
// const { dropResult } = await incEquipPrintDrop(roleSt);
|
||||||
if (dropResult) {
|
// if (dropResult) {
|
||||||
const dropEquipId = randEquipPrintId(warInfo);
|
// const dropEquipId = randEquipPrintId(warInfo);
|
||||||
if (dropEquipId) {
|
// if (dropEquipId) {
|
||||||
roleSt.fixReward.push({ id: dropEquipId, count: 1 });
|
// roleSt.fixReward.push({ id: dropEquipId, count: 1 });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
await ComBattleTeamModel.updateRewardSt(teamCode, roleId, true);
|
await ComBattleTeamModel.updateRewardSt(teamCode, roleId, true);
|
||||||
const goods = await addItems(roleId, roleName, sid, roleSt.fixReward);
|
const goods = await addItems(roleId, roleName, sid, roleSt.fixReward);
|
||||||
|
|||||||
@@ -124,12 +124,12 @@ export async function checkComBattleDrop(roleId: string, battleCode: string) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!roleSt || roleSt.gotReward) return { status: -1, resResult: resResult(STATUS.COM_BATTLE_REWARD_ERR) };
|
if (!roleSt || roleSt.gotReward) return { status: -1, resResult: resResult(STATUS.COM_BATTLE_REWARD_ERR) };
|
||||||
let fixReward = getRewardByBlueprtId(team.blueprtId);
|
let { fixReward, teammateReward } = getRewardByBlueprtId(team.blueprtId);
|
||||||
if (!roleSt.isCap) {
|
if (!roleSt.isCap) {
|
||||||
if (roleSt.isFrd) {
|
if (roleSt.isFrd) {
|
||||||
fixReward = [];
|
fixReward = [];
|
||||||
} else {
|
} else {
|
||||||
fixReward = ratioReward(fixReward, COM_BTL_CONST.ASSIST_REWARD_RATIO);
|
fixReward = teammateReward;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await ComBattleTeamModel.updateRewardSt(team.teamCode, roleId, true);
|
await ComBattleTeamModel.updateRewardSt(team.teamCode, roleId, true);
|
||||||
@@ -152,19 +152,12 @@ export function setComBtlTimer(teamCode: string, timer: NodeJS.Timer, timerMap:
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getRealReward(blueprtId: number, roleSt: RoleStatus) {
|
export async function getRealReward(blueprtId: number, roleSt: RoleStatus) {
|
||||||
let fixReward = getRewardByBlueprtId(blueprtId);
|
let { fixReward, teammateReward } = getRewardByBlueprtId(blueprtId);
|
||||||
if (!roleSt.isCap) {
|
if (!roleSt.isCap) {
|
||||||
if (roleSt.isFrd) {
|
if (roleSt.isFrd) {
|
||||||
let frdPointRec = await FriendPointModel.getFrdPointRecToday(roleSt.roleId, FRIEND_DROP_TYPE.COM_BATTLE);
|
fixReward = []
|
||||||
if (!frdPointRec || frdPointRec.cnt <= FRIEND_DROP_MAX.COM_BTL - COM_BTL_CONST.FRDCNT_DROP) {
|
|
||||||
fixReward = [getFriendPointObject(COM_BTL_CONST.FRDCNT_DROP)];
|
|
||||||
} else if (frdPointRec.cnt < FRIEND_DROP_MAX.COM_BTL) {
|
|
||||||
fixReward = [getFriendPointObject(COM_BTL_CONST.FRDCNT_DROP - frdPointRec.cnt)];
|
|
||||||
} else {
|
} else {
|
||||||
fixReward = [];
|
fixReward = teammateReward;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
fixReward = ratioReward(fixReward, COM_BTL_CONST.ASSIST_REWARD_RATIO);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fixReward;
|
return fixReward;
|
||||||
@@ -428,28 +421,28 @@ function incEquipPrintDropData(roleSt: RoleStatus, dropRec: EquipPrintDropType)
|
|||||||
return dropResult;
|
return dropResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function incEquipPrintDrop(roleSt: RoleStatus) {
|
// export async function incEquipPrintDrop(roleSt: RoleStatus) {
|
||||||
const { roleId, roleName } = roleSt;
|
// const { roleId, roleName } = roleSt;
|
||||||
let dropRec = await EquipPrintDropModel.getByRoleId(roleId);
|
// let dropRec = await EquipPrintDropModel.getByRoleId(roleId);
|
||||||
if (!dropRec) {
|
// if (!dropRec) {
|
||||||
dropRec = await EquipPrintDropModel.createDoc(initEquipPrintDropData(roleId, roleName));
|
// dropRec = await EquipPrintDropModel.createDoc(initEquipPrintDropData(roleId, roleName));
|
||||||
}
|
// }
|
||||||
|
|
||||||
const dropResult = incEquipPrintDropData(roleSt, dropRec);
|
// const dropResult = incEquipPrintDropData(roleSt, dropRec);
|
||||||
dropRec = await EquipPrintDropModel.updateDoc(roleId, omit(dropRec, ['_id', 'createdAt', 'updatedAt']));
|
// dropRec = await EquipPrintDropModel.updateDoc(roleId, omit(dropRec, ['_id', 'createdAt', 'updatedAt']));
|
||||||
return { dropResult, dropRec };
|
// return { dropResult, dropRec };
|
||||||
}
|
// }
|
||||||
|
|
||||||
export function randEquipPrintId(warInfo: DicWar) {
|
// export function randEquipPrintId(warInfo: DicWar) {
|
||||||
if (!warInfo || !warInfo.jackpotReward) {
|
// if (!warInfo || !warInfo.jackpotReward) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
const result = getRandEelmWithWeight(warInfo.jackpotReward);
|
// const result = getRandEelmWithWeight(warInfo.jackpotReward);
|
||||||
if (!result || !result.dic || !result.dic.id) {
|
// if (!result || !result.dic || !result.dic.id) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
return result.dic.id;
|
// return result.dic.id;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照好友关系,新增加成
|
* 按照好友关系,新增加成
|
||||||
|
|||||||
@@ -48,9 +48,12 @@ export class RoleStatus {
|
|||||||
// 是否领奖
|
// 是否领奖
|
||||||
@prop({ required: true, default: false })
|
@prop({ required: true, default: false })
|
||||||
gotReward: boolean;
|
gotReward: boolean;
|
||||||
// 固定奖励
|
// 队长奖励
|
||||||
@prop({ required: true, default: [], type: ItemReward })
|
@prop({ required: true, default: [], type: ItemReward })
|
||||||
fixReward: ItemReward[];
|
fixReward: ItemReward[];
|
||||||
|
// 队友奖励
|
||||||
|
@prop({ required: true, default: [], type: ItemReward })
|
||||||
|
teammateReward: ItemReward[];
|
||||||
// 好友间伤害加成
|
// 好友间伤害加成
|
||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
frdRatio: number = 0;
|
frdRatio: number = 0;
|
||||||
|
|||||||
@@ -343,8 +343,8 @@ export function getWarByBlueprtId(blueprtId: number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRewardByBlueprtId(blueprtId: number) {
|
export function getRewardByBlueprtId(blueprtId: number) {
|
||||||
let { fixReward } = getWarByBlueprtId(blueprtId);
|
let { fixReward, teammateReward } = getWarByBlueprtId(blueprtId);
|
||||||
return fixReward;
|
return { fixReward, teammateReward };
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseComBtlLvRange() {
|
function parseComBtlLvRange() {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export interface DicWar {
|
|||||||
readonly dispatchJsonId: number;
|
readonly dispatchJsonId: number;
|
||||||
// 寻宝奖励
|
// 寻宝奖励
|
||||||
readonly jackpotReward: Array<{id: number, weight: number}>;
|
readonly jackpotReward: Array<{id: number, weight: number}>;
|
||||||
|
// 寻宝队友奖励
|
||||||
|
readonly teammateReward: Array<{id: number, count: number}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dicWar = new Map<number, DicWar>();
|
export const dicWar = new Map<number, DicWar>();
|
||||||
@@ -48,6 +50,7 @@ export function loadWar() {
|
|||||||
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
o.parseRandomReward = parseRandomReward(o.parseRandomReward);
|
||||||
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
o.detailUIBg = parseDetailUIBg(o.detailUIBg);
|
||||||
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
o.jackpotReward = parseJackpotReward(o.jackpotReward);
|
||||||
|
o.teammateReward = parseFixReward(o.teammateReward);
|
||||||
|
|
||||||
dicWar.set(o.war_id, o);
|
dicWar.set(o.war_id, o);
|
||||||
if(o.warType == WAR_TYPE.PVP) {
|
if(o.warType == WAR_TYPE.PVP) {
|
||||||
|
|||||||
Reference in New Issue
Block a user