礼物装备

master_ob2
PC-202302260912\Administrator 2023-09-13 17:15:03 +08:00
parent ab67613577
commit 89c41eec78
2 changed files with 83 additions and 59 deletions

View File

@ -2394,10 +2394,59 @@ public class HeroLogic {
return sb; return sb;
} }
public CommonProto.FightTeamInfo combinationFightTeam(User user, int teamId, List<CommonProto.FightUnitInfo> heroFightInfos){
return CommonProto.FightTeamInfo.newBuilder()
.addAllFightUnitList(heroFightInfos)
.addAllPokemonUnitList(HeroLogic.getInstance().getNotHeroFightUnitInfo(user))
.addAllMagicSoldierList(HeroLogic.getInstance().getMagicSolderFightUnitInfo(user))
.setTeamPassiveList("")
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user))
.setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId))
.build();
}
/**
*
* @param user
* @return
*/
public List<CommonProto.FightUnitInfo> getNotHeroFightUnitInfo(User user) {
List<CommonProto.FightUnitInfo> pokemonInfos = new ArrayList<>();
// 灵兽
getPokemonFightUnitInfo(user, pokemonInfos);
// 主角技
getPlayerFightUnitInfo(user, pokemonInfos);
return pokemonInfos;
}
public void getPokemonFightUnitInfo(User user, List<CommonProto.FightUnitInfo> pokemonInfos) {
//灵兽
Map<Integer, String> pokemonTeamMap = user.getPokemonManager().getPokemonTeamMap();
PokemonManager pokemonManager = user.getPokemonManager();
for (Map.Entry<Integer, String> entry : pokemonTeamMap.entrySet()) {
Pokemon pokemon = pokemonManager.getPokemonMap().get(entry.getValue());
if (pokemon == null) {
continue;
}
SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar());
Map<Integer, Integer> map = calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel());
StringBuilder propertyBuilder = getOnePokemonProperty(map, pokemon.getLevel());
CommonProto.FightUnitInfo info = CommonProto.FightUnitInfo.newBuilder()
.setPosition(entry.getKey())
.setStar(pokemon.getStar())
.setProperty(propertyBuilder.toString())
.setUnitId(String.valueOf(pokemon.getTmpId()))
.setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId()))
.build();
pokemonInfos.add(info);
}
}
/** /**
* *
*/ */
public void getPracticeSkill(User user, List<CommonProto.FightUnitInfo> pokemonList) { public void getPlayerFightUnitInfo (User user, List<CommonProto.FightUnitInfo> pokemonList) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
HashMap<Integer, Long> attrMap = new HashMap<>(); HashMap<Integer, Long> attrMap = new HashMap<>();
@ -2410,8 +2459,7 @@ public class HeroLogic {
// 获取属性 // 获取属性
calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel()); calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel());
}catch (Exception e){ }catch (Exception e){
LOGGER.error("获取主角技能报错:{}", e.getMessage()); LOGGER.error("获取主角技能报错:{}", e.getMessage(),e);
e.printStackTrace();
} }
} }
@ -2425,6 +2473,16 @@ public class HeroLogic {
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel()); SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap); combinedAttribute(playerLevelConfig.getPlayerPropList(), attrMap);
// 主角礼物属性
Set<Integer> giftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
for (Integer id : giftEquipList) {
SEquipConfig config = SEquipConfig.equipConfigMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), attrMap);
}
// 属性 // 属性
String property = getPlayerProperty(attrMap); String property = getPlayerProperty(attrMap);
@ -2462,57 +2520,12 @@ public class HeroLogic {
// 去除最后一位得#号 // 去除最后一位得#号
} }
public CommonProto.FightTeamInfo combinationFightTeam(User user, int teamId, List<CommonProto.FightUnitInfo> heroFightInfos){
return CommonProto.FightTeamInfo.newBuilder()
.addAllFightUnitList(heroFightInfos)
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
.addAllMagicSoldierList(HeroLogic.getInstance().getMagicSolderSkills(user))
.setTeamPassiveList("")
.setSpecialPassive(SpecialForTeamBuildEnum.toParm(teamId, user))
.setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId))
.build();
}
/**
*
* @param user
* @return
*/
public List<CommonProto.FightUnitInfo> getPokemonSkills(User user) {
//灵兽
Map<Integer, String> pokemonTeamMap = user.getPokemonManager().getPokemonTeamMap();
PokemonManager pokemonManager = user.getPokemonManager();
List<CommonProto.FightUnitInfo> pokemonInfos = new ArrayList<>();
for (Map.Entry<Integer, String> entry : pokemonTeamMap.entrySet()) {
Pokemon pokemon = pokemonManager.getPokemonMap().get(entry.getValue());
if (pokemon == null) {
continue;
}
SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar());
Map<Integer, Integer> map = calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel());
StringBuilder propertyBuilder = getOnePokemonProperty(map, pokemon.getLevel());
CommonProto.FightUnitInfo info = CommonProto.FightUnitInfo.newBuilder()
.setPosition(entry.getKey())
.setStar(pokemon.getStar())
.setProperty(propertyBuilder.toString())
.setUnitId(String.valueOf(pokemon.getTmpId()))
.setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId()))
.build();
pokemonInfos.add(info);
}
// 变身卡
getPracticeSkill(user, pokemonInfos);
return pokemonInfos;
}
/** /**
* *
* @param user * @param user
* @return * @return
*/ */
public List<CommonProto.FightUnitInfo> getMagicSolderSkills(User user) { public List<CommonProto.FightUnitInfo> getMagicSolderFightUnitInfo(User user) {
List<CommonProto.FightUnitInfo> MagicSolderInfos = new ArrayList<>(); List<CommonProto.FightUnitInfo> MagicSolderInfos = new ArrayList<>();
MagicSoldierManager soldierManager = user.getMagicSoldierManager(); MagicSoldierManager soldierManager = user.getMagicSoldierManager();
for (String id : soldierManager.getMember()) { for (String id : soldierManager.getMember()) {
@ -2674,6 +2687,8 @@ public class HeroLogic {
Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero, isForce); Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero, isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE)); heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
// 主角属性加成
applyPlayerAndSkill(heroAllAttribute, user);
// 灵兽和神兵 // 灵兽和神兵
applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user); applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user);
// 图鉴,皮肤,称号,坐骑等。。。 // 图鉴,皮肤,称号,坐骑等。。。
@ -2684,8 +2699,6 @@ public class HeroLogic {
applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user); applyHeroLikableAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 法宝聚灵和命格属性加成 // 法宝聚灵和命格属性加成
applyTrumpAndGemAttribute(heroAllAttribute, user); applyTrumpAndGemAttribute(heroAllAttribute, user);
// 主角和主角技
applyPlayerAndSkill(heroAllAttribute, user);
// 工坊科技树加成(疑似废弃) // 工坊科技树加成(疑似废弃)
applyWorkShopTechnologyAttribute(heroAllAttribute, hero.getTemplateId(), user); applyWorkShopTechnologyAttribute(heroAllAttribute, hero.getTemplateId(), user);
// 装备和套装属性 // 装备和套装属性
@ -2901,11 +2914,16 @@ public class HeroLogic {
calPlayerCardAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel()); calPlayerCardAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel());
} }
//化身之力提供的属性 // 礼物主角属性
// Map<Integer, SChangingForce> SChangingForce = STableManager.getConfig(SChangingForce.class); Set<Integer> playerGiftEquipList = user.getPlayerInfoManager().getPlayerGiftEquipList();
// if(SChangingForce.get(user.getHeroManager().getTransformationForce()) != null){ Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
// combinedAttribute(SChangingForce.get(user.getHeroManager().getTransformationForce()).getPropList(), heroAllAttribute); for (Integer id : playerGiftEquipList) {
// } SEquipConfig config = configMap.get(id);
if (config == null){
continue;
}
combinedAttribute(config.getPlayerProperty(), heroAllAttribute);
}
} }
private void applyEquipSuiteAttribute(Map<Integer, Long> heroAllAttribute, Hero hero){ private void applyEquipSuiteAttribute(Map<Integer, Long> heroAllAttribute, Hero hero){
@ -3344,7 +3362,7 @@ public class HeroLogic {
if (style == GlobalsDef.ABSOLUTE_TYPE || targetPro.getStyle() == GlobalsDef.PERCENT_TYPE) { if (style == GlobalsDef.ABSOLUTE_TYPE || targetPro.getStyle() == GlobalsDef.PERCENT_TYPE) {
if (heroAllAttribute.containsKey(targetPropertyId)) { if (heroAllAttribute.containsKey(targetPropertyId)) {
long targetValue = heroAllAttribute.getOrDefault(targetPropertyId, 0L); long targetValue = heroAllAttribute.getOrDefault(targetPropertyId, 0L);
effectValue += targetValue; effectValue += (int) targetValue;
heroAllAttribute.put(targetPropertyId, (long) effectValue); heroAllAttribute.put(targetPropertyId, (long) effectValue);
} else { } else {
newAddAttribute.merge(targetPropertyId, (long) effectValue, Long::sum); newAddAttribute.merge(targetPropertyId, (long) effectValue, Long::sum);
@ -3941,7 +3959,7 @@ public class HeroLogic {
SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star); SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star);
combinedAttribute(cardStar.getPlayerPropList(), attrMap); combinedAttribute(cardStar.getPlayerPropList(), attrMap);
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); LOGGER.error("计算主角属性报错error{}",e.getMessage(),e);
} }
} }
@ -3969,7 +3987,7 @@ public class HeroLogic {
} }
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); LOGGER.error("计算主角变身卡属性报错error{}",e.getMessage(),e);
} }
} }

View File

@ -22,6 +22,8 @@ public class SEquipConfig implements BaseConfig,Comparable<SEquipConfig> {
private int[][] property; private int[][] property;
private int[][] playerProperty;
private int[] propertyMax; private int[] propertyMax;
private int[] pool; private int[] pool;
@ -207,6 +209,10 @@ public class SEquipConfig implements BaseConfig,Comparable<SEquipConfig> {
return gift; return gift;
} }
public int[][] getPlayerProperty() {
return playerProperty;
}
@Override @Override
public int compareTo(SEquipConfig o) { public int compareTo(SEquipConfig o) {
return this.getStar() - o.getStar(); return this.getStar() - o.getStar();