战力同步

master_ob2
PC-202302260912\Administrator 2023-08-14 16:09:38 +08:00
parent 8aa5f9cdad
commit 090fe26a22
8 changed files with 444 additions and 428 deletions

View File

@ -165,6 +165,27 @@ public class Utils {
return map;
}
// map做减法
public static Map<Integer, Long> subtractMaps(Map<Integer, Long> map1, Map<Integer, Long> map2) {
Map<Integer, Long> result = new HashMap<>(map1);
for (Map.Entry<Integer, Long> entry : map2.entrySet()) {
int key = entry.getKey();
long value = entry.getValue();
if (result.containsKey(key)) {
long remainingValue = result.get(key) - value;
if (remainingValue > 0) {
result.put(key, remainingValue);
} else {
result.remove(key);
}
}
}
return result;
}
/**
* map
*/

View File

@ -373,56 +373,56 @@ public class MapLogic {
* @return
* @throws Exception
*/
public String initTeamInfo(int teamId, int uid, User user, MapManager mapManager, int initType) throws Exception {
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
return "阵容不存在";
}
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
Map<String, Map<Integer, Long>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
break;
}
Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Endless);
if (teamId == TeamEnum.ENDLESS_TEAM.getTeamId() && user.getMapManager().getEndlessMapInfo().getSeason() == timeControllerOfFunction.getTimes()) {
Map<String, Integer> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
if (endlessHeroInfo != null && endlessHeroInfo.size() > 0) {
if (initType != 2) {
Integer heroPercent = endlessHeroInfo.get(heroInfo.getHeroId());
if (heroPercent != null) {
int curHp = (int) ((double) heroPercent / 10000 * heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) curHp);
}
} else {
mapManager.updateEndlessHeroHp(hero.getId(), 10000);
}
}
}
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
heroes.add(heroInfo.getHeroId());
}
if (heroes.size() != teamPosHeroInfos.size()) {
LOGGER.info("enterMap() uid=>{} team pos is wrong ", uid, teamId);
return "阵容有误";
}
if (2 == initType && teamId != TeamEnum.ENDLESS_TEAM.getTeamId()) {
Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
for (Map.Entry<Integer, Integer> item : foodBufferMap.entrySet()) {
Integer value = item.getValue();
if (value <= -1) {
SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(item.getKey());
CombatLogic.getInstance().updateHeroAttributJustOne(user, teamPosHeroInfos, sFoodsConfig, heroAllAttributeMap, true);
}
}
}
mapManager.setTeamId(teamId);
mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
return "";
public void initTeamInfo(int teamId, int uid, User user, MapManager mapManager, int initType) throws Exception {
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
// if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
// return "阵容不存在";
// }
// List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
// Map<String, Map<Integer, Long>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
// if (hero == null) {
// break;
// }
// Map<Integer, Long> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
// TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.Endless);
// if (teamId == TeamEnum.ENDLESS_TEAM.getTeamId() && user.getMapManager().getEndlessMapInfo().getSeason() == timeControllerOfFunction.getTimes()) {
// Map<String, Integer> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
// if (endlessHeroInfo != null && endlessHeroInfo.size() > 0) {
// if (initType != 2) {
// Integer heroPercent = endlessHeroInfo.get(heroInfo.getHeroId());
// if (heroPercent != null) {
// int curHp = (int) ((double) heroPercent / 10000 * heroAllAttribute.get(HeroAttributeEnum.Hp.getPropertyId()));
// heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), (long) curHp);
// }
// } else {
// mapManager.updateEndlessHeroHp(hero.getId(), 10000);
// }
// }
// }
//
// heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
// heroes.add(heroInfo.getHeroId());
// }
// if (heroes.size() != teamPosHeroInfos.size()) {
// LOGGER.info("enterMap() uid=>{} team pos is wrong ", uid, teamId);
// return "阵容有误";
// }
// if (2 == initType && teamId != TeamEnum.ENDLESS_TEAM.getTeamId()) {
// Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
// for (Map.Entry<Integer, Integer> item : foodBufferMap.entrySet()) {
// Integer value = item.getValue();
// if (value <= -1) {
// SFoodsConfig sFoodsConfig = STableManager.getConfig(SFoodsConfig.class).get(item.getKey());
// CombatLogic.getInstance().updateHeroAttributJustOne(user, teamPosHeroInfos, sFoodsConfig, heroAllAttributeMap, true);
// }
// }
// }
//
// mapManager.setTeamId(teamId);
// mapManager.setHeroAllAttributeMap(heroAllAttributeMap);
// return "";
}
// public void cellToProto(List<CommonProto.Cell> cells, Map.Entry<Integer, Cell> entry) {

View File

