初始英雄技能

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

View File

@ -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)