team force

back_recharge
wangyuan 2020-04-16 11:52:20 +08:00
parent 322f1735b7
commit bbd9fe8271
5 changed files with 53 additions and 48 deletions

View File

@ -88,6 +88,8 @@ public class TeamPosManager extends MongoBase {
public void setCurTeamPosId(int curTeamPosId) {
this.curTeamPosId = curTeamPosId;
//缓存失效
cachePassskill.remove(curTeamPosId);
}
public Map<Integer, List<int[][]>> getCacheTeamPro() {

View File

@ -738,34 +738,42 @@ public class CombatLogic {
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);
List<Integer> heroSkillList = HeroLogic.getInstance().getHeroSkillList(user, targetHero);
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()!=1 && config.getType()!=94 && PassiveskillCalEnum.contains(config.getType())){
passiveskillEffect.add(config.getId());
}
});
if(teamId!=0){
List<Integer> result = user.getTeamPosManager().getCachePassskill().get(teamId);
if(result!=null){
passiveskillEffect.addAll(result);
return passiveskillEffect;
}
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);
for(TeamPosHeroInfo teamPosHeroInfo :teamPosHeroInfos){
Hero hero = heroMap.get(teamPosHeroInfo.getHeroId());
List<Integer> heroSkillListTmp = HeroLogic.getInstance().getHeroSkillList(user, hero);
heroSkillListTmp.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()!=1 && config.getType()==94){
passiveskillEffect.add(config.getId());
}
});
}
user.getTeamPosManager().updatePassSkillTeamPos(teamId,passiveskillEffect);
}else{
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()!=1 && PassiveskillCalEnum.contains(config.getType())){
if(config!=null &&config.getEffectiveRange()!=1 && config.getType()==94){
passiveskillEffect.add(config.getId());
}
});
}
user.getTeamPosManager().updatePassSkillTeamPos(teamId,passiveskillEffect);
return passiveskillEffect;
}

View File

@ -6,5 +6,5 @@ import config.SPassiveSkillLogicConfig;
import java.util.Map;
public interface PassiveSkillProcessor {
void process(SPassiveSkillLogicConfig config, Hero hero, Map<Integer, Integer> sourceMap, Map<Integer, Integer> heroSkillAdMap);
void process(SPassiveSkillLogicConfig config, Hero hero, Map<Integer, Integer> heroSkillAdMap);
}

View File

@ -9,7 +9,7 @@ import java.util.Map;
//90 94 171
public enum PassiveskillCalEnum {
SingleAdd(90,(config,hero,sourceMap,heroSkillAdMap)->{
SingleAdd(90,(config,hero,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[0];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
@ -23,10 +23,10 @@ public enum PassiveskillCalEnum {
parm = value[1]*10000;
}
int extreeValue = (int) cal(optCode, sourceMap.getOrDefault(sPropertyConfig.getPropertyId(), 0), parm);
int extreeValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extreeValue);
}),
AllAdd(94,(config,hero,sourceMap,heroSkillAdMap)->{
AllAdd(94,(config,hero,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[1];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
@ -39,10 +39,10 @@ public enum PassiveskillCalEnum {
}
parm = value[0]*10000;
}
int extreeValue = (int) cal(optCode, sourceMap.getOrDefault(sPropertyConfig.getPropertyId(), 0), parm);
int extreeValue = (int) cal(optCode, parm);
heroSkillAdMap.put(sPropertyConfig.getPropertyId(),heroSkillAdMap.getOrDefault(sPropertyConfig.getPropertyId(),0)+extreeValue);
}),
HEROAFTER100ADD(171,(config,hero,sourceMap,heroSkillAdMap)->{
HEROAFTER100ADD(171,(config,hero,heroSkillAdMap)->{
float[] value = config.getValue();
int battlePropertyId = (int) value[0];
SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByBattlePID(battlePropertyId);
@ -87,7 +87,6 @@ public enum PassiveskillCalEnum {
/**
* @param optCode
* @param source
* @param parm
* a() oab
* 1 a+b
@ -95,19 +94,19 @@ public enum PassiveskillCalEnum {
* 3 a-b
* 4 a*(1-b)
*/
public static float cal(int optCode,int source,float parm){
public static float cal(int optCode,float parm){
switch (optCode){
case 1:{
return parm;
}
case 2:{
return parm*10000;
return parm;
}
case 3:{
return -parm;
}
case 4:{
return -parm*10000;
return -parm;
}
}
return 0f;

View File

@ -672,8 +672,6 @@ public class HeroLogic{
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);
calHeoForce(user,hero);
}
/**
@ -1016,7 +1014,7 @@ public class HeroLogic{
int especialEquipId = equipTalismana[1];
Map<Integer,SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
sEquipTalismana.forEach((k,v)->{
if(k<especialEquipLevel&&v.getOpenSkillRules()!=null){
if(k<=especialEquipLevel&&v.getOpenSkillRules()!=null){
Arrays.stream(v.getOpenSkillRules()).forEach(i->skillList.add(i));
}
});
@ -1291,6 +1289,10 @@ public class HeroLogic{
int tempStar = hero.getEspecialEquipLevel();
Map<Integer, Map<Integer, SEquipTalismana>> equipTalismanaMap = SEquipTalismana.equipTalismanaStarMap;
SEquipTalismana equipTali = equipTalismanaMap.get(equipTempId).get(tempStar);
Arrays.stream(equipTali.getProperty()).forEach(e->{
System.out.println("----------" + e[0] +"----" +e[1] );
});
combinedAttribute(equipTali.getProperty(),heroAllAttribute);
}
@ -1336,7 +1338,7 @@ public class HeroLogic{
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config.getValue()[2] !=4){
PassiveskillCalEnum.calEnumMap.get(config.getType()).getPassiveSkillProcessor().process(config,hero,heroAllAttribute,heroSkillAdMap);
PassiveskillCalEnum.calEnumMap.get(config.getType()).getPassiveSkillProcessor().process(config,hero,heroSkillAdMap);
}
});
@ -1344,11 +1346,13 @@ public class HeroLogic{
combinedAttribute(heroSkillAdMap,heroAllAttribute);
heroSkillAdMap.clear();
}
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);
PassiveskillCalEnum.calEnumMap.get(configTmp.getType()).getPassiveSkillProcessor().process(configTmp,hero,heroSkillAdMap);
}
});
if(!heroSkillAdMap.isEmpty()){
@ -1366,6 +1370,7 @@ public class HeroLogic{
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);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
@ -2023,15 +2028,6 @@ public class HeroLogic{
}
hero.setIsLock(lockState);
MessageUtil.sendMessage(session,1,responseMsgId,null,true);
Map<Integer,Integer> pokemonAttributeMap = new HashMap<>();
Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
for(Pokemon pokemon : pokemonMap.values()){
combinePokemonAttribute(pokemonAttributeMap, pokemon,false);
}
for(Map.Entry<Integer,Integer> item : pokemonAttributeMap.entrySet()){
LOGGER.info("the proId={},the value={}",item.getKey(),item.getValue());
}
}
/**
@ -2092,9 +2088,9 @@ public class HeroLogic{
int userLevel = user.getPlayerInfoManager().getLevel();
for(HeroInfoProto.SoulEquipPos item:soulEquipIdsList){
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]){
int[] sign_locations = SSpecialConfig.getOnceArrayValue(SSpecialConfig.Sign_Location);
int position = item.getPosition()-1;
if(position<0||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);