From 884292447879ba92673243ce2440d22c30b51a01 Mon Sep 17 00:00:00 2001 From: wangyuan Date: Tue, 30 Apr 2019 14:30:56 +0800 Subject: [PATCH] =?UTF-8?q?equip=E6=8E=89=E8=90=BD=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=95=B0=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ljsd/jieling/config/SEquipConfig.java | 6 +++ .../com/ljsd/jieling/logic/dao/Equip.java | 37 ++++++++++++++----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java index 1502917f0..c03ada391 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/config/SEquipConfig.java @@ -32,6 +32,8 @@ public class SEquipConfig implements BaseConfig { private int ifClear; + private int initialLevel; + @Override public void init() throws Exception { @@ -85,4 +87,8 @@ public class SEquipConfig implements BaseConfig { public int getQuality() { return quality; } + + public int getInitialLevel() { + return initialLevel; + } } \ No newline at end of file diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java index c9347e1dd..44d03b46b 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/dao/Equip.java @@ -39,15 +39,24 @@ public class Equip extends MongoBase { this.equipId = equipTid; this.propertyValueByIdMap = new HashMap<>(); SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(equipTid); + SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(sEquipConfig.getInitialLevel()); + Map promoteMap = new HashMap<>(); + if( sWorkShopSetting != null && sWorkShopSetting.getPromoteMap()!=null){ + promoteMap = sWorkShopSetting.getPromoteMap(); + } int properTyId = sEquipConfig.getPropertyMin()[0]; int properMinNum = sEquipConfig.getPropertyMin()[1]; int properMaxNum = sEquipConfig.getPropertyMax()[1]; - int finalProperValue = MathUtils.random(properMinNum, properMaxNum); + Integer propertyPromote = promoteMap.get(properTyId); + if(propertyPromote == null){ + propertyPromote = 0; + } + int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100); this.propertyValueByIdMap.put(properTyId, finalProperValue); int secondNumMin = sEquipConfig.getSecondNumMin(); int secondNumMax = sEquipConfig.getSecondNumMax(); int secondValue = MathUtils.random(secondNumMin, secondNumMax); - this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue); + this.secondValueByIdMap = getSecondValue(sEquipConfig.getPool(), secondValue,promoteMap); } //锻造 @@ -72,11 +81,11 @@ public class Equip extends MongoBase { int properMaxNum = sEquipConfig.getPropertyMax()[1]; int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100); this.propertyValueByIdMap.put(properTyId,finalProperValue); - setForRunnes(runneIds); + setForRunnes(runneIds,promoteMap); } - private void setForRunnes(List runneIds){ + private void setForRunnes(List runneIds,Map promoteMap){ Map result = new HashMap<>(); for(Integer runneId : runneIds ){ SRunesConfig sRunesConfig = SRunesConfig.getsRunesConfigById(runneId); @@ -85,20 +94,20 @@ public class Equip extends MongoBase { int secondNumMin = sRunesConfig.getSecondNumMin(); int secondNumMax = sRunesConfig.getSecondNumMax(); int secondValue = MathUtils.random(secondNumMin, secondNumMax); - randomForRunne(secondPool,secondValue,result); + randomForRunne(secondPool,secondValue,result,promoteMap); } int mainPool = sRunesConfig.getMainPool(); if(mainPool!=0){ int mainNum = sRunesConfig.getMainNum(); - randomForRunne(mainPool,mainNum,result); + randomForRunne(mainPool,mainNum,result,promoteMap); } } secondValueByIdMap = result; } - private void randomForRunne(int poolId,int nums,Map secondValueByIdMap){ + private void randomForRunne(int poolId,int nums,Map secondValueByIdMap,Map promoteMap){ List sRunesPoolConfigs = SRunesPoolConfig.getsRunesPoolConfigsByPoolNum(poolId); Map result = new HashMap<>(); int totalWeight = 0; @@ -111,7 +120,11 @@ public class Equip extends MongoBase { for(SRunesPoolConfig sRunesPoolConfig : sRunesPoolConfigs){ weight+=sRunesPoolConfig.getWeight(); if(randomWeight<=weight){ - int random = MathUtils.random(sRunesPoolConfig.getMin(), sRunesPoolConfig.getMax()); + Integer propertyPromote = promoteMap.get(sRunesPoolConfig.getPropertyId()); + if(propertyPromote == null){ + propertyPromote = 0; + } + int random = MathUtils.random(sRunesPoolConfig.getMin() * (100 + propertyPromote) / 100, sRunesPoolConfig.getMax()* (100 + propertyPromote) / 100); result.put(sRunesPoolConfig.getPropertyId(),random); break; } @@ -132,7 +145,7 @@ public class Equip extends MongoBase { } } - private Map getSecondValue(int poolId,int nums){ + private Map getSecondValue(int poolId,int nums,Map promoteMap){ Map result = new HashMap<>(); List sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId); int totalWeight = 0; @@ -145,7 +158,11 @@ public class Equip extends MongoBase { for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){ weight+=sEquipPropertyPool.getWeight(); if(randomWeight<=weight){ - int random = MathUtils.random(sEquipPropertyPool.getMin(), sEquipPropertyPool.getMax()); + Integer propertyPromote = promoteMap.get(sEquipPropertyPool.getPropertyId()); + if(propertyPromote == null){ + propertyPromote = 0; + } + int random = MathUtils.random(sEquipPropertyPool.getMin() * (100 + propertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + propertyPromote) / 100); result.put(sEquipPropertyPool.getPropertyId(),random); break; }