编队修改
parent
55019f706a
commit
7650ddf064
|
@ -84,6 +84,7 @@ public interface GlobalsDef {
|
|||
//队伍
|
||||
int TEAM_ARENA_DEFENSE =101;//竞技场防御编队
|
||||
int TEAM_ARENA_ATTACH =201;//竞技场进攻编队
|
||||
int ENDLESS_TEAM = 401;//无尽编队
|
||||
int BLOODY_TEAM =701; //血战队伍
|
||||
int CHAMPION_ATTACK_TEAM =801; //
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ljsd.jieling.handler.map;
|
|||
import com.ljsd.fight.FightType;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
|
@ -340,7 +341,7 @@ public class MapLogic {
|
|||
break;
|
||||
}
|
||||
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
||||
if(teamId==401&&user.getMapManager().getEndlessMapInfo().getSeason()==endlessSeason){
|
||||
if(teamId==GlobalsDef.ENDLESS_TEAM&&user.getMapManager().getEndlessMapInfo().getSeason()==endlessSeason){
|
||||
Map<String, Integer> endlessHeroInfo = user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo();
|
||||
if(endlessHeroInfo!=null&&endlessHeroInfo.size()>0){
|
||||
if(initType!=2){
|
||||
|
@ -362,7 +363,7 @@ public class MapLogic {
|
|||
LOGGER.info("enterMap() uid=>{} team pos is wrong ", uid, teamId);
|
||||
return "阵容有误";
|
||||
}
|
||||
if(2 == initType && teamId!=401){
|
||||
if(2 == initType && teamId!=GlobalsDef.ENDLESS_TEAM){
|
||||
Map<Integer, Integer> foodBufferMap = mapManager.getFoodBufferMap();
|
||||
for(Map.Entry<Integer,Integer> item : foodBufferMap.entrySet()){
|
||||
Integer value = item.getValue();
|
||||
|
@ -1253,7 +1254,7 @@ public class MapLogic {
|
|||
}
|
||||
int teamId = mapManager.getTeamId();
|
||||
mapManager.setLastFightResult(resultCode);
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
mapManager.updateEndlessFightCount(1+mapManager.getEndlessMapInfo().getFightCount());
|
||||
}
|
||||
if (resultCode == 0) {
|
||||
|
@ -1305,7 +1306,7 @@ public class MapLogic {
|
|||
|
||||
}
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
for (int i = 0 ; i <team.size();i++) {
|
||||
Hero hero = user.getHeroManager().getHero(team.get(i).getHeroId());
|
||||
Map<Integer, Integer> heroAllAttribute = HeroLogic.getInstance().calHeroNotBufferAttribute(user, hero,false,teamId);
|
||||
|
@ -1557,7 +1558,7 @@ public class MapLogic {
|
|||
}
|
||||
int teamId = mapManager.getTeamId();
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==401){
|
||||
if(SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId()).getType()==4&&teamId==GlobalsDef.ENDLESS_TEAM){
|
||||
mapManager.updateEndlessFightCount(mapManager.getEndlessMapInfo().getFightCount()+1);
|
||||
if(checkResult[0]>0){
|
||||
for (int i = 0 ; i <team.size();i++) {
|
||||
|
@ -2999,7 +3000,7 @@ public class MapLogic {
|
|||
}
|
||||
endlessMapInfo.setEndlessHeroInfo(endlessHeroInfo);
|
||||
mapManager.setEndlessMapInfo(endlessMapInfo);
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(401);
|
||||
List<TeamPosHeroInfo> team = user.getTeamPosManager().getTeamPosForHero().get(GlobalsDef.ENDLESS_TEAM);
|
||||
if(team!=null&&team.size()>0){
|
||||
Set<String> cacheRemove = new HashSet<>();
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = mapManager.getHeroAllAttributeMap();
|
||||
|
@ -3021,7 +3022,7 @@ public class MapLogic {
|
|||
iterator.remove();
|
||||
}
|
||||
}
|
||||
user.getTeamPosManager().updateTeamPosByTeamId(401,team);
|
||||
user.getTeamPosManager().updateTeamPosByTeamId(GlobalsDef.ENDLESS_TEAM,team);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -747,6 +747,13 @@ public class MapManager extends MongoBase {
|
|||
endlessMapInfo.setConsumeExecution(count);
|
||||
updateString("endlessMapInfo.consumeExecution",endlessMapInfo.getConsumeExecution());
|
||||
}
|
||||
public void removeEndlessHero(String hero){
|
||||
Map<String, Integer> endlessHeroInfo = endlessMapInfo.getEndlessHeroInfo();
|
||||
if(endlessHeroInfo!=null){
|
||||
endlessHeroInfo.remove(hero);
|
||||
}
|
||||
updateString("endlessMapInfo",endlessMapInfo);
|
||||
}
|
||||
|
||||
public void updateEndlessOpenedMap(Set<Integer> mapIds){
|
||||
endlessMapInfo.setOpenMap(mapIds);
|
||||
|
|
|
@ -40,6 +40,7 @@ import util.TimeUtils;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class HeroLogic{
|
||||
|
@ -471,20 +472,26 @@ public class HeroLogic{
|
|||
|
||||
public void saveTeamPos(ISession iSession, int teamId, List<CommonProto.TeamHeroInfo> heroIds , List<CommonProto.TeamPokemonInfo> pokemonoIds) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Set<Integer> set = new HashSet<>();
|
||||
heroIds.forEach(heroId->set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId()));
|
||||
if(set.size()!=heroIds.size()){
|
||||
throw new ErrorCodeException(ErrorCode.NO_USE_SAME_HERO);
|
||||
}
|
||||
String err = checkTeamPos(user, teamId,heroIds,pokemonoIds);
|
||||
if(!"".equals(err)){
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode(err));
|
||||
}
|
||||
user.getTeamPosManager().changeTeamInfo(teamId,heroIds,pokemonoIds);
|
||||
//401图内可以更改编队
|
||||
if(teamId == 401){
|
||||
if(teamId == GlobalsDef.ENDLESS_TEAM){
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
if(teamPosHeroInfos!=null){
|
||||
List<String> heroes = new ArrayList<>(teamPosHeroInfos.size());
|
||||
Map<String, Map<Integer, Integer>> heroAllAttributeMap = new HashMap<>(teamPosHeroInfos.size());
|
||||
List<MapInfoProto.HeroInfo> indiHeros = new ArrayList<>();
|
||||
for (TeamPosHeroInfo heroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
Hero hero = heroManager.getHero(heroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
break;
|
||||
}
|
||||
|
@ -1810,15 +1817,32 @@ public class HeroLogic{
|
|||
//妖灵师是否在阵容中
|
||||
public boolean isBattleArray (User user,String heroId){
|
||||
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
|
||||
for (Map.Entry<Integer, List<TeamPosHeroInfo>> entry: teamPosForHero.entrySet() ){
|
||||
List<TeamPosHeroInfo> values = entry.getValue();
|
||||
for(TeamPosHeroInfo teamPosHeroInfo : values){
|
||||
if(heroId.equals(teamPosHeroInfo.getHeroId())){
|
||||
return true;
|
||||
}
|
||||
//判断是否不可下阵中有该英雄
|
||||
AtomicBoolean result = new AtomicBoolean(true);
|
||||
int[] teamId = SSpecialConfig.getOnceArrayValue(SSpecialConfig.HERO_RESOLVE_LICENCE);
|
||||
List<Integer> list = new ArrayList<>();
|
||||
Arrays.stream(teamId).forEach(i->list.add(i));
|
||||
|
||||
list.stream().filter(tId->teamPosForHero.containsKey(tId)).forEach(tId->teamPosForHero.get(tId).forEach(hero->{
|
||||
if(hero.getHeroId().equals(heroId)){
|
||||
result.set(false);
|
||||
}
|
||||
}));
|
||||
//直接删除英雄
|
||||
if(result.get()){
|
||||
teamPosForHero.entrySet().stream().filter(entry->
|
||||
!list.contains(entry.getKey())).forEach(entry->{
|
||||
entry.getValue().forEach(value->{
|
||||
if(value.getHeroId().equals(heroId)){
|
||||
teamPosForHero.get(entry.getKey()).remove(value);
|
||||
if(entry.getKey()==GlobalsDef.ENDLESS_TEAM&&user.getMapManager().getEndlessMapInfo().getEndlessHeroInfo().get(heroId)!=null){
|
||||
user.getMapManager().removeEndlessHero(heroId);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return false;
|
||||
return result.get();
|
||||
}
|
||||
|
||||
public int calPokenmonForce(Pokemon pokemon){
|
||||
|
|
|
@ -54,6 +54,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String TIME_LIMIT_RECRUITMENT_FREEINTEGRAL = "time_limit_recruitment_FreeIntegral";//东海寻仙每获得150分赠送一次免费招募
|
||||
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_RESOLVE_LICENCE = "hero_resolve_licence";//分解英雄时,处于编队中会有提示
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue