diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java index a024855b3..07ef49b07 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/HeroManager.java @@ -9,7 +9,6 @@ import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.hero.HongMengAttributeEnum; import config.SLikeAbilityConfig; import config.SSpecialConfig; -import config.SWishConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -210,19 +209,6 @@ public class HeroManager extends MongoBase { updateString("randomCountByType."+type, value); } - public int getWeightByDraw(int type){ - int weight = 0; - Map map = SWishConfig.map; - Integer count = randomCountByType.getOrDefault(type, 0); - for (SWishConfig config : map.values()) { - if (count < config.getDrawCardNumber()){ - break; - } - weight = config.getWeight(); - } - return weight; - } - public int getCountByDraw(int type){ return randomCountByType.getOrDefault(type, 0); } 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 025aa1edf..9a6ec5f30 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 @@ -916,6 +916,33 @@ public class HeroLogic { return activity.getType() == activityType; } + /** + * 获取心愿抽卡概率 + * @param user + * @param type + * @return + */ + public int getWeightByDraw(User user, int type){ + int defaultWeight = 0; + int mythWeight = 0; + Map typeMap = SWishConfig.typeMap.get(type); + int count = user.getHeroManager().getRandomCountByType().getOrDefault(type, 0); + for (SWishConfig config : typeMap.values()) { + if (count < config.getDrawCardNumber()){ + break; + } + defaultWeight = config.getWeight(); + mythWeight = config.getMythWeight(); + } + int wish = user.getPlayerInfoManager().getDesireDraw().getOrDefault(type, 0); + SCHero hero = SCHero.getsCHero().get(wish); + if (hero == null || hero.getNatural() != 7){ + return defaultWeight; + }else { + return mythWeight; + } + } + /** * 心愿抽卡校验 */ @@ -927,7 +954,7 @@ public class HeroLogic { return item; } - int weight = user.getHeroManager().getWeightByDraw(type); + int weight = getWeightByDraw(user, type); int randomInt = MathUtils.randomInt(10000); if (randomInt <= weight) { // 读取格子信息 @@ -2824,16 +2851,26 @@ public class HeroLogic { combinedAttribute(magicSoldierAttribute, heroAllAttribute); } - private void applyBonusesAttribute(Map heroAllAttribute, int heroSkin, User user) { - PlayerManager playerInfoManager = user.getPlayerInfoManager(); - - // ... 图鉴、皮肤、称号、坐骑等属性加成逻辑 ... + /** + * 获取全部图鉴 + * @param user + * @return + */ + public HashSet getAllBook(User user){ HashSet bookSet = new HashSet<>(); bookSet.addAll(user.getPokemonManager().getPokemonBookEnabled());//灵兽图鉴加成 bookSet.addAll(user.getHeroManager().getHeroHandBookEnabled());//神将羁绊加成 bookSet.addAll(user.getEquipManager().getEquipBookEnabled());//魂印图鉴加成 bookSet.addAll(user.getItemManager().getEquipBookEnabled());//白金装备加成 bookSet.addAll(user.getMagicSoldierManager().getMagicSoldierBook());//神兵图鉴加成 + return bookSet; + } + + private void applyBonusesAttribute(Map heroAllAttribute, int heroSkin, User user) { + PlayerManager playerInfoManager = user.getPlayerInfoManager(); + + // ... 图鉴、皮肤、称号、坐骑等属性加成逻辑 ... + HashSet bookSet = getAllBook(user); if (!bookSet.isEmpty()) { //计算图鉴加成 Map config = STableManager.getConfig(SSpiritAnimalBook.class); @@ -6998,7 +7035,7 @@ public class HeroLogic { HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder(); builder.setUpLv(hero.getPotentialLv(type)); - builder.setGiftLv(getGiftPotentialLv(user, hero)); + builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user)); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.PotentialUpLvResponse_VALUE, builder.build(), true); } @@ -7025,6 +7062,26 @@ public class HeroLogic { return result; } + /** + * 获取礼物加成得潜能等级 + */ + public int getBookPotentialLv(User user) { + int result = 0; + HashSet allBook = getAllBook(user); + if (allBook.isEmpty()){ + return result; + } + Map bookMap = STableManager.getConfig(SSpiritAnimalBook.class); + for (Integer id : allBook) { + SSpiritAnimalBook book = bookMap.get(id); + if (book == null){ + continue; + } + result += book.getPotential(); + } + return result; + } + /** * 潜能回退 */ @@ -7079,8 +7136,10 @@ public class HeroLogic { return 0; } int giftPotentialLv = getGiftPotentialLv(user, hero); + int bookPotentialLv = getBookPotentialLv(user); int potentialLv = hero.getPotentialLv(type); - SPotentialNew potentialNew = SPotentialNew.typeMap.get(type).get(potentialLv + giftPotentialLv); + int totalPotenialLv = potentialLv + giftPotentialLv + bookPotentialLv; + SPotentialNew potentialNew = SPotentialNew.typeMap.get(type).get(totalPotenialLv); if (potentialNew == null) { return 0; } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java index 915132ef2..5e19d799a 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/player/PlayerLogic.java @@ -8,7 +8,6 @@ import com.ljsd.jieling.core.GlobalsDef; import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType; import com.ljsd.jieling.db.mongo.AreaManager; -import com.ljsd.jieling.db.mongo.MongoUtil; import com.ljsd.jieling.db.redis.RedisKey; import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.exception.ErrorCode; @@ -26,9 +25,6 @@ import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic; import com.ljsd.jieling.logic.activity.event.GuildForceChangeEvent; import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent; -import com.ljsd.jieling.logic.dao.Pokemon; -import com.ljsd.jieling.logic.dao.PropertyItem; -import com.ljsd.jieling.logic.dao.TeamPosHeroInfo; import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.cross.CSPlayer; import com.ljsd.jieling.logic.dao.root.GuildInfo; @@ -44,7 +40,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic; import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag; import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler; import com.ljsd.jieling.network.session.ISession; -import com.ljsd.jieling.thrift.idl.*; +import com.ljsd.jieling.thrift.idl.RPCRequestIFace; import com.ljsd.jieling.thrift.pool.ClientAdapterPo; import com.ljsd.jieling.util.*; import config.*; @@ -58,7 +54,6 @@ import util.MathUtils; import util.TimeUtils; import java.util.*; -import java.util.stream.Collectors; @SuppressWarnings("unchecked") public class PlayerLogic { @@ -1046,7 +1041,7 @@ public class PlayerLogic { builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute)); builder.setHero(CBean2Proto.getHongmengHero(userInMem, hero)); - builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero)); + builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero) + HeroLogic.getInstance().getBookPotentialLv(userInMem)); Map guildSkill = userInMem.getGuildMyInfo().getGuildSkill(); int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession(); Integer skill = guildSkill.getOrDefault(profession, 0); diff --git a/tablemanager/src/main/java/config/SSpiritAnimalBook.java b/tablemanager/src/main/java/config/SSpiritAnimalBook.java index a3a9fca76..ba256aa14 100644 --- a/tablemanager/src/main/java/config/SSpiritAnimalBook.java +++ b/tablemanager/src/main/java/config/SSpiritAnimalBook.java @@ -1,10 +1,7 @@ package config; -import manager.STableManager; import manager.Table; -import java.util.Map; - @Table(name ="SpiritAnimalBook") public class SSpiritAnimalBook implements BaseConfig { @@ -14,7 +11,7 @@ public class SSpiritAnimalBook implements BaseConfig { private int[][] activePara; - private int activeForce; + private int potential; private int fetterType; @@ -41,8 +38,8 @@ public class SSpiritAnimalBook implements BaseConfig { return activePara; } - public int getActiveForce() { - return activeForce; + public int getPotential() { + return potential; } public int getFetterType() { diff --git a/tablemanager/src/main/java/config/SWishConfig.java b/tablemanager/src/main/java/config/SWishConfig.java index b65bff40f..ec00fc369 100644 --- a/tablemanager/src/main/java/config/SWishConfig.java +++ b/tablemanager/src/main/java/config/SWishConfig.java @@ -21,6 +21,8 @@ public class SWishConfig implements BaseConfig { private int weight; + private int mythWeight; + public static Map map; public static Map> typeMap = new HashMap<>(); @@ -60,5 +62,7 @@ public class SWishConfig implements BaseConfig { return weight; } - + public int getMythWeight() { + return mythWeight; + } } \ No newline at end of file