装备属性必出

back_recharge
wangyuan 2019-05-07 15:41:21 +08:00
parent e103042663
commit 954d3168a9
2 changed files with 18 additions and 1 deletions

View File

@ -54,5 +54,7 @@ public interface GlobalsDef {
int EXPLORE_MAP_DIGGLE_TYPE =4;
int EXPLORE_MAP_ACTION_POWER_RORMULA_TYPE =5;
int MUST_BE = -1;
}

View File

@ -150,13 +150,28 @@ public class Equip extends MongoBase implements Cloneable{
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(poolId);
int totalWeight = 0;
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
int weight = sEquipPropertyPool.getWeight();
if(weight == GlobalsDef.MUST_BE){
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);
nums--;
continue;
}
totalWeight+=sEquipPropertyPool.getWeight();
}
while (result.size()<nums){
int weight = 0;
int randomWeight = MathUtils.randomInt(totalWeight) +1;
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
weight+=sEquipPropertyPool.getWeight();
int weightTmp= sEquipPropertyPool.getWeight();
if(weightTmp<=0){
continue;
}
weight+=weightTmp;
if(randomWeight<=weight){
Integer propertyPromote = promoteMap.get(sEquipPropertyPool.getPropertyId());
if(propertyPromote == null){