初始英雄技能

This commit is contained in:
zhaocy 2022-07-04 11:43:27 +08:00
parent 491b7a271e
commit d3fc1d40e9
2 changed files with 29 additions and 8 deletions

View File

@ -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() cfg, err := this.getHeroConfigure()
if err != nil { if err != nil {
return nil return nil
} }
if v, ok := cfg.GetDataMap()[heroId]; ok { if v, ok := cfg.GetDataMap()[heroCfgId]; ok {
return v return v
} }
return nil return nil

View File

@ -39,7 +39,6 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
HeroID: heroCfg.Hid, HeroID: heroCfg.Hid,
Star: heroCfg.Star, //初始星级 Star: heroCfg.Star, //初始星级
Lv: 1, //初始等级 Lv: 1, //初始等级
NormalSkill: []*pb.SkillData{}, //初始技能
IsOverlying: true, //是否允许叠加, IsOverlying: true, //是否允许叠加,
Block: false, //未锁定 Block: false, //未锁定
CardType: heroCfg.Type, //卡片类型 CardType: heroCfg.Type, //卡片类型
@ -50,9 +49,31 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero {
Energy: make(map[int32]int32), Energy: make(map[int32]int32),
Property: make(map[string]int32), Property: make(map[string]int32),
} }
this.initHeroSkill(newHero)
return 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) { func (this *ModelHero) createOneHero(uid string, heroCfgId int32) (err error) {
hero := this.initHero(uid, heroCfgId) hero := this.initHero(uid, heroCfgId)