From 1b15516ac3355a98ecdd74935ea317aa1b10e035 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Mon, 28 Aug 2023 14:08:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E5=9B=9E=E5=93=8D?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/robot/modulerobot_hero.go | 36 ++++++++++++++++++------------- 1 file changed, 21 insertions(+), 15 deletions(-) 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