parent
91aa55d295
commit
75200c0d51
|
|
@ -9,7 +9,6 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
|
||||
import config.SLikeAbilityConfig;
|
||||
import config.SSpecialConfig;
|
||||
import config.SWishConfig;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -210,19 +209,6 @@ public class HeroManager extends MongoBase {
|
|||
updateString("randomCountByType."+type, value);
|
||||
}
|
||||
|
||||
public int getWeightByDraw(int type){
|
||||
int weight = 0;
|
||||
Map<Integer, SWishConfig> map = SWishConfig.map;
|
||||
Integer count = randomCountByType.getOrDefault(type, 0);
|
||||
for (SWishConfig config : map.values()) {
|
||||
if (count < config.getDrawCardNumber()){
|
||||
break;
|
||||
}
|
||||
weight = config.getWeight();
|
||||
}
|
||||
return weight;
|
||||
}
|
||||
|
||||
public int getCountByDraw(int type){
|
||||
return randomCountByType.getOrDefault(type, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
// 读取格子信息
|
||||
|
|
@ -2824,16 +2851,26 @@ public class HeroLogic {
|
|||
combinedAttribute(magicSoldierAttribute, heroAllAttribute);
|
||||
}
|
||||
|
||||
private void applyBonusesAttribute(Map<Integer, Long> heroAllAttribute, int heroSkin, User user) {
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
|
||||
// ... 图鉴、皮肤、称号、坐骑等属性加成逻辑 ...
|
||||
/**
|
||||
* 获取全部图鉴
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public HashSet<Integer> getAllBook(User user){
|
||||
HashSet<Integer> bookSet = new HashSet<>();
|
||||
bookSet.addAll(user.getPokemonManager().getPokemonBookEnabled());//灵兽图鉴加成
|
||||
bookSet.addAll(user.getHeroManager().getHeroHandBookEnabled());//神将羁绊加成
|
||||
bookSet.addAll(user.getEquipManager().getEquipBookEnabled());//魂印图鉴加成
|
||||
bookSet.addAll(user.getItemManager().getEquipBookEnabled());//白金装备加成
|
||||
bookSet.addAll(user.getMagicSoldierManager().getMagicSoldierBook());//神兵图鉴加成
|
||||
return bookSet;
|
||||
}
|
||||
|
||||
private void applyBonusesAttribute(Map<Integer, Long> heroAllAttribute, int heroSkin, User user) {
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
|
||||
// ... 图鉴、皮肤、称号、坐骑等属性加成逻辑 ...
|
||||
HashSet<Integer> bookSet = getAllBook(user);
|
||||
if (!bookSet.isEmpty()) {
|
||||
//计算图鉴加成
|
||||
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
|
||||
|
|
@ -6998,7 +7035,7 @@ public class HeroLogic {
|
|||
|
||||
HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder();
|
||||
builder.setUpLv(hero.getPotentialLv(type));
|
||||
builder.setGiftLv(getGiftPotentialLv(user, hero));
|
||||
builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user));
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.PotentialUpLvResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
|
|
@ -7025,6 +7062,26 @@ public class HeroLogic {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取礼物加成得潜能等级
|
||||
*/
|
||||
public int getBookPotentialLv(User user) {
|
||||
int result = 0;
|
||||
HashSet<Integer> allBook = getAllBook(user);
|
||||
if (allBook.isEmpty()){
|
||||
return result;
|
||||
}
|
||||
Map<Integer, SSpiritAnimalBook> bookMap = STableManager.getConfig(SSpiritAnimalBook.class);
|
||||
for (Integer id : allBook) {
|
||||
SSpiritAnimalBook book = bookMap.get(id);
|
||||
if (book == null){
|
||||
continue;
|
||||
}
|
||||
result += book.getPotential();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 潜能回退
|
||||
*/
|
||||
|
|
@ -7079,8 +7136,10 @@ public class HeroLogic {
|
|||
return 0;
|
||||
}
|
||||
int giftPotentialLv = getGiftPotentialLv(user, hero);
|
||||
int bookPotentialLv = getBookPotentialLv(user);
|
||||
int potentialLv = hero.getPotentialLv(type);
|
||||
SPotentialNew potentialNew = SPotentialNew.typeMap.get(type).get(potentialLv + giftPotentialLv);
|
||||
int totalPotenialLv = potentialLv + giftPotentialLv + bookPotentialLv;
|
||||
SPotentialNew potentialNew = SPotentialNew.typeMap.get(type).get(totalPotenialLv);
|
||||
if (potentialNew == null) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import com.ljsd.jieling.core.GlobalsDef;
|
|||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.db.mongo.AreaManager;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
|
|
@ -26,9 +25,6 @@ import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
|||
import com.ljsd.jieling.logic.activity.event.GuildForceChangeEvent;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.Pokemon;
|
||||
import com.ljsd.jieling.logic.dao.PropertyItem;
|
||||
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.cross.CSPlayer;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
|
|
@ -44,7 +40,7 @@ import com.ljsd.jieling.logic.store.BuyGoodsNewLogic;
|
|||
import com.ljsd.jieling.logic.store.newRechargeInfo.bean.ReceiveWelfareBag;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thrift.idl.*;
|
||||
import com.ljsd.jieling.thrift.idl.RPCRequestIFace;
|
||||
import com.ljsd.jieling.thrift.pool.ClientAdapterPo;
|
||||
import com.ljsd.jieling.util.*;
|
||||
import config.*;
|
||||
|
|
@ -58,7 +54,6 @@ import util.MathUtils;
|
|||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class PlayerLogic {
|
||||
|
|
@ -1046,7 +1041,7 @@ public class PlayerLogic {
|
|||
|
||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
builder.setHero(CBean2Proto.getHongmengHero(userInMem, hero));
|
||||
builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero));
|
||||
builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero) + HeroLogic.getInstance().getBookPotentialLv(userInMem));
|
||||
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
|
||||
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
|
||||
Integer skill = guildSkill.getOrDefault(profession, 0);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="SpiritAnimalBook")
|
||||
public class SSpiritAnimalBook implements BaseConfig {
|
||||
|
||||
|
|
@ -14,7 +11,7 @@ public class SSpiritAnimalBook implements BaseConfig {
|
|||
|
||||
private int[][] activePara;
|
||||
|
||||
private int activeForce;
|
||||
private int potential;
|
||||
|
||||
private int fetterType;
|
||||
|
||||
|
|
@ -41,8 +38,8 @@ public class SSpiritAnimalBook implements BaseConfig {
|
|||
return activePara;
|
||||
}
|
||||
|
||||
public int getActiveForce() {
|
||||
return activeForce;
|
||||
public int getPotential() {
|
||||
return potential;
|
||||
}
|
||||
|
||||
public int getFetterType() {
|
||||
|
|
|
|||
|
|
@ -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