From a4f7cb971f91db4d5306973f041cc23de4ec9d71 Mon Sep 17 00:00:00 2001 From: duhui Date: Sat, 20 Feb 2021 16:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=B8=BF=E8=92=99=E9=98=B5=EF=BC=8C=E9=AD=82?= =?UTF-8?q?=E5=AE=9D=E7=81=B5=E5=AE=9D=E8=AE=A1=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/hero/HeroLogic.java | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 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 405e515b0..0d2712881 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 @@ -3733,7 +3733,8 @@ public class HeroLogic{ // 装备 hongmengEquip(hongMengAddAttributeEquip, hero); // 魂宝 灵宝 - soulOrSpirit(soulEquip, spiritEquip, equipMap, hero); + soulOrSpirit(soulEquip, 1, equipMap, hero); + soulOrSpirit(spiritEquip, 2, equipMap, hero); // 法宝 especialAdd(especialEquipLevel, hero); } @@ -3853,46 +3854,44 @@ public class HeroLogic{ /** * 鸿蒙阵对魂宝灵宝加成 - * @param soulEquip - * @param spiritEquip + * @param jewelEquip + * @param type 1魂宝 2灵宝 * @param equipMap * @param hero */ - public void soulOrSpirit(HongMengAddAttribute soulEquip, HongMengAddAttribute spiritEquip, Map equipMap, Hero hero) { - if (hero.getJewelInfo().isEmpty()) { - soulEquip.value = -1; - spiritEquip.value = -1; - soulEquip.heroTid = 0; - spiritEquip.heroTid = 0; - } else { - for (String jewel : hero.getJewelInfo()) { - PropertyItem propertyItem = equipMap.get(jewel); - if (propertyItem == null) { - soulEquip.value = -1; - soulEquip.heroTid = 0; - spiritEquip.value = -1; - spiritEquip.heroTid = 0; - break; - } else { - SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(propertyItem.getEquipId()); - if (config == null) { - continue; - } - // getLocation 1魂宝 2灵宝 - if (config.getLocation() == 1) { - if (propertyItem.getLevel() < soulEquip.value){ - soulEquip.value = propertyItem.getLevel(); - soulEquip.heroTid = hero.getTemplateId(); - } - } else { - if (propertyItem.getLevel() < spiritEquip.value){ - spiritEquip.value = propertyItem.getLevel(); - spiritEquip.heroTid = hero.getTemplateId(); - } + private void soulOrSpirit(HongMengAddAttribute jewelEquip, int type, Map equipMap, Hero hero) { + // 记录器,玩家是否拥有这件装备 + boolean result = true; + // 遍历英雄身上的魂宝和灵宝 + for (String jewel : hero.getJewelInfo()) { + // 玩家装备表里是否存在 + PropertyItem propertyItem = equipMap.get(jewel); + if (propertyItem != null){ + SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(propertyItem.getEquipId()); + // location 1魂宝 2灵宝 + if (config != null && config.getLocation() == type) { + result = false; + if (propertyItem.getLevel() < jewelEquip.value){ + jewelEquip.value = propertyItem.getLevel(); + jewelEquip.heroTid = hero.getTemplateId(); } } } } + if (result){ + notJewelInit(jewelEquip); + } + } + + /** + * 没有宝物时初始化 + * @param jewels + */ + private void notJewelInit(HongMengAddAttribute... jewels){ + for (int i = 0; i < jewels.length; i++) { + jewels[i].value = -1; + jewels[i].heroTid = 0; + } } /**