@ -1,46 +1,31 @@
package com.ljsd.jieling.handler.map.mapType;
import com.googlecode.protobuf.format.JsonFormat;
import com.ljsd.fight.CheckFight;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.map.*;
import com.ljsd.jieling.handler.map.Cell;
import com.ljsd.jieling.handler.map.EventType;
import com.ljsd.jieling.handler.map.MapLogic;
import com.ljsd.jieling.handler.map.MapManager;
import com.ljsd.jieling.handler.map.behavior.BaseBehavior;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
import com.ljsd.jieling.handler.mission.Mission;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.StoryEvent;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.logic.store.StoreType;
import rpc.protocols.CommonProto;
import rpc.protocols.FightInfoProto;
import rpc.protocols.MapInfoProto;
import com.ljsd.jieling.util.*;
import com.ljsd.jieling.util.CBean2Proto;
import config.*;
import manager.STableManager;
import org.luaj.vm2.LuaValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import rpc.protocols.CommonProto;
import rpc.protocols.FightInfoProto;
import rpc.protocols.MapInfoProto;
import util.CellUtil;
import util.MathUtils;
import util.TimeUtils;
import java.util.*;
@ -221,32 +206,31 @@ public abstract class AbstractMap implements IMap {
}
public void revive(User user,SChallengeConfig sChallengeConfig,List<Long> remainHp,int teamId) throws Exception {
// 失败需要等待n秒后复活所有英雄
MapManager mapManager = user.getMapManager();
int dieCount = user.getMapManager().getDieCount();
dieCount++;
user.getMapManager().setDieCount(dieCount);
int[] reviveTime = sChallengeConfig.getReviveTime();
long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
int leftTime = MapLogic.getLeftTime(user, true);
remainHp.clear();
if (leftTime <= (int) (time / 1000)) {
MapLogic.resetMapInfo(user, false);
} else {
MapLogic.getInstance().initTeamInfo(mapManager.getTeamId(), user.getId(), user, mapManager, 2);
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
}
}
// MapManager mapManager = user.getMapManager();
// int dieCount = user.getMapManager().getDieCount();
//
// dieCount++;
// user.getMapManager().setDieCount(dieCount);
// int[] reviveTime = sChallengeConfig.getReviveTime();
// long time = (long) (MathUtils.calABX(dieCount, reviveTime) * 1000);
// user.getMapManager().setCanMoveTime(TimeUtils.now() + time);
// int leftTime = MapLogic.getLeftTime(user, true);
// remainHp.clear();
// if (leftTime <= (int) (time / 1000)) {
// MapLogic.resetMapInfo(user, false);
// } else {
// MapLogic.getInstance().initTeamInfo(mapManager.getTeamId(), user.getId(), user, mapManager, 2);
// List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(mapManager.getTeamId());
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
// if (hero == null) {
// continue;
// }
// Map<Integer, Long> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero, false, teamId);
// remainHp.add(heroAttributeMap.get(HeroAttributeEnum.CurHP.getPropertyId()));
// }
// }
}
// public void refreshHp(User user,int teamId,int[] checkResult){
// List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);

View File

@ -190,7 +190,7 @@ public class HeroManager extends MongoBase {
return faBaoSoulMap;
}
private Map<Integer,Integer>faBaoGongMingSkillMap= new HashMap<>();//法宝之魂共鸣数据<法宝组合id技能id>
private Map<Integer,Integer> faBaoGongMingSkillMap = new HashMap<>();//法宝之魂共鸣数据<法宝组合id技能id>
public Map<Integer, Integer> getFaBaoGongMingSkillMap() {
return faBaoGongMingSkillMap;

View File

@ -1,7 +1,6 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.Map;
@ -19,7 +18,7 @@ public class MailManager extends MongoBase {
return mailMap;
}
public void addMail(Mail mail){
public void addMail(Mail mail){
mail.init(mail.getRoleUid(), getMongoKey() + ".mailMap." + mail.getId());
updateString("mailMap." + mail.getId(), mail);
mailMap.put(mail.getId(), mail);

View File

@ -151,28 +151,28 @@ public class CombatLogic {
mapManager.eatFood(foodIdOrEventId,contiue);
}
public void updateHeroAttributJustOne(User user,List<TeamPosHeroInfo> teamPosHeroInfoList,SFoodsConfig sFoodsConfig, Map<String, Map<Integer, Long>> heroAllAttributeMap,boolean isRecory){
Map<Integer,Long> foodAddMap = new HashMap<>();
getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
if (hero == null) {
continue;
}
Map<Integer, Long> heroAllAttribute = new HashMap<>();
if(isRecory){
heroAllAttribute =heroAllAttributeMap.get(hero.getId());
}else {
heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
continue;
}
}
HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
HeroLogic.getInstance().calInteractAdd(heroAllAttribute,false);
heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
}
user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
public void updateHeroAttributeJustOne(User user,List<TeamPosHeroInfo> teamPosHeroInfoList,SFoodsConfig sFoodsConfig, Map<String, Map<Integer, Long>> heroAllAttributeMap,boolean isRecory){
// Map<Integer,Long> foodAddMap = new HashMap<>();
// getFoodAttributeAdd(GlobalsDef.FOOD_ADDITION_BATTLE_TYPE, GlobalsDef.FOOD_EAT_AFFECT_PERSON, foodAddMap, sFoodsConfig);
// for (TeamPosHeroInfo heroInfo : teamPosHeroInfoList) {
// Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
// if (hero == null) {
// continue;
// }
// Map<Integer, Long> heroAllAttribute = new HashMap<>();
// if(isRecory){
// heroAllAttribute =heroAllAttributeMap.get(hero.getId());
// }else {
// heroAllAttribute = user.getMapManager().getHeroAllAttributeByHeroId(hero.getId());
// if(heroAllAttribute == null || heroAllAttribute.get(HeroAttributeEnum.CurHP.getPropertyId()) <= 0){
// continue;
// }
// }
// HeroLogic.getInstance().combinedAttribute(foodAddMap,heroAllAttribute);
// HeroLogic.getInstance().calInteractAdd(heroAllAttribute,false);
// heroAllAttributeMap.put(hero.getId(), heroAllAttribute);
// }
// user.getMapManager().setHeroAllAttributeMap(heroAllAttributeMap);
}
public Map<Integer,Long> attributeByEatFood( User user,int type,int target){

View File

@ -3,9 +3,6 @@ package com.ljsd.jieling.logic.fight.passiveSkillCal;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import config.SCHero;
import config.SPropertyConfig;
import java.util.Arrays;
@ -33,7 +30,7 @@ public enum PassiveskillCalEnum {
}
int extraValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+extraValue);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), 0L)+extraValue);
}),
AllAdd(94,(config,hero,heroSkillAdMap,user,teamId)->{
float[] value = config.getValue();
@ -49,12 +46,12 @@ public enum PassiveskillCalEnum {
parm = value[0]*10000;
}
if( sPropertyConfig.getStyle()== GlobalsDef.PERCENT_TYPE){
if(sPropertyConfig.getStyle()== GlobalsDef.PERCENT_TYPE){
parm = value[0]*10000;
}
int extraValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+extraValue);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), 0L)+extraValue);
}),
HEROAFTER100ADD(171,(config,hero,heroSkillAdMap,user,teamId)->{
float[] value = config.getValue();
@ -66,7 +63,7 @@ public enum PassiveskillCalEnum {
return;
}
int parm = (int) value[1]*times;
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), 0L)+parm);
}),//武将100级后每升一级[c]额外增加[d]
HERO_PROFESSION_ADD(129,(config,hero,heroSkillAdMap,user,teamId)->{
float[] value = config.getValue();
@ -89,7 +86,7 @@ public enum PassiveskillCalEnum {
parm = value[1]*10000;
}
int extraValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+extraValue);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), 0L)+extraValue);
}),
HERO_HAVE_PROFESSION_ADD(413,(config,hero,heroSkillAdMap,user,teamId)->{
//被动技能,编队每增加一个同属性英雄属性额外增加一定数值
@ -129,7 +126,7 @@ public enum PassiveskillCalEnum {
parm = value[1]*10000*haveNum;
}
int extraValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), Long.valueOf(0))+extraValue);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(), 0L)+extraValue);
}),
;
private int type;

