神魂绑定检测条件代码修改
parent
3e2455b84a
commit
5c0c449856
|
@ -38,13 +38,15 @@ public class HeroGodSoulBindRequestHandler extends BaseHandler<HeroInfoProto.Her
|
|||
LOGGER.error("当前神将神魂不能被激活");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
int index=0;
|
||||
for (int[] ints : heroConfig.getSoul()) {
|
||||
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){
|
||||
LOGGER.error("选中的英雄不满足激活神魂条件");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
index+=ints[3];
|
||||
}
|
||||
}
|
||||
for (String _heroId : bindHeroList) {
|
||||
|
|
|
@ -5775,34 +5775,45 @@ public class HeroLogic {
|
|||
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);
|
||||
Hero hero= user.getHeroManager().getHero(heroId);
|
||||
int num=0;
|
||||
for (String heroDId : bindHeroList) {
|
||||
Hero bindHero= user.getHeroManager().getHero(heroDId);
|
||||
if (bindHero.getStar()<heroRankupGroup.getStarLimit())continue;
|
||||
if (heroRankupGroup.getIsId()>0){
|
||||
if (bindHero.getTemplateId()==heroRankupGroup.getIsId()) {
|
||||
num++;
|
||||
for (int i = index; i < needNum+index; i++) {
|
||||
Hero bindHero= user.getHeroManager().getHero(bindHeroList.get(i));
|
||||
Hero hero= user.getHeroManager().getHero(heroId);
|
||||
if (bindHero.getStar()<heroRankupGroup.getStarLimit()){//星级要求
|
||||
return false;
|
||||
}
|
||||
if (heroRankupGroup.getIsId()>0){//需要指定神将
|
||||
if (bindHero.getTemplateId()!=heroRankupGroup.getIsId()) {
|
||||
return false;
|
||||
}
|
||||
}else if(heroRankupGroup.getIssame()>0) {
|
||||
if (bindHero.getTemplateId()==hero.getTemplateId()) {
|
||||
num++;
|
||||
}else if(heroRankupGroup.getIssame()>0) {//需要相同神将
|
||||
if (bindHero.getTemplateId()!=hero.getTemplateId()) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
SCHero heroConfig=SCHero.getsCHero().get(bindHero.getTemplateId());
|
||||
SCHero heroConfig=SCHero.getsCHero().get(hero.getTemplateId());
|
||||
SCHero bindHeroConfig=SCHero.getsCHero().get(bindHero.getTemplateId());
|
||||
if (heroConfig.getPropertyName()==bindHeroConfig.getPropertyName()){
|
||||
num++;
|
||||
if (heroConfig.getPropertyName()!=bindHeroConfig.getPropertyName()){//需要同系神将
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (num>=needNum){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
///获取英雄神魂技能
|
||||
|
|
Loading…
Reference in New Issue