1. 图鉴加潜能

2. 心愿神话概率修改
master_dev
grimm 2024-04-10 16:27:51 +08:00
parent 91aa55d295
commit 75200c0d51
5 changed files with 76 additions and 35 deletions

View File

@ -9,7 +9,6 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum; import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import config.SLikeAbilityConfig; import config.SLikeAbilityConfig;
import config.SSpecialConfig; import config.SSpecialConfig;
import config.SWishConfig;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -210,19 +209,6 @@ public class HeroManager extends MongoBase {
updateString("randomCountByType."+type, value); 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){ public int getCountByDraw(int type){
return randomCountByType.getOrDefault(type, 0); return randomCountByType.getOrDefault(type, 0);
} }

View File

@ -916,6 +916,33 @@ public class HeroLogic {
return activity.getType() == activityType; 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; return item;
} }
int weight = user.getHeroManager().getWeightByDraw(type); int weight = getWeightByDraw(user, type);
int randomInt = MathUtils.randomInt(10000); int randomInt = MathUtils.randomInt(10000);
if (randomInt <= weight) { if (randomInt <= weight) {
// 读取格子信息 // 读取格子信息
@ -2824,16 +2851,26 @@ public class HeroLogic {
combinedAttribute(magicSoldierAttribute, heroAllAttribute); 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<>(); HashSet<Integer> bookSet = new HashSet<>();
bookSet.addAll(user.getPokemonManager().getPokemonBookEnabled());//灵兽图鉴加成 bookSet.addAll(user.getPokemonManager().getPokemonBookEnabled());//灵兽图鉴加成
bookSet.addAll(user.getHeroManager().getHeroHandBookEnabled());//神将羁绊加成 bookSet.addAll(user.getHeroManager().getHeroHandBookEnabled());//神将羁绊加成
bookSet.addAll(user.getEquipManager().getEquipBookEnabled());//魂印图鉴加成 bookSet.addAll(user.getEquipManager().getEquipBookEnabled());//魂印图鉴加成
bookSet.addAll(user.getItemManager().getEquipBookEnabled());//白金装备加成 bookSet.addAll(user.getItemManager().getEquipBookEnabled());//白金装备加成
bookSet.addAll(user.getMagicSoldierManager().getMagicSoldierBook());//神兵图鉴加成 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()) { if (!bookSet.isEmpty()) {
//计算图鉴加成 //计算图鉴加成
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class); Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
@ -6998,7 +7035,7 @@ public class HeroLogic {
HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder(); HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder();
builder.setUpLv(hero.getPotentialLv(type)); 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); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.PotentialUpLvResponse_VALUE, builder.build(), true);
} }
@ -7025,6 +7062,26 @@ public class HeroLogic {
return result; 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; return 0;
} }
int giftPotentialLv = getGiftPotentialLv(user, hero); int giftPotentialLv = getGiftPotentialLv(user, hero);
int bookPotentialLv = getBookPotentialLv(user);
int potentialLv = hero.getPotentialLv(type); 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) { if (potentialNew == null) {
return 0; return 0;
} }

View File

@ -8,7 +8,6 @@ import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.VipPrivilegeType; import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType; import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
import com.ljsd.jieling.db.mongo.AreaManager; 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.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil; import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode; 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.GuildForceChangeEvent;
import com.ljsd.jieling.logic.activity.event.Poster; import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent; 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.*;
import com.ljsd.jieling.logic.dao.cross.CSPlayer; import com.ljsd.jieling.logic.dao.cross.CSPlayer;
import com.ljsd.jieling.logic.dao.root.GuildInfo; 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.bean.ReceiveWelfareBag;
import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler; import com.ljsd.jieling.logic.store.newRechargeInfo.rechargeHandler.RechargeHandler;
import com.ljsd.jieling.network.session.ISession; 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.thrift.pool.ClientAdapterPo;
import com.ljsd.jieling.util.*; import com.ljsd.jieling.util.*;
import config.*; import config.*;
@ -58,7 +54,6 @@ import util.MathUtils;
import util.TimeUtils; import util.TimeUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class PlayerLogic { public class PlayerLogic {
@ -1046,7 +1041,7 @@ public class PlayerLogic {
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute)); builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
builder.setHero(CBean2Proto.getHongmengHero(userInMem, hero)); 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(); Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession(); int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
Integer skill = guildSkill.getOrDefault(profession, 0); Integer skill = guildSkill.getOrDefault(profession, 0);

View File

@ -1,10 +1,7 @@
package config; package config;
import manager.STableManager;
import manager.Table; import manager.Table;
import java.util.Map;
@Table(name ="SpiritAnimalBook") @Table(name ="SpiritAnimalBook")
public class SSpiritAnimalBook implements BaseConfig { public class SSpiritAnimalBook implements BaseConfig {
@ -14,7 +11,7 @@ public class SSpiritAnimalBook implements BaseConfig {
private int[][] activePara; private int[][] activePara;
private int activeForce; private int potential;
private int fetterType; private int fetterType;
@ -41,8 +38,8 @@ public class SSpiritAnimalBook implements BaseConfig {
return activePara; return activePara;
} }
public int getActiveForce() { public int getPotential() {
return activeForce; return potential;
} }
public int getFetterType() { public int getFetterType() {

View File

@ -21,6 +21,8 @@ public class SWishConfig implements BaseConfig {
private int weight; private int weight;
private int mythWeight;
public static Map<Integer, SWishConfig> map; public static Map<Integer, SWishConfig> map;
public static Map<Integer, Map<Integer, SWishConfig>> typeMap = new HashMap<>(); public static Map<Integer, Map<Integer, SWishConfig>> typeMap = new HashMap<>();
@ -60,5 +62,7 @@ public class SWishConfig implements BaseConfig {
return weight; return weight;
} }
public int getMythWeight() {
return mythWeight;
}
} }