竞技场报错消耗次数问题修改
parent
af1962b6a1
commit
b6c502c199
|
@ -196,22 +196,31 @@ public class ArenaLogic {
|
|||
|
||||
/**
|
||||
* 竞技场挑战消耗校验
|
||||
* @param ifUpdate true 消耗
|
||||
*/
|
||||
public void checkChallenge(User user) throws Exception {
|
||||
public void checkChallenge(User user, boolean ifUpdate) throws Exception {
|
||||
if (!user.getTeamPosManager().getTeamPosForHero().containsKey(TeamEnum.TEAM_ARENA_DEFENSE.getTeamId())) {
|
||||
throw new ErrorTableException(161);//编队未配置
|
||||
}
|
||||
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
|
||||
// 免费特权
|
||||
int battleFree = sArenaSetting.getBattleFree();
|
||||
boolean vipUpdate = PlayerLogic.getInstance().checkAndUpdate(user, battleFree, 1);
|
||||
if (vipUpdate){
|
||||
return;
|
||||
}
|
||||
// 道具校验
|
||||
boolean enough = ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME, 0);
|
||||
if (!enough) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
|
||||
if (ifUpdate){
|
||||
// 免费特权
|
||||
PlayerLogic.getInstance().checkAndUpdate(user, battleFree, 1);
|
||||
// 道具校验
|
||||
ItemUtil.itemCost(user, new int[][]{sArenaSetting.getCost()}, BIReason.ARENA_CHALLENGE_CONSUME, 0);
|
||||
}else {
|
||||
// 免费特权
|
||||
boolean vipUpdate = PlayerLogic.getInstance().check(user, battleFree, 1);
|
||||
if (vipUpdate){
|
||||
return;
|
||||
}
|
||||
// 道具校验
|
||||
boolean enough = ItemUtil.checkCost(user, new int[][]{sArenaSetting.getCost()});
|
||||
if (!enough) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -800,7 +809,7 @@ public class ArenaLogic {
|
|||
int challengeTeamId = TeamEnum.MIAN_LINE_TEAM.getTeamId();
|
||||
|
||||
// 校验是否可以战斗
|
||||
checkChallenge(user);
|
||||
checkChallenge(user, false);
|
||||
|
||||
// 初始化战斗结果和防御方原始分数
|
||||
FightResult result;
|
||||
|
@ -824,6 +833,9 @@ public class ArenaLogic {
|
|||
if(fightResult == -1){
|
||||
throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION, "战斗异常");
|
||||
}
|
||||
// if (true){
|
||||
// throw new ErrorCodeException(ErrorCode.FIGHT_EXCEPTION, "战斗异常");
|
||||
// }
|
||||
// 获取我的原始分数
|
||||
ArenaInfo arenaInfo = getArenaInfo(user.getId());
|
||||
int roomId = arenaInfo.getRoomId();
|
||||
|
@ -853,6 +865,8 @@ public class ArenaLogic {
|
|||
refreshArenaOpponentList(user);
|
||||
// 任务
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.ARENA_CHALLENGE, fightResult, myScore);
|
||||
// 校验并消耗
|
||||
checkChallenge(user, true);
|
||||
// 返回包装
|
||||
CommonProto.Drop.Builder arenaReward = getArenaReward(user, fightResult);
|
||||
ArenaInfoProto.NewArenaChallengeResponse.Builder builder = ArenaInfoProto.NewArenaChallengeResponse.newBuilder()
|
||||
|
|
Loading…
Reference in New Issue