# Conflicts:
#	tablemanager/src/main/java/config/SSpecialConfig.java
back_recharge
lvxinran 2020-04-15 17:20:23 +08:00
commit a2b94590ef
12 changed files with 344 additions and 42 deletions

View File

@ -174,9 +174,15 @@ public class MathUtils {
* @return * @return
*/ */
public static List<Integer> randomForOneArray(int sourceArray[], int randomNums) { public static List<Integer> randomForOneArray(int sourceArray[], int randomNums) {
List<Integer> result = new ArrayList<>(); List<Integer> result = new ArrayList<>();
if(randomNums==0){
return result;
}
int length = sourceArray.length; int length = sourceArray.length;
Set<Integer> cacheIndexs = new HashSet<>(); Set<Integer> cacheIndexs = new HashSet<>();
// 这种while循环我觉得还是尽量避免下 或者一定要有个循环上限
while (randomNums>0){ while (randomNums>0){
int randomPos = randomInt(length); int randomPos = randomInt(length);
if(cacheIndexs.contains(randomPos)){ if(cacheIndexs.contains(randomPos)){

View File

@ -115,11 +115,14 @@ public interface BIReason {
int EXPEDITION_DROP_REWARD = 66;//猎妖之路奖励 int EXPEDITION_DROP_REWARD = 66;//猎妖之路奖励
int UNLOAD_SOUL_REWARD = 67;//猎妖之路奖励 int UNLOAD_SOUL_REWARD = 67;//脱下魂印
int COMPLEX_EQUIP = 68;//合成装备 int COMPLEX_EQUIP = 68;//合成装备
int REPLACE_SOUL_REWARD = 69;//替换魂印
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级 int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
int SECRETBOX_CONSUME = 1001;//秘盒抽卡 int SECRETBOX_CONSUME = 1001;//秘盒抽卡

View File

@ -17,6 +17,8 @@ public class TeamPosManager extends MongoBase {
private int curTeamPosId; private int curTeamPosId;
@Transient @Transient
private Map<Integer,List<int[][]>> cacheTeamPro = new HashMap<>(5); private Map<Integer,List<int[][]>> cacheTeamPro = new HashMap<>(5);
@Transient
private Map<Integer,List<Integer>> cachePassskill = new HashMap<>(5);
public TeamPosManager(){ public TeamPosManager(){
this.setRootCollection(User._COLLECTION_NAME); this.setRootCollection(User._COLLECTION_NAME);
@ -96,6 +98,14 @@ public class TeamPosManager extends MongoBase {
cacheTeamPro.put(teamId,result); cacheTeamPro.put(teamId,result);
} }
public Map<Integer, List<Integer>> getCachePassskill() {
return cachePassskill;
}
public void updatePassSkillTeamPos(int teamId, List<Integer> result){
cachePassskill.put(teamId,result);
}
public void updateTeamPosByTeamId(int teamId,List<TeamPosHeroInfo> infos){ public void updateTeamPosByTeamId(int teamId,List<TeamPosHeroInfo> infos){
teamPosForHero.put(teamId,infos); teamPosForHero.put(teamId,infos);
updateString("teamPosForHero."+teamId,infos); updateString("teamPosForHero."+teamId,infos);

View File

@ -22,6 +22,7 @@ import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SecretEvent; import com.ljsd.jieling.logic.activity.event.SecretEvent;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum; import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic; import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic; import com.ljsd.jieling.logic.mail.MailLogic;
@ -735,6 +736,41 @@ public class CombatLogic {
return ""; return "";
} }
public List<Integer> passiveskillEffect(User user,Hero targetHero,int teamId){
List<Integer> passiveskillEffect = new ArrayList<>();
if(teamId == 0){
List<Integer> heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, targetHero);
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()!=1 && PassiveskillCalEnum.contains(config.getType())){
passiveskillEffect.add(config.getId());
}
});
return passiveskillEffect;
}
List<Integer> result = user.getTeamPosManager().getCachePassskill().get(teamId);
if(result!=null){
return result;
}
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for(TeamPosHeroInfo teamPosHeroInfo :teamPosHeroInfos){
Hero hero = heroMap.get(teamPosHeroInfo.getHeroId());
List<Integer> heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, hero);
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()!=1 && PassiveskillCalEnum.contains(config.getType())){
passiveskillEffect.add(config.getId());
}
});
}
user.getTeamPosManager().updatePassSkillTeamPos(teamId,passiveskillEffect);
return passiveskillEffect;
}
public static List<int[][]> elementEffect(User user,int teamId){ public static List<int[][]> elementEffect(User user,int teamId){
List<int[][]> teamParm = user.getTeamPosManager().getCacheTeamPro().get(teamId); List<int[][]> teamParm = user.getTeamPosManager().getCacheTeamPro().get(teamId);
if(teamParm!=null){ if(teamParm!=null){
@ -809,14 +845,14 @@ public class CombatLogic {
} }
effect[0] = normalProperties; effect[0] = normalProperties;
effect[1] = special; effect[1] = special;
for(int i = 0 ; i<effect.length;i++){ /* for(int i = 0 ; i<effect.length;i++){
if(effect[i].length>2){ if(effect[i].length>2){
// LOGGER.info("生效的光环为{}{}{}",effect[i][0],effect[i][1],effect[i][2]); // LOGGER.info("生效的光环为{}{}{}",effect[i][0],effect[i][1],effect[i][2]);
}else{ }else{
// LOGGER.info("生效的光环为{}{}",effect[i][0],effect[i][1]); // LOGGER.info("生效的光环为{}{}",effect[i][0],effect[i][1]);
} }
} }*/
List<int[][]> resultEffect = new ArrayList<>(); List<int[][]> resultEffect = new ArrayList<>();
for(int i = 0; i <effect.length;i++){ for(int i = 0; i <effect.length;i++){
for(Map.Entry<Integer,SElementalResonanceConfig> entry:configMap.entrySet()){ for(Map.Entry<Integer,SElementalResonanceConfig> entry:configMap.entrySet()){
@ -825,10 +861,10 @@ public class CombatLogic {
} }
} }
} }
Iterator<int[][]> it = resultEffect.iterator(); /* Iterator<int[][]> it = resultEffect.iterator();
while (it.hasNext()){ while (it.hasNext()){
int[][] next = it.next(); int[][] next = it.next();
} }*/
user.getTeamPosManager().updateTeamPos(teamId,resultEffect); user.getTeamPosManager().updateTeamPos(teamId,resultEffect);
return resultEffect; return resultEffect;
} }

View File

@ -0,0 +1,10 @@
package com.ljsd.jieling.logic.fight.passiveSkillCal;
import com.ljsd.jieling.logic.dao.Hero;
import config.SPassiveSkillLogicConfig;
import java.util.Map;
public interface PassiveSkillProcessor {
void process(SPassiveSkillLogicConfig config, Hero hero, Map<Integer, Integer> sourceMap, Map<Integer, Integer> heroSkillAdMap);
}

View File

@ -0,0 +1,116 @@
package com.ljsd.jieling.logic.fight.passiveSkillCal;
import com.ljsd.jieling.core.GlobalsDef;
import config.SPropertyConfig;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
//90 94 171
public enum PassiveskillCalEnum {
SingleAdd(90,(config,hero,sourceMap,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[0];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
int optCode = (int) value[2];
//转换
float parm = value[1];
if(optCode%2==0){
if( sPropertyConfig.getStyle()!= GlobalsDef.PERCENT_TYPE){
sPropertyConfig = SPropertyConfig.getsPropertyConfigByTargetPropertyId(sPropertyConfig.getPropertyId());
}
parm = value[1]*10000;
}
int extreeValue = (int) cal(optCode, sourceMap.getOrDefault(sPropertyConfig.getPropertyId(), 0), parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extreeValue);
}),
AllAdd(94,(config,hero,sourceMap,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[1];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
int optCode = (int) value[2];
//转换
float parm = value[0];
if(optCode%2==0){
if( sPropertyConfig.getStyle()!= GlobalsDef.PERCENT_TYPE){
sPropertyConfig = SPropertyConfig.getsPropertyConfigByTargetPropertyId(sPropertyConfig.getPropertyId());
}
parm = value[0]*10000;
}
int extreeValue = (int) cal(optCode, sourceMap.getOrDefault(sPropertyConfig.getPropertyId(), 0), parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extreeValue);
}),
HEROAFTER100ADD(171,(config,hero,sourceMap,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[0];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
int level = hero.getLevel();
int times=level-100;
if(times<=0){
return;
}
int parm = (int) value[1]*times;
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+parm);
}),//武将100级后每升一级[c]额外增加[d]
;
private int type;
private PassiveSkillProcessor passiveSkillProcessor;
PassiveskillCalEnum(int type,PassiveSkillProcessor passiveSkillProcessor) {
this.type = type;
this.passiveSkillProcessor = passiveSkillProcessor;
}
public static Map<Integer,PassiveskillCalEnum> calEnumMap = new HashMap<>();
static {
Arrays.stream(PassiveskillCalEnum.values()).forEach(e->{
calEnumMap.put(e.type,e);
});
}
public PassiveSkillProcessor getPassiveSkillProcessor() {
return passiveSkillProcessor;
}
public static Map<Integer, PassiveskillCalEnum> getCalEnumMap() {
return calEnumMap;
}
public static boolean contains(int type){
return calEnumMap.containsKey(type);
}
/**
* @param optCode
* @param source
* @param parm
* a() oab
* 1 a+b
* 2 a+oa*b
* 3 a-b
* 4 a*(1-b)
*/
public static float cal(int optCode,int source,float parm){
switch (optCode){
case 1:{
return parm;
}
case 2:{
return parm*10000;
}
case 3:{
return -parm;
}
case 4:{
return -parm*10000;
}
}
return 0f;
}
}

View File

@ -18,6 +18,7 @@ import com.ljsd.jieling.logic.activity.eventhandler.HeroFiveStarGetEventHandler;
import com.ljsd.jieling.logic.dao.*; import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User; import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic; import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.fight.passiveSkillCal.PassiveskillCalEnum;
import com.ljsd.jieling.logic.item.ItemLogic; import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.logic.mission.GameEvent; import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.MissionLoigc; import com.ljsd.jieling.logic.mission.MissionLoigc;
@ -678,6 +679,7 @@ public class HeroLogic{
HeroInfoProto.UpHeroLevelResponse build = HeroInfoProto.UpHeroLevelResponse.newBuilder().setHeroId(heroId).setTargetLevel(hero.getLevel()).build(); HeroInfoProto.UpHeroLevelResponse build = HeroInfoProto.UpHeroLevelResponse.newBuilder().setHeroId(heroId).setTargetLevel(hero.getLevel()).build();
//发送成功消息 //发送成功消息
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,build,true); MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.UP_HERO_LEVEL_RESPONSE_VALUE,build,true);
calHeoForce(user,hero);
} }
@ -983,19 +985,12 @@ public class HeroLogic{
return result; return result;
} }
public StringBuilder getHeroSkills(User user,Hero hero, StringBuilder sb){ public List<Integer> getHeroSkillList(User user,Hero hero){
List<Integer> skillList = new ArrayList<>();
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId()); SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
for (Integer skillId : tempHero.getSkillListByStar(hero.getStar())) { skillList.addAll(tempHero.getSkillListByStar(hero.getStar()));
sb.append(skillId).append(DIVISION); skillList.addAll( tempHero.getPassiveSkills(1,hero.getBreakId()));
} skillList.addAll( tempHero.getPassiveSkills(2,hero.getStarBreakId()));
Map<Integer, Map<Integer, List<Integer>>> passiveSkillMap = tempHero.getPassiveSkillMap();
passiveSkillMap.get(1).getOrDefault(hero.getBreakId(),new ArrayList<>()).forEach(skillId->{
sb.append(skillId).append(DIVISION);
});
passiveSkillMap.get(2).getOrDefault(hero.getBreakId(),new ArrayList<>()).forEach(skillId->{
sb.append(skillId).append(DIVISION);
});
Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap(); Map<Integer, String> equipByPositionMap = hero.getEquipByPositionMap();
if(!equipByPositionMap.isEmpty()){ if(!equipByPositionMap.isEmpty()){
@ -1007,21 +1002,40 @@ public class HeroLogic{
} }
int skillId = equipMap.get(equipId).getSkill(); int skillId = equipMap.get(equipId).getSkill();
if(skillId!=0){ if(skillId!=0){
sb.append(skillId).append(DIVISION); skillList.add(skillId);
} }
} }
} }
//魂印
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
soulEquipByPositionMap.values().forEach(e->{
if(config.get(e).getPassiveSkill()!=0){
skillList.add(config.get(e).getPassiveSkill());
}
});
//法宝技能 //法宝技能
int[] equipTalismana = tempHero.getEquipTalismana(); int[] equipTalismana = tempHero.getEquipTalismana();
if(hero.getStar()<equipTalismana[0]){ if(hero.getStar()<equipTalismana[0]){
return sb; return skillList;
} }
int especialEquipLevel = hero.getEspecialEquipLevel(); int especialEquipLevel = hero.getEspecialEquipLevel();
int especialEquipId = equipTalismana[1]; int especialEquipId = equipTalismana[1];
Map<Integer,SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId); Map<Integer,SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
sEquipTalismana.forEach((k,v)->{ sEquipTalismana.forEach((k,v)->{
if(k<especialEquipLevel&&v.getOpenSkillRules()!=null){ if(k<especialEquipLevel&&v.getOpenSkillRules()!=null){
Arrays.stream(v.getOpenSkillRules()).forEach(i->sb.append(i).append(DIVISION)); Arrays.stream(v.getOpenSkillRules()).forEach(i->skillList.add(i));
}
});
return skillList;
}
public StringBuilder getHeroSkills(User user,Hero hero, StringBuilder sb){
List<Integer> heroSkillList = getHeroSkillList(user, hero);
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()==1){
sb.append(skill).append(DIVISION);
} }
}); });
return sb; return sb;
@ -1305,6 +1319,12 @@ public class HeroLogic{
combinedAttribute(property,heroAllAttribute); combinedAttribute(property,heroAllAttribute);
} }
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
Map<Integer, SEquipConfig> equipConfigMap = STableManager.getConfig(SEquipConfig.class);
soulEquipByPositionMap.values().forEach(e->{
combinedAttribute( equipConfigMap.get(e).getProperty(),heroAllAttribute);
});
//阵营光环加成 //阵营光环加成
if(!isForce){ if(!isForce){
if(teamId!=0){ if(teamId!=0){
@ -1316,14 +1336,43 @@ public class HeroLogic{
} }
} }
} }
//被动技能加成
List<Integer> heroSkillList = CombatLogic.getInstance().passiveskillEffect(user, hero,teamId);
Map<Integer, Integer> heroSkillAdMap = new HashMap<>();
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config.getValue()[2] !=4){
PassiveskillCalEnum.calEnumMap.get(config.getType()).getPassiveSkillProcessor().process(config,hero,heroAllAttribute,heroSkillAdMap);
}
});
if(!heroSkillAdMap.isEmpty()){
combinedAttribute(heroSkillAdMap,heroAllAttribute);
heroSkillAdMap.clear();
}
calInteractAdd(heroAllAttribute); calInteractAdd(heroAllAttribute);
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig configTmp = SPassiveSkillLogicConfig.getConfig(skill);
if(configTmp.getValue()[2] ==4){
PassiveskillCalEnum.calEnumMap.get(configTmp.getType()).getPassiveSkillProcessor().process(configTmp,hero,heroAllAttribute,heroSkillAdMap);
}
});
if(!heroSkillAdMap.isEmpty()){
combinedAttribute(heroSkillAdMap,heroAllAttribute);
calInteractAdd(heroAllAttribute);
heroSkillAdMap.clear();
}
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE)); heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
//装备战力保存 //装备战力保存
heroAllAttribute.put(HeroAttributeEnum.EquipForce.getPropertyId(),equipForce); heroAllAttribute.put(HeroAttributeEnum.EquipForce.getPropertyId(),equipForce);
return heroAllAttribute; return heroAllAttribute;
} }
public Map<Integer,Integer> calRobotHeroAttribute(SCHero scHero,int heroLevel,int heroBrekId,int[] pokemonIds,int pokemonLevel,boolean isForce){ public Map<Integer,Integer> calRobotHeroAttribute(SCHero scHero,int heroLevel,int heroBrekId,int[] pokemonIds,int pokemonLevel,boolean isForce){
Map<Integer, Integer> heroAllAttribute = calRobotHeroAllAttribute(scHero.getId(),heroLevel,heroBrekId,isForce); Map<Integer, Integer> heroAllAttribute = calRobotHeroAllAttribute(scHero.getId(),heroLevel,heroBrekId,isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE)); heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
@ -1412,7 +1461,7 @@ public class HeroLogic{
Map<Integer, Integer> heroAllAttribute; Map<Integer, Integer> heroAllAttribute;
heroAllAttribute = calHeroNotBufferAttribute(user, hero,true,0); heroAllAttribute = calHeroNotBufferAttribute(user, hero,true,0);
//战力保存 //战力保存
int force = calForce(heroAllAttribute); int force = calForce(heroAllAttribute);
return force + heroAllAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId()); return force + heroAllAttribute.get(HeroAttributeEnum.EquipForce.getPropertyId());
} }
@ -2017,34 +2066,61 @@ public class HeroLogic{
int uid = iSession.getUid(); int uid = iSession.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
String heroId = optHeroSoul.getHeroId(); String heroId = optHeroSoul.getHeroId();
System.out.println(heroId);
Hero hero = user.getHeroManager().getHero(heroId); Hero hero = user.getHeroManager().getHero(heroId);
checkAllowedOpt(2,user,hero.getStar()); checkAllowedOpt(2,user,hero.getStar());
checkAllowedWear(user,hero.getTemplateId(),optHeroSoul.getSoulEquipIdsList(),unload); checkAllowedWear(user,hero,optHeroSoul.getSoulEquipIdsList(),unload);
Map<Integer,Integer> returnItems = new HashMap<>();
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
optHeroSoul.getSoulEquipIdsList().forEach(e->{ optHeroSoul.getSoulEquipIdsList().forEach(e->{
if(soulEquipByPositionMap.containsKey(e.getPosition())){
returnItems.put(soulEquipByPositionMap.get(e.getPosition()),1);
}
hero.updateSoulEquipPositionMap(e.getPosition(),e.getEquipId()); hero.updateSoulEquipPositionMap(e.getPosition(),e.getEquipId());
}); });
ItemUtil.dropMap(user,returnItems,BIReason.REPLACE_SOUL_REWARD);
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.SOUL_EQUIP_WEAR_RESPONSE_VALUE,null,true); MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.SOUL_EQUIP_WEAR_RESPONSE_VALUE,null,true);
} }
private void checkAllowedWear(User user,int targetHeroTid,List<HeroInfoProto.SoulEquipPos> soulEquipIdsList, HeroInfoProto.OptHeroSoul unload) throws Exception { private void checkAllowedWear(User user,Hero targetHero,List<HeroInfoProto.SoulEquipPos> soulEquipIdsList, HeroInfoProto.OptHeroSoul unload) throws Exception {
int targetHeroTid = targetHero.getTemplateId();
List<Integer> equids = new ArrayList<>(); List<Integer> equids = new ArrayList<>();
Map<Integer, Integer> soulEquipByPositionMap = targetHero.getSoulEquipByPositionMap();
Collection<Integer> values = soulEquipByPositionMap.values();
for(HeroInfoProto.SoulEquipPos item:soulEquipIdsList){
if(values.contains(item.getEquipId()) && soulEquipByPositionMap.get(item.getPosition()) != item.getEquipId()){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
}
soulEquipIdsList.forEach(e->equids.add(e.getEquipId())); soulEquipIdsList.forEach(e->equids.add(e.getEquipId()));
List<Integer> unloadSoulIds = new ArrayList<>(); List<Integer> unloadSoulIds = new ArrayList<>();
if(unload!=null){ Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
if(unload!=null && !StringUtil.isEmpty(unload.getHeroId())){
String heroId = unload.getHeroId();
List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList(); List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList();
soulEquipIdsListUnload.forEach(e->{ Map<Integer, Integer> unloadSoulEquipByPositionMap = heroMap.get(heroId).getSoulEquipByPositionMap();
equids.remove(e.getEquipId()); for(HeroInfoProto.SoulEquipPos soulEquipPos:soulEquipIdsListUnload){
unloadSoulIds.add(e.getEquipId()); unloadSoulIds.add(soulEquipPos.getEquipId());
}); if(unloadSoulEquipByPositionMap.get(soulEquipPos.getPosition())!=soulEquipPos.getEquipId()){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
}
equids.removeAll(unloadSoulIds);
} }
//是否魂印能被本英雄佩戴 //是否魂印能被本英雄佩戴
//是否只能一名武将佩戴 //是否只能一名武将佩戴
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
Set<Integer> cacheIds = new HashSet<>(); Set<Integer> cacheIds = new HashSet<>();
int userLevel = user.getPlayerInfoManager().getLevel();
for(HeroInfoProto.SoulEquipPos item:soulEquipIdsList){ for(HeroInfoProto.SoulEquipPos item:soulEquipIdsList){
int equipId = item.getEquipId(); int equipId = item.getEquipId();
int[] sign_locations = SSpecialConfig.getOnceArrayValue("Sign_Location");
int position = item.getPosition();
if(position<sign_locations.length|| position>sign_locations.length-1 || userLevel < sign_locations[position]){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
}
SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipId); SEquipConfig sEquipConfig = STableManager.getConfig(SEquipConfig.class).get(equipId);
if(sEquipConfig.getRangeHeroTids()!=null && !sEquipConfig.getRangeHeroTids().contains(targetHeroTid)){ if(sEquipConfig.getRangeHeroTids()!=null && !sEquipConfig.getRangeHeroTids().contains(targetHeroTid)){
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE); throw new ErrorCodeException(ErrorCode.SERVER_DEFINE);
@ -2074,7 +2150,7 @@ public class HeroLogic{
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH); throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
} }
} }
if(unload!=null){ if(unload!=null&&!StringUtil.isEmpty(unload.getHeroId())){
Hero hero = user.getHeroManager().getHero(unload.getHeroId()); Hero hero = user.getHeroManager().getHero(unload.getHeroId());
List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList(); List<HeroInfoProto.SoulEquipPos> soulEquipIdsListUnload = unload.getSoulEquipIdsList();
soulEquipIdsListUnload.forEach(e->{ soulEquipIdsListUnload.forEach(e->{
@ -2124,6 +2200,9 @@ public class HeroLogic{
} }
public static void unloadSoulEquipOpt(ISession iSession, String heroId, List<HeroInfoProto.SoulEquipPos> equipIdsList) throws Exception { public static void unloadSoulEquipOpt(ISession iSession, String heroId, List<HeroInfoProto.SoulEquipPos> equipIdsList) throws Exception {
if(equipIdsList == null || equipIdsList.isEmpty()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int uid = iSession.getUid(); int uid = iSession.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
Hero hero = user.getHeroManager().getHero(heroId); Hero hero = user.getHeroManager().getHero(heroId);

View File

@ -60,7 +60,7 @@ public class SCHero implements BaseConfig{
private Map<Integer, Map<Integer, ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar; private Map<Integer, Map<Integer, ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
private Map<Integer,Map<Integer,List<Integer>>> passiveSkillMap; private Map<Integer,TreeMap<Integer,List<Integer>>> passiveSkillMap;
private static Map<Integer,SCHero> piecesMap; private static Map<Integer,SCHero> piecesMap;
@ -147,9 +147,9 @@ public class SCHero implements BaseConfig{
} }
scHero.setSkillListByStar(skillTmp); scHero.setSkillListByStar(skillTmp);
Map<Integer,Map<Integer,List<Integer>>> passiveSkillMapTmp = new HashMap<>(); Map<Integer,TreeMap<Integer,List<Integer>>> passiveSkillMapTmp = new HashMap<>();
passiveSkillMapTmp.put(1,new HashMap<>()); passiveSkillMapTmp.put(1,new TreeMap<>());
passiveSkillMapTmp.put(2,new HashMap<>()); passiveSkillMapTmp.put(2,new TreeMap<>());
for(int[] openSkillRule : scHero.getOpenPassiveSkillRules()){ for(int[] openSkillRule : scHero.getOpenPassiveSkillRules()){
int type = openSkillRule[0]; int type = openSkillRule[0];
@ -292,11 +292,15 @@ public class SCHero implements BaseConfig{
return equipTalismana; return equipTalismana;
} }
public Map<Integer, Map<Integer, List<Integer>>> getPassiveSkillMap() {
return passiveSkillMap; public List<Integer> getPassiveSkills(int type,int id){
if( passiveSkillMap.get(type).floorEntry(id)==null){
return new ArrayList<>(0);
}
return passiveSkillMap.get(type).floorEntry(id).getValue();
} }
public void setPassiveSkillMap(Map<Integer, Map<Integer, List<Integer>>> passiveSkillMap) { public void setPassiveSkillMap(Map<Integer, TreeMap<Integer, List<Integer>>> passiveSkillMap) {
this.passiveSkillMap = passiveSkillMap; this.passiveSkillMap = passiveSkillMap;
} }
} }

View File

@ -19,6 +19,8 @@ public class SEquipConfig implements BaseConfig {
private int[] propertyMin; private int[] propertyMin;
private int[][] property;
private int[] propertyMax; private int[] propertyMax;
private int[] pool; private int[] pool;
@ -160,4 +162,8 @@ public class SEquipConfig implements BaseConfig {
public int getPassiveSkill() { public int getPassiveSkill() {
return passiveSkill; return passiveSkill;
} }
public int[][] getProperty() {
return property;
}
} }

View File

@ -18,6 +18,10 @@ public class SPassiveSkillLogicConfig implements BaseConfig {
private int weight; private int weight;
private int effectiveRange;
private int coverID;
public static Map<Integer, SPassiveSkillLogicConfig> config; public static Map<Integer, SPassiveSkillLogicConfig> config;
@Override @Override
@ -48,4 +52,8 @@ public class SPassiveSkillLogicConfig implements BaseConfig {
public int getWeight() { public int getWeight() {
return weight; return weight;
} }
public int getEffectiveRange() {
return effectiveRange;
}
} }

View File

@ -9,8 +9,6 @@ import java.util.Map;
@Table(name ="PropertyConfig") @Table(name ="PropertyConfig")
public class SPropertyConfig implements BaseConfig { public class SPropertyConfig implements BaseConfig {
private int id;
private int propertyId; private int propertyId;
private int style; private int style;
@ -21,19 +19,35 @@ public class SPropertyConfig implements BaseConfig {
private int ifFormula; private int ifFormula;
private int propertyIdInBattle;
private static Map<Integer,SPropertyConfig> sPropertyConfigByPIDMap; private static Map<Integer,SPropertyConfig> sPropertyConfigByPIDMap;
private static Map<Integer,SPropertyConfig> sPropertyIConfigByInBattleMap;
private static Map<Integer,SPropertyConfig> sPropertyConfigByTargetMap;
@Override @Override
public void init() throws Exception { public void init() throws Exception {
Map<Integer,SPropertyConfig> sPropertyConfigByPIDMapTmp = new HashMap<>(); Map<Integer,SPropertyConfig> sPropertyConfigByPIDMapTmp = new HashMap<>();
Map<Integer,SPropertyConfig> sPropertyIConfigByInBattleMapTmp = new HashMap<>();
Map<Integer,SPropertyConfig> sPropertyConfigByTargetMapTmp = new HashMap<>();
Map<Integer, SPropertyConfig> config = STableManager.getConfig(SPropertyConfig.class); Map<Integer, SPropertyConfig> config = STableManager.getConfig(SPropertyConfig.class);
for(SPropertyConfig sPropertyConfig : config.values()){ for(SPropertyConfig sPropertyConfig : config.values()){
int propertyId = sPropertyConfig.getPropertyId(); int propertyId = sPropertyConfig.getPropertyId();
sPropertyConfigByPIDMapTmp.put(propertyId,sPropertyConfig); sPropertyConfigByPIDMapTmp.put(propertyId,sPropertyConfig);
int propertyIdInBattle = sPropertyConfig.getPropertyIdInBattle();
if(propertyIdInBattle!=0){
sPropertyIConfigByInBattleMapTmp.put(propertyIdInBattle,sPropertyConfig);
}
int targetPropertyId = sPropertyConfig.getTargetPropertyId();
if(targetPropertyId!=0){
sPropertyConfigByTargetMapTmp.put(targetPropertyId,sPropertyConfig);
}
} }
sPropertyConfigByPIDMap = sPropertyConfigByPIDMapTmp; sPropertyConfigByPIDMap = sPropertyConfigByPIDMapTmp;
sPropertyIConfigByInBattleMap = sPropertyIConfigByInBattleMapTmp;
sPropertyConfigByTargetMap = sPropertyConfigByTargetMapTmp;
} }
@ -41,10 +55,15 @@ public class SPropertyConfig implements BaseConfig {
return sPropertyConfigByPIDMap.get(propertyId); return sPropertyConfigByPIDMap.get(propertyId);
} }
public int getId() { public static SPropertyConfig getsPropertyConfigByBattlePID(int battlePropertyId) {
return id; return sPropertyIConfigByInBattleMap .get(battlePropertyId);
} }
public static SPropertyConfig getsPropertyConfigByTargetPropertyId(int targetPropertyId) {
return sPropertyConfigByTargetMap.get(targetPropertyId);
}
public int getPropertyId() { public int getPropertyId() {
return propertyId; return propertyId;
} }
@ -64,4 +83,8 @@ public class SPropertyConfig implements BaseConfig {
public int getIfFormula() { public int getIfFormula() {
return ifFormula; return ifFormula;
} }
public int getPropertyIdInBattle() {
return propertyIdInBattle;
}
} }

View File

@ -55,6 +55,7 @@ public class SSpecialConfig implements BaseConfig {
public static final String HERO_RETURN_PERCENT = "hero_return_percent";//回溯返还材料比例 实际百分比为填写数值/10000 public static final String HERO_RETURN_PERCENT = "hero_return_percent";//回溯返还材料比例 实际百分比为填写数值/10000
public static final String HERO_SACRIFICE_PERCENT = "hero_sacrifice_percent";//献祭返还材料比例 实际百分比为填写数值/10000 public static final String HERO_SACRIFICE_PERCENT = "hero_sacrifice_percent";//献祭返还材料比例 实际百分比为填写数值/10000
public static final String HERO_RESOLVE_LICENCE = "hero_resolve_licence";//分解英雄时,处于编队中会有提示 public static final String HERO_RESOLVE_LICENCE = "hero_resolve_licence";//分解英雄时,处于编队中会有提示
public static final String Sign_Location = "Sign_Location";//魂印位置开启条件(玩家等级)
@Override @Override
public void init() throws Exception { public void init() throws Exception {