change weight

back_recharge
wangyuan 2019-03-14 11:13:05 +08:00
parent a1e84b5a16
commit 78df2af776
3 changed files with 4 additions and 4 deletions

View File

@ -107,7 +107,7 @@ public class Equip extends MongoBase {
int randomWeight = MathUtils.randomInt(totalWeight) +1; int randomWeight = MathUtils.randomInt(totalWeight) +1;
for(SRunesPoolConfig sRunesPoolConfig : sRunesPoolConfigs){ for(SRunesPoolConfig sRunesPoolConfig : sRunesPoolConfigs){
weight+=sRunesPoolConfig.getWeight(); weight+=sRunesPoolConfig.getWeight();
if(randomWeight<weight){ if(randomWeight<=weight){
int random = MathUtils.random(sRunesPoolConfig.getMin(), sRunesPoolConfig.getMax()); int random = MathUtils.random(sRunesPoolConfig.getMin(), sRunesPoolConfig.getMax());
result.put(sRunesPoolConfig.getPropertyId(),random); result.put(sRunesPoolConfig.getPropertyId(),random);
break; break;
@ -137,7 +137,7 @@ public class Equip extends MongoBase {
int randomWeight = MathUtils.randomInt(totalWeight) +1; int randomWeight = MathUtils.randomInt(totalWeight) +1;
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){ for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
weight+=sEquipPropertyPool.getWeight(); weight+=sEquipPropertyPool.getWeight();
if(randomWeight<weight){ if(randomWeight<=weight){
int random = MathUtils.random(sEquipPropertyPool.getMin(), sEquipPropertyPool.getMax()); int random = MathUtils.random(sEquipPropertyPool.getMin(), sEquipPropertyPool.getMax());
result.put(sEquipPropertyPool.getPropertyId(),random); result.put(sEquipPropertyPool.getPropertyId(),random);
break; break;

View File

@ -171,7 +171,7 @@ public class HeroLogic {
for(int i=0;i<diamondBoxContain.length;i++){ for(int i=0;i<diamondBoxContain.length;i++){
int[] poolWeightInfo = diamondBoxContain[i]; int[] poolWeightInfo = diamondBoxContain[i];
weight += poolWeightInfo[1]; weight += poolWeightInfo[1];
if(randWeight<weight){ if(randWeight<=weight){
pooId = poolWeightInfo[0]; pooId = poolWeightInfo[0];
break; break;
} }

View File

@ -88,7 +88,7 @@ public class WorkShopLogic {
int weight=0; int weight=0;
for(int[] poolWeightInfo : poolWeight){ for(int[] poolWeightInfo : poolWeight){
weight+=poolWeightInfo[1]; weight+=poolWeightInfo[1];
if(randomWeight>weight){ if(randomWeight>=weight){
SMysteryFoodPoolConfig sMysteryFoodPoolConfig = randomFromFoodPool(poolWeightInfo[0]); SMysteryFoodPoolConfig sMysteryFoodPoolConfig = randomFromFoodPool(poolWeightInfo[0]);
int itemId = sMysteryFoodPoolConfig.getItemId(); int itemId = sMysteryFoodPoolConfig.getItemId();
drop[i++] = new int[]{itemId,1}; drop[i++] = new int[]{itemId,1};