From 8c567c5150ee0bfd7f15a123288b33a8f916fffa Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 8 Sep 2022 10:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=88=98=E6=96=97=E5=8D=95?= =?UTF-8?q?=E6=B3=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fight/attribute/attributenumeric.go | 4 ++ modules/battle/fight/attribute/fixedpoint.go | 24 +++++++ .../battle/fight/component/fightroledata.go | 65 +++++++++++++++++++ modules/battle/modelBattle.go | 2 + 4 files changed, 95 insertions(+) create mode 100644 modules/battle/fight/attribute/attributenumeric.go create mode 100644 modules/battle/fight/attribute/fixedpoint.go diff --git a/modules/battle/fight/attribute/attributenumeric.go b/modules/battle/fight/attribute/attributenumeric.go new file mode 100644 index 000000000..5d6b66e71 --- /dev/null +++ b/modules/battle/fight/attribute/attributenumeric.go @@ -0,0 +1,4 @@ +package attribute + +type AttributeNumeric struct { +} diff --git a/modules/battle/fight/attribute/fixedpoint.go b/modules/battle/fight/attribute/fixedpoint.go new file mode 100644 index 000000000..0fc766fbd --- /dev/null +++ b/modules/battle/fight/attribute/fixedpoint.go @@ -0,0 +1,24 @@ +package attribute + +import ( + "math" +) + +//基准倍数 +const CARDINAL_NUMBER int = 10000 + +func NewFixedPoint(value float32) *FixedPoint { + return &FixedPoint{ + rawValue: int(math.Round(float64(value * float32(CARDINAL_NUMBER)))), + } +} + +type FixedPoint struct { + rawValue int + + scalar float32 +} + +func (this *FixedPoint) Scalar() float32 { + return this.scalar * 0.0001 +} diff --git a/modules/battle/fight/component/fightroledata.go b/modules/battle/fight/component/fightroledata.go index 3dc526e93..548df961a 100644 --- a/modules/battle/fight/component/fightroledata.go +++ b/modules/battle/fight/component/fightroledata.go @@ -1,6 +1,11 @@ package component +import ( + "go_dreamfactory/modules/battle/fight/attribute" +) + type FightRoleData struct { + //基础属性--------------------------------------------------------------------------------------------------------------------------- /// /// 角色名 /// @@ -37,4 +42,64 @@ type FightRoleData struct { /// 英雄ID /// HeroID string + + //战斗属性--------------------------------------------------------------------------------------------------------------------------- + /// + /// 行动值 + /// + Operate attribute.AttributeNumeric + /// + /// 最大生命 + /// + MaxHp attribute.AttributeNumeric + + /// + /// 当前生命 + /// + Hp attribute.AttributeNumeric + + /// + /// 攻击 + /// + Atk attribute.AttributeNumeric + + /// + /// 防御 + /// + Def attribute.AttributeNumeric + + /// + /// 速度 + /// + Speed attribute.AttributeNumeric + + /// + /// 暴击率 + /// + Critical attribute.AttributeNumeric + + /// + /// 暴击伤害 + /// + CriticalPower attribute.AttributeNumeric + + /// + /// 效果命中 + /// + EffectHit attribute.AttributeNumeric + + /// + /// 效果抵抗 + /// + EfectResist attribute.AttributeNumeric + + /// + /// 失手率 + /// + LostHold attribute.AttributeNumeric + + /// + /// 会心率 + /// + UnderStand attribute.AttributeNumeric } diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index 9f9ce696f..f18d9fe76 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -135,6 +135,8 @@ func (this *modelBattleComp) createpve(session comm.IUserSession, conn *db.DBCon } } } + //临时处理 单波怪物 + break } } }