From 17fc08fc63033214f87abea80e849344d79c7398 Mon Sep 17 00:00:00 2001 From: "DESKTOP-C3M45P4\\dengdan" Date: Wed, 7 Oct 2026 23:14:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E8=A7=92=E7=A5=9E?= =?UTF-8?q?=E8=A7=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/hero/HeroLogic.java | 223 ++++++++++-------- .../jieling/logic/hero/TrainingLogic.java | 6 + .../logic/playerGod/PlayerGodLogic.java | 6 +- .../main/java/config/SBecomeAGodSetting.java | 110 ++++++--- 4 files changed, 218 insertions(+), 127 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 d2bea623c..677294b7b 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 @@ -2739,61 +2739,66 @@ public class HeroLogic { * @param isForce true:展示 false:战斗 */ public Map calHeroNotBufferAttribute(User user, Hero hero, boolean isForce, int teamId) { - // ... 总属性计算 ... - Map heroAllAttribute = calHeroAllAttribute(user, hero, isForce); - heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); - // 主角属性加成 - applyPlayerAndSkill(heroAllAttribute, user); - // 灵兽和神兵 - applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user); - // 图鉴,皮肤,称号,坐骑等。。。 - applyBonusesAttribute(heroAllAttribute, hero.getSkin(), user); - // 四象心法增加总属性 - applyFourQuadrantAttribute(heroAllAttribute, hero.getTemplateId(), user); - // 英雄好感度增加属性 - applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user); - // 法宝聚灵和命格属性加成 - applyTrumpAndGemAttribute(heroAllAttribute, user); - // 工坊科技树加成(废弃) + synchronized (user){ + // ... 总属性计算 ... + Map heroAllAttribute = calHeroAllAttribute(user, hero, isForce); + heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); + // 主角属性加成 + applyPlayerAndSkill(heroAllAttribute, user); + // 灵兽和神兵 + applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user); + // 图鉴,皮肤,称号,坐骑等。。。 + applyBonusesAttribute(heroAllAttribute, hero.getSkin(), user); + // 四象心法增加总属性 + applyFourQuadrantAttribute(heroAllAttribute, hero.getTemplateId(), user); + // 英雄好感度增加属性 + applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user); + // 法宝聚灵和命格属性加成 + applyTrumpAndGemAttribute(heroAllAttribute, user); + // 工坊科技树加成(废弃) // applyWorkShopTechnologyAttribute(heroAllAttribute, hero.getTemplateId(), user); - // 装备和套装属性 - applyEquipSuiteAttribute(heroAllAttribute, hero, user); - // 魂灵宝加成 - applyJewelAttribute(heroAllAttribute, hero, user); - // 礼物装备加成 - applyGiftEquipAttribute(heroAllAttribute, hero, user); - // 特训加成 - applyTrainingAttribute(heroAllAttribute, hero); - // 法宝,法相加成 - applyBaublesAndFaxiangAttribute(heroAllAttribute, hero, user); - // 小兵加成 - applySoldierAttribute(heroAllAttribute, hero, user); - // 魂印和神印属性加成 - applySoulEquipAndGodSealAttribute(heroAllAttribute, hero, user); - // 助阵 - applyAssistAttribute(heroAllAttribute, user); - // 主角修为和修行等级属性加成 - applyXiuxingAndXiuxianAttribute(heroAllAttribute, user); - // 公会技能和特权加成 - applyGuildSkillAndVipAttribute(heroAllAttribute, hero.getTemplateId(), user); - // 阵营光环,大闹天宫特殊加成 - applyTeamAttribute(heroAllAttribute, isForce, teamId, user); - // 被动技能 - applyPassiveSkillAttribute(heroAllAttribute, hero, teamId, user); - // 主角六道神脉 - applyPlayerMeridiansAttribute(heroAllAttribute,user); + // 装备和套装属性 + applyEquipSuiteAttribute(heroAllAttribute, hero, user); + // 魂灵宝加成 + applyJewelAttribute(heroAllAttribute, hero, user); + // 礼物装备加成 + applyGiftEquipAttribute(heroAllAttribute, hero, user); + // 特训加成 + applyTrainingAttribute(heroAllAttribute, hero); + // 法宝,法相加成 + applyBaublesAndFaxiangAttribute(heroAllAttribute, hero, user); + // 小兵加成 + applySoldierAttribute(heroAllAttribute, hero, user); + // 魂印和神印属性加成 + applySoulEquipAndGodSealAttribute(heroAllAttribute, hero, user); + // 助阵 + applyAssistAttribute(heroAllAttribute, user); + // 主角修为和修行等级属性加成 + applyXiuxingAndXiuxianAttribute(heroAllAttribute, user); + // 公会技能和特权加成 + applyGuildSkillAndVipAttribute(heroAllAttribute, hero.getTemplateId(), user); + // 阵营光环,大闹天宫特殊加成 + applyTeamAttribute(heroAllAttribute, isForce, teamId, user); + // 被动技能 + applyPassiveSkillAttribute(heroAllAttribute, hero, teamId, user); + // 主角六道神脉 + applyPlayerMeridiansAttribute(heroAllAttribute,user); - //pvp队伍加成特殊处理,必须放在最后 - if (!isForce && !TeamEnum.isPvpTeam(teamId)) { - heroAllAttribute.remove(HeroAttributeEnum.PVPDamageBocusFactor.getPropertyId()); - heroAllAttribute.remove(HeroAttributeEnum.PVPDamageReduceFactor.getPropertyId()); - } + //pvp队伍加成特殊处理,必须放在最后 + if (!isForce && !TeamEnum.isPvpTeam(teamId)) { + heroAllAttribute.remove(HeroAttributeEnum.PVPDamageBocusFactor.getPropertyId()); + heroAllAttribute.remove(HeroAttributeEnum.PVPDamageReduceFactor.getPropertyId()); + } // LOGGER.info("战力基础属性1=================={}",heroAllAttribute); - // 总计算 - calInteractAdd(heroAllAttribute, isForce); - heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); + // 总计算 + calInteractAdd(heroAllAttribute, isForce); + heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); // LOGGER.info("战力基础属性2=================={}",heroAllAttribute); - return heroAllAttribute; +// for(int key : heroAllAttribute.keySet()){ +// System.out.println("英雄id : " + hero.getTemplateId() + "---英雄属性 key : " + key + "----value : " + heroAllAttribute.get(key) + "------------"); +// } + return heroAllAttribute; + } } private void applyPokemonAndMagicSoldierAttribute(Map heroAllAttribute, int teamId, User user) { @@ -3485,34 +3490,23 @@ public class HeroLogic { if(config == null){ continue; } - //根据层数获取解锁的属性库 - int[] floor = config.getFloor(); - int[] propertyGit = config.getPropertyGit(); - int num = 0; + Map propMap = SBecomeAGodSetting.getPropByTypeAndTower(type,towerNum); + if(propMap == null || propMap.size() == 0){ + continue; + } int level = map.get(type); - for(int i = 0;i prop = this.showPlayerMeridiansAttribute(user); LOGGER.error("异常的神觉加成,当前战力---" + force + "------神觉加成---" + prop.toString()); } +// for(int i = 1;i<=100;i++){ +// this.testPlayerMeridiansAttribute(2400,i); +// } } /** @@ -7528,42 +7525,74 @@ public class HeroLogic { //获取用户神觉塔层数 int towerNum = user.getPlayerInfoManager().getPlayerGodTowerNum(); Map attrMap = new HashMap<>(); - for(int type:map.keySet()){ - if(!map.containsKey(type)){ + for(int type:map.keySet()) { + if (!map.containsKey(type)) { continue; } SBecomeAGodSetting config = SBecomeAGodSetting.getConfigBytype(type); - if(config == null){ + if (config == null) { + continue; + } + Map propMap = SBecomeAGodSetting.getPropByTypeAndTower(type, towerNum); + if (propMap == null || propMap.size() == 0) { continue; } - //根据层数获取解锁的属性库 - int[] floor = config.getFloor(); - int[] propertyGit = config.getPropertyGit(); - int num = 0; int level = map.get(type); - for(int i = 0;i map = new HashMap<>(); + Map attrMap = new HashMap<>(); + map.put(1,1); + map.put(2,1); + map.put(3,1); + map.put(4,1); + map.put(5,1); + map.put(6,1); + for(int type:map.keySet()) { + if (!map.containsKey(type)) { + continue; + } + SBecomeAGodSetting config = SBecomeAGodSetting.getConfigBytype(type); + if (config == null) { + continue; + } + Map propMap = SBecomeAGodSetting.getPropByTypeAndTower(type, towerNum); + if (propMap == null || propMap.size() == 0) { + continue; + } + for (int propertyId : propMap.values()) { + SBecomeAGodPropertyGit propConfig = SBecomeAGodPropertyGit.getSBecomeAGodPropertyGitByTypeAndLevel(propertyId, level); + if (propConfig == null) { + continue; + } + if (propConfig.getProperty() != null) { + for (int[] ints : propConfig.getProperty()) { + attrMap.put(ints[0], attrMap.getOrDefault(ints[0], 0L) + ints[1]); + } + } + } + } + System.out.println("神觉属性 tower : + " + towerNum + " --- level : " + level + "start------------------------"); + for(int propId : attrMap.keySet()){ + System.out.println("神觉属性 key : " + propId + "---value--" + attrMap.get(propId)); + } + System.out.println("神觉属性 tower : + " + towerNum + " --- level : " + level + "end------------------------"); + } + /** * 解锁天书密卷神技 */ diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/TrainingLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/TrainingLogic.java index 5347314b5..2aebd4aa5 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/TrainingLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/hero/TrainingLogic.java @@ -569,6 +569,12 @@ public class TrainingLogic { giftCost.put(gifts.getItemId(), gifts.getItemNum()); ItemUtil.itemCostLong(user, giftCost, BIReason.TRAINING_UP_LV_COST, 0); break; +// case GlobalItemType.SOUL_MARK://魂印 +// CommonProto.Item gifts = proto.getPlayerGifts(); +// HashMap giftCost = new HashMap<>(1); +// giftCost.put(gifts.getItemId(), gifts.getItemNum()); +// ItemUtil.itemCostLong(user, giftCost, BIReason.TRAINING_UP_LV_COST, 0); +// break; default: throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"道具消耗类型找不到"); } diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/playerGod/PlayerGodLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/playerGod/PlayerGodLogic.java index cc2f74562..861caf115 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/playerGod/PlayerGodLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/playerGod/PlayerGodLogic.java @@ -103,10 +103,10 @@ public class PlayerGodLogic { int needLevel = config.getLevelConfine(); Map map = playerManager.getPlayerGodMeridiansLevels(); for(int i=1;i<=6;i++){ - if(!map.containsKey(i)){ - throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel not enough"); + int playerMeridiansLevel = 0; + if(map.containsKey(i)){ + playerMeridiansLevel = map.get(i); } - int playerMeridiansLevel = map.get(i); if(playerMeridiansLevel < needLevel){ throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel not enough"); } diff --git a/tablemanager/src/main/java/config/SBecomeAGodSetting.java b/tablemanager/src/main/java/config/SBecomeAGodSetting.java index 8d78ec059..b9de60f54 100644 --- a/tablemanager/src/main/java/config/SBecomeAGodSetting.java +++ b/tablemanager/src/main/java/config/SBecomeAGodSetting.java @@ -23,16 +23,16 @@ public class SBecomeAGodSetting implements BaseConfig { public static Map map = new HashMap<>(); public static Map typeMap = new HashMap<>(); - //按照六道类型和阶数存储的累积属性库id集合 - public static Map>> propMap = new HashMap<>(); - //按塔的层数存储的对应阶数属性库集合 - public static Map towerPropMap = new HashMap<>(); + //按照六道类型和塔层数存储的累积属性库id集合(为方便快速获取,按层数直接存取对应的属性id集合,只保留3000层的,多余3000层的循环比较) + public static Map>> propMap = new HashMap<>(); + //按照六道类型存储的最大属性库层数,超过该层数,直接取最大层数属性库集合,无需比较奖励 + public static Map towerMaxMap = new HashMap<>(); @Override public void init() throws Exception { map = STableManager.getConfig(SBecomeAGodSetting.class); - Map>> _propMap = new HashMap<>(); - Map _towerPropMap = new HashMap<>(); + Map>> _propMap = new HashMap<>(); + Map _towerMaxMap = new HashMap<>(); for(SBecomeAGodSetting config : map.values()){ typeMap.put(config.getType(),config); int[] floor = config.getFloor(); @@ -40,37 +40,41 @@ public class SBecomeAGodSetting implements BaseConfig { if(floor == null || floor.length == 0){ continue; } - Map> map = new HashMap<>(); - int maxNum = 0; + Map> map = new HashMap<>(); + int maxNum = 3000; + int trueMaxTowerNum = 0; if(propertyGit!= null && propertyGit.length > 0){ for(int i = 0;i list = new ArrayList<>(); - for(int j= 0;j=floor[i]){ + Map subMap = null; + if(!map.containsKey(j)){ + subMap = new HashMap<>(); + }else{ + subMap = map.get(j); + if(subMap == null){ + subMap = new HashMap<>(); + } + } + if(i 10000){ - maxNum = 10000; - } - for(int i=0;i<=maxNum;i++){ - - } - _propMap.put(type,map); + _propMap.put(config.getType(),map); + _towerMaxMap.put(config.getType(),trueMaxTowerNum); } propMap = _propMap; + towerMaxMap = _towerMaxMap; +// testTowerProp(); } @@ -101,5 +105,57 @@ public class SBecomeAGodSetting implements BaseConfig { return null; } + /** + * 根据六道类型和神觉塔层数获取属性库 + * @param type + * @param tower + * @return + */ + public static Map getPropByTypeAndTower(int type,int tower){ + Map map = null; + if(propMap.containsKey(type)){ + Map> subMap = propMap.get(type); + //不存在的类型,直接返回null + if(subMap == null){ + return map; + } + if(subMap.containsKey(tower)){ + return subMap.get(tower); + } + //没获取到,实际塔层数超过了3000,先判断是否超过了真实配置的最大层数,超过了,直接取最大层数属性库 + int trueTowerNum = towerMaxMap.get(type); + if(tower > trueTowerNum){ + return subMap.get(trueTowerNum); + } + //实际奖励配置的最大层数超过了3000层,则直接真实比较 + SBecomeAGodSetting config = SBecomeAGodSetting.getConfigBytype(type); + if(config == null){ + return map; + } + //根据层数获取解锁的属性库 + int[] floor = config.getFloor(); + int[] propertyGit = config.getPropertyGit(); + map = new HashMap<>(); + for(int i = 0;i map = getPropByTypeAndTower(j,i); + System.out.println("六道属性库测试--type : " + j + "---层数 : " + i + "---属性库 : " + map.values()); + } + } + } + } \ No newline at end of file