diff --git a/go.mod b/go.mod
index d958f48fa..6be685a41 100644
--- a/go.mod
+++ b/go.mod
@@ -187,7 +187,7 @@ require (
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
- gopkg.in/yaml.v3 v3.0.1 // indirect
+ gopkg.in/yaml.v3 v3.0.1
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
)
diff --git a/modules/battle/fight/attribute/attributenumeric.go b/modules/battle/fight/attribute/attributenumeric.go
index 9137887c2..84ea13c14 100644
--- a/modules/battle/fight/attribute/attributenumeric.go
+++ b/modules/battle/fight/attribute/attributenumeric.go
@@ -44,12 +44,95 @@ func (this *AttributeNumeric) Value() float32 {
return this.fixedValue.Scalar()
}
+///基础数值
func (this *AttributeNumeric) SetBase(value float32) float32 {
this.BaseValue.SetFloat(value)
this.onChange()
return this.BaseValue.Value()
}
-func (this *AttributeNumeric) onChange() {
- // this.fixedValue = (this.BaseValue.Fixed()*(1+this.ProValue.Fixed())+this.AppendValue.Fixed())*(1+this.BuffProValue.Fixed()) + this.BuffValue.Fixed()
+func (this *AttributeNumeric) AddBase(value float32) float32 {
+ this.BaseValue.Add(value)
+ this.onChange()
+ return this.BaseValue.Value()
+}
+
+func (this *AttributeNumeric) MinusBase(value float32) float32 {
+ this.BaseValue.Minus(value)
+ this.onChange()
+ return this.BaseValue.Value()
+}
+
+///附加数值
+func (this *AttributeNumeric) SetAppend(value float32) float32 {
+ this.AppendValue.SetFloat(value)
+ this.onChange()
+ return this.AppendValue.Value()
+}
+
+func (this *AttributeNumeric) AddAppend(value float32) float32 {
+ this.AppendValue.Add(value)
+ this.onChange()
+ return this.AppendValue.Value()
+}
+
+func (this *AttributeNumeric) MinusAppend(value float32) float32 {
+ this.AppendValue.Minus(value)
+ this.onChange()
+ return this.AppendValue.Value()
+}
+
+///附加百分比数值
+func (this *AttributeNumeric) SetPro(value float32) float32 {
+ this.ProValue.SetFloat(value)
+ this.onChange()
+ return this.ProValue.Value()
+}
+func (this *AttributeNumeric) AddPro(value float32) float32 {
+ this.ProValue.Add(value)
+ this.onChange()
+ return this.ProValue.Value()
+}
+func (this *AttributeNumeric) MinusPro(value float32) float32 {
+ this.ProValue.Minus(value)
+ this.onChange()
+ return this.ProValue.Value()
+}
+
+/// Buff附加数值
+func (this *AttributeNumeric) SetBuff(value float32) float32 {
+ this.BuffValue.SetFloat(value)
+ this.onChange()
+ return this.BuffValue.Value()
+}
+func (this *AttributeNumeric) AddBuff(value float32) float32 {
+ this.BuffValue.Add(value)
+ this.onChange()
+ return this.BuffValue.Value()
+}
+func (this *AttributeNumeric) MinusBuff(value float32) float32 {
+ this.BuffValue.Minus(value)
+ this.onChange()
+ return this.BuffValue.Value()
+}
+
+/// Buff附加百分比数值
+func (this *AttributeNumeric) SetBuffPro(value float32) float32 {
+ this.BuffProValue.SetFloat(value)
+ this.onChange()
+ return this.BuffProValue.Value()
+}
+func (this *AttributeNumeric) AddBuffPro(value float32) float32 {
+ this.BuffProValue.Add(value)
+ this.onChange()
+ return this.BuffProValue.Value()
+}
+func (this *AttributeNumeric) MinusBuffPro(value float32) float32 {
+ this.BuffProValue.Minus(value)
+ this.onChange()
+ return this.BuffProValue.Value()
+}
+
+func (this *AttributeNumeric) onChange() {
+ this.fixedValue = (FixedPoint_Multiply(this.BaseValue.Fixed(), (NewFixedPoint(1)+this.ProValue.Fixed())) + FixedPoint_Multiply(this.AppendValue.Fixed(), (NewFixedPoint(1)+this.BuffProValue.Fixed())) + this.BuffValue.Fixed())
}
diff --git a/modules/battle/fight/attribute/fixednumeric.go b/modules/battle/fight/attribute/fixednumeric.go
index 7ec29cc63..c327e3101 100644
--- a/modules/battle/fight/attribute/fixednumeric.go
+++ b/modules/battle/fight/attribute/fixednumeric.go
@@ -29,6 +29,7 @@ func (this FixedNumeric) SetFloat(value float32) float32 {
this.baseValue = NewFixedPoint(value)
return this.baseValue.Scalar()
}
+
func (this FixedNumeric) Set(value FixedPoint) float32 {
this.baseValue = value
return this.baseValue.Scalar()
diff --git a/modules/battle/fight/attribute/fixedpoint.go b/modules/battle/fight/attribute/fixedpoint.go
index 5f0385e55..1d9da5b17 100644
--- a/modules/battle/fight/attribute/fixedpoint.go
+++ b/modules/battle/fight/attribute/fixedpoint.go
@@ -9,25 +9,21 @@ import (
const CARDINAL_NUMBER int = 10000
func NewFixedPoint(value float32) FixedPoint {
- return FixedPoint{
- rawValue: int(math.Round(float64(value * float32(CARDINAL_NUMBER)))),
- }
+ return FixedPoint(math.Round(float64(value * float32(CARDINAL_NUMBER))))
}
-type FixedPoint struct {
- rawValue int
-}
+type FixedPoint int
func (this FixedPoint) SetInt(v int) {
- this.rawValue = v
+ this = FixedPoint(v)
}
func (this FixedPoint) Scalar() float32 {
- return float32(this.rawValue) * 0.0001
+ return float32(this) * 0.0001
}
func (this FixedPoint) ToInt() int {
- return this.rawValue / CARDINAL_NUMBER
+ return int(this) / CARDINAL_NUMBER
}
func (this FixedPoint) ToFloat() float32 {
return this.Scalar()
@@ -39,39 +35,31 @@ func (this FixedPoint) ToString() string {
/// -
func (this FixedPoint) Add(v float32) {
y := NewFixedPoint(v)
- this.rawValue = this.rawValue + y.rawValue
+ this = FixedPoint(int(this) + int(y))
}
/// -
func (this FixedPoint) Reduce(v float32) {
y := NewFixedPoint(v)
- this.rawValue = this.rawValue - y.rawValue
+ this = FixedPoint(int(this) - int(y))
}
/// +
func FixedPoint_Add(x, y FixedPoint) FixedPoint {
- result := FixedPoint{}
- result.rawValue = x.rawValue + y.rawValue
- return result
+ return FixedPoint(x + y)
}
/// -
func FixedPoint_Reduce(x, y FixedPoint) FixedPoint {
- result := FixedPoint{}
- result.rawValue = x.rawValue - y.rawValue
- return result
+ return FixedPoint(x - y)
}
/// *
func FixedPoint_Multiply(x, y FixedPoint) FixedPoint {
- result := FixedPoint{}
- result.rawValue = (x.rawValue * y.rawValue) / CARDINAL_NUMBER
- return result
+ return FixedPoint((int(x) * int(y)) / CARDINAL_NUMBER)
}
/// /
func FixedPoint_Divide(x, y FixedPoint) FixedPoint {
- result := FixedPoint{}
- result.rawValue = (x.rawValue * CARDINAL_NUMBER) / (y.rawValue)
- return result
+ return FixedPoint((int(x) * CARDINAL_NUMBER) / int(y))
}
diff --git a/modules/battle/fight/attribute/healthpoint.go b/modules/battle/fight/attribute/healthpoint.go
index 261a90ed5..5dc622103 100644
--- a/modules/battle/fight/attribute/healthpoint.go
+++ b/modules/battle/fight/attribute/healthpoint.go
@@ -49,6 +49,18 @@ func (this *HealthPoint) MaxValue() int32 {
return int32(this.CurrMaxHp.Value())
}
+func (this *HealthPoint) OnChange() {
+ //先计算当前血量百分比
+ var per = this.Percent()
+ // 当前最大生命值 = 总生命 * ( 1 + 当前最大生命百分比加成 )+ 当前最大生命加成
+ //FightDebug.Log($"增加前属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}");
+ this.CurrMaxHp.SetBase((FixedPoint_Multiply(this.MaxHp.Fixed(), (NewFixedPoint(1)+this.CurrMaxHpPro.Fixed())) + this.CurrMaxHpAppend.Fixed()).Scalar())
+ //计算变化之后的当前血量
+ var curHp = FixedPoint_Multiply(this.CurrMaxHp.Fixed(), NewFixedPoint(per))
+ this.Hp.Set(curHp)
+ //FightDebug.Log($"增加后属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}");
+}
+
///
/// 扣血
///
@@ -61,7 +73,7 @@ func (this *HealthPoint) Minus(value float32) {
/// 加血
///
func (this *HealthPoint) Add(value float32) {
- if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)).rawValue > this.CurrMaxHp.Fixed().rawValue {
+ if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)) > this.CurrMaxHp.Fixed() {
this.Reset()
} else {
this.Hp.Add(value)
@@ -72,7 +84,7 @@ func (this *HealthPoint) Add(value float32) {
/// 获取治疗溢出值
///
func (this *HealthPoint) Overflow(value float32) float32 {
- if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)).rawValue > this.CurrMaxHp.Fixed().rawValue {
+ if FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)) > this.CurrMaxHp.Fixed() {
return FixedPoint_Divide(FixedPoint_Add(this.Hp.Fixed(), NewFixedPoint(value)), this.CurrMaxHp.Fixed()).Scalar()
}
return 0
@@ -84,3 +96,31 @@ func (this *HealthPoint) Overflow(value float32) float32 {
func (this *HealthPoint) Percent() float32 {
return FixedPoint_Divide(this.Hp.Fixed(), this.CurrMaxHp.Fixed()).Scalar()
}
+
+///
+/// 损失血量百分比
+///
+func (this *HealthPoint) LostPercent() float32 {
+ return FixedPoint_Divide((this.CurrMaxHp.Fixed() - this.Hp.Fixed()), this.CurrMaxHp.Fixed()).Scalar()
+}
+
+///
+/// 指定百分比血量
+///
+func (this *HealthPoint) PercentHealth(pct float32) float32 {
+ return FixedPoint_Multiply(this.CurrMaxHp.Fixed(), NewFixedPoint(pct)).Scalar()
+}
+
+///
+/// 扣除的血量
+///
+func (this *HealthPoint) Deduct() float32 {
+ return FixedPoint(this.CurrMaxHp.Fixed() - this.Hp.Fixed()).Scalar()
+}
+
+///
+/// 是否满血
+///
+func (this *HealthPoint) IsFull() bool {
+ return this.Hp.Fixed() == this.CurrMaxHp.Fixed()
+}
diff --git a/modules/battle/fight/buff/fightbuff.go b/modules/battle/fight/buff/fightbuff.go
new file mode 100644
index 000000000..c4e696a3e
--- /dev/null
+++ b/modules/battle/fight/buff/fightbuff.go
@@ -0,0 +1,9 @@
+package buff
+
+func NewFightBuff() *FightBuff {
+ return &FightBuff{}
+}
+
+type FightBuff struct {
+ FightBuffBase
+}
diff --git a/modules/battle/fight/buff/fightbuffbase.go b/modules/battle/fight/buff/fightbuffbase.go
new file mode 100644
index 000000000..0001c8e87
--- /dev/null
+++ b/modules/battle/fight/buff/fightbuffbase.go
@@ -0,0 +1,41 @@
+package buff
+
+type FightBuffBase struct {
+}
+
+/// 激活Buff
+func (this FightBuffBase) Activate() {
+
+}
+
+/// 结束Buff
+func (this FightBuffBase) End() {
+
+}
+
+/// 增加CD回合数
+func (this FightBuffBase) AddCD(pVal int32) int32 {
+ return 0
+}
+
+/// 减少CD回合数
+func (this FightBuffBase) MinusCD(pVal int32) int32 {
+ return 0
+}
+
+/// 设置CD回合数为新的值
+func (this FightBuffBase) SetCD(newVal int32) int32 {
+ return 0
+}
+
+///
+/// 是否存在指定Tag
+///
+func (this FightBuffBase) HasTag(pTag string) bool {
+ return false
+}
+
+/// 战斗结束时的清理
+func (this FightBuffBase) Clear() {
+
+}
diff --git a/modules/battle/fight/buff/fightpoisonbuff.go b/modules/battle/fight/buff/fightpoisonbuff.go
new file mode 100644
index 000000000..6f9bf931b
--- /dev/null
+++ b/modules/battle/fight/buff/fightpoisonbuff.go
@@ -0,0 +1,9 @@
+package buff
+
+func NewFightPoisonBuff() *FightPoisonBuff {
+ return &FightPoisonBuff{}
+}
+
+type FightPoisonBuff struct {
+ FightBuff
+}
diff --git a/modules/battle/fight/buff/fightpropercentbuff.go b/modules/battle/fight/buff/fightpropercentbuff.go
new file mode 100644
index 000000000..8d5a02fbd
--- /dev/null
+++ b/modules/battle/fight/buff/fightpropercentbuff.go
@@ -0,0 +1,9 @@
+package buff
+
+func NewFightProPercentBuff(proType int, quaType bool) *FightProPercentBuff {
+ return &FightProPercentBuff{}
+}
+
+type FightProPercentBuff struct {
+ FightBuff
+}
diff --git a/modules/battle/fight/buff/fightshieldbuff.go b/modules/battle/fight/buff/fightshieldbuff.go
new file mode 100644
index 000000000..833d99244
--- /dev/null
+++ b/modules/battle/fight/buff/fightshieldbuff.go
@@ -0,0 +1,9 @@
+package buff
+
+func NewFightShieldBuff() *FightShieldBuff {
+ return &FightShieldBuff{}
+}
+
+type FightShieldBuff struct {
+ FightBuff
+}
diff --git a/modules/battle/fight/core/buffstore.go b/modules/battle/fight/core/buffstore.go
index 02beff722..80590e5b4 100644
--- a/modules/battle/fight/core/buffstore.go
+++ b/modules/battle/fight/core/buffstore.go
@@ -1,8 +1,125 @@
package core
+import "go_dreamfactory/modules/battle/fight/buff"
+
type BuffStore struct {
///
/// 已经添加的buff类型
///
HasBuffTypes []int
+ ///
+ /// Buff列表 [BuffId, FightBuff]
+ ///
+ Buffs map[int][]IBuff
+ temp []int
+}
+
+func (this *BuffStore) CreateBuff(pType BuffType) IBuff {
+ switch pType {
+ case BuffType_NONE:
+ break
+ case BuffType_ATKUP:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Atk, false)
+ case BuffType_DEFUP:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Def, false)
+ case BuffType_SPDUP:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Agi, false)
+ case BuffType_CRATEUP:
+ return buff.NewFightProPercentBuff(PropertyType_Add_Cri, false)
+ case BuffType_CRITRESIST:
+ break
+ case BuffType_ATKDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Atk, true)
+ case BuffType_DEFDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Def, true)
+ case BuffType_SPDDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Buff_Per_Agi, true)
+ case BuffType_CRATEDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Add_Cri, true)
+ case BuffType_MISSRATEUP:
+ return buff.NewFightProPercentBuff(PropertyType_LostHold_per, false)
+ case BuffType_SEAR:
+ break
+ case BuffType_INVINCIBILITY:
+ return buff.NewFightBuff()
+ case BuffType_STANDOFF:
+ break
+ case BuffType_STUN:
+ return buff.NewFightBuff()
+ case BuffType_FREEZE:
+ return buff.NewFightBuff()
+ case BuffType_DISEASED:
+ return buff.NewFightBuff()
+ case BuffType_PETRIFICATION:
+ return buff.NewFightBuff()
+ case BuffType_SILENCE:
+ return buff.NewFightBuff()
+ case BuffType_TAUNT:
+ break
+ case BuffType_IMMUNITY:
+ return buff.NewFightBuff()
+ case BuffType_SHIELD:
+ return buff.NewFightShieldBuff()
+ case BuffType_NOTSPEED:
+ return buff.NewFightBuff()
+ case BuffType_DAMREUP:
+ return buff.NewFightProPercentBuff(PropertyType_DamRe_Per, true)
+ case BuffType_HPUP:
+ return buff.NewFightProPercentBuff(PropertyType_Add_Per_Hp, false)
+ case BuffType_EFFHITUP:
+ return buff.NewFightProPercentBuff(PropertyType_Add_EffHit, false)
+ case BuffType_EFFREUP:
+ return buff.NewFightProPercentBuff(PropertyType_Add_EffRe, false)
+ case BuffType_HPDOWN:
+ break
+ case BuffType_EFFHITDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Add_EffHit, true)
+ case BuffType_EFFREDOWN:
+ return buff.NewFightProPercentBuff(PropertyType_Add_EffRe, true)
+ case BuffType_CAUSEDAMUP:
+ return buff.NewFightProPercentBuff(PropertyType_CauseDam_Per, false)
+ case BuffType_POISON:
+ return buff.NewFightPoisonBuff()
+ case BuffType_ATTRTRANS:
+ break
+ case BuffType_UNDEAD:
+ break
+ case BuffType_DEVOUR:
+ break
+ case BuffType_DONTMISS:
+ break
+ case BuffType_NOTGAIN:
+ break
+ case BuffType_NOTCONTROL:
+ break
+ case BuffType_SLEEP:
+ break
+ }
+ return buff.NewFightBuff()
+}
+func (this *BuffStore) ForEach(action func(IBuff)) {
+ this.temp = this.temp[:0]
+ for k, _ := range this.Buffs {
+ this.temp = append(this.temp, k)
+ }
+ for _, v := range this.temp {
+ list := this.Buffs[v]
+ for _, v1 := range list {
+ action(v1)
+ }
+ }
+}
+func (this *BuffStore) HasBuff(judge func(IBuff) bool) bool {
+ for _, v := range this.Buffs {
+ for _, buff := range v {
+ if judge(buff) {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+func (this *BuffStore) Clear() {
+ this.Buffs = make(map[int][]IBuff)
}
diff --git a/modules/battle/fight/core/bufftype.go b/modules/battle/fight/core/bufftype.go
new file mode 100644
index 000000000..749e0d60f
--- /dev/null
+++ b/modules/battle/fight/core/bufftype.go
@@ -0,0 +1,162 @@
+package core
+
+type BuffType int
+
+const (
+ ///
+ /// 无效类型
+ ///
+ BuffType_NONE = 0
+ ///
+ /// 攻击提升
+ ///
+ BuffType_ATKUP = 1
+ ///
+ /// 防御提升
+ ///
+ BuffType_DEFUP = 2
+ ///
+ /// 速度提升
+ ///
+ BuffType_SPDUP = 3
+ ///
+ /// 暴击提升
+ ///
+ BuffType_CRATEUP = 4
+ ///
+ /// 暴击抵抗
+ ///
+ BuffType_CRITRESIST = 5
+ ///
+ /// 攻击下降
+ ///
+ BuffType_ATKDOWN = 6
+ ///
+ /// 防御下降
+ ///
+ BuffType_DEFDOWN = 7
+ ///
+ /// 速度下降
+ ///
+ BuffType_SPDDOWN = 8
+ ///
+ /// 暴击下降
+ ///
+ BuffType_CRATEDOWN = 9
+ ///
+ /// 烙印
+ ///
+ BuffType_SEAR = 10
+ ///
+ /// 失手率提升
+ ///
+ BuffType_MISSRATEUP = 11
+ ///
+ /// 无敌
+ ///
+ BuffType_INVINCIBILITY = 12
+ ///
+ /// 对峙
+ ///
+ BuffType_STANDOFF = 13
+ ///
+ /// 眩晕
+ ///
+ BuffType_STUN = 14
+ ///
+ /// 冰冻
+ ///
+ BuffType_FREEZE = 15
+ ///
+ /// 禁疗
+ ///
+ BuffType_DISEASED = 16
+ ///
+ /// 石化
+ ///
+ BuffType_PETRIFICATION = 17
+ ///
+ /// 沉默
+ ///
+ BuffType_SILENCE = 18
+ ///
+ /// 挑衅
+ ///
+ BuffType_TAUNT = 19
+ ///
+ /// 免疫
+ ///
+ BuffType_IMMUNITY = 20
+ ///
+ /// 护盾
+ ///
+ BuffType_SHIELD = 21
+ ///
+ /// 不可移动
+ ///
+ BuffType_NOTSPEED = 22
+ ///
+ /// 受到伤害降低
+ ///
+ BuffType_DAMREUP = 23
+ ///
+ /// 血量提升
+ ///
+ BuffType_HPUP = 24
+ ///
+ /// 效果命中提升
+ ///
+ BuffType_EFFHITUP = 25
+ ///
+ /// 效果抵抗提升
+ ///
+ BuffType_EFFREUP = 26
+ ///
+ /// 血量下降
+ ///
+ BuffType_HPDOWN = 27
+ ///
+ /// 效果命中下降
+ ///
+ BuffType_EFFHITDOWN = 28
+ ///
+ /// 效果抵抗下降
+ ///
+ BuffType_EFFREDOWN = 29
+ ///
+ /// 伤害提升增加
+ ///
+ BuffType_CAUSEDAMUP = 30
+ ///
+ /// 中毒
+ ///
+ BuffType_POISON = 31
+ ///
+ /// 属性转换
+ ///
+ BuffType_ATTRTRANS = 32
+ ///
+ /// 不死
+ ///
+ BuffType_UNDEAD = 33
+ ///
+ /// 吞噬
+ ///
+ BuffType_DEVOUR = 34
+ ///
+ /// 不会失手
+ ///
+ BuffType_DONTMISS = 35
+ ///
+ /// 不能获得增益buff
+ ///
+ BuffType_NOTGAIN = 36
+ ///
+ /// 免疫控制
+ ///
+ BuffType_NOTCONTROL = 37
+ ///
+ /// 睡眠
+ ///
+ BuffType_SLEEP = 38
+)
diff --git a/modules/battle/fight/core/core.go b/modules/battle/fight/core/core.go
index 8c6967d9c..9bb1255b0 100644
--- a/modules/battle/fight/core/core.go
+++ b/modules/battle/fight/core/core.go
@@ -48,7 +48,7 @@ type (
///
/// 技能id
/// 技能等级
- AddSkill(skillId int32, skillLv int32) ISkil
+ AddSkill(skillId int32, skillLv int32) ISkill
/// 获取行动令牌
StartAction()
/// 结束行动令牌
@@ -71,7 +71,7 @@ type (
/// 获取下一个技能id
GetNextSkillId() int32
/// 获取后续子技能
- GetAfterAtk(skillId int) ISkil
+ GetAfterAtk(skillId int) ISkill
/// 触发SkillId技能,选择的目标是TargetRid
EmitSkill(skillId int32, targetRid []int32)
/// 自身的 Buff 和 被动 是否有指定标签
@@ -85,7 +85,7 @@ type (
AutoEmitSkill(pFightRole IFightRole)
}
//技能对象
- ISkil interface {
+ ISkill interface {
///
/// 获取技能配置信息
///
@@ -120,6 +120,12 @@ type (
///
SendSkillLog()
}
+ IAfterSkill interface {
+ ///
+ /// 战斗结束时的清理
+ ///
+ Clear()
+ }
//Buff对象
IBuff interface {
/// 激活Buff
diff --git a/modules/battle/fight/core/fightroledata.go b/modules/battle/fight/core/fightroledata.go
index 67aa1ebe3..d94190f13 100644
--- a/modules/battle/fight/core/fightroledata.go
+++ b/modules/battle/fight/core/fightroledata.go
@@ -104,6 +104,10 @@ type FightRoleData struct {
///region 技能相关-----------------------------------------------------------------------
///
+ /// 技能信息 id:lv
+ ///
+ SkillsInfo []ISkill
+ ///
/// 最后一次选择的skillAtk类技能
///
LastSkillId int32
@@ -117,10 +121,19 @@ type FightRoleData struct {
///
/// 在角色初始化时,会根据SkillsInfo实例化对应的技能保存于此
///
- Skills map[int32]ISkil
+ Skills map[int32]ISkill
+ ///
+ /// AfterAtk集合
+ ///
+ AfterSkills map[int]IAfterSkill
///
/// BUFF集合
///
BuffStore *BuffStore
+
+ ///
+ /// 被动技能集合
+ ///
+ PassiveStore PassiveStore
}
diff --git a/modules/battle/fight/core/passivestore.go b/modules/battle/fight/core/passivestore.go
new file mode 100644
index 000000000..a5a9c2f57
--- /dev/null
+++ b/modules/battle/fight/core/passivestore.go
@@ -0,0 +1,31 @@
+package core
+
+import "go_dreamfactory/modules/battle/fight/passive"
+
+type PassiveStore struct {
+ Passives map[int]passive.IFightPassive
+ temp []int
+}
+
+func (this *PassiveStore) CreatePassive(pType string) passive.IFightPassive {
+ switch pType {
+ case "CallSkillPas":
+ return passive.NewFightCallSkillPas()
+ }
+ return nil
+}
+func (this *PassiveStore) ForEach(action func(fp passive.IFightPassive)) {
+ this.temp = make([]int, 0)
+ for k, _ := range this.Passives {
+ this.temp = append(this.temp, k)
+ }
+ for _, v := range this.temp {
+ action(this.Passives[v])
+ }
+}
+func (this *PassiveStore) RemovePassive(id int) {
+
+}
+func (this *PassiveStore) Clear() {
+ this.Passives = make(map[int]passive.IFightPassive)
+}
diff --git a/modules/battle/fight/core/propertytype.go b/modules/battle/fight/core/propertytype.go
new file mode 100644
index 000000000..dc471786a
--- /dev/null
+++ b/modules/battle/fight/core/propertytype.go
@@ -0,0 +1,174 @@
+package core
+
+type PropertyType int
+
+const (
+ ///
+ /// 总生命
+ ///
+ PropertyType_Total_Hp = 1
+ ///
+ /// 当前总生命
+ ///
+ PropertyType_NowTotal_Hp = 2
+ ///
+ /// 当前生命
+ ///
+ PropertyType_NowHp = 3
+ ///
+ /// 总攻击
+ ///
+ PropertyType_Total_Atk = 4
+ ///
+ /// 总防御
+ ///
+ PropertyType_Total_Def = 5
+ ///
+ /// 总速度
+ ///
+ PropertyType_Total_Agi = 6
+ ///
+ /// 总暴击率
+ ///
+ PropertyType_Total_Cri = 7
+ ///
+ /// 总暴击伤害
+ ///
+ PropertyType_Total_CriDam = 8
+ ///
+ /// 总效果命中
+ ///
+ PropertyType_Total_EffHit = 9
+ ///
+ /// 总效果抵抗
+ ///
+ PropertyType_Total_EffRe = 10
+ ///
+ /// 已损失生命值
+ ///
+ PropertyType_LostHp = 11
+ ///
+ /// 已损失生命值百分比
+ ///
+ PropertyType_LostPerHp = 12
+ ///
+ /// 当前生命百分比
+ ///
+ PropertyType_NowHp_Per = 13
+ ///
+ /// 附加生命(修改属性类型从这里开始)
+ ///
+ PropertyType_Add_Hp = 14
+ ///
+ /// 附加百分比生命
+ ///
+ PropertyType_Add_Per_Hp = 15
+ ///
+ /// BUFF附加生命
+ ///
+ PropertyType_Buff_Hp = 16
+ ///
+ /// BUFF附加百分比生命
+ ///
+ PropertyType_Buff_Per_Hp = 17
+ ///
+ /// 附加攻击
+ ///
+ PropertyType_Add_Atk = 18
+ ///
+ /// 附加百分比攻击
+ ///
+ PropertyType_Add_Per_Atk = 19
+ ///
+ /// BUFF附加攻击
+ ///
+ PropertyType_Buff_Atk = 20
+ ///
+ /// BUFF附加百分比攻击
+ ///
+ PropertyType_Buff_Per_Atk = 21
+ ///
+ /// 附加防御
+ ///
+ PropertyType_Add_Def = 22
+ ///
+ /// 附加百分比防御
+ ///
+ PropertyType_Add_Per_Def = 23
+ ///
+ /// BUFF附加防御
+ ///
+ PropertyType_Buff_Def = 24
+ ///
+ /// BUFF附加百分比防御
+ ///
+ PropertyType_Buff_Per_Def = 25
+ ///
+ /// 附加速度
+ ///
+ PropertyType_Add_Agi = 26
+ ///
+ /// 附加百分比速度
+ ///
+ PropertyType_Add_Per_Agi = 27
+ ///
+ /// BUFF附加速度
+ ///
+ PropertyType_Buff_Agi = 28
+ ///
+ /// BUFF附加百分比速度
+ ///
+ PropertyType_Buff_Per_Agi = 29
+ ///
+ /// 附加暴击率
+ ///
+ PropertyType_Add_Cri = 30
+ ///
+ /// 附加暴击伤害
+ ///
+ PropertyType_Add_CriDam = 31
+ ///
+ /// 附加效果命中
+ ///
+ PropertyType_Add_EffHit = 32
+ ///
+ /// 附加效果抵抗
+ ///
+ PropertyType_Add_EffRe = 33
+ ///
+ /// 行动值
+ ///
+ PropertyType_ActValue = 34
+ ///
+ /// 伤害减免(buff附加百分比)
+ ///
+ PropertyType_DamRe_Per = 35
+ ///
+ /// 伤害提升(buff附加百分比)
+ ///
+ PropertyType_CauseDam_Per = 36
+ ///
+ /// 伤害减免(固定值)
+ ///
+ PropertyType_DamRe = 37
+ ///
+ /// 伤害提升(固定值)
+ ///
+ PropertyType_CauseDam = 38
+ ///
+ /// 失手率buff增加百分比
+ ///
+ PropertyType_LostHold_per = 39
+ ///
+ /// 会心率buff增加百分比
+ ///
+ PropertyType_UnderStand_per = 40
+ ///
+ /// 治疗加成
+ ///
+ PropertyType_TreAdd = 41
+ ///
+ /// 受疗加成
+ ///
+ PropertyType_BeTreAdd = 42
+)
diff --git a/modules/battle/fight/fightrole.go b/modules/battle/fight/fightrole.go
index 6a895b33b..8da6fd579 100644
--- a/modules/battle/fight/fightrole.go
+++ b/modules/battle/fight/fightrole.go
@@ -1,8 +1,10 @@
package fight
import (
+ "fmt"
"go_dreamfactory/modules/battle/fight/attribute"
"go_dreamfactory/modules/battle/fight/core"
+ "go_dreamfactory/modules/battle/fight/passive"
cfg "go_dreamfactory/sys/configure/structs"
)
@@ -52,3 +54,36 @@ func (this *FightRole) IsDead() bool {
func (this *FightRole) Dead() {
this.data.ALive = false
}
+
+///
+/// 战斗结束时的清理
+///
+func (this *FightRole) Clear() {
+ //清理所有技能
+ for _, v := range this.data.Skills {
+ v.Clear()
+ }
+
+ //清理所有攻击后技能
+ for _, v := range this.data.AfterSkills {
+ v.Clear()
+ }
+
+ //清理所有buff
+ this.data.BuffStore.ForEach(func(buff core.IBuff) {
+ buff.Clear()
+ })
+ // //清理所有被动就能
+ this.data.PassiveStore.ForEach(func(fp passive.IFightPassive) {
+ fp.Clear()
+ })
+
+ //清空
+ this.data.Skills = make(map[int32]core.ISkill)
+ this.data.AfterSkills = make(map[int]core.IAfterSkill)
+ this.data.BuffStore.Clear()
+ this.data.PassiveStore.Clear()
+}
+func (this *FightRole) ToString() string {
+ return fmt.Sprintf("[%s]", this.data.Name)
+}
diff --git a/modules/battle/fight/passive/fightcallskillpas.go b/modules/battle/fight/passive/fightcallskillpas.go
new file mode 100644
index 000000000..b860cdfec
--- /dev/null
+++ b/modules/battle/fight/passive/fightcallskillpas.go
@@ -0,0 +1,12 @@
+package passive
+
+func NewFightCallSkillPas() IFightPassive {
+ return &FightCallSkillPas{}
+}
+
+///
+/// 通用调用技能和子技能
+///
+type FightCallSkillPas struct {
+ FightPassive
+}
diff --git a/modules/battle/fight/passive/fightpassive.go b/modules/battle/fight/passive/fightpassive.go
new file mode 100644
index 000000000..29d7ab04e
--- /dev/null
+++ b/modules/battle/fight/passive/fightpassive.go
@@ -0,0 +1,12 @@
+package passive
+
+type IFightPassive interface {
+ Clear()
+}
+
+type FightPassive struct {
+}
+
+func (this *FightPassive) Clear() {
+
+}
diff --git a/modules/battle/fight/skill/fightafterskill.go b/modules/battle/fight/skill/fightafterskill.go
new file mode 100644
index 000000000..17194d783
--- /dev/null
+++ b/modules/battle/fight/skill/fightafterskill.go
@@ -0,0 +1,15 @@
+package skill
+
+type FightAfterSkill struct {
+ ///
+ /// 技能效果是否生效
+ ///
+ TakeEffect bool
+}
+
+///
+/// 战斗结束时的清理
+///
+func (this *FightAfterSkill) Clear() {
+ this.TakeEffect = false
+}