上传 装备属性计算不一致bug
This commit is contained in:
parent
0f0411a5b3
commit
52be8710cb
@ -36,7 +36,7 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化英雄
|
// 初始化英雄
|
||||||
func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
|
func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
|
||||||
heroCfg, _ := this.module.configure.GetHeroConfig(heroCfgId)
|
heroCfg, _ := this.module.configure.GetHeroConfig(heroCfgId)
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
|
|||||||
return newHero
|
return newHero
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化英雄技能
|
// 初始化英雄技能
|
||||||
func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData {
|
func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData {
|
||||||
heroCfg, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
heroCfg, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func (this *ModelHero) initHeroSkill(hero *pb.DBHero) []*pb.SkillData {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建一个指定的英雄
|
// 创建一个指定的英雄
|
||||||
func (this *ModelHero) createSpecialHero(uid string, heroCfgId string) (hero *pb.DBHero, err error) {
|
func (this *ModelHero) createSpecialHero(uid string, heroCfgId string) (hero *pb.DBHero, err error) {
|
||||||
list := this.getHeroList(uid)
|
list := this.getHeroList(uid)
|
||||||
for _, v := range list {
|
for _, v := range list {
|
||||||
@ -132,7 +132,7 @@ func (this *ModelHero) CloneNewHero(uid string, hero *pb.DBHero) (newHero *pb.DB
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化可叠加的英雄
|
// 初始化可叠加的英雄
|
||||||
func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) {
|
func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int32) (hero *pb.DBHero, err error) {
|
||||||
var (
|
var (
|
||||||
model *db.DBModel
|
model *db.DBModel
|
||||||
@ -158,7 +158,7 @@ func (this *ModelHero) initHeroOverlying(uid string, heroCfgId string, count int
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取一个英雄(参数唯一objID)
|
// 获取一个英雄(参数唯一objID)
|
||||||
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
||||||
hero := &pb.DBHero{}
|
hero := &pb.DBHero{}
|
||||||
err := this.GetListObj(uid, heroId, hero)
|
err := this.GetListObj(uid, heroId, hero)
|
||||||
@ -168,7 +168,7 @@ func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero {
|
|||||||
return hero
|
return hero
|
||||||
}
|
}
|
||||||
|
|
||||||
//消耗英雄卡
|
// 消耗英雄卡
|
||||||
func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero) (err error) {
|
func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero) (err error) {
|
||||||
|
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
@ -183,7 +183,7 @@ func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero) (err error)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取玩家的英雄列表
|
// 获取玩家的英雄列表
|
||||||
func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
func (this *ModelHero) getHeroList(uid string) []*pb.DBHero {
|
||||||
heroes := make([]*pb.DBHero, 0)
|
heroes := make([]*pb.DBHero, 0)
|
||||||
err := this.GetList(uid, &heroes)
|
err := this.GetList(uid, &heroes)
|
||||||
@ -276,11 +276,13 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range hero.Suits {
|
for _, v := range hero.Suits {
|
||||||
if configure, err := this.module.configure.GetEquipsuit(v.Suitid); err != nil {
|
if v.Effect {
|
||||||
this.module.Errorln(err)
|
if configure, err := this.module.configure.GetEquipsuit(v.Suitid); err != nil {
|
||||||
} else {
|
this.module.Errorln(err)
|
||||||
for k, v := range configure.SetBonuses {
|
} else {
|
||||||
addProperty[k] += v
|
for k, v := range configure.SetBonuses {
|
||||||
|
addProperty[k] += v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -300,7 +302,7 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
|||||||
this.mergeAddProperty(hero.Uid, hero, addProperty, equipSkill)
|
this.mergeAddProperty(hero.Uid, hero, addProperty, equipSkill)
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置装备
|
// 设置装备
|
||||||
func (this *ModelHero) setEquipment(uid string, hero *pb.DBHero) (newHero *pb.DBHero, err error) {
|
func (this *ModelHero) setEquipment(uid string, hero *pb.DBHero) (newHero *pb.DBHero, err error) {
|
||||||
if len(hero.EquipID) == 0 {
|
if len(hero.EquipID) == 0 {
|
||||||
return
|
return
|
||||||
@ -316,7 +318,7 @@ func (this *ModelHero) setEquipment(uid string, hero *pb.DBHero) (newHero *pb.DB
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并属性即属性值累加 (data 额外加的属性)
|
// 合并属性即属性值累加 (data 额外加的属性)
|
||||||
func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[string]int32) (err error) {
|
func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[string]int32) (err error) {
|
||||||
for k, v := range hero.Property {
|
for k, v := range hero.Property {
|
||||||
if v1, ok := data[k]; ok {
|
if v1, ok := data[k]; ok {
|
||||||
@ -332,7 +334,7 @@ func (this *ModelHero) mergeMainProperty(uid string, hero *pb.DBHero, data map[s
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并附加属性
|
// 合并附加属性
|
||||||
func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[string]int32, skills []*pb.SkillData) {
|
func (this *ModelHero) mergeAddProperty(uid string, hero *pb.DBHero, data map[string]int32, skills []*pb.SkillData) {
|
||||||
hero.AddProperty = data
|
hero.AddProperty = data
|
||||||
|
|
||||||
@ -373,8 +375,8 @@ func (this *ModelHero) StarHpAddition(star int32) (addValue float32) {
|
|||||||
return addValue
|
return addValue
|
||||||
}
|
}
|
||||||
|
|
||||||
//属性计算 基础属性
|
// 属性计算 基础属性
|
||||||
//英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
// 英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数
|
||||||
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
||||||
growCfg := this.module.configure.GetHeroLvgrow(hero.HeroID)
|
growCfg := this.module.configure.GetHeroLvgrow(hero.HeroID)
|
||||||
heroCfg, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
heroCfg, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||||
@ -416,7 +418,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
|
|||||||
this.resetJuexingProperty(hero)
|
this.resetJuexingProperty(hero)
|
||||||
}
|
}
|
||||||
|
|
||||||
//重新计算英雄属性
|
// 重新计算英雄属性
|
||||||
func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DBHero) (err error) {
|
func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DBHero) (err error) {
|
||||||
this.PropertyCompute(hero) //重新计算 property 的值
|
this.PropertyCompute(hero) //重新计算 property 的值
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
@ -639,7 +641,7 @@ func (this *ModelHero) InitMonsterHero(heroCfgId string, star, lv int32) *pb.DBH
|
|||||||
return newHero
|
return newHero
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置天赋属性
|
// 设置天赋属性
|
||||||
func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTalentData) {
|
func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTalentData) {
|
||||||
if conf == nil || hero == nil {
|
if conf == nil || hero == nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user