diff --git a/modules/robot/modulerobot_hero.go b/modules/robot/modulerobot_hero.go index 86d691016..b6b170ea2 100644 --- a/modules/robot/modulerobot_hero.go +++ b/modules/robot/modulerobot_hero.go @@ -84,24 +84,30 @@ func (this *ModuleRobot_Hero) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskDa bMax := false // 获取英雄数据 var bFound bool - for k, v := range this.heros { - if c, err := this.GMGetTalentByHeroId(k); err != nil { - for _, v1 := range this.talent { - if len(v1.Talent) == len(c) { - bMax = true - break - } - if v1.HeroId == v.HeroID { - bFound = true - resp.ObjId = v1.Id - resp.Heroid = v.HeroID - // 依次往后学 - if len(v1.Talent) < len(c) { - resp.TalentID = c[len(v1.Talent)].Skillid + for _, v := range this.heros { + if c, err := this.GMGetTalentByHeroId(v.HeroID); err == nil { + if this.talent == nil { + resp.TalentID = c[0].Skillid + resp.Heroid = v.HeroID + } else { + for _, v1 := range this.talent { + if len(v1.Talent) == len(c) { + bMax = true + break + } + if v1.HeroId == v.HeroID { + bFound = true + resp.ObjId = v1.Id + resp.Heroid = v.HeroID + // 依次往后学 + if len(v1.Talent) < len(c) { + resp.TalentID = c[len(v1.Talent)].Skillid + } + break } - break } } + } if bMax { // 当前英雄全满共鸣后 继续找下一个英雄 continue