diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index f8cadd949..6ff609a78 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -10,6 +10,7 @@ import ( "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/sys/db" + "math" "time" "go.mongodb.org/mongo-driver/bson/primitive" @@ -735,31 +736,53 @@ func (this *modelBattleComp) createBattleRole(hero *pb.DBHero, vlv int32, tid, p for k, v := range hero.Property { arrt := AttributesTransBase(k) - role.Property[arrt] += v - if k == comm.Hp { - role.Currhp += v + if arrt != 0 { + role.Property[arrt] += v + if k == comm.Hp { + role.Currhp += v + } } } + + for k, v := range hero.AddProperty { + switch k { + case comm.HpPro: + hero.AddProperty[comm.Hp] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Hp]))) + case comm.AtkPro: + hero.AddProperty[comm.Atk] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Atk]))) + case comm.DefPro: + hero.AddProperty[comm.Def] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Def]))) + case comm.SpeedPro: + hero.AddProperty[comm.Speed] += int32(math.Floor((float64(v) / 1000) * float64(hero.Property[comm.Speed]))) + } + } + for k, v := range hero.AddProperty { arrt := AttributesTransExt(k) - role.Property[arrt] += v - if k == comm.Hp { - role.Currhp += v + if arrt != 0 { + role.Property[arrt] += v + if k == comm.Hp { + role.Currhp += v + } } } for k, v := range hero.JuexProperty { arrt := AttributesTransExt(k) - role.Property[arrt] += v - if k == comm.Hp { - role.Currhp += v + if arrt != 0 { + role.Property[arrt] += v + if k == comm.Hp { + role.Currhp += v + } } } for k, v := range hero.HoroscopeProperty { arrt := AttributesTransExt(k) - role.Property[arrt] += v - if k == comm.Hp { - role.Currhp += v + if arrt != 0 { + role.Property[arrt] += v + if k == comm.Hp { + role.Currhp += v + } } }