diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index a42c7176e..e290f2de6 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -36,6 +36,13 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor }) return } +func (p *ModelHero) cloneTags(tags map[int32]int32) map[int32]int32 { + cloneTags := make(map[int32]int32) + for k, v := range tags { + cloneTags[k] = v + } + return cloneTags +} // 计算英雄战力 func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error) { @@ -50,7 +57,18 @@ func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error skillStar *cfg.GameFightingSkillStarData ) tmpHero = new(pb.DBHero) + //tmpHero = this.copyPoint(hero) *tmpHero = *hero // 克隆一个对象 + // tmpHero.Property = make(map[int32]int32) + // tmpHero.AddProperty = make(map[int32]int32) + // tmpHero.JuexProperty = make(map[int32]int32) + // tmpHero.HoroscopeProperty = make(map[int32]int32) + // tmpHero.TalentProperty = make(map[int32]int32) + tmpHero.Property = this.cloneTags(hero.Property) + tmpHero.AddProperty = this.cloneTags(hero.AddProperty) + tmpHero.JuexProperty = this.cloneTags(hero.JuexProperty) + tmpHero.HoroscopeProperty = this.cloneTags(hero.HoroscopeProperty) + tmpHero.TalentProperty = this.cloneTags(hero.TalentProperty) preValue = hero.Fightvalue if heroCfg, err = this.module.configure.GetHeroConfig(tmpHero.HeroID); err != nil { return