From 0c39c60bff7d7dfebe5f570353baadb5058cbcc9 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 18 Aug 2023 20:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A3=85=E5=A4=87pro?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/battle/modelBattle.go | 47 ++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 12 deletions(-) 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 + } } }