From 6bfaa31a8a8bcf77375843e34d5fd0f0294a88bf Mon Sep 17 00:00:00 2001 From: duhui Date: Thu, 1 Jul 2021 11:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E6=84=BF=E6=8A=BD=E5=8D=A1,=20?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/hero/HeroLogic.java | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java index 98c62b17e..ae3adb974 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/HeroLogic.java @@ -36,10 +36,12 @@ import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent; import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType; import com.ljsd.jieling.logic.store.BuyGoodsNewLogic; import com.ljsd.jieling.logic.store.newRechargeInfo.PushRechargeType; -import com.ljsd.jieling.network.server.ProtocolsManager; import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.tools.Utils; -import com.ljsd.jieling.util.*; +import com.ljsd.jieling.util.CBean2Proto; +import com.ljsd.jieling.util.ItemUtil; +import com.ljsd.jieling.util.MessageUtil; +import com.ljsd.jieling.util.ToolsUtil; import config.*; import manager.STableManager; import org.slf4j.Logger; @@ -329,17 +331,7 @@ public class HeroLogic{ for(int i = 0 ;i= value){ - resultRandom[i] = wishDrawCardCheck(user,sLotteryRewardConfig.getReward()); - }else { - resultRandom[i] = sLotteryRewardConfig.getReward(); - } - //记录次数 - heroManager.putRandomCount(sLotterySetting.getLotteryType(),num+1); + resultRandom[i] = drawCard(user,sLotteryRewardConfig,sLotterySetting); index = i; } //上报抽卡 @@ -382,6 +374,31 @@ public class HeroLogic{ } } + /** + * 英雄卡池抽卡封装 + * @param user + * @param sLotteryRewardConfig + * @param sLotterySetting + * @return + */ + private int[] drawCard(User user, SLotteryRewardConfig sLotteryRewardConfig, SLotterySetting sLotterySetting){ + HeroManager heroManager = user.getHeroManager(); + // 限制次数 + int value = SSpecialConfig.getIntegerValue(SSpecialConfig.UNLOCKCARDWISH); + // 对应卡池抽奖次数 + Integer num = heroManager.getRandomCountByType().getOrDefault(sLotterySetting.getLotteryType(),0); + // 心愿抽卡 + int[] result; + if (sLotterySetting.getLotteryType() == 1 && num >= value){ + result = wishDrawCardCheck(user,sLotteryRewardConfig.getReward()); + }else { + result = sLotteryRewardConfig.getReward(); + } + //记录次数 + heroManager.putRandomCount(sLotterySetting.getLotteryType(),num+1); + return result; + } + /** * 心愿抽卡校验 * @param user