神话心愿

master_haizei
grimm 2024-05-10 19:02:48 +08:00
parent f2f641772c
commit a8964a6fd6
2 changed files with 33 additions and 2 deletions

View File

@ -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) {
// 读取格子信息

View File

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