diff --git a/modules/hero/configure_comp.go b/modules/hero/configure_comp.go index e5f8a2310..686e45aad 100644 --- a/modules/hero/configure_comp.go +++ b/modules/hero/configure_comp.go @@ -198,12 +198,12 @@ func (this *configureComp) GetHeroStargrow() (configure *cfg.Game_heroStargrow, } //获取英雄配置 -func (this *configureComp) GetHero(heroId int32) *cfg.Game_newHeroData { +func (this *configureComp) GetHero(heroCfgId int32) *cfg.Game_newHeroData { cfg, err := this.getHeroConfigure() if err != nil { return nil } - if v, ok := cfg.GetDataMap()[heroId]; ok { + if v, ok := cfg.GetDataMap()[heroCfgId]; ok { return v } return nil diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 9a80d1680..400b72482 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -37,12 +37,11 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero { Id: objId, Uid: uid, HeroID: heroCfg.Hid, - Star: heroCfg.Star, //初始星级 - Lv: 1, //初始等级 - NormalSkill: []*pb.SkillData{}, //初始技能 - IsOverlying: true, //是否允许叠加, - Block: false, //未锁定 - CardType: heroCfg.Type, //卡片类型 + Star: heroCfg.Star, //初始星级 + Lv: 1, //初始等级 + IsOverlying: true, //是否允许叠加, + Block: false, //未锁定 + CardType: heroCfg.Type, //卡片类型 Skins: []int32{}, EquipID: make([]string, 6), //初始装备 SameCount: 1, //默认叠加数量 @@ -50,9 +49,31 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero { Energy: make(map[int32]int32), Property: make(map[string]int32), } + this.initHeroSkill(newHero) return newHero } +//初始化英雄技能 +func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData { + heroCfg := this.moduleHero.configure.GetHero(hero.HeroID) + if heroCfg != nil { + skills := []*pb.SkillData{{ + SkillID: heroCfg.Skill1, + SkillLv: 1, + }, { + SkillID: heroCfg.Skill2, + SkillLv: 1, + }, { + SkillID: heroCfg.Skill3, + SkillLv: 1, + }} + hero.NormalSkill = skills + hero.CaptainSkill = heroCfg.Skill + } + + return nil +} + //创建一个指定的英雄 func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (err error) { hero := this.initHero(uid, heroCfgId)