View File

@ -64,7 +64,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@SuppressWarnings({"DanglingJavadoc", "JavadocDeclaration", "CommentedOutCode", "unused"})
@SuppressWarnings({"DanglingJavadoc", "JavadocDeclaration", "CommentedOutCode", "unused", "CollectionAddAllCanBeReplacedWithConstructor"})
public class HeroLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
@ -2665,109 +2665,162 @@ public class HeroLogic {
return pokenSkillPassiveResult.toString();
}
//图鉴属性加成
public void bonuses(Set<Integer> bookEnabled, Map<Integer, Long> heroAllAttribute) {
if (!bookEnabled.isEmpty()) {
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
for (int bootId : bookEnabled) {
int[][] activePara = Optional.ofNullable(config.get(bootId)).map(SSpiritAnimalBook::getActivePara).orElse(new int[0][]);
combinedAttribute(activePara, heroAllAttribute);
}
}
}
/**
*
*/
public Map<Integer, Long> calHeroNotBufferAttribute(User user, Hero hero, boolean isForce, int teamId) {
// ... 总属性计算 ...
Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero, isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
PokemonManager pokemonManager = user.getPokemonManager();
HeroManager heroManager = user.getHeroManager();
EquipManager equipManager = user.getEquipManager();
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
ItemManager itemManager = user.getItemManager();
// 灵兽和神兵
applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user);
// 图鉴,皮肤,称号,坐骑等。。。
applyBonusesAttribute(heroAllAttribute, hero.getSkin(), user);
// 四象心法增加总属性
applyFourQuadrantAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 英雄好感度增加属性
applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 法宝聚灵和命格属性加成
applyTrumpAndGemAttribute(heroAllAttribute, user);
// 主角和主角技
applyPlayerAndSkill(heroAllAttribute, user);
// 工坊科技树加成(疑似废弃)
applyWorkShopTechnologyAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 装备和套装属性
applyEquipSuiteAttribute(heroAllAttribute, hero);
// 魂灵宝加成
applyJewelAttribute(heroAllAttribute, hero, user);
// 法宝,法相加成
applyEquipTalismanaAndFaxiangAttribute(heroAllAttribute, hero, user);
// 魂印和神印属性加成
applySoulEquipAndGodSealAttribute(heroAllAttribute, hero, user);
// 主角修为和修行等级属性加成
applyXiuxingAndXiuxianAttribute(heroAllAttribute, user);
// 公会技能和特权加成
applyGuildSkillAndVipAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 阵营光环,大闹天宫特殊加成
applyTeamAttribute(heroAllAttribute, isForce, teamId, user);
// 被动技能
applyPassiveSkillAttribute(heroAllAttribute, hero, teamId, user);
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (teamId != 0) {
int heroNum = user.getTeamPosManager().getTeamPosForHero().get(teamId).size();
if (teamId == TeamEnum.TRIAL_TEAM.getTeamId()) {
//森罗环境固定为5
heroNum = 5;
// 总计算
calInteractAdd(heroAllAttribute, isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
return heroAllAttribute;
}
private void applyPokemonAndMagicSoldierAttribute(Map<Integer, Long> heroAllAttribute, int teamId, User user) {
// ... 灵兽和神兵属性加成逻辑 ...
int num = Optional.ofNullable(user.getTeamPosManager().getTeamPosForHero().get(teamId)).map(List::size).orElse(0);
if (num == 0){
return;
}
//森罗环境固定为5
int heroNum = teamId == TeamEnum.TRIAL_TEAM.getTeamId()?5:num;
// 灵兽战力
int[][] pokemonAttr = calPokemonAttribute(user.getPokemonManager());
for (int i = 0; i < pokemonAttr.length; i++) {
pokemonAttr[i][1] = pokemonAttr[i][1] / heroNum;
}
combinedAttribute(pokemonAttr, heroAllAttribute);
// 神兵战力
int[][] magicSoldierAttribute = calMagicSoldierAttribute(user.getMagicSoldierManager());
combinedAttribute(magicSoldierAttribute, heroAllAttribute);
}
private void applyBonusesAttribute(Map<Integer, Long> heroAllAttribute, int heroSkin, User user) {
PlayerManager playerInfoManager = user.getPlayerInfoManager();
// ... 图鉴、皮肤、称号、坐骑等属性加成逻辑 ...
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());//神兵图鉴加成
if (!bookSet.isEmpty()) {
//计算图鉴加成
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
for (int bootId : bookSet) {
int[][] activePara = Optional.ofNullable(config.get(bootId)).map(SSpiritAnimalBook::getActivePara).orElse(new int[0][]);
combinedAttribute(activePara, heroAllAttribute);
}
// 灵兽战力
int[][] pokemonAttr = calPokemonAttribute(pokemonManager);
for (int i = 0; i < pokemonAttr.length; i++) {
pokemonAttr[i][1] = pokemonAttr[i][1] / heroNum;
}
combinedAttribute(pokemonAttr, heroAllAttribute);
// 神兵战力
int[][] magicSoldierAttribute = calMagicSoldierAttribute(soldierManager);
combinedAttribute(magicSoldierAttribute, heroAllAttribute);
}
//全部图鉴
HashSet<Integer> bookSet = new HashSet<>();
//灵兽图鉴加成
bookSet.addAll(pokemonManager.getPokemonBookEnabled());
//神将羁绊加成
bookSet.addAll(heroManager.getHeroHandBookEnabled());
//魂印图鉴加成
bookSet.addAll(equipManager.getEquipBookEnabled());
//白金装备加成
bookSet.addAll(itemManager.getEquipBookEnabled());
//神兵图鉴加成
bookSet.addAll(soldierManager.getMagicSoldierBook());
//计算图鉴加成
bonuses(bookSet, heroAllAttribute);
//英雄皮肤加成 记得判断皮肤过期
int skin = hero.getSkin();
if (skin != 0) {
Map<Integer, Integer> skinInfo = heroManager.getSkinInfo();
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skin);
if (heroSkin != 0) {
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(heroSkin);
if (sHeroSkin != null && sHeroSkin.getMonomerProperty() != null && sHeroSkin.getMonomerProperty().length > 0) {
if (skinInfo.containsKey(skin) && (skinInfo.get(skin) == -1 || skinInfo.get(skin) > TimeUtils.nowInt())) {
if (skinInfo.containsKey(heroSkin) && (skinInfo.get(heroSkin) == -1 || skinInfo.get(heroSkin) > TimeUtils.nowInt())) {
combinedAttribute(sHeroSkin.getMonomerProperty(), heroAllAttribute);
}
}
}
// 法宝聚灵总星级增加属性
// 玩家皮肤,称号,坐骑
List<Integer> list = new ArrayList<>();
list.addAll(playerInfoManager.getUserSkinValidTime().keySet());// 皮肤
list.addAll(playerInfoManager.getUserTitleValidTime().keySet());// 称号
list.addAll(playerInfoManager.getUserMountValidTime().keySet());// 坐骑
for (Integer id : list) {
SPlayerHeadIcon headIcon = SPlayerHeadIcon.getHeadIconMap().get(id);
if (headIcon == null){
continue;
}
combinedAttribute(headIcon.getUnlockProperty(), heroAllAttribute);
}
}
private void applyTrumpAndGemAttribute(Map<Integer, Long> heroAllAttribute, User user) {
// ... 法宝聚灵和命格增加属性逻辑 ...
HeroManager heroManager = user.getHeroManager();
// 法宝聚灵
Map<Integer, Integer> faBaoSoulMap = heroManager.getFaBaoSoulMap();
for (Map.Entry<Integer, Integer> faBaoSoulEntry : faBaoSoulMap.entrySet()) {
// 等级处理
STrump trumpConfig = STrump.sTrumpMap.get(faBaoSoulEntry.getKey());
STrumpLevelupPool lvUpProps = STrumpLevelupPool.levelPoolMap.get(trumpConfig.getLvupPool()).get(faBaoSoulEntry.getValue());
combinedAttribute(lvUpProps.getLvupProps(), heroAllAttribute);
}
Map<Integer, STrumpStar> trumpStarMap = STableManager.getConfig(STrumpStar.class);
// 按照累计星数倒叙排列
List<STrumpStar> trumpStars = trumpStarMap.values().stream().sorted(Comparator.comparing(STrumpStar::getStarNum).reversed()).collect(Collectors.toList());
// 玩家全部的总星级
int sumStar = heroManager.getFaBaoSoulMap().values().stream().mapToInt(v -> v).sum();
for (STrumpStar star : trumpStars) {
if (sumStar >= star.getStarNum()){
combinedAttribute(star.getPropList(), heroAllAttribute);
break;
}
}
//玩家皮肤加成
for (Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserSkinValidTime().entrySet()) {
if (!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())) {
int sumStar = faBaoSoulMap.values().stream().mapToInt(v -> v).sum();
STrumpStar trumpStar = null;
for (STrumpStar value : trumpStarMap.values()) {
// 星级处理
if (trumpStar == null){
trumpStar = value;
continue;
}
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(), heroAllAttribute);
}
//玩家称号加成
for (Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserTitleValidTime().entrySet()) {
if (!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())) {
continue;
if (trumpStar.getStarNum() < value.getStarNum()){
trumpStar = value;
}
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(), heroAllAttribute);
}
//玩家坐骑加成
for (Map.Entry<Integer, Long> entry : user.getPlayerInfoManager().getUserMountValidTime().entrySet()) {
if (!SPlayerHeadIcon.getHeadIconMap().containsKey(entry.getKey())) {
continue;
if (trumpStar != null) {
combinedAttribute(trumpStar.getPropList(), heroAllAttribute);
}
// 命格
for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
int lifeStoneId = entry.getValue();
if (lifeStoneId <= 0){
continue;
}
SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
}
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(), heroAllAttribute);
}
//四象心法加成
}
private void applyFourQuadrantAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
HeroManager heroManager = user.getHeroManager();
// ... 四象心法总属性加成 ...
for (Map.Entry<Integer, SixiangProfessionInfo> entry :heroManager.getSixiangDataMap().entrySet()) {
SCHero scHero = SCHero.getsCHero().get(heroTempId);
if (scHero.getProfession() != entry.getKey()) {
continue;
}
@ -2782,6 +2835,7 @@ public class HeroLogic {
combinedAttribute(upStarProp, heroAllAttribute);
}
}
///四象心法共鸣属性加成
if (heroManager.GetSiXiangGongMingLv() > 0) {
SFourQuadrantConfig fourConfig = SFourQuadrantConfig.configByStrtMap.get(heroManager.GetSiXiangGongMingLv());
@ -2799,10 +2853,13 @@ public class HeroLogic {
}
int[][] skillProp = ItemUtil.mapToArray(skillPropertyMap);
combinedAttribute(skillProp, heroAllAttribute);
}
//英雄好感度属性加成
if (heroManager.getHeroLikableMap().containsKey(scHero.getId())) {
int[][] likableProp = ItemUtil.mapToArray(heroManager.getHeroLikablePropAddMap(scHero.getId()));
private void applyHeroLikableAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
HeroManager heroManager = user.getHeroManager();
// ... 英雄好感度属性增加 ...
if (heroManager.getHeroLikableMap().containsKey(heroTempId)) {
int[][] likableProp = ItemUtil.mapToArray(heroManager.getHeroLikablePropAddMap(heroTempId));
combinedAttribute(likableProp, heroAllAttribute);
}
//英雄总好感度属性加成
@ -2811,26 +2868,10 @@ public class HeroLogic {
int[][] allLikableProp = ItemUtil.mapToArray(allLikablePropAddMap);
combinedAttribute(allLikableProp, heroAllAttribute);
}
}
///法宝之魂属性加成
for (Map.Entry<Integer, Integer> faBaoSoulEntry :heroManager.getFaBaoSoulMap().entrySet()) {
STrump trumpConfig = STrump.sTrumpMap.get(faBaoSoulEntry.getKey());
STrumpLevelupPool lvUpProps = STrumpLevelupPool.levelPoolMap.get(trumpConfig.getLvupPool()).get(faBaoSoulEntry.getValue());
combinedAttribute(lvUpProps.getLvupProps(), heroAllAttribute);
}
///命格属性加成
for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
int lifeStoneId=entry.getValue();
if (lifeStoneId>0){
SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
}
}
}
// 主角本身给英雄的加成
private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user){
// ... 主角和主角技能 ...
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
if (playerLevelConfig != null){
combinedAttribute(playerLevelConfig.getPropList(), heroAllAttribute);
@ -2838,7 +2879,7 @@ public class HeroLogic {
}
// 变身卡加成 / 主角技能
for (TransformationInfo info : heroManager.getTransformationList().values()) {
for (TransformationInfo info : user.getHeroManager().getTransformationList().values()) {
// 主角属性
calPlayerAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel());
// 英雄属性
@ -2850,29 +2891,93 @@ public class HeroLogic {
// if(SChangingForce.get(user.getHeroManager().getTransformationForce()) != null){
// combinedAttribute(SChangingForce.get(user.getHeroManager().getTransformationForce()).getPropList(), heroAllAttribute);
// }
}
// 装备套装属性
getEquipSuiteAttr(hero, heroAllAttribute);
private void applyEquipSuiteAttribute(Map<Integer, Long> heroAllAttribute, Hero hero){
//工坊科技树加成
Map<Integer, Integer> techProfressionMap = user.getWorkShopController().getTechnologyMap().get(scHero.getProfession());
if (techProfressionMap != null) {
for (Map.Entry<Integer, Integer> item : techProfressionMap.entrySet()) {
SWorkShopTechnology sWorkShopTechnology = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
if (sWorkShopTechnology == null) {
continue;
}
int[][] attrAdd = sWorkShopTechnology.getValues();
if (attrAdd != null && attrAdd.length > 0) {
combinedAttribute(attrAdd, heroAllAttribute);
// ... 获取装备套装属性 ...
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
Map<Integer, SEquipStrengthen> strengthenMap = SEquipStrengthen.lvMap;
Map<Integer, SEquipRankUp> rankUpMap = SEquipRankUp.lvMap;
Map<Integer, HeroEquipStrong> strongMap = hero.getEquipStrongMap();
int advanceLv = hero.getEquipAdvanceLv();
// 套装list初始化
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
while (iterator.hasNext()) {
Map.Entry<Integer, Integer> next = iterator.next();
SEquipConfig sEquipConfig = equipConfigMap.get(next.getValue());
int[][] property = sEquipConfig.getProperty();
Map<Integer, Long> propertyValueByIdMap = new HashMap<>();
for (int[] prop : property) {
long value = prop[1];
SPropertyConfig config = SPropertyConfig.getsPropertyConfigByPID(prop[0]);
// 家园装备强化属性,只增加基础属性
if (config != null && config.getStyle() == 1){
double buff = 0;
int strongLv = strongMap.getOrDefault(sEquipConfig.getPosition(),new HeroEquipStrong(sEquipConfig.getPosition())).getStrongLv();
buff += Optional.ofNullable(strengthenMap.get(strongLv)).map(SEquipStrengthen::getRate).orElse(0);
// 突破
buff += Optional.ofNullable(rankUpMap.get(advanceLv)).map(v -> v.getRate()[sEquipConfig.getPosition() - 1]).orElse(0);
value = value + (long) Math.ceil(buff/10000*value);
}
propertyValueByIdMap.put(prop[0], value);
}
combinedAttribute(propertyValueByIdMap, heroAllAttribute);
// 添加到套装list
suiteNumList.add(sEquipConfig);
}
//法宝加成
/*========== 开始处理套装 ============*/
// 根据升序顺序排列list
Collections.sort(suiteNumList);
// 记录当前长度(位置)
int num = suiteNumList.size();
if (!suiteNumList.isEmpty()) {
// 遍历套装list
for (SEquipConfig item : suiteNumList) {
//根据星级读取配置表,为空表示不是套装
SEquipSuiteConfig sEquipSuiteConfig = SEquipSuiteConfig.config.get(item.getStar());
if (null != sEquipSuiteConfig) {
// 根据套装数量读表,为空标是套装数量不足
Map<Integer, Long> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(num);
if (suitePropertyMap != null) {
// 计算战力
combinedAttribute(suitePropertyMap, heroAllAttribute);
}
}
// 不管是否是套装,都要-1
num -= 1;
}
}
}
private void applyWorkShopTechnologyAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
// ... 工坊和科技树 ...
SCHero scHero = SCHero.getsCHero().get(heroTempId);
Map<Integer, Integer> techProfressionMap = user.getWorkShopController().getTechnologyMap().get(scHero.getProfession());
if (techProfressionMap == null) {
return;
}
for (Map.Entry<Integer, Integer> item : techProfressionMap.entrySet()) {
SWorkShopTechnology sWorkShopTechnology = STableManager.getFigureConfig(CommonStaticConfig.class).getsWorkTechMapByTechIdAndLevel(item.getKey(), item.getValue());
if (sWorkShopTechnology == null) {
continue;
}
int[][] attrAdd = sWorkShopTechnology.getValues();
if (attrAdd != null && attrAdd.length > 0) {
combinedAttribute(attrAdd, heroAllAttribute);
}
}
}
private void applyEquipTalismanaAndFaxiangAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
// ... 法宝 ...
int heroStar = hero.getStar();
//判断是否解锁法宝
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (scHero.getEquipTalismana() != null && scHero.getEquipTalismana().length > 0 && heroStar >= scHero.getEquipTalismana()[0]) {
int equipTempId = scHero.getEquipTalismana()[1];
int tempStar = hero.getEspecialEquipLevelByHongmeng(user.getHeroManager(), hero.getId());
@ -2881,6 +2986,30 @@ public class HeroLogic {
combinedAttribute(equipTali.getProperty(), heroAllAttribute);
}
// ... 法相 ...
Set<String> faxiangList = hero.getFaxiangList();
if (faxiangList != null && !faxiangList.isEmpty()){
for (String id : faxiangList) {
Faxiang faxiang = user.getEquipManager().getFaxiang(id);
SFaxiangConfig config = SFaxiangConfig.faxiangMap.get(faxiang.getItemId());
SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv());
SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar());
int[][] levelPara = levelConfig.getLevelPara();
int[][] property = new int[levelPara.length][2];
for (int i = 0; i < levelPara.length; i++) {
int[] alone = levelPara[i];
property[i][0] = alone[0];
int value = (int)(alone[1] * (starConfig.getStarPara()/10000d+1));
property[i][1] = value;
}
combinedAttribute(property, heroAllAttribute);
}
}
}
private void applyJewelAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
// ... 魂灵宝属性 ...
EquipManager equipManager = user.getEquipManager();
Map<String, PropertyItem> equipMap = new HashMap<>();
// 助战英雄
HelpHero helpHero = HelpHeroLogic.getHelpHeroByHeroId(user.getId(), hero.getId());
@ -2889,10 +3018,9 @@ public class HeroLogic {
equipMap.put(jewel.getId(), jewel);
}
} else {
equipMap = hero.getCreateType() == 1 ? user.getExpeditionManager().getEquipMap() : user.getEquipManager().getEquipMap();
equipMap = hero.getCreateType() == 1 ? user.getExpeditionManager().getEquipMap() : equipManager.getEquipMap();
}
//宝器加成 魂灵宝
Set<String> jewelInfo = hero.getJewelInfo();
boolean flashing = jewelInfo.size() == 2;
int minLevel = -1;
@ -2981,32 +3109,13 @@ public class HeroLogic {
combinedAttribute(config.get(buildLevelProperty).getProperty(), heroAllAttribute);
}
}
}
// 法相加成
Set<String> faxiangList = hero.getFaxiangList();
if (faxiangList != null && !faxiangList.isEmpty()){
for (String id : faxiangList) {
Faxiang faxiang = equipManager.getFaxiang(id);
SFaxiangConfig config = SFaxiangConfig.faxiangMap.get(faxiang.getItemId());
SFaxiangLevelConfig levelConfig = SFaxiangLevelConfig.poolMap.get(config.getLevelUpPool()).get(faxiang.getStrongLv());
SFaxiangStarConfig starConfig = SFaxiangStarConfig.poolMap.get(config.getStar()).get(faxiang.getStar());
int[][] levelPara = levelConfig.getLevelPara();
int[][] property = new int[levelPara.length][2];
for (int i = 0; i < levelPara.length; i++) {
int[] alone = levelPara[i];
property[i][0] = alone[0];
int value = (int)(alone[1] * (starConfig.getStarPara()/10000d+1));
property[i][1] = value;
}
combinedAttribute(property, heroAllAttribute);
}
}
private void applySoulEquipAndGodSealAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, User user){
// ... 魂印和神印等属性加成 ...
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
//魂印
ArrayList<Integer> list = new ArrayList<>(hero.getSoulEquipByPositionMap().values());
//神印
ArrayList<Integer> list = new ArrayList<>();
list.addAll(hero.getSoulEquipByPositionMap().values());
list.addAll(hero.getGodSealByPositionMap().values());
for (Integer id : list) {
SEquipConfig sEquipConfig = equipConfigMap.get(id);
@ -3015,6 +3124,10 @@ public class HeroLogic {
combinedAttribute(property, heroAllAttribute);
}
}
}
private void applyXiuxingAndXiuxianAttribute(Map<Integer, Long> heroAllAttribute, User user){
// ... 修行和修仙 ...
// 修行等级属性加成
Map<Integer, SXiuXian> xiuXianMap = STableManager.getConfig(SXiuXian.class);
@ -3041,24 +3154,11 @@ public class HeroLogic {
combinedAttribute(otherAttriMaop, heroAllAttribute);
}
}
}
// //皮肤、称号加成 -- 前端未实现,暂时注释
// int decoration = user.getPlayerInfoManager().getDecoration();
// int designation = user.getPlayerInfoManager().getDesignation();
// if(decoration!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(decoration)!=null){
// combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(decoration).getProperty(),heroAllAttribute);
// }if(designation!=0&&SPlayerAppearance.sPlayerAppearanceMap.get(designation)!=null){
// combinedAttribute(SPlayerAppearance.sPlayerAppearanceMap.get(designation).getProperty(),heroAllAttribute);
// }
//
// //坐骑加成 -- 前端未实现,暂时注释
// if(user.getPlayerInfoManager().getRide()!=0){
// int rideLevel = user.getPlayerInfoManager().getRideLevel();
// int[][] property = SPlayerMountLevelUp.sPlayerMountLevelUpMap.get(rideLevel).getProperty();
// combinedAttribute(property,heroAllAttribute);
// }
//公会技能加成
private void applyGuildSkillAndVipAttribute(Map<Integer, Long> heroAllAttribute, int heroTempId, User user){
// ... 工会技能 ....
SCHero scHero = SCHero.getsCHero().get(heroTempId);
Map<Integer, Integer> guildSkill = user.getGuildMyInfo().getGuildSkill();
if (guildSkill.containsKey(scHero.getProfession())) {
int size = SGuildTechnology.technologyMap.get(scHero.getProfession()).size();
@ -3077,49 +3177,7 @@ public class HeroLogic {
combinedAttribute(arraySkills, heroAllAttribute);
}
//阵营光环加成
if (teamId != 0) {
try {
int[][] elementEffect = CombatLogic.getInstance().elementEffect(user, teamId);
if (elementEffect != null && elementEffect.length > 0) {
combinedAttribute(elementEffect, heroAllAttribute);
}
} catch (Exception e) {
e.printStackTrace();
}
}
//被动技能加成
Set<Integer> heroSkillList = CombatLogic.getInstance().passiveskillEffect(user, hero, teamId);
if (teamId == TeamEnum.EXPEDITION_TEAM.getTeamId()) {
ExpeditionManager expeditionManager = user.getExpeditionManager();
Set<SExpeditionHolyConfig> expeditionHolyConfigs = ExpeditionLogic.getFirstRankHoly(expeditionManager);
for (SExpeditionHolyConfig config : expeditionHolyConfigs) {
if (config.getPassiveSkillId() > 0) {
heroSkillList.add(config.getPassiveSkillId());
}
}
}
Map<Integer, Long> heroSkillAdMap = new HashMap<>();
for (Integer skill : heroSkillList) {
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if (null != config.getValue() && config.getValue().length > 2 && config.getValue()[2] != 4) {
PassiveskillCalEnum passiveskillCalEnum = PassiveskillCalEnum.calEnumMap.get(config.getType());
if (null != passiveskillCalEnum) {
passiveskillCalEnum.getPassiveSkillProcessor().process(config, hero, heroSkillAdMap,user,teamId);
}
}
}
if (!heroSkillAdMap.isEmpty()) {
combinedAttribute(heroSkillAdMap, heroAllAttribute);
heroSkillAdMap.clear();
}
//特权加成
// ... 特权属性 ...
int vipLevel = user.getPlayerInfoManager().getVipLevel();
SVipLevelConfig sVipLevelConfig = SVipLevelConfig.getsVipLevelConfigMap().get(vipLevel);
if (null != sVipLevelConfig) {
@ -3128,104 +3186,62 @@ public class HeroLogic {
combinedAttribute(elementEffect, heroAllAttribute);
}
}
}
if (teamId == TeamEnum.EXPEDITION_TEAM.getTeamId()) {
if (user.getExpeditionManager().getWorldTreasureReward().getIsBuy() == 1) {
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SKILL_EFFECT_TGMB);
combinedAttribute(new int[][]{onceArrayValue}, heroAllAttribute);
private void applyTeamAttribute(Map<Integer, Long> heroAllAttribute, boolean isForce, int teamId, User user){
// ... 阵营光环,大闹天宫,pvp属性 ...
if (teamId != 0) {
// 阵营光环加成
int[][] elementEffect = CombatLogic.getInstance().elementEffect(user, teamId);
if (elementEffect != null && elementEffect.length > 0) {
combinedAttribute(elementEffect, heroAllAttribute);
}
}
// 大闹天宫特殊加成
if (teamId == TeamEnum.EXPEDITION_TEAM.getTeamId() && user.getExpeditionManager().getWorldTreasureReward().getIsBuy() == 1) {
int[] onceArrayValue = SSpecialConfig.getOnceArrayValue(SSpecialConfig.SKILL_EFFECT_TGMB);
combinedAttribute(new int[][]{onceArrayValue}, heroAllAttribute);
}
//pvp队伍加成
if (!isForce && !TeamEnum.isPvpTeam(teamId)) {
heroAllAttribute.remove(HeroAttributeEnum.PVPDamageBocusFactor.getPropertyId());
heroAllAttribute.remove(HeroAttributeEnum.PVPDamageReduceFactor.getPropertyId());
}
calInteractAdd(heroAllAttribute, isForce);
heroSkillList.forEach(skill -> {
SPassiveSkillLogicConfig configTmp = SPassiveSkillLogicConfig.getConfig(skill);
if (null != configTmp.getValue() && configTmp.getValue().length > 2 && configTmp.getValue()[2] == 4) {
PassiveskillCalEnum passiveskillCalEnum = PassiveskillCalEnum.calEnumMap.get(configTmp.getType());
if (null != passiveskillCalEnum) {
passiveskillCalEnum.getPassiveSkillProcessor().process(configTmp, hero, heroSkillAdMap,user,teamId);
}
}
});
if (!heroSkillAdMap.isEmpty()) {
combinedAttribute(heroSkillAdMap, heroAllAttribute);
calInteractAdd(heroAllAttribute, isForce);
heroSkillAdMap.clear();
}
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
return heroAllAttribute;
}
/**
*
* @param hero
* @param heroAllAttribute
*/
private void getEquipSuiteAttr(Hero hero, Map<Integer, Long> heroAllAttribute){
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByPositionMap().entrySet().iterator();
private void applyPassiveSkillAttribute(Map<Integer, Long> heroAllAttribute, Hero hero, int teamId, User user){
// ...被动技能处理...
Set<Integer> heroSkillList = CombatLogic.getInstance().passiveskillEffect(user, hero, teamId);
Map<Integer, SEquipStrengthen> strengthenMap = SEquipStrengthen.lvMap;
Map<Integer, SEquipRankUp> rankUpMap = SEquipRankUp.lvMap;
Map<Integer, HeroEquipStrong> strongMap = hero.getEquipStrongMap();
int advanceLv = hero.getEquipAdvanceLv();
// 套装list初始化
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
while (iterator.hasNext()) {
Map.Entry<Integer, Integer> next = iterator.next();
SEquipConfig sEquipConfig = equipConfigMap.get(next.getValue());
int[][] property = sEquipConfig.getProperty();
Map<Integer, Long> propertyValueByIdMap = new HashMap<>();
for (int[] prop : property) {
long value = prop[1];
SPropertyConfig config = SPropertyConfig.getsPropertyConfigByPID(prop[0]);
// 家园装备强化属性,只增加基础属性
if (config != null && config.getStyle() == 1){
double buff = 0;
int strongLv = strongMap.getOrDefault(sEquipConfig.getPosition(),new HeroEquipStrong(sEquipConfig.getPosition())).getStrongLv();
buff += Optional.ofNullable(strengthenMap.get(strongLv)).map(SEquipStrengthen::getRate).orElse(0);
// 突破
buff += Optional.ofNullable(rankUpMap.get(advanceLv)).map(v -> v.getRate()[sEquipConfig.getPosition() - 1]).orElse(0);
value = value + (long) Math.ceil(buff/10000*value);
}
propertyValueByIdMap.put(prop[0], value);
}
combinedAttribute(propertyValueByIdMap, heroAllAttribute);
// 添加到套装list
suiteNumList.add(sEquipConfig);
// 大闹天宫队伍特殊处理
if (teamId == TeamEnum.EXPEDITION_TEAM.getTeamId()) {
ExpeditionManager expeditionManager = user.getExpeditionManager();
Set<SExpeditionHolyConfig> expeditionHolyConfigs = ExpeditionLogic.getFirstRankHoly(expeditionManager);
expeditionHolyConfigs.stream().filter(v->v.getPassiveSkillId() > 0).forEach(e -> heroSkillList.add(e.getPassiveSkillId()));
}
/*========== 开始处理套装 ============*/
// 根据升序顺序排列list
Collections.sort(suiteNumList);
// 记录当前长度(位置)
int num = suiteNumList.size();
if (!suiteNumList.isEmpty()) {
// 遍历套装list
for (SEquipConfig item : suiteNumList) {
//根据星级读取配置表,为空表示不是套装
SEquipSuiteConfig sEquipSuiteConfig = SEquipSuiteConfig.config.get(item.getStar());
if (null != sEquipSuiteConfig) {
// 根据套装数量读表,为空标是套装数量不足
Map<Integer, Long> suitePropertyMap = sEquipSuiteConfig.getSuiteMap().get(num);
if (suitePropertyMap != null) {
// 计算战力
combinedAttribute(suitePropertyMap, heroAllAttribute);
}
}
// 不管是否是套装,都要-1
num -= 1;
Map<Integer, Long> heroSkillAdMap = new HashMap<>();
Map<Integer, Long> heroSkillAdMap2 = new HashMap<>();
for (Integer skill : heroSkillList) {
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
float[] value = config.getValue();
if (value == null || value.length <= 2){
continue;
}
PassiveskillCalEnum passiveskillCalEnum = PassiveskillCalEnum.calEnumMap.get(config.getType());
if (passiveskillCalEnum == null){
continue;
}
if (value[2] == 4){
passiveskillCalEnum.getPassiveSkillProcessor().process(config, hero, heroSkillAdMap, user, teamId);
}else {
passiveskillCalEnum.getPassiveSkillProcessor().process(config, hero, heroSkillAdMap2, user, teamId);
}
}
combinedAttribute(heroSkillAdMap, heroAllAttribute);
combinedAttribute(heroSkillAdMap2, heroAllAttribute);
}
/**
@ -3383,9 +3399,8 @@ public class HeroLogic {
public int calForce(Map<Integer, Long> heroAllAttribute) {
double result;
float forceNum=0;//基础值
float forceAdd=0;//加成值
float forceNum = 0;//基础值
float forceAdd = 0;//加成值
//战力计算
for(Map.Entry<Integer, Long> item : heroAllAttribute.entrySet()){
Integer propertyId = item.getKey();
@ -3395,20 +3410,17 @@ public class HeroLogic {
continue;
}
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(propertyId);
if (sPropertyConfig==null){
continue;
}
if (sPropertyConfig.getScore()==0){
if (sPropertyConfig==null || sPropertyConfig.getScore()==0){
continue;
}
if(sPropertyConfig.getStyle() == GlobalsDef.PERCENT_TYPE){
LOGGER.info("result1 ================> {},{}" , item, sPropertyConfig.getScore());
forceAdd += propertyValue * sPropertyConfig.getScore() / 10000;
}else{
forceNum += propertyValue * sPropertyConfig.getScore();
}
}
result=forceNum+(forceNum*forceAdd);
float result = (forceAdd + 1) * forceNum;
return (int)result;
}
@ -3430,6 +3442,10 @@ public class HeroLogic {
int propertyValue = item[1];
heroAttributeMap.put(propertyId, heroAttributeMap.getOrDefault(propertyId, 0L) + propertyValue);
}
// ArrayList<int[][]> list = new ArrayList<>();
// list.add(otherAttriMap);
// Map<Integer, Long> mapObject = Utils.getItemMapObject(list);
// LOGGER.info("加成属性==>{}, ==>{}",mapObject,heroAttributeMap);
}
//新版穿装备
@ -5266,9 +5282,8 @@ public class HeroLogic {
* 鸿
*
* @param session
* @throws Exception
*/
public void addOrUpdateHongmeng(ISession session) throws Exception {
public void addOrUpdateHongmeng(ISession session) {
addOrUpdateHongmeng(session, false);
}
@ -5502,7 +5517,7 @@ public class HeroLogic {
}
}
} catch (Exception e) {
LOGGER.error("鸿蒙阵报错,{}",e);
LOGGER.error("鸿蒙阵报错,{}",e.getMessage());
}
}