equip掉落属性数值修改

back_recharge
wangyuan 2019-04-30 14:30:56 +08:00
parent e600edbeb3
commit 8842924478
2 changed files with 33 additions and 10 deletions

View File

@ -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;
}
}

View File

@ -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<Integer, Integer> 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<Integer> runneIds){
private void setForRunnes(List<Integer> runneIds,Map<Integer, Integer> promoteMap){
Map<Integer,Integer> 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<Integer,Integer> secondValueByIdMap){
private void randomForRunne(int poolId,int nums,Map<Integer,Integer> secondValueByIdMap,Map<Integer, Integer> promoteMap){
List<SRunesPoolConfig> sRunesPoolConfigs = SRunesPoolConfig.getsRunesPoolConfigsByPoolNum(poolId);
Map<Integer,Integer> 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<Integer,Integer> getSecondValue(int poolId,int nums){
private Map<Integer,Integer> getSecondValue(int poolId,int nums,Map<Integer, Integer> promoteMap){
Map<Integer,Integer> result = new HashMap<>();
List<SEquipPropertyPool> 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;
}