back_recharge
lvxinran 2020-04-16 15:09:03 +08:00
commit 7d40e3d2fd
9 changed files with 81 additions and 51 deletions

View File

@ -233,6 +233,7 @@ public class BehaviorUtil {
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
.setProperty(property.substring(0, property.length()-1))
.setPosition(teamPosHeroInfo.getPosition())
.build();
heroFightInfos.add(heroFightInfo);
}

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

@ -679,8 +679,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);
}
/**
@ -1023,21 +1021,39 @@ 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));
}
});
return skillList;
}
public void coverSkill(List<Integer> heroSkillList){
Set<Integer> coverSkillIds = new HashSet<>();
heroSkillList.forEach(skill->{
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getCoverID()!=0){
coverSkillIds.add(config.getCoverID());
}
});
heroSkillList.removeAll(coverSkillIds);
}
public StringBuilder getHeroSkills(User user,Hero hero, StringBuilder sb){
List<Integer> heroSkillList = getHeroSkillList(user, hero);
heroSkillList.forEach(skill->{
coverSkill(heroSkillList);
for(int i=0;i<heroSkillList.size();i++){
Integer skill = heroSkillList.get(i);
if(i<2){
sb.append(skill).append(DIVISION);
continue;
}
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if(config!=null &&config.getEffectiveRange()==1){
sb.append(skill).append(DIVISION);
}
});
}
return sb;
}
@ -1298,6 +1314,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);
}
@ -1343,7 +1363,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);
}
});
@ -1351,11 +1371,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()){
@ -1373,6 +1395,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));
@ -2047,15 +2070,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());
}
}
/**
@ -2116,9 +2130,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);

View File

@ -80,6 +80,7 @@ public class FightDataUtil {
unitData.set("professionId", sMonster.getProfession());
unitData.set("camp", 1);
unitData.set("type", sMonster.getType());
unitData.set("position", i+1);
unitData.set("quality", sMonster.getQuality());
unitData.set("element",sMonster.getPropertyName());
if (unitSkill.length==1){
@ -249,6 +250,7 @@ public class FightDataUtil {
unitData.set("camp", postion);
unitData.set("type", 1);
unitData.set("quality", 1);
unitData.set("position", data.getPosition());
unitData.set("element", hero.getPropertyName());
unitData.set("skill", getSkill(skillIds[0]));

View File

@ -351,7 +351,7 @@ public class ItemUtil {
String rewardStr = dropInfo.split("\\|")[0];
String weight = dropInfo.split("\\|")[1];
String[] rewards= rewardStr.split("#");
String[] weights= rewardStr.split("#");
String[] weights= weight.split("#");
for (int i = 0; i < rewards.length; i++) {
int rewardId = Integer.valueOf(rewards[i]);
if (dropAddition.contains(rewardId)) {

View File

@ -56,4 +56,8 @@ public class SPassiveSkillLogicConfig implements BaseConfig {
public int getEffectiveRange() {
return effectiveRange;
}
public int getCoverID() {
return coverID;
}
}