助战报错
parent
951219b8df
commit
40b74dc476
|
@ -22,6 +22,7 @@ import com.ljsd.jieling.logic.fight.eventhandler.MainLineOrInnerDemonFightHandle
|
|||
import com.ljsd.jieling.logic.help.HelpHero;
|
||||
import com.ljsd.jieling.logic.help.HelpHeroLogic;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.MonsterUtil;
|
||||
|
@ -216,10 +217,10 @@ public class BehaviorUtil {
|
|||
|
||||
fightInfo.put(RedisKey.FIGHT_HEROES, JsonFormat.printToString(fightTeamInfo));
|
||||
fightInfo.put(RedisKey.FIGHT_MONSTERS_1, JsonFormat.printToString(monsterGroupList.get(0)));
|
||||
if (monsterGroupList1.size() != 0){
|
||||
if (!monsterGroupList1.isEmpty()){
|
||||
fightInfo.put(RedisKey.FIGHT_MONSTERS_2, JsonFormat.printToString(monsterGroupList1.get(0)));
|
||||
}
|
||||
if (monsterGroupList2.size() != 0){
|
||||
if (!monsterGroupList2.isEmpty()){
|
||||
fightInfo.put(RedisKey.FIGHT_MONSTERS_3, JsonFormat.printToString(monsterGroupList2.get(0)));
|
||||
}
|
||||
fightInfo.put(RedisKey.FIGHT_SEED,Integer.toString(seed));
|
||||
|
@ -230,9 +231,6 @@ public class BehaviorUtil {
|
|||
|
||||
/**
|
||||
* 获取FightUnitInfo
|
||||
* @param user
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public static CommonProto.FightTeamInfo getFightTeamInfo(User user, int teamId,boolean isMySelf) {
|
||||
if(teamId==TeamEnum.TRIAL_TEAM.getTeamId()){
|
||||
|
@ -246,41 +244,49 @@ public class BehaviorUtil {
|
|||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
// 四灵试炼,助战
|
||||
if (FourChallengeLogic.isFourChallengeTeam(teamId)){
|
||||
HelpHero helpHero = HelpHeroLogic.getHelpHeroByHeroId(user.getId(), teamPosHeroInfo.getHeroId());
|
||||
if (helpHero == null){
|
||||
continue;
|
||||
}
|
||||
hero = helpHero.getHero();
|
||||
}
|
||||
CommonProto.FightUnitInfo builder;
|
||||
if (hero != null){
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,new StringBuilder()).toString();
|
||||
String property = HeroLogic.getInstance().getHeroProperty(user,hero,new StringBuilder(),isMySelf,teamId).toString();
|
||||
builder = getFightUnitInfo(hero, heroSkill, property, teamPosHeroInfo.getPosition());
|
||||
}
|
||||
if (hero == null) {
|
||||
else if(FourChallengeLogic.isFourChallengeTeam(teamId)){
|
||||
HelpHero helpHero = HelpHeroLogic.getHelpHeroByHeroId(user.getId(), teamPosHeroInfo.getHeroId());
|
||||
if (helpHero == null || helpHero.getHero() == null){
|
||||
continue;
|
||||
}
|
||||
User userByRpc = PlayerLogic.getInstance().getUserByRpc(helpHero.getUid());
|
||||
if (userByRpc == null){
|
||||
continue;
|
||||
}
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(userByRpc,helpHero.getHero(),new StringBuilder()).toString();
|
||||
String property = HeroLogic.getInstance().getHeroProperty(userByRpc,helpHero.getHero(),new StringBuilder(),isMySelf,teamId).toString();
|
||||
builder = getFightUnitInfo(helpHero.getHero(), heroSkill, property, teamPosHeroInfo.getPosition());
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
StringBuilder skillSb = new StringBuilder();
|
||||
StringBuilder propertySb = new StringBuilder();
|
||||
String heroSkill = HeroLogic.getInstance().getHeroSkills(user,hero,skillSb).toString();
|
||||
String property = HeroLogic.getInstance().getHeroProperty(user,hero,propertySb,isMySelf,teamId).toString();
|
||||
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setPosition(teamPosHeroInfo.getPosition())
|
||||
.setStar(hero.getStar())
|
||||
.setSkinId(hero.getSkin())
|
||||
.setGodSoulLv(hero.getGodSoulLv())
|
||||
.setPropertyId(hero.getPropertyId())
|
||||
.build();
|
||||
heroFightInfos.add(heroFightInfo);
|
||||
heroFightInfos.add(builder);
|
||||
}
|
||||
return HeroLogic.getInstance().combinationFightTeam(user,teamId,heroFightInfos);
|
||||
}
|
||||
|
||||
private static CommonProto.FightUnitInfo getFightUnitInfo(Hero hero, String heroSkill, String property, int position){
|
||||
return CommonProto.FightUnitInfo.newBuilder()
|
||||
.setUnitId(Integer.toString(hero.getTemplateId()))
|
||||
.setUnitSkillIds(heroSkill.substring(0,heroSkill.length()-1))
|
||||
.setProperty(property.substring(0, property.length()-1))
|
||||
.setPosition(position)
|
||||
.setStar(hero.getStar())
|
||||
.setSkinId(hero.getSkin())
|
||||
.setGodSoulLv(hero.getGodSoulLv())
|
||||
.setPropertyId(hero.getPropertyId())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新事件时 更新任务
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue