神话心愿
parent
f2f641772c
commit
a8964a6fd6
|
|
@ -916,6 +916,33 @@ public class HeroLogic {
|
|||
return activity.getType() == activityType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取心愿抽卡概率
|
||||
* @param user
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public int getWeightByDraw(User user, int type){
|
||||
int defaultWeight = 0;
|
||||
int mythWeight = 0;
|
||||
Map<Integer, SWishConfig> typeMap = SWishConfig.typeMap.get(type);
|
||||
int count = user.getHeroManager().getRandomCountByType().getOrDefault(type, 0);
|
||||
for (SWishConfig config : typeMap.values()) {
|
||||
if (count < config.getDrawCardNumber()){
|
||||
break;
|
||||
}
|
||||
defaultWeight = config.getWeight();
|
||||
mythWeight = config.getMythWeight();
|
||||
}
|
||||
int wish = user.getPlayerInfoManager().getDesireDraw().getOrDefault(type, 0);
|
||||
SCHero hero = SCHero.getsCHero().get(wish);
|
||||
if (hero == null || hero.getNatural() != 7){
|
||||
return defaultWeight;
|
||||
}else {
|
||||
return mythWeight;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿抽卡校验
|
||||
*/
|
||||
|
|
@ -927,7 +954,7 @@ public class HeroLogic {
|
|||
return item;
|
||||
}
|
||||
|
||||
int weight = user.getHeroManager().getWeightByDraw(type);
|
||||
int weight = getWeightByDraw(user, type);
|
||||
int randomInt = MathUtils.randomInt(10000);
|
||||
if (randomInt <= weight) {
|
||||
// 读取格子信息
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ public class SWishConfig implements BaseConfig {
|
|||
|
||||
private int weight;
|
||||
|
||||
private int mythWeight;
|
||||
|
||||
public static Map<Integer, SWishConfig> map;
|
||||
|
||||
public static Map<Integer, Map<Integer, SWishConfig>> typeMap = new HashMap<>();
|
||||
|
|
@ -60,5 +62,7 @@ public class SWishConfig implements BaseConfig {
|
|||
return weight;
|
||||
}
|
||||
|
||||
|
||||
public int getMythWeight() {
|
||||
return mythWeight;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue