神魂绑定检测条件代码修改

back_recharge
yuanshuai 2021-11-01 18:32:03 +08:00
parent 3e2455b84a
commit 5c0c449856
2 changed files with 34 additions and 21 deletions

View File

@ -38,13 +38,15 @@ public class HeroGodSoulBindRequestHandler extends BaseHandler<HeroInfoProto.Her
LOGGER.error("当前神将神魂不能被激活"); LOGGER.error("当前神将神魂不能被激活");
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED); throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
} }
int index=0;
for (int[] ints : heroConfig.getSoul()) { for (int[] ints : heroConfig.getSoul()) {
if (ints[0]==godSoulLv){ if (ints[0]==godSoulLv){
boolean isCheckCondition=HeroLogic.getInstance().CheckHeroBindCondition(user,heroId,bindHeroList,ints[2],ints[3]); boolean isCheckCondition=HeroLogic.getInstance().CheckHeroBindCondition(user,heroId,bindHeroList,ints[2],ints[3],index);
if (!isCheckCondition){ if (!isCheckCondition){
LOGGER.error("选中的英雄不满足激活神魂条件"); LOGGER.error("选中的英雄不满足激活神魂条件");
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED); throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
} }
index+=ints[3];
} }
} }
for (String _heroId : bindHeroList) { for (String _heroId : bindHeroList) {

View File

@ -5775,34 +5775,45 @@ public class HeroLogic {
fBuilder.setLikableRemainTime(remainTime); fBuilder.setLikableRemainTime(remainTime);
} }
///神魂绑定检测条件是否满足 /**
public boolean CheckHeroBindCondition(User user,String heroId,List<String>bindHeroList,int heroRankupId,int needNum){ *
* @param user
* @param heroId
* @param bindHeroList
* @param heroRankupId id
* @param needNum
* @param index
* @return
*/
public boolean CheckHeroBindCondition(User user,String heroId,List<String>bindHeroList,int heroRankupId,int needNum,int index){
if (needNum+index>=bindHeroList.size())//首先判断数量是否满足条件
{
return false;
}
SHeroRankupGroup heroRankupGroup=STableManager.getConfig(SHeroRankupGroup.class).get(heroRankupId); SHeroRankupGroup heroRankupGroup=STableManager.getConfig(SHeroRankupGroup.class).get(heroRankupId);
Hero hero= user.getHeroManager().getHero(heroId); for (int i = index; i < needNum+index; i++) {
int num=0; Hero bindHero= user.getHeroManager().getHero(bindHeroList.get(i));
for (String heroDId : bindHeroList) { Hero hero= user.getHeroManager().getHero(heroId);
Hero bindHero= user.getHeroManager().getHero(heroDId); if (bindHero.getStar()<heroRankupGroup.getStarLimit()){//星级要求
if (bindHero.getStar()<heroRankupGroup.getStarLimit())continue; return false;
if (heroRankupGroup.getIsId()>0){ }
if (bindHero.getTemplateId()==heroRankupGroup.getIsId()) { if (heroRankupGroup.getIsId()>0){//需要指定神将
num++; if (bindHero.getTemplateId()!=heroRankupGroup.getIsId()) {
return false;
} }
}else if(heroRankupGroup.getIssame()>0) { }else if(heroRankupGroup.getIssame()>0) {//需要相同神将
if (bindHero.getTemplateId()==hero.getTemplateId()) { if (bindHero.getTemplateId()!=hero.getTemplateId()) {
num++; return false;
} }
}else { }else {
SCHero heroConfig=SCHero.getsCHero().get(bindHero.getTemplateId()); SCHero heroConfig=SCHero.getsCHero().get(hero.getTemplateId());
SCHero bindHeroConfig=SCHero.getsCHero().get(bindHero.getTemplateId()); SCHero bindHeroConfig=SCHero.getsCHero().get(bindHero.getTemplateId());
if (heroConfig.getPropertyName()==bindHeroConfig.getPropertyName()){ if (heroConfig.getPropertyName()!=bindHeroConfig.getPropertyName()){//需要同系神将
num++; return false;
} }
} }
if (num>=needNum){
return true;
}
} }
return false; return true;
} }
///获取英雄神魂技能 ///获取英雄神魂技能