上传战斗系统代码

This commit is contained in:
liwei1dao 2022-10-09 14:30:56 +08:00
parent 3371a23703
commit 4754609b29
44 changed files with 1915 additions and 276 deletions

2
go.mod
View File

@ -14,7 +14,6 @@ require (
github.com/gin-gonic/gin v1.8.1 github.com/gin-gonic/gin v1.8.1
github.com/go-playground/validator/v10 v10.10.1 github.com/go-playground/validator/v10 v10.10.1
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5
github.com/go-vgo/robotgo v0.100.10
github.com/golang-jwt/jwt v3.2.2+incompatible github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang/protobuf v1.5.2 github.com/golang/protobuf v1.5.2
github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket v1.4.2
@ -45,7 +44,6 @@ require (
require ( require (
github.com/BurntSushi/toml v1.2.0 // indirect github.com/BurntSushi/toml v1.2.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/kr/fs v0.1.0 // indirect github.com/kr/fs v0.1.0 // indirect
github.com/onsi/gomega v1.20.0 // indirect github.com/onsi/gomega v1.20.0 // indirect

3
go.sum
View File

@ -582,9 +582,6 @@ github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5h
github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q=
github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo=
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
github.com/otiai10/gosseract v2.2.1+incompatible h1:Ry5ltVdpdp4LAa2bMjsSJH34XHVOV7XMi41HtzL8X2I=
github.com/otiai10/gosseract v2.2.1+incompatible/go.mod h1:XrzWItCzCpFRZ35n3YtVTgq5bLAhFIkascoRo8G32QE=
github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=

View File

@ -13,6 +13,9 @@ func NewAttributeNumeric(pData float32) *AttributeNumeric {
return attribute return attribute
} }
/// <summary>
/// 属性数值
/// </summary>
type AttributeNumeric struct { type AttributeNumeric struct {
fixedValue FixedPoint fixedValue FixedPoint
/// <summary> /// <summary>
@ -47,92 +50,92 @@ func (this *AttributeNumeric) Value() float32 {
///基础数值 ///基础数值
func (this *AttributeNumeric) SetBase(value float32) float32 { func (this *AttributeNumeric) SetBase(value float32) float32 {
this.BaseValue.SetFloat(value) this.BaseValue.SetFloat(value)
this.onChange() this.OnChange()
return this.BaseValue.Value() return this.BaseValue.Value()
} }
func (this *AttributeNumeric) AddBase(value float32) float32 { func (this *AttributeNumeric) AddBase(value float32) float32 {
this.BaseValue.Add(value) this.BaseValue.Add(value)
this.onChange() this.OnChange()
return this.BaseValue.Value() return this.BaseValue.Value()
} }
func (this *AttributeNumeric) MinusBase(value float32) float32 { func (this *AttributeNumeric) MinusBase(value float32) float32 {
this.BaseValue.Minus(value) this.BaseValue.Minus(value)
this.onChange() this.OnChange()
return this.BaseValue.Value() return this.BaseValue.Value()
} }
///附加数值 ///附加数值
func (this *AttributeNumeric) SetAppend(value float32) float32 { func (this *AttributeNumeric) SetAppend(value float32) float32 {
this.AppendValue.SetFloat(value) this.AppendValue.SetFloat(value)
this.onChange() this.OnChange()
return this.AppendValue.Value() return this.AppendValue.Value()
} }
func (this *AttributeNumeric) AddAppend(value float32) float32 { func (this *AttributeNumeric) AddAppend(value float32) float32 {
this.AppendValue.Add(value) this.AppendValue.Add(value)
this.onChange() this.OnChange()
return this.AppendValue.Value() return this.AppendValue.Value()
} }
func (this *AttributeNumeric) MinusAppend(value float32) float32 { func (this *AttributeNumeric) MinusAppend(value float32) float32 {
this.AppendValue.Minus(value) this.AppendValue.Minus(value)
this.onChange() this.OnChange()
return this.AppendValue.Value() return this.AppendValue.Value()
} }
///附加百分比数值 ///附加百分比数值
func (this *AttributeNumeric) SetPro(value float32) float32 { func (this *AttributeNumeric) SetPro(value float32) float32 {
this.ProValue.SetFloat(value) this.ProValue.SetFloat(value)
this.onChange() this.OnChange()
return this.ProValue.Value() return this.ProValue.Value()
} }
func (this *AttributeNumeric) AddPro(value float32) float32 { func (this *AttributeNumeric) AddPro(value float32) float32 {
this.ProValue.Add(value) this.ProValue.Add(value)
this.onChange() this.OnChange()
return this.ProValue.Value() return this.ProValue.Value()
} }
func (this *AttributeNumeric) MinusPro(value float32) float32 { func (this *AttributeNumeric) MinusPro(value float32) float32 {
this.ProValue.Minus(value) this.ProValue.Minus(value)
this.onChange() this.OnChange()
return this.ProValue.Value() return this.ProValue.Value()
} }
/// Buff附加数值 /// Buff附加数值
func (this *AttributeNumeric) SetBuff(value float32) float32 { func (this *AttributeNumeric) SetBuff(value float32) float32 {
this.BuffValue.SetFloat(value) this.BuffValue.SetFloat(value)
this.onChange() this.OnChange()
return this.BuffValue.Value() return this.BuffValue.Value()
} }
func (this *AttributeNumeric) AddBuff(value float32) float32 { func (this *AttributeNumeric) AddBuff(value float32) float32 {
this.BuffValue.Add(value) this.BuffValue.Add(value)
this.onChange() this.OnChange()
return this.BuffValue.Value() return this.BuffValue.Value()
} }
func (this *AttributeNumeric) MinusBuff(value float32) float32 { func (this *AttributeNumeric) MinusBuff(value float32) float32 {
this.BuffValue.Minus(value) this.BuffValue.Minus(value)
this.onChange() this.OnChange()
return this.BuffValue.Value() return this.BuffValue.Value()
} }
/// Buff附加百分比数值 /// Buff附加百分比数值
func (this *AttributeNumeric) SetBuffPro(value float32) float32 { func (this *AttributeNumeric) SetBuffPro(value float32) float32 {
this.BuffProValue.SetFloat(value) this.BuffProValue.SetFloat(value)
this.onChange() this.OnChange()
return this.BuffProValue.Value() return this.BuffProValue.Value()
} }
func (this *AttributeNumeric) AddBuffPro(value float32) float32 { func (this *AttributeNumeric) AddBuffPro(value float32) float32 {
this.BuffProValue.Add(value) this.BuffProValue.Add(value)
this.onChange() this.OnChange()
return this.BuffProValue.Value() return this.BuffProValue.Value()
} }
func (this *AttributeNumeric) MinusBuffPro(value float32) float32 { func (this *AttributeNumeric) MinusBuffPro(value float32) float32 {
this.BuffProValue.Minus(value) this.BuffProValue.Minus(value)
this.onChange() this.OnChange()
return this.BuffProValue.Value() return this.BuffProValue.Value()
} }
func (this *AttributeNumeric) onChange() { 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()) 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())
} }

View File

@ -6,6 +6,9 @@ func NewFixedNumeric(pData float32) FixedNumeric {
return fixed return fixed
} }
/// <summary>
/// 浮点型数值
/// </summary>
type FixedNumeric struct { type FixedNumeric struct {
baseValue FixedPoint baseValue FixedPoint
} }

View File

@ -36,12 +36,6 @@ type HealthPoint struct {
CurrMaxHpAppend *AttributeNumeric CurrMaxHpAppend *AttributeNumeric
} }
/// <summary>
/// 重置当前生命值为最大值
/// </summary>
func (this *HealthPoint) Reset() {
this.Hp.SetFloat(this.CurrMaxHp.Value())
}
func (this *HealthPoint) Value() int32 { func (this *HealthPoint) Value() int32 {
return int32(this.Hp.Value()) return int32(this.Hp.Value())
} }
@ -61,6 +55,13 @@ func (this *HealthPoint) OnChange() {
//FightDebug.Log($"增加后属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}"); //FightDebug.Log($"增加后属性{(MaxHp.Fixed)}----- {(1 + CurrMaxHpPro.Fixed)}----- {CurrMaxHpAppend.Fixed}");
} }
/// <summary>
/// 重置当前生命值为最大值
/// </summary>
func (this *HealthPoint) Reset() {
this.Hp.SetFloat(this.CurrMaxHp.Value())
}
/// <summary> /// <summary>
/// 扣血 /// 扣血
/// </summary> /// </summary>

View File

@ -1,9 +1,73 @@
package buff package buff
import (
"go_dreamfactory/modules/battle/fight/core"
cfg "go_dreamfactory/sys/configure/structs"
)
var id int64 = 0
func NewFightBuff() *FightBuff { func NewFightBuff() *FightBuff {
return &FightBuff{} id++
return &FightBuff{
GId: id,
}
} }
type FightBuff struct { type FightBuff struct {
FightBuffBase FightBuffBase
BuffConf *cfg.GameSkillBuffData
GId int64
}
func (this FightBuff) GetBuffConf() *cfg.GameSkillBuffData {
return this.BuffConf
}
func (this FightBuff) Activate(param float32) {
this.FightBuffBase.Activate(param)
}
func (this FightBuff) OnEnd(skill core.IAfterSkill) {
this.FromRole.GetFightBase().Debugf("%d 准备移除Buff:%d 类型=%d ", this.OwnerRole.GetData().UniqueId, this.BuffConf.Id, this.BuffConf.BuffType)
if this.BuffConf.BuffIcon != "" {
var com = new(core.ComMondifyBuff)
com.To = this.OwnerRole.GetData().Rid
com.Gid = this.GId
com.BuffId = this.BuffConf.Id
com.Operate = 0
if skill != nil {
skill.AddLog(com)
} else {
this.OwnerRole.GetFightBase().GetFightLog().AddCommand(com)
}
if this.NeedHpSync() {
var hpCmd = new(core.ComModifyHealth)
hpCmd.To = this.OwnerRole.GetData().Rid
hpCmd.Nhp = this.OwnerRole.GetCurrentHealth().Value()
hpCmd.Mhp = this.OwnerRole.GetCurrentHealth().MaxValue()
hpCmd.HideDmg = true
if skill != nil {
skill.AddLog(hpCmd)
} else {
this.OwnerRole.GetFightBase().GetFightLog().AddCommand(hpCmd)
}
}
}
this.OwnerRole.GetData().BuffStore.RemoveBuff(this)
}
/// <summary>
/// 当前buff效果是否需要同步血量
/// </summary>
/// <returns></returns>
func (this FightBuff) NeedHpSync() bool {
return false
}
/// <summary>
/// 回合开始开始需要触发效果的
/// </summary>
func (this FightBuff) OnRoundStart() {
} }

View File

@ -1,41 +1,125 @@
package buff package buff
import "go_dreamfactory/modules/battle/fight/core"
type FightBuffBase struct { type FightBuffBase struct {
/// <summary>
/// 所属子技能ID
/// </summary>
AfterSkillId int
/// <summary>
/// Buff投放者
/// </summary>
FromRole core.IFightRole
/// <summary>
/// Buff持有者
/// </summary>
OwnerRole core.IFightRole
/// <summary>
/// 剩余持续回合数
/// </summary>
duration int
/// <summary>
/// 叠加层数 [叠加Buff不立即叠加效果, 受BufParNum影响]
/// </summary>
OverlapNum int
/// <summary>
/// 叠加Buff当前效果次数
/// </summary>
EffectNum int
/// <summary>
/// 是否无限回合
/// </summary>
AlwaysExist bool
BufParNum int
}
/// <summary>
/// cd 回合数
/// </summary>
/// <remarks>
/// -1 无限回合0 回合结束后移除
/// </remarks>
func (this FightBuffBase) GetRound() int {
return this.duration
}
/// <summary>
/// cd 回合数
/// </summary>
/// <remarks>
/// -1 无限回合0 回合结束后移除
/// </remarks>
func (this FightBuffBase) SetRound(value int) {
this.AlwaysExist = value == -1
this.duration = value
} }
/// 激活Buff /// 激活Buff
func (this FightBuffBase) Activate() { func (this FightBuffBase) Activate(param float32) {
this.Restore()
this.EffectNum = this.OverlapNum / this.BufParNum
this.OnActivate(param)
}
func (this FightBuffBase) OnActivate(param float32) {
} }
/// 结束Buff /// 结束Buff
func (this FightBuffBase) End() { func (this FightBuffBase) Restore() {
} }
func (this FightBuffBase) OnEnd(skill core.IAfterSkill) {
/// 增加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
} }
/// <summary> /// <summary>
/// 是否存在指定Tag /// 结束Buff
/// </summary> /// </summary>
func (this FightBuffBase) HasTag(pTag string) bool { func (this FightBuffBase) End(skill core.IAfterSkill) {
return false this.Restore()
this.OnEnd(skill)
this.Clear()
} }
/// 战斗结束时的清理 /// 战斗结束时的清理
func (this FightBuffBase) Clear() { func (this FightBuffBase) Clear() {
} }
//CD 处理--------------------------------------------------------------------------------------------------------------------
/// <summary>
/// 增加剩余回合数 v 默认:1
/// </summary>
/// <returns>新的回合数</returns>
func (this FightBuffBase) AddDuration(v int) int {
this.duration += v
return this.duration
}
/// <summary>
/// 减少剩余回合数 v 默认:1
/// </summary>
/// <returns>新的回合数</returns>
func (this FightBuffBase) MinusDuration(v int) int {
this.duration -= v
if this.duration < 0 {
this.duration = 0
}
this.SetDuration(this.duration)
return this.duration
}
/// <summary>
/// 设置剩余回合数为新的值
/// </summary>
/// <param name="newVal"></param>
func (this FightBuffBase) SetDuration(newVal int) int {
this.duration = newVal
if this.duration == 0 && !this.AlwaysExist {
this.End(nil)
}
return this.duration
}

View File

@ -1,5 +1,7 @@
package buff package buff
import "go_dreamfactory/modules/battle/fight/core"
func NewFightPoisonBuff() *FightPoisonBuff { func NewFightPoisonBuff() *FightPoisonBuff {
return &FightPoisonBuff{} return &FightPoisonBuff{}
} }
@ -7,3 +9,17 @@ func NewFightPoisonBuff() *FightPoisonBuff {
type FightPoisonBuff struct { type FightPoisonBuff struct {
FightBuff FightBuff
} }
func (this FightPoisonBuff) OnRoundStart() {
this.FromRole.GetFightBase().Debugf("{%d}中毒buff触发", this.OwnerRole.GetData().Rid)
num := this.OwnerRole.GetCurrentHealth().CurrMaxHp.Value() * (float32(this.BuffConf.EffectArgu[0]) / 1000.0)
this.OwnerRole.ReceiveDamage(this.FromRole, num, nil)
var com = new(core.ComModifyHealth)
com.From = this.FromRole.GetData().Rid
com.To = this.OwnerRole.GetData().Rid
com.Num = num * -1
com.Nhp = this.OwnerRole.GetCurrentHealth().Value()
com.Mhp = this.OwnerRole.GetCurrentHealth().MaxValue()
com.Baoji = false
this.OwnerRole.GetFightBase().GetFightLog().AddCommand(com)
}

View File

@ -1,9 +1,46 @@
package buff package buff
import (
"go_dreamfactory/modules/battle/fight/core"
)
func NewFightProPercentBuff(proType int, quaType bool) *FightProPercentBuff { func NewFightProPercentBuff(proType int, quaType bool) *FightProPercentBuff {
return &FightProPercentBuff{} return &FightProPercentBuff{}
} }
/// <summary>
/// 修改属性buff (百分比数值)
/// </summary
type FightProPercentBuff struct { type FightProPercentBuff struct {
FightBuff FightBuff
/// <summary>
/// 属性类型
/// </summary>
ProType int
/// <summary>
/// 是否减法
/// </summary>
BufQuaType bool
BuffValue float32
}
func (this FightProPercentBuff) OnActivate(param float32) {
var effectArgu = this.BuffConf.EffectArgu
if len(effectArgu) < 1 { // 参数列属性值
this.FromRole.GetFightBase().Errorf("buff效果参数配置错误 ID={%d},参数[ 属性值]", this.BuffConf.Id)
return
}
value := effectArgu[0]
perc := float32(value) / 1000.0
this.BuffValue = perc * float32(this.EffectNum)
core.TrySetValue(this.OwnerRole, this.ProType, this.BuffValue, !this.BufQuaType)
}
func (this FightProPercentBuff) Restore() {
core.TrySetValue(this.OwnerRole, this.ProType, this.BuffValue, this.BufQuaType)
this.BuffValue = 0
}
func (this FightProPercentBuff) NeedHpSync() bool {
return this.ProType == int(core.PropertyType_Add_Per_Hp) || this.ProType == int(core.PropertyType_Add_Hp)
} }

View File

@ -1,9 +1,43 @@
package buff package buff
import (
"go_dreamfactory/modules/battle/fight/attribute"
"go_dreamfactory/modules/battle/fight/core"
)
func NewFightShieldBuff() *FightShieldBuff { func NewFightShieldBuff() *FightShieldBuff {
return &FightShieldBuff{} return &FightShieldBuff{}
} }
type FightShieldBuff struct { type FightShieldBuff struct {
FightBuff FightBuff
ShieldValue attribute.FixedNumeric
tmepDamage attribute.FixedNumeric
}
func (this FightShieldBuff) OnActivate(param float32) {
var val float32 = 0
if param > 0 {
val = param
} else {
args := this.BuffConf.EffectArgu
var pValue float32 = 0
for i := 0; i < len(args); i += 3 {
source := args[i] //[属性来源]
proType := args[i+1] //[属性类型]
proValue := args[i+2] //[属性值]
var target core.IFightRole
if source == 1 {
target = this.OwnerRole
} else {
target = this.FromRole
}
// var target = source == 1 ? OwnerRole : FromRole; // 1 取自身属性 2 取目标属性
if !core.TryGetValue(target, int(proType), &pValue) {
continue
}
val += pValue * float32(proValue) / 1000.0
}
}
this.ShieldValue.Add(val)
} }

View File

@ -0,0 +1,224 @@
package component
import (
"go_dreamfactory/modules/battle/fight/buff"
"go_dreamfactory/modules/battle/fight/core"
)
type BuffStore struct {
/// <summary>
/// 已经添加的buff类型
/// </summary>
HasBuffTypes []int
/// <summary>
/// Buff列表 [BuffId, FightBuff]
/// </summary>
Buffs map[int][]core.IBuff
temp []int
}
/// <summary>
/// 查找相同 BuffId 的Buff
/// </summary>
func (this *BuffStore) GetBuffList(pBuffId int) []core.IBuff {
if v, ok := this.Buffs[pBuffId]; ok {
return v
}
return nil
}
func (this *BuffStore) TryGetBuffList(pBuffId int, pBuffList *[]core.IBuff) bool {
if v, ok := this.Buffs[pBuffId]; ok {
*pBuffList = v
return true
}
*pBuffList = nil
return false
}
/// <summary>
/// 查找不是指定 BuffId 的Buff
/// </summary>
func (this *BuffStore) GetBuffListNon(pBuffId int) []core.IBuff {
tResult := make([]core.IBuff, 0)
iskeep := false
for k, v := range this.Buffs {
if k != pBuffId {
for _, v1 := range v {
iskeep = false
for _, v2 := range tResult {
if v1 == v2 {
iskeep = true
}
}
if !iskeep {
tResult = append(tResult, v1)
}
}
}
}
return tResult
}
/// <summary>获取指定buff列表</summary>
func (this *BuffStore) GetBuffListByFilter(filter func(buff core.IBuff) bool) []core.IBuff {
tResult := make([]core.IBuff, 0)
iskeep := false
this.ForEach(func(buff core.IBuff) {
if filter(buff) {
iskeep = false
for _, v2 := range tResult {
if buff == v2 {
iskeep = true
}
}
if !iskeep {
tResult = append(tResult, buff)
}
}
})
return tResult
}
func (this *BuffStore) GetBuffListByTypes(pType []core.BuffType) []core.IBuff {
tResult := make([]core.IBuff, 0)
iskeep := false
this.ForEach(func(buff core.IBuff) {
for _, tTag := range pType {
if buff.GetBuffConf().BuffType == int32(tTag) {
iskeep = false
for _, v2 := range tResult {
if buff == v2 {
iskeep = true
}
}
if !iskeep {
tResult = append(tResult, buff)
}
break
}
}
})
return tResult
}
func (this *BuffStore) ForEach(action func(core.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)
}
}
}
/// <summary>
/// 附加Buff
/// 默认参数 param=0;shift=false
/// </summary>
func (this *BuffStore) Attach(pSkill core.IAfterSkill, id int, randVal int, numVal int, round int, param float32, shift bool) bool {
return true
}
func (this *BuffStore) HasBuff(judge func(core.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][]core.IBuff)
}
func (this *BuffStore) CreateBuff(pType core.BuffType) core.IBuff {
switch pType {
case core.BuffType_NONE:
break
case core.BuffType_ATKUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Atk), false)
case core.BuffType_DEFUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Def), false)
case core.BuffType_SPDUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Agi), false)
case core.BuffType_CRATEUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_Cri), false)
case core.BuffType_CRITRESIST:
break
case core.BuffType_ATKDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Atk), true)
case core.BuffType_DEFDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Def), true)
case core.BuffType_SPDDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Buff_Per_Agi), true)
case core.BuffType_CRATEDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_Cri), true)
case core.BuffType_MISSRATEUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_LostHold_per), false)
case core.BuffType_SEAR:
break
case core.BuffType_INVINCIBILITY:
return buff.NewFightBuff()
case core.BuffType_STANDOFF:
break
case core.BuffType_STUN:
return buff.NewFightBuff()
case core.BuffType_FREEZE:
return buff.NewFightBuff()
case core.BuffType_DISEASED:
return buff.NewFightBuff()
case core.BuffType_PETRIFICATION:
return buff.NewFightBuff()
case core.BuffType_SILENCE:
return buff.NewFightBuff()
case core.BuffType_TAUNT:
break
case core.BuffType_IMMUNITY:
return buff.NewFightBuff()
case core.BuffType_SHIELD:
return buff.NewFightShieldBuff()
case core.BuffType_NOTSPEED:
return buff.NewFightBuff()
case core.BuffType_DAMREUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_DamRe_Per), true)
case core.BuffType_HPUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_Per_Hp), false)
case core.BuffType_EFFHITUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_EffHit), false)
case core.BuffType_EFFREUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_EffRe), false)
case core.BuffType_HPDOWN:
break
case core.BuffType_EFFHITDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_EffHit), true)
case core.BuffType_EFFREDOWN:
return buff.NewFightProPercentBuff(int(core.PropertyType_Add_EffRe), true)
case core.BuffType_CAUSEDAMUP:
return buff.NewFightProPercentBuff(int(core.PropertyType_CauseDam_Per), false)
case core.BuffType_POISON:
return buff.NewFightPoisonBuff()
case core.BuffType_ATTRTRANS:
break
case core.BuffType_UNDEAD:
break
case core.BuffType_DEVOUR:
break
case core.BuffType_DONTMISS:
break
case core.BuffType_NOTGAIN:
break
case core.BuffType_NOTCONTROL:
break
case core.BuffType_SLEEP:
break
}
return buff.NewFightBuff()
}

View File

@ -1,20 +1,23 @@
package core package component
import "go_dreamfactory/modules/battle/fight/passive" import (
"go_dreamfactory/modules/battle/fight/core"
"go_dreamfactory/modules/battle/fight/passive"
)
type PassiveStore struct { type PassiveStore struct {
Passives map[int]passive.IFightPassive Passives map[int]core.IFightPassive
temp []int temp []int
} }
func (this *PassiveStore) CreatePassive(pType string) passive.IFightPassive { func (this *PassiveStore) CreatePassive(pType string) core.IFightPassive {
switch pType { switch pType {
case "CallSkillPas": case "CallSkillPas":
return passive.NewFightCallSkillPas() return passive.NewFightCallSkillPas()
} }
return nil return nil
} }
func (this *PassiveStore) ForEach(action func(fp passive.IFightPassive)) { func (this *PassiveStore) ForEach(action func(fp core.IFightPassive)) {
this.temp = make([]int, 0) this.temp = make([]int, 0)
for k, _ := range this.Passives { for k, _ := range this.Passives {
this.temp = append(this.temp, k) this.temp = append(this.temp, k)
@ -27,5 +30,5 @@ func (this *PassiveStore) RemovePassive(id int) {
} }
func (this *PassiveStore) Clear() { func (this *PassiveStore) Clear() {
this.Passives = make(map[int]passive.IFightPassive) this.Passives = make(map[int]core.IFightPassive)
} }

View File

@ -1,125 +0,0 @@
package core
import "go_dreamfactory/modules/battle/fight/buff"
type BuffStore struct {
/// <summary>
/// 已经添加的buff类型
/// </summary>
HasBuffTypes []int
/// <summary>
/// Buff列表 [BuffId, FightBuff]
/// </summary>
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)
}

View File

@ -1,11 +1,19 @@
package core package core
import cfg "go_dreamfactory/sys/configure/structs" import (
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules/battle/fight/attribute"
cfg "go_dreamfactory/sys/configure/structs"
)
type ( type (
///战斗控制器 ///战斗控制器
IFight interface { IFight interface {
log.ILogger
GetRoles() []IFightRole GetRoles() []IFightRole
GetFightLog() IFightLog
GetFightEvent() IFightEvent
GetSkillConfig(SkillId int, skillLv int) interface{}
/// 战前逻辑 /// 战前逻辑
BeforeStart() BeforeStart()
///开始战斗 ///开始战斗
@ -32,6 +40,17 @@ type (
/// <param name="skillid">技能ID</param> /// <param name="skillid">技能ID</param>
/// <param name="targetRid">选择的目标rid</param> /// <param name="targetRid">选择的目标rid</param>
EmitSkill(skillId int32, targetRid []int32) EmitSkill(skillId int32, targetRid []int32)
/// <summary>
/// 触发的释放主技能添加到这边(出手角色主技能执行完了,再执行)
/// </summary>
AddPassiveMainSkill(role IFightRole, skillId int32)
/// <summary>
/// 生成随机数
/// </summary>
/// <param name="minNum">最小值(含)</param>
/// <param name="maxNum">最大值(含)</param>
/// <returns></returns>
Rand(min, max int) int
} }
//战斗角色 //战斗角色
IFightRole interface { IFightRole interface {
@ -42,7 +61,8 @@ type (
/// <summary> /// <summary>
/// 角色数据 /// 角色数据
/// </summary> /// </summary>
GetData() FightRoleData GetData() *FightRoleData
GetCurrentHealth() *attribute.HealthPoint
/// <summary> /// <summary>
/// 增加一个主技能 /// 增加一个主技能
/// </summary> /// </summary>
@ -56,7 +76,7 @@ type (
/// 修改行动值 /// 修改行动值
ModifyOperateValue(newNum float32) ModifyOperateValue(newNum float32)
///接收伤害 ///接收伤害
ReceiveDamage(damageValue float32) int ReceiveDamage(from IFightRole, DamageValue float32, skill IAfterSkill)
/// 是否致死伤害 /// 是否致死伤害
WillDead(damageValue float32) bool WillDead(damageValue float32) bool
/// 接收治疗 /// 接收治疗
@ -71,7 +91,7 @@ type (
/// 获取下一个技能id /// 获取下一个技能id
GetNextSkillId() int32 GetNextSkillId() int32
/// 获取后续子技能 /// 获取后续子技能
GetAfterAtk(skillId int) ISkill GetAfterAtk(skillId int32) ISkill
/// 触发SkillId技能选择的目标是TargetRid /// 触发SkillId技能选择的目标是TargetRid
EmitSkill(skillId int32, targetRid []int32) EmitSkill(skillId int32, targetRid []int32)
/// 自身的 Buff 和 被动 是否有指定标签 /// 自身的 Buff 和 被动 是否有指定标签
@ -90,11 +110,14 @@ type (
/// 获取技能配置信息 /// 获取技能配置信息
/// </summary> /// </summary>
GetSkillConf() *cfg.GameSkillAtkData GetSkillConf() *cfg.GameSkillAtkData
GetSourceSkillId() int32
SetSourceSkillId(skillid int32)
GetSkillLog() *ComSkillAfterAtk
/// <summary> /// <summary>
/// 触发 /// 触发
/// 遍历所有ChildSkills生成对应的实例并Emit触发 /// 遍历所有ChildSkills生成对应的实例并Emit触发
/// </summary> /// </summary>
Emit() Emit() bool
/// <summary> /// <summary>
/// 减少CD回合数 /// 减少CD回合数
/// </summary> /// </summary>
@ -121,6 +144,12 @@ type (
SendSkillLog() SendSkillLog()
} }
IAfterSkill interface { IAfterSkill interface {
GetOwnerRole() IFightRole
GetAfterSkillConf() cfg.GameSkillAfteratkData
GetSkillArgs() []int
GetSourceSkillId() int
AddLog(pCom IComEffectSkill)
AddSkillLog(afterAtk *ComSkillAfterAtk)
/// <summary> /// <summary>
/// 战斗结束时的清理 /// 战斗结束时的清理
/// </summary> /// </summary>
@ -128,24 +157,37 @@ type (
} }
//Buff对象 //Buff对象
IBuff interface { IBuff interface {
GetBuffConf() *cfg.GameSkillBuffData
/// 激活Buff /// 激活Buff
Activate() Activate(param float32)
/// 结束Buff /// 结束Buff
End() OnEnd(skill IAfterSkill)
/// 增加CD回合数
AddCD(pVal int32) int32
/// 减少CD回合数
MinusCD(pVal int32) int32
/// 设置CD回合数为新的值
SetCD(newVal int32) int32
/// <summary> /// <summary>
/// 是否存在指定Tag
/// </summary>
HasTag(pTag string) bool
/// 战斗结束时的清理 /// 战斗结束时的清理
/// </summary>
Clear() Clear()
} }
//buff集合
IBuffStore interface {
GetHasBuffTypes() []int
ForEach(action func(buff IBuff))
RemoveBuff(buff IBuff)
Clear()
}
//被动技集合
IPassiveStore interface {
TryGetPassive(pPassId int) (v IFightPassive, ok bool)
ForEach(action func(fp IFightPassive))
Clear()
}
IFightPassive interface {
GetTriggerPassiveRole() IFightRole
Clear()
}
//战报
IFightLog interface {
AddCommand(log interface{})
}
IFightEvent interface { IFightEvent interface {
//发送事件 //发送事件
EmitForInt(eventNumber int, args ...interface{}) EmitForInt(eventNumber int, args ...interface{})

View File

@ -98,6 +98,27 @@ const (
/// 除选定目标外的其他友方 /// 除选定目标外的其他友方
/// </summary> /// </summary>
AferSkillFromType_FriendExceptChoose AferSkillFromType = 7 AferSkillFromType_FriendExceptChoose AferSkillFromType = 7
/// <summary>
/// 触发被动的角色(发起者)
/// </summary>
AferSkillFromType_TriggerPassiveFrom = 8
/// <summary>
/// 继承上一个技能选敌
/// </summary>
AferSkillFromType_SourceSkillTarget = 9
/// <summary>
/// 除去上一个技能选敌之后友方
/// </summary>
AferSkillFromType_ExceptSourceSkillTargetFriend = 10
/// <summary>
/// 除去上一个技能选敌之后敌方
/// </summary>
AferSkillFromType_ExceptSourceSkillTargetEnemy = 11
/// <summary>
/// 触发被动的角色(目标)
/// </summary>
AferSkillFromType_TriggerPassiveTarget = 12
) )
type EventType int8 type EventType int8
@ -106,27 +127,27 @@ const (
/// <summary> /// <summary>
/// 空 /// 空
/// </summary> /// </summary>
EventType_None EventType = -1 EventType_None = -1
/// <summary> /// <summary>
/// 开始战斗时 /// 开始战斗时
/// </summary> /// </summary>
EventType_OnFightStart EventType = iota EventType_OnFightStart EventType = iota
/// <summary> /// <summary>
/// 回合行动前 /// 回合开始
/// </summary> /// </summary>
EventType_OnRoundStart EventType_OnRoundStart
/// <summary> /// <summary>
/// 回合结束 /// 回合结束
/// </summary> /// </summary>
EventType_OnRoundEnd EventType_OnRoundEnd
/// <summary> /// <summary>
/// 行动结束前 /// 技能开始
/// </summary> /// </summary>
EventType_OnPreActionEnd EventType_OnSkillStart
/// <summary> /// <summary>
/// 行动结束后 /// 技能结束
/// </summary> /// </summary>
EventType_OnPostActionEnd EventType_OnSkillEnd
/// <summary> /// <summary>
/// 效果执行前 /// 效果执行前
/// </summary> /// </summary>
@ -155,10 +176,59 @@ const (
/// 被暴击 /// 被暴击
/// </summary> /// </summary>
EventType_OnPostReceiveCriCal EventType_OnPostReceiveCriCal
/// <summary>
/// 击破护盾时
/// </summary>
EventType_OnPostGiveLostShield
/// <summary>
/// 护盾被击破时
/// </summary>
EventType_OnPostReceiveLostShield
/// <summary> /// <summary>
/// 回合行动后 /// 回合行动后
/// </summary> /// </summary>
EventType_OnStopAction EventType_OnStopAction
/// <summary>
/// 受到致死伤害时
/// </summary>
EventType_OnDeathDmg
/// <summary>
/// 造成伤害
/// </summary>
EventType_OnDamage
/// <summary>
/// 受到伤害
/// </summary>
EventType_OnBeDamage
/// <summary>
/// 造成击杀
/// </summary>
EventType_OnKill
/// <summary>
/// 治疗前
/// </summary>
EventType_OnPreTre
/// <summary>
/// 治疗后
/// </summary>
EventType_OnTreEnd
/// <summary>
/// 被治疗前
/// </summary>
EventType_OnPreBeTre
/// <summary>
/// 被治疗后
/// </summary>
EventType_OnBeTreEnd
/// <summary>
/// 移除buff后
/// </summary>
EventType_OnRemoveBuffEnd
/// <summary>
/// 添加buff
/// </summary>
EventType_OnAddBuff
) )
type EOrderType int8 type EOrderType int8
@ -184,7 +254,7 @@ func (this *ComModifyOperate) ToString() string {
} }
type ComSetSkillCD struct { type ComSetSkillCD struct {
From byte From int
Skillid int32 Skillid int32
Nv byte Nv byte
} }
@ -270,14 +340,21 @@ type ComSkillAfterAtk struct {
ComList []*ComEffectSkill ComList []*ComEffectSkill
} }
//技能指令
type IComEffectSkill interface {
}
type ComEffectSkill struct { type ComEffectSkill struct {
To byte To int
} }
type ComMondifyBuff struct { type ComMondifyBuff struct {
ComEffectSkill ComEffectSkill
BuffId int Gid int64 //唯一实体id
Append bool BuffId int32 //配置id
OverlapNum int //叠加层数
Param float32 //参数 - 护盾量
Operate byte // 0 移除 1 添加 2 修改
} }
/// <summary> /// <summary>
@ -285,11 +362,19 @@ type ComMondifyBuff struct {
/// </summary> /// </summary>
func (this *ComMondifyBuff) Recycle() { func (this *ComMondifyBuff) Recycle() {
this.BuffId = 0 this.BuffId = 0
this.Append = false this.Operate = 0
this.To = 0 this.To = 0
} }
func (this *ComMondifyBuff) ToString() string { func (this *ComMondifyBuff) ToString() string {
var str = fmt.Sprintf("Buff变化 to={%d} buffId={%d} append={%t}", this.To, this.BuffId, this.Append) var operateStr string
if this.Operate == 0 {
operateStr = "移除"
} else if this.Operate == 1 {
operateStr = "添加"
} else {
operateStr = "修改"
}
var str = fmt.Sprintf("Buff变化 to={%d}gid={%d} buffId={%d} overlapNum={%d} operate={%s}", this.To, this.Gid, this.BuffId, this.OverlapNum, operateStr)
return str return str
} }
@ -298,11 +383,13 @@ func (this *ComMondifyBuff) ToString() string {
/// </summary> /// </summary>
type ComModifyHealth struct { type ComModifyHealth struct {
ComEffectSkill ComEffectSkill
HideDmg bool
From int
Baoji bool Baoji bool
Miss bool Miss bool
Num float32 Num float32
Nhp int Nhp int32
Mhp int Mhp int32
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,12 @@
package core
const StepNum int = 10
/// <summary>
/// 效果触发概率判断
/// </summary>
func Exec_Pr(pSkill IAfterSkill, pr int) bool {
randVal := pSkill.GetOwnerRole().GetFightBase().Rand(1, 1000)
// FightDebug.Log($"子技能 {pSkill.AfterSkillConf.Id} 效果触发概率判断:{randVal}, Bool: {randVal <= pr}");
return randVal <= pr
}

View File

@ -0,0 +1,260 @@
package core
import "go_dreamfactory/modules/battle/fight/attribute"
func Get(role IFightRole, attributeType int) *attribute.FixedNumeric {
switch PropertyType(attributeType) {
case PropertyType_Add_Hp: // 附加生命
return &role.GetCurrentHealth().CurrMaxHpAppend.BaseValue
case PropertyType_Add_Per_Hp: // 附加百分比生命
return &role.GetCurrentHealth().CurrMaxHpPro.BaseValue
case PropertyType_Add_Atk: // 附加攻击
return &role.GetData().Atk.AppendValue
case PropertyType_Add_Per_Atk: // 附加百分比攻击
return &role.GetData().Atk.ProValue
case PropertyType_Buff_Atk: // BUFF附加攻击
return &role.GetData().Atk.BuffValue
case PropertyType_Buff_Per_Atk: // BUFF附加百分比攻击
return &role.GetData().Atk.BuffProValue
case PropertyType_Add_Def: // 附加防御
return &role.GetData().Def.AppendValue
case PropertyType_Add_Per_Def: // 附加百分比防御
return &role.GetData().Def.ProValue
case PropertyType_Buff_Def: // BUFF附加防御
return &role.GetData().Def.BuffValue
case PropertyType_Buff_Per_Def: // BUFF附加百分比防御
return &role.GetData().Def.BuffProValue
case PropertyType_Add_Agi: // 附加速度
return &role.GetData().Speed.AppendValue
case PropertyType_Add_Per_Agi: // 附加百分比速度
return &role.GetData().Speed.ProValue
case PropertyType_Buff_Agi: // BUFF附加速度
return &role.GetData().Speed.BuffValue
case PropertyType_Buff_Per_Agi: // BUFF附加百分比速度
return &role.GetData().Speed.BuffProValue
case PropertyType_Add_Cri: // 附加暴击率
return &role.GetData().Critical.BuffProValue
case PropertyType_Add_CriDam: // 附加暴击伤害
return &role.GetData().CriticalPower.BuffProValue
case PropertyType_Add_EffHit: // 附加效果命中
return &role.GetData().EffectHit.BuffProValue
case PropertyType_Add_EffRe: // 附加效果抵抗
return &role.GetData().EfectResist.BuffProValue
case PropertyType_ActValue: // 行动值
return &role.GetData().Operate.BaseValue
case PropertyType_DamRe: // 伤害减免
return &role.GetData().DamRe.BaseValue
//30 DamRe 伤害减免
//31 CauseDam 造成伤害参数
//32 SufferDam 受到伤害参数
//33 MissPr 失手率
//34 KnowPr 会心率
//35 KnowPrDam 会心伤害
//36 AddEffPr 附加效果触发概率
//37 HpShield 生命护盾
//38 CauseHpShieldPer 护盾量百分比加成
//39 SufferHpShieldPer 受到护盾量百分比加成
//40 CauseAddHp 治疗量百分比加成
//41 SufferAddHp 受到治疗量百分比加成
//42 IgnoreDefPer 无视防御百分比
//43 SucHp 吸血百分比
//44 Add_SufCri 附加暴击抵抗
}
role.GetFightBase().Debugf("属性暂未绑定:%d", attributeType)
return nil
}
/// <summary>
/// 获取真实属性值
/// </summary>
func TryGetValue(role IFightRole, attributeType int, pValue *float32) bool {
var (
numeric *attribute.FixedNumeric
)
switch PropertyType(attributeType) {
case PropertyType_Total_Hp: // 总生命
*pValue = role.GetCurrentHealth().MaxHp.Value()
return true
case PropertyType_NowTotal_Hp: // 当前总生命
*pValue = role.GetCurrentHealth().CurrMaxHp.Value()
return true
case PropertyType_NowHp: // 当前生命
*pValue = role.GetCurrentHealth().Hp.Value()
return true
case PropertyType_Total_Atk: // 总攻击
*pValue = role.GetData().Atk.Value()
return true
case PropertyType_Total_Def: // 总防御
*pValue = role.GetData().Def.Value()
return true
case PropertyType_Total_Agi: // 总速度
*pValue = role.GetData().Speed.Value()
return true
case PropertyType_Total_Cri: // 总暴击率
*pValue = role.GetData().Critical.Value()
return true
case PropertyType_Total_CriDam: // 总暴击伤害
*pValue = role.GetData().CriticalPower.Value()
return true
case PropertyType_Total_EffHit: // 总效果命中
*pValue = role.GetData().EffectHit.Value()
return true
case PropertyType_Total_EffRe: // 总效果抵抗
*pValue = role.GetData().EfectResist.Value()
return true
case PropertyType_LostHp: // 已损失生命值
*pValue = role.GetCurrentHealth().Deduct()
return true
case PropertyType_LostPerHp: // 已损失生命值百分比
*pValue = role.GetCurrentHealth().LostPercent() * 1000
return true
case PropertyType_NowHp_Per: // 当前生命百分比
*pValue = role.GetCurrentHealth().Percent() * 1000
return true
}
numeric = Get(role, attributeType)
if numeric != nil {
*pValue = numeric.Value()
return true
}
*pValue = 0
return false
}
/// <summary>尝试设置属性</summary>
func TrySetValue(role IFightRole, attributeType int, pValue float32, add bool) bool {
var (
numeric *attribute.AttributeNumeric
attr attribute.FixedNumeric
value float32
f float32
)
switch PropertyType(attributeType) {
case PropertyType_Add_Hp: // 附加生命
var attri = role.GetCurrentHealth().CurrMaxHpAppend.BaseValue
if add {
value = attri.Add(pValue)
} else {
value = attri.Minus(pValue)
}
role.GetCurrentHealth().CurrMaxHpAppend.OnChange()
role.GetCurrentHealth().OnChange()
return true
case PropertyType_Add_Per_Hp: // 附加百分比生命
var attri = role.GetCurrentHealth().CurrMaxHpPro.BaseValue
if add {
value = attri.Add(pValue)
} else {
value = attri.Minus(pValue)
}
role.GetCurrentHealth().CurrMaxHpPro.OnChange()
role.GetCurrentHealth().OnChange()
return true
case PropertyType_Add_Atk: // 附加攻击
numeric = role.GetData().Atk
attr = role.GetData().Atk.AppendValue
break
case PropertyType_Add_Per_Atk: // 附加百分比攻击
numeric = role.GetData().Atk
attr = role.GetData().Atk.ProValue
break
case PropertyType_Buff_Atk: // BUFF附加攻击
numeric = role.GetData().Atk
attr = role.GetData().Atk.BuffValue
break
case PropertyType_Buff_Per_Atk: // BUFF附加百分比攻击
numeric = role.GetData().Atk
attr = role.GetData().Atk.BuffProValue
break
case PropertyType_Add_Def: // 附加防御
numeric = role.GetData().Def
attr = role.GetData().Def.AppendValue
break
case PropertyType_Add_Per_Def: // 附加百分比防御
numeric = role.GetData().Def
attr = role.GetData().Def.ProValue
break
case PropertyType_Buff_Def: // BUFF附加防御
numeric = role.GetData().Def
attr = role.GetData().Def.BuffValue
break
case PropertyType_Buff_Per_Def: // BUFF附加百分比防御
numeric = role.GetData().Def
attr = role.GetData().Def.BuffProValue
break
case PropertyType_Add_Agi: // 附加速度
numeric = role.GetData().Speed
attr = role.GetData().Speed.AppendValue
break
case PropertyType_Add_Per_Agi: // 附加百分比速度
numeric = role.GetData().Speed
attr = role.GetData().Speed.ProValue
break
case PropertyType_Buff_Agi: // BUFF附加速度
numeric = role.GetData().Speed
attr = role.GetData().Speed.BuffValue
break
case PropertyType_Buff_Per_Agi: // BUFF附加百分比速度
numeric = role.GetData().Speed
attr = role.GetData().Speed.BuffProValue
break
case PropertyType_Add_Cri: // 附加暴击率
numeric = role.GetData().Critical
attr = role.GetData().Critical.BuffProValue
break
case PropertyType_Add_CriDam: // 附加暴击伤害
numeric = role.GetData().CriticalPower
attr = role.GetData().CriticalPower.BuffProValue
break
case PropertyType_Add_EffHit: // 附加效果命中
numeric = role.GetData().EffectHit
attr = role.GetData().EffectHit.BuffProValue
break
case PropertyType_Add_EffRe: // 附加效果抵抗
numeric = role.GetData().EfectResist
attr = role.GetData().EfectResist.BuffProValue
break
case PropertyType_ActValue: // 行动值
numeric = role.GetData().Operate
attr = role.GetData().Operate.BaseValue
break
case PropertyType_DamRe: // 伤害减免
numeric = role.GetData().DamRe
attr = role.GetData().DamRe.BuffValue
break
case PropertyType_DamRe_Per: // 伤害减免(百分比)
numeric = role.GetData().DamRe
attr = role.GetData().DamRe.BuffProValue
break
case PropertyType_CauseDam: // 伤害提升
numeric = role.GetData().CauseDam
attr = role.GetData().DamRe.BuffValue
break
case PropertyType_CauseDam_Per: // 伤害提升(百分比)
numeric = role.GetData().CauseDam
attr = role.GetData().CauseDam.BuffProValue
break
case PropertyType_LostHold_per: // 失手率(百分比)
numeric = role.GetData().LostHold
attr = role.GetData().LostHold.BuffProValue
break
case PropertyType_UnderStand_per: // 会心率(百分比)
numeric = role.GetData().UnderStand
attr = role.GetData().UnderStand.BuffProValue
break
}
if numeric == nil {
role.GetFightBase().Debugf("属性暂未绑定:%d value:%f f:%f", attributeType, value, f)
return false
}
if add {
f = attr.Add(pValue)
} else {
f = attr.Minus(pValue)
}
numeric.OnChange()
return true
}

View File

@ -24,7 +24,7 @@ type FightRoleData struct {
/// <summary> /// <summary>
/// 唯一标记同时也是List FightBase.Roles的索引 /// 唯一标记同时也是List FightBase.Roles的索引
/// </summary> /// </summary>
Rid byte Rid int
/// <summary> /// <summary>
/// 唯一id, 用于调试打日志 /// 唯一id, 用于调试打日志
/// </summary> /// </summary>
@ -101,6 +101,24 @@ type FightRoleData struct {
/// 会心率 /// 会心率
/// </summary> /// </summary>
UnderStand *attribute.AttributeNumeric UnderStand *attribute.AttributeNumeric
/// <summary>
/// 伤害减免
/// </summary>
DamRe *attribute.AttributeNumeric
/// <summary>
/// 伤害提升
/// </summary>
CauseDam *attribute.AttributeNumeric
/// <summary>
/// 治疗加成
/// </summary>
TreAdd *attribute.AttributeNumeric
/// <summary>
/// 受疗加成
/// </summary>
BeTreAdd *attribute.AttributeNumeric
///region 技能相关----------------------------------------------------------------------- ///region 技能相关-----------------------------------------------------------------------
/// <summary> /// <summary>
@ -114,7 +132,7 @@ type FightRoleData struct {
/// <summary> /// <summary>
/// 最后一次skillAtk技能选择的目标 /// 最后一次skillAtk技能选择的目标
/// </summary> /// </summary>
LastChooseTarget []byte LastChooseTarget []int
/// <summary> /// <summary>
/// 可执行技能列表 /// 可执行技能列表
/// </summary> /// </summary>
@ -130,10 +148,10 @@ type FightRoleData struct {
/// <summary> /// <summary>
/// BUFF集合 /// BUFF集合
/// </summary> /// </summary>
BuffStore *BuffStore BuffStore IBuffStore
/// <summary> /// <summary>
/// 被动技能集合 /// 被动技能集合
/// </summary> /// </summary>
PassiveStore PassiveStore PassiveStore IPassiveStore
} }

View File

@ -0,0 +1,33 @@
package core
import "strconv"
type MapString map[string]string
func (this MapString) TryGetInt(pKey string) (result int, ok bool) {
var (
err error
v string
)
if v, ok = this[pKey]; ok {
if result, err = strconv.Atoi(v); err == nil {
return
}
}
result = 0
return
}
func (this MapString) TryGetFloat(pKey string, pResult *float32) bool {
var err error
var value float64
if v, ok := this[pKey]; ok {
if value, err = strconv.ParseFloat(v, 32); err == nil {
*pResult = 0
return false
} else {
*pResult = float32(value)
return true
}
}
return false
}

View File

@ -6,169 +6,169 @@ const (
/// <summary> /// <summary>
/// 总生命 /// 总生命
/// </summary> /// </summary>
PropertyType_Total_Hp = 1 PropertyType_Total_Hp PropertyType = 1
/// <summary> /// <summary>
/// 当前总生命 /// 当前总生命
/// </summary> /// </summary>
PropertyType_NowTotal_Hp = 2 PropertyType_NowTotal_Hp PropertyType = 2
/// <summary> /// <summary>
/// 当前生命 /// 当前生命
/// </summary> /// </summary>
PropertyType_NowHp = 3 PropertyType_NowHp PropertyType = 3
/// <summary> /// <summary>
/// 总攻击 /// 总攻击
/// </summary> /// </summary>
PropertyType_Total_Atk = 4 PropertyType_Total_Atk PropertyType = 4
/// <summary> /// <summary>
/// 总防御 /// 总防御
/// </summary> /// </summary>
PropertyType_Total_Def = 5 PropertyType_Total_Def PropertyType = 5
/// <summary> /// <summary>
/// 总速度 /// 总速度
/// </summary> /// </summary>
PropertyType_Total_Agi = 6 PropertyType_Total_Agi PropertyType = 6
/// <summary> /// <summary>
/// 总暴击率 /// 总暴击率
/// </summary> /// </summary>
PropertyType_Total_Cri = 7 PropertyType_Total_Cri PropertyType = 7
/// <summary> /// <summary>
/// 总暴击伤害 /// 总暴击伤害
/// </summary> /// </summary>
PropertyType_Total_CriDam = 8 PropertyType_Total_CriDam PropertyType = 8
/// <summary> /// <summary>
/// 总效果命中 /// 总效果命中
/// </summary> /// </summary>
PropertyType_Total_EffHit = 9 PropertyType_Total_EffHit PropertyType = 9
/// <summary> /// <summary>
/// 总效果抵抗 /// 总效果抵抗
/// </summary> /// </summary>
PropertyType_Total_EffRe = 10 PropertyType_Total_EffRe PropertyType = 10
/// <summary> /// <summary>
/// 已损失生命值 /// 已损失生命值
/// </summary> /// </summary>
PropertyType_LostHp = 11 PropertyType_LostHp PropertyType = 11
/// <summary> /// <summary>
/// 已损失生命值百分比 /// 已损失生命值百分比
/// </summary> /// </summary>
PropertyType_LostPerHp = 12 PropertyType_LostPerHp PropertyType = 12
/// <summary> /// <summary>
/// 当前生命百分比 /// 当前生命百分比
/// </summary> /// </summary>
PropertyType_NowHp_Per = 13 PropertyType_NowHp_Per PropertyType = 13
/// <summary> /// <summary>
/// 附加生命(修改属性类型从这里开始) /// 附加生命(修改属性类型从这里开始)
/// </summary> /// </summary>
PropertyType_Add_Hp = 14 PropertyType_Add_Hp PropertyType = 14
/// <summary> /// <summary>
/// 附加百分比生命 /// 附加百分比生命
/// </summary> /// </summary>
PropertyType_Add_Per_Hp = 15 PropertyType_Add_Per_Hp PropertyType = 15
/// <summary> /// <summary>
/// BUFF附加生命 /// BUFF附加生命
/// </summary> /// </summary>
PropertyType_Buff_Hp = 16 PropertyType_Buff_Hp PropertyType = 16
/// <summary> /// <summary>
/// BUFF附加百分比生命 /// BUFF附加百分比生命
/// </summary> /// </summary>
PropertyType_Buff_Per_Hp = 17 PropertyType_Buff_Per_Hp PropertyType = 17
/// <summary> /// <summary>
/// 附加攻击 /// 附加攻击
/// </summary> /// </summary>
PropertyType_Add_Atk = 18 PropertyType_Add_Atk PropertyType = 18
/// <summary> /// <summary>
/// 附加百分比攻击 /// 附加百分比攻击
/// </summary> /// </summary>
PropertyType_Add_Per_Atk = 19 PropertyType_Add_Per_Atk PropertyType = 19
/// <summary> /// <summary>
/// BUFF附加攻击 /// BUFF附加攻击
/// </summary> /// </summary>
PropertyType_Buff_Atk = 20 PropertyType_Buff_Atk PropertyType = 20
/// <summary> /// <summary>
/// BUFF附加百分比攻击 /// BUFF附加百分比攻击
/// </summary> /// </summary>
PropertyType_Buff_Per_Atk = 21 PropertyType_Buff_Per_Atk PropertyType = 21
/// <summary> /// <summary>
/// 附加防御 /// 附加防御
/// </summary> /// </summary>
PropertyType_Add_Def = 22 PropertyType_Add_Def PropertyType = 22
/// <summary> /// <summary>
/// 附加百分比防御 /// 附加百分比防御
/// </summary> /// </summary>
PropertyType_Add_Per_Def = 23 PropertyType_Add_Per_Def PropertyType = 23
/// <summary> /// <summary>
/// BUFF附加防御 /// BUFF附加防御
/// </summary> /// </summary>
PropertyType_Buff_Def = 24 PropertyType_Buff_Def PropertyType = 24
/// <summary> /// <summary>
/// BUFF附加百分比防御 /// BUFF附加百分比防御
/// </summary> /// </summary>
PropertyType_Buff_Per_Def = 25 PropertyType_Buff_Per_Def PropertyType = 25
/// <summary> /// <summary>
/// 附加速度 /// 附加速度
/// </summary> /// </summary>
PropertyType_Add_Agi = 26 PropertyType_Add_Agi PropertyType = 26
/// <summary> /// <summary>
/// 附加百分比速度 /// 附加百分比速度
/// </summary> /// </summary>
PropertyType_Add_Per_Agi = 27 PropertyType_Add_Per_Agi PropertyType = 27
/// <summary> /// <summary>
/// BUFF附加速度 /// BUFF附加速度
/// </summary> /// </summary>
PropertyType_Buff_Agi = 28 PropertyType_Buff_Agi PropertyType = 28
/// <summary> /// <summary>
/// BUFF附加百分比速度 /// BUFF附加百分比速度
/// </summary> /// </summary>
PropertyType_Buff_Per_Agi = 29 PropertyType_Buff_Per_Agi PropertyType = 29
/// <summary> /// <summary>
/// 附加暴击率 /// 附加暴击率
/// </summary> /// </summary>
PropertyType_Add_Cri = 30 PropertyType_Add_Cri PropertyType = 30
/// <summary> /// <summary>
/// 附加暴击伤害 /// 附加暴击伤害
/// </summary> /// </summary>
PropertyType_Add_CriDam = 31 PropertyType_Add_CriDam PropertyType = 31
/// <summary> /// <summary>
/// 附加效果命中 /// 附加效果命中
/// </summary> /// </summary>
PropertyType_Add_EffHit = 32 PropertyType_Add_EffHit PropertyType = 32
/// <summary> /// <summary>
/// 附加效果抵抗 /// 附加效果抵抗
/// </summary> /// </summary>
PropertyType_Add_EffRe = 33 PropertyType_Add_EffRe PropertyType = 33
/// <summary> /// <summary>
/// 行动值 /// 行动值
/// </summary> /// </summary>
PropertyType_ActValue = 34 PropertyType_ActValue PropertyType = 34
/// <summary> /// <summary>
/// 伤害减免(buff附加百分比) /// 伤害减免(buff附加百分比)
/// </summary> /// </summary>
PropertyType_DamRe_Per = 35 PropertyType_DamRe_Per PropertyType = 35
/// <summary> /// <summary>
/// 伤害提升(buff附加百分比) /// 伤害提升(buff附加百分比)
/// </summary> /// </summary>
PropertyType_CauseDam_Per = 36 PropertyType_CauseDam_Per PropertyType = 36
/// <summary> /// <summary>
/// 伤害减免(固定值) /// 伤害减免(固定值)
/// </summary> /// </summary>
PropertyType_DamRe = 37 PropertyType_DamRe PropertyType = 37
/// <summary> /// <summary>
/// 伤害提升(固定值) /// 伤害提升(固定值)
/// </summary> /// </summary>
PropertyType_CauseDam = 38 PropertyType_CauseDam PropertyType = 38
/// <summary> /// <summary>
/// 失手率buff增加百分比 /// 失手率buff增加百分比
/// </summary> /// </summary>
PropertyType_LostHold_per = 39 PropertyType_LostHold_per PropertyType = 39
/// <summary> /// <summary>
/// 会心率buff增加百分比 /// 会心率buff增加百分比
/// </summary> /// </summary>
PropertyType_UnderStand_per = 40 PropertyType_UnderStand_per PropertyType = 40
/// <summary> /// <summary>
/// 治疗加成 /// 治疗加成
/// </summary> /// </summary>
PropertyType_TreAdd = 41 PropertyType_TreAdd PropertyType = 41
/// <summary> /// <summary>
/// 受疗加成 /// 受疗加成
/// </summary> /// </summary>
PropertyType_BeTreAdd = 42 PropertyType_BeTreAdd PropertyType = 42
) )

View File

@ -2,6 +2,7 @@ package fight
import ( import (
"go_dreamfactory/modules/battle/fight/core" "go_dreamfactory/modules/battle/fight/core"
"math"
) )
type FightBase struct { type FightBase struct {
@ -24,9 +25,17 @@ type FightBase struct {
LastActionRole core.IFightRole LastActionRole core.IFightRole
/// 战斗AI /// 战斗AI
FightAI core.IFightAI FightAI core.IFightAI
/// <summary>
/// 随机数种子
/// </summary>
RandSeed int64
///事件系统 ///事件系统
FightEvent core.IFightEvent FightEvent core.IFightEvent
/// <summary> /// <summary>
/// 战报
/// </summary>
FightLog core.IFightLog
/// <summary>
/// 触发释放主技能,需要在当前出手角色技能释放完成之后再执行 /// 触发释放主技能,需要在当前出手角色技能释放完成之后再执行
/// </summary> /// </summary>
readyEmitSkills map[core.IFightRole]int32 readyEmitSkills map[core.IFightRole]int32
@ -166,11 +175,11 @@ func (this *FightBase) GetActionRole() core.IFightRole {
/// <param name="targetRid">选择的目标rid</param> /// <param name="targetRid">选择的目标rid</param>
func (this *FightBase) EmitSkill(skillId int32, targetRid []int32, toNextRound bool) { func (this *FightBase) EmitSkill(skillId int32, targetRid []int32, toNextRound bool) {
// FightDebug.Log($">>>>>>>> {LastActionRole.Data.UniqueId} 使用技能 skillid={skillId} 选择了Rid: {targetRid[0].ToString()}"); // FightDebug.Log($">>>>>>>> {LastActionRole.Data.UniqueId} 使用技能 skillid={skillId} 选择了Rid: {targetRid[0].ToString()}");
this.FightEvent.EmitForInt(int(skillId), this.LastActionRole)
this.LastActionRole.EmitSkill(skillId, targetRid) this.LastActionRole.EmitSkill(skillId, targetRid)
this.FightEvent.EmitForInt(int(core.EventType_OnRoundEnd), this.LastActionRole)
//主动技能触发所有带动作的子技能需要在主动技能释放完成之后执行 //主动技能触发所有带动作的子技能需要在主动技能释放完成之后执行
this.EmitPassiveMainSkill() this.EmitPassiveMainSkill()
this.FightEvent.EmitForInt(int(core.EventType_OnRoundEnd), this.LastActionRole)
this.FightEvent.EmitForInt(int(core.EventType_OnPreActionEnd), this.LastActionRole)
this.OnLastActionRoleActionStop() this.OnLastActionRoleActionStop()
} }
@ -194,3 +203,15 @@ func (this *FightBase) OnLastActionRoleActionStop() {
//检测战斗是否结束 //检测战斗是否结束
this.CheckFightEnd() this.CheckFightEnd()
} }
/// <summary>
/// 生成随机数
/// </summary>
/// <param name="minNum">最小值(含)</param>
/// <param name="maxNum">最大值(含)</param>
/// <returns></returns>
func (this *FightBase) Rand(min, max int) int {
RandSeed := (this.RandSeed*9301 + 49297) % 233280
num := int(math.Floor(float64(RandSeed/233280.0)*float64(max-min+1) + float64(min)))
return num
}

View File

@ -1,5 +1,65 @@
package fight package fight
import "reflect"
func NewFightEvent() *FightEvent {
return &FightEvent{
events: make(map[string][]reflect.Value),
}
}
type FightEvent struct { type FightEvent struct {
events map[string][]reflect.Value
onceevents map[string][]reflect.Value
}
/// <summary>
/// 发送消息
/// </summary>
/// <param name="key"></param>
/// <param name="args"></param>
func (this *FightEvent) Emit(key string, params ...interface{}) {
}
/// <summary>
/// 监听消息
/// </summary>
/// <param name="key"></param>
/// <param name="callback"></param>
func (this *FightEvent) On(key string, f interface{}) {
}
/// <summary>
/// 监听一次消息
/// </summary>
/// <param name="key"></param>
/// <param name="callback"></param>
func (this *FightEvent) Once(key string, f interface{}) {
}
/// <summary>
/// 移除监听消息
/// </summary>
/// <param name="key"></param>
/// <param name="callback"></param>
func (this *FightEvent) Off(key string, f interface{}) {
}
/// <summary>
/// 移除监听消息
/// </summary>
/// <param name="key"></param>
func (this *FightEvent) OffKey(key string) {
}
/// <summary>
/// 重置事件中心
/// </summary>
func (this *FightEvent) Clear() {
} }

View File

@ -0,0 +1,17 @@
package fight
import "go_dreamfactory/modules/battle/fight/core"
//战报
type FightLog struct {
FightBase core.IFight
Commands []interface{}
}
/// <summary>
/// 增加战报日志
/// </summary>
/// <param name="log"></param>
func (this *FightLog) AddCommand(object interface{}) {
this.Commands = append(this.Commands, object)
}

View File

@ -4,7 +4,6 @@ import (
"fmt" "fmt"
"go_dreamfactory/modules/battle/fight/attribute" "go_dreamfactory/modules/battle/fight/attribute"
"go_dreamfactory/modules/battle/fight/core" "go_dreamfactory/modules/battle/fight/core"
"go_dreamfactory/modules/battle/fight/passive"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
) )
@ -18,13 +17,17 @@ type FightRole struct {
/// 角色数据 /// 角色数据
/// </summary> /// </summary>
data core.FightRoleData data core.FightRoleData
CurrentHealth *attribute.HealthPoint currentHealth *attribute.HealthPoint
}
func (this *FightRole) GetCurrentHealth() *attribute.HealthPoint {
return this.currentHealth
} }
func (this *FightRole) Initialize(pData core.FightRoleData) { func (this *FightRole) Initialize(pData core.FightRoleData) {
// this.data = pData // this.data = pData
// this.CurrentHealth = attribute.NewHealthPoint(this.data.Hp) // this.currentHealth = attribute.NewHealthPoint(this.data.Hp)
// this.CurrentHealth.Reset() // this.currentHealth.Reset()
// this.data.BuffStore.OwnerRole = this // this.data.BuffStore.OwnerRole = this
// this.data.PassiveStore.OwnerRole = this // this.data.PassiveStore.OwnerRole = this
} }
@ -33,13 +36,13 @@ func (this *FightRole) Initialize(pData core.FightRoleData) {
/// 接收伤害 /// 接收伤害
/// </summary> /// </summary>
func (this *FightRole) ReceiveDamage(DamageValue float32) { func (this *FightRole) ReceiveDamage(DamageValue float32) {
this.CurrentHealth.Minus(DamageValue) this.currentHealth.Minus(DamageValue)
// FightDebug.Log($"========接收伤害:{Data.UniqueId} 变化值={DamageValue} 当前血量={CurrentHealth.Value}"); // FightDebug.Log($"========接收伤害:{Data.UniqueId} 变化值={DamageValue} 当前血量={currentHealth.Value}");
if this.IsDead() { if this.IsDead() {
//有不死buff生命值设置为1 //有不死buff生命值设置为1
for _, v := range this.data.BuffStore.HasBuffTypes { for _, v := range this.data.BuffStore.GetHasBuffTypes() {
if v == cfg.GameBuffType_UNDEAD { if v == cfg.GameBuffType_UNDEAD {
this.CurrentHealth.Hp.SetFloat(1) this.currentHealth.Hp.SetFloat(1)
break break
} }
} }
@ -49,7 +52,7 @@ func (this *FightRole) ReceiveDamage(DamageValue float32) {
} }
func (this *FightRole) IsDead() bool { func (this *FightRole) IsDead() bool {
return this.CurrentHealth.Value() <= 0 return this.currentHealth.Value() <= 0
} }
func (this *FightRole) Dead() { func (this *FightRole) Dead() {
this.data.ALive = false this.data.ALive = false
@ -74,7 +77,7 @@ func (this *FightRole) Clear() {
buff.Clear() buff.Clear()
}) })
// //清理所有被动就能 // //清理所有被动就能
this.data.PassiveStore.ForEach(func(fp passive.IFightPassive) { this.data.PassiveStore.ForEach(func(fp core.IFightPassive) {
fp.Clear() fp.Clear()
}) })

View File

@ -2,6 +2,117 @@ package fight
import "go_dreamfactory/modules/battle/fight/core" import "go_dreamfactory/modules/battle/fight/core"
//From-------------------------------------------------------------------------------------------------------
/// <summary>
/// 从roles里过滤出符合From设定的对象List
/// </summary>
/// <param name="roles">筛选前List<FightRole></param>
/// <param name="skill">用哪个技能来筛选</param>
/// <returns>筛选后List<FightRole></returns>
func From(roles []core.IFightRole, skill core.IAfterSkill) []core.IFightRole {
from := skill.GetAfterSkillConf().From
if from == int32(core.AferSkillFromType_TriggerPassiveFrom) {
if source, ok := skill.GetOwnerRole().GetData().PassiveStore.TryGetPassive(skill.GetSourceSkillId()); ok && source.GetTriggerPassiveRole() != nil {
return []core.IFightRole{source.GetTriggerPassiveRole()}
} else {
// FightDebug.Error("没有找到该子技能的SourceSkill 或者 该被动的触发者为null")
}
return []core.IFightRole{}
}
return nil
}
/// <summary>
/// 从roles里过滤出符合设定的对象List
/// </summary>
/// <param name="roles">筛选前List<FightRole></param>
/// <param name="actionRole">当前行动role</param>
/// <param name="from">afterSkill里设置的From</param>
/// <returns></returns>
func FromByType(roles []core.IFightRole, actionRole core.IFightRole, from int) []core.IFightRole {
switch core.AferSkillFromType(from) {
case core.AferSkillFromType_All:
// 选所有
return roles
case core.AferSkillFromType_Friend: // 只选友方
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive && role.GetData().Side == actionRole.GetData().Side {
result = append(result, role)
}
}
return result
case core.AferSkillFromType_Enemy: // 只选敌方
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive && role.GetData().Side != actionRole.GetData().Side {
result = append(result, role)
}
}
return result
case core.AferSkillFromType_Self: // 只选自己
return []core.IFightRole{actionRole}
case core.AferSkillFromType_PlayerChoose:
// 只选skillAtk里选择的目标
if actionRole.GetData().LastChooseTarget == nil {
// 如果主技能是个被动, 则此值会为空
actionRole.GetData().LastChooseTarget = make([]int, 0)
}
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive {
for _, v := range actionRole.GetData().LastChooseTarget {
if v == role.GetData().Rid {
result = append(result, role)
}
}
}
}
return result
case core.AferSkillFromType_FriendExceptSelf:
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive && role.GetData().Side == actionRole.GetData().Side && role != actionRole {
result = append(result, role)
}
}
return result
case core.AferSkillFromType_EnemyExceptChoose: // 除选定目标外的其他敌方
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive && role.GetData().Side != actionRole.GetData().Side {
iskeep := false
for _, v := range actionRole.GetData().LastChooseTarget {
if v == role.GetData().Rid {
iskeep = true
}
}
if iskeep {
result = append(result, role)
}
}
}
return result
case core.AferSkillFromType_FriendExceptChoose: // 除选定目标外的其他友方
result := make([]core.IFightRole, 0)
for _, role := range roles {
if role.GetData().ALive && role.GetData().Side == actionRole.GetData().Side {
iskeep := false
for _, v := range actionRole.GetData().LastChooseTarget {
if v == role.GetData().Rid {
iskeep = true
}
}
if iskeep {
result = append(result, role)
}
}
}
return result
}
return []core.IFightRole{}
}
/// <summary> /// <summary>
/// 从roles里过滤出符合设定的对象List /// 从roles里过滤出符合设定的对象List
/// </summary> /// </summary>

View File

@ -1,6 +1,11 @@
package passive package passive
func NewFightCallSkillPas() IFightPassive { import (
"fmt"
"go_dreamfactory/modules/battle/fight/core"
)
func NewFightCallSkillPas() core.IFightPassive {
return &FightCallSkillPas{} return &FightCallSkillPas{}
} }
@ -10,3 +15,36 @@ func NewFightCallSkillPas() IFightPassive {
type FightCallSkillPas struct { type FightCallSkillPas struct {
FightPassive FightPassive
} }
func (this *FightCallSkillPas) OnEvent(argu []interface{}) {
this.FightPassive.OnEvent(argu)
this.ApplyAfterAtk()
}
/// <summary>
/// 执行子技能
/// </summary>
func (this *FightCallSkillPas) ApplyAfterAtk() {
// FightDebug.Log("触发被动执行子技能")
for _, skillId := range this.PassiveConf.Callback {
if fmt.Sprintf("%d", skillId)[0] == '1' {
this.OwnerRole.GetFightBase().AddPassiveMainSkill(this.OwnerRole, skillId)
} else {
afterSkill := this.OwnerRole.GetAfterAtk(skillId)
if afterSkill == nil {
continue
}
// 当前子技能的技能来源为当前被动
afterSkill.SetSourceSkillId(this.PassiveConf.Id)
//直接执行(执行成功才写入日志)
if afterSkill.Emit() {
//如果是其他子技能触发的就把日志写入该子技能中 不是就直接发送日志
if this.EmitAfterSkill != nil {
this.EmitAfterSkill.AddSkillLog(afterSkill.GetSkillLog())
return
}
afterSkill.SendSkillLog()
}
}
}
}

View File

@ -1,10 +1,422 @@
package passive package passive
type IFightPassive interface { import (
Clear() "fmt"
} "go_dreamfactory/modules/battle/fight"
"go_dreamfactory/modules/battle/fight/buff"
"go_dreamfactory/modules/battle/fight/core"
cfg "go_dreamfactory/sys/configure/structs"
"strconv"
)
type FightPassive struct { type FightPassive struct {
buff.FightBuffBase
/// <summary>
/// skillPassive 配置
/// </summary>
PassiveConf cfg.GameSkillPassiveData
/// <summary>
/// 这个被动是哪个角色给我施加的
/// </summary>
FromRole core.IFightRole
/// <summary>
/// 被动持有者
/// </summary>
OwnerRole core.IFightRole
/// <summary>
/// 触发被动的发起者(该角色触发了被动执行此子技能)
/// </summary>
TriggerPassiveRole core.IFightRole
/// <summary>
/// 触发被动的角色目标(该角色触发了被动执行此子技能)
/// </summary>
TriggerPassiveTarget core.IFightRole
/// <summary>
/// 条件检测参数
/// </summary>
AddConArgs core.MapString
/// <summary>
/// 触发此被动的子技能Id
/// </summary>
EmitAfterSkillId int32
EventType core.EventType
/// <summary>
/// 触发此被动的子技能(需要把战报输入到这个子技能中)
/// </summary>
EmitAfterSkill core.IAfterSkill
/// <summary>
/// 被动CD
/// </summary>
CD int
/// <summary>
/// 当前CD =0 才能触发
/// </summary>
CurrentCD int
/// <summary>
/// 每回合累计触发次数
/// </summary>
TotalEmitTimes int
}
func (this *FightPassive) GetTriggerPassiveRole() core.IFightRole {
return this.TriggerPassiveRole
}
func (this *FightPassive) OnActivate(param float32) {
this.EventType = this.CurEvent()
this.InitEvent()
}
//绑定被动-------------------------
/// <summary>
/// 初始化事件
/// </summary>
func (this *FightPassive) InitEvent() {
eventIndex := int(this.EventType)
if eventIndex != -1 {
this.OwnerRole.GetFightBase().GetFightEvent().OnForInt(
eventIndex,
this.OnReceiveEvent,
)
}
}
func (this *FightPassive) OnReceiveEvent(argu []interface{}) {
if !this.CheckEmit() {
return
}
if !this.CheckWhere(argu) {
return
}
this.FromRole.GetFightBase().Debugf("角色 %d 被动技能 %d 执行, 触发子技能: %d", this.OwnerRole.GetData().UniqueId, this.PassiveConf.Id, this.EmitAfterSkillId)
this.OnEvent(argu)
this.TotalEmitTimes++
this.EmitAfterSkill = nil
this.EmitAfterSkillId = 0
this.TriggerPassiveRole = nil
this.TriggerPassiveTarget = nil
}
/// <summary>
/// 接收到事件
/// </summary>
func (this *FightPassive) OnEvent(argu []interface{}) {
}
//触发被动---------------------------------------------------------------------------
func (this *FightPassive) CheckEmit() bool {
//需要先检查cd 再判断当前回合是否触发达上限
// FightDebug.Log($"{OwnerRole.Data.Rid}被动{PassiveConf.Id}当前CD={CurrentCD}TotalEmitTimes ={TotalEmitTimes},触发事件={EventType}");
if this.CurrentCD != 0 || int32(this.TotalEmitTimes) >= this.PassiveConf.MaxEmitTimes {
return false
}
randVal := int32(this.OwnerRole.GetFightBase().Rand(1, 1000))
// FightDebug.Log($"{OwnerRole.Data.Rid}被动技能 {PassiveConf.Id} 触发几率判断:{randVal}");
return randVal <= this.PassiveConf.PasPr
}
//检测逻辑----------------------------------------------------------------------------
func (this *FightPassive) CheckWhere(argu []interface{}) bool {
switch this.EventType {
case core.EventType_OnRoundStart: // 角色回合行动前
case core.EventType_OnRoundEnd: // 角色回合结束后
case core.EventType_OnSkillStart: // 行动结束前
case core.EventType_OnSkillEnd: // 行动结束后
// 参数 [发起者, ]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false
}
break
case core.EventType_OnPreEffect: // 准备执行效果前
// 参数 [发起者, afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false
}
if !this.CheckCondition(argu[1].(core.IAfterSkill)) {
return false
}
this.EmitAfterSkill = argu[1].(core.IAfterSkill)
this.EmitAfterSkillId = this.EmitAfterSkill.GetAfterSkillConf().Id
break
case core.EventType_OnPostGiveEffect: // 施加效果时
case core.EventType_OnPreReceiveEffect: // 受到效果执行前
case core.EventType_OnPostReceiveEffect: // 受到效果时
case core.EventType_OnPostGiveLostShield: // 击破护盾时
case core.EventType_OnPostReceiveLostShield: // 护盾被击破时
case core.EventType_OnDamage: // 造成伤害
case core.EventType_OnBeDamage: // 受到伤害
case core.EventType_OnPreTre: // 造成治疗前
case core.EventType_OnTreEnd: // 造成治疗后
case core.EventType_OnPreBeTre: // 受到治疗前
case core.EventType_OnBeTreEnd: // 受到治疗后
// 参数 [发起者, 目标者, afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckCondition(argu[2].(core.IAfterSkill)) {
return false
}
this.EmitAfterSkill = argu[2].(core.IAfterSkill)
this.EmitAfterSkillId = this.EmitAfterSkill.GetAfterSkillConf().Id
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
case core.EventType_OnPostGiveCriCal: // 暴击时
case core.EventType_OnPostReceiveCriCal: // 被暴击时
// 参数 [发起者, 目标者, 是否暴击, afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckCriCal(argu[2].(int)) {
return false
}
this.EmitAfterSkill = argu[3].(core.IAfterSkill)
this.EmitAfterSkillId = this.EmitAfterSkill.GetAfterSkillConf().Id
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
case core.EventType_OnCalcDmgEffect: // 受到伤害计算后
// 参数 [发起者, 目标者, 是否致死, afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckDeadDmg(argu[2].(int)) {
return false
}
this.EmitAfterSkill = argu[3].(core.IAfterSkill)
this.EmitAfterSkillId = this.EmitAfterSkill.GetAfterSkillConf().Id
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
case core.EventType_OnDeathDmg: // 受致死伤害后
// 参数 [发起者, 目标者]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckDeadDmg(argu[2].(int)) {
return false
}
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
case core.EventType_OnKill:
// 参数 [发起者, 目标者, afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckKillCondition(argu[2].(core.IAfterSkill)) {
return false
}
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
case core.EventType_OnRemoveBuffEnd:
case core.EventType_OnAddBuff:
// 参数 [发起者, 目标者, buff效果类型是否成功,afterSkill]
if !this.CheckTarget(argu[0].(core.IFightRole)) {
return false // , argu[1] as FightRole
}
if !this.CheckBuffCondition(argu[2].(int), argu[3].(bool)) {
return false
}
this.TriggerPassiveTarget = argu[1].(core.IFightRole)
break
}
this.TriggerPassiveRole = argu[0].(core.IFightRole)
return true
}
func (this *FightPassive) CheckKillCondition(skill core.IAfterSkill) bool {
for key, vlaue := range this.AddConArgs {
switch key {
case "SkillID": //死于某技能
if skill == nil {
return false
}
return fmt.Sprintf("%d", skill.GetAfterSkillConf().Id) == vlaue
}
}
return true
}
func (this *FightPassive) CheckBuffCondition(effect int, succ bool) bool {
for key, vlaue := range this.AddConArgs {
switch key {
case "EffType": //buff效果类型
if fmt.Sprintf("%d", effect) != vlaue {
return false
}
if result, ok := this.AddConArgs.TryGetInt("Result"); !ok {
// FightDebug.Error($"{PassiveConf.Id}参数配置错误EffType后面必须指定目标Result");
return false
} else {
if succ {
return result == 1
} else {
return result == 0
}
}
}
}
return true
}
/// <summary>
/// 检测目标
/// </summary>
/// <param name="pLaunch">发起者</param>
/// <param name="pRole">目标者</param>
func (this *FightPassive) CheckTarget(pLaunch core.IFightRole) bool {
// FightDebug.Log("开始目标检测-++++++++++++");
switch this.PassiveConf.TargetCheck {
case 0: // 全体
return true
case 1: // 友方
// 检测所有友军身上有没有目标为友军,施加效果时检测,并且效果标签为治疗的被动
return this.OwnerRole.GetData().Side == pLaunch.GetData().Side
case 2: // 敌方
// 检测敌方所有角色身上有没有目标为敌军,施加效果时检测,并且效果标签为治疗的被动
return pLaunch.GetData().Side != this.OwnerRole.GetData().Side
case 3: // 自身
// 检测自身身上有没有目标为自身,施加效果时检测,并且效果标签为治疗的被动
return this.OwnerRole.GetData().Rid == pLaunch.GetData().Rid
case 4: // 不包含自身的友方
// 不包含自身友军
return this.OwnerRole.GetData().Side == pLaunch.GetData().Side && this.OwnerRole.GetData().Rid != pLaunch.GetData().Rid
}
// FightDebug.Log("目标检测不通过-++++++++++++");
return false
}
/// <summary>
/// 检测暴击
/// </summary>
func (this *FightPassive) CheckCriCal(pCriCal int) bool {
if CriRely, ok := this.AddConArgs.TryGetInt("CriRely"); !ok {
return true
} else {
return CriRely == pCriCal
}
}
/// <summary>
/// 检测是否致死伤害
/// </summary>
func (this *FightPassive) CheckDeadDmg(pDead int) bool {
if LetDmg, ok := this.AddConArgs.TryGetInt("LetDmg"); !ok {
return true
} else {
return LetDmg == pDead
}
}
/// <summary>
/// 条件检测
/// </summary>
/// <param name="form">发起者</param>
/// <param name="to">目标者</param>
/// <param name="afterSkill">afterSkill</param>
/// <returns></returns>
func (this *FightPassive) CheckCondition(afterSkill core.IAfterSkill) bool {
// FightDebug.Log("开始条件检测-++++++++++++");
for key, vlaue := range this.AddConArgs {
vint, _ := strconv.Atoi(vlaue)
switch key {
case "Hpproless": //目标血量低于多少
if target, ok := this.AddConArgs.TryGetInt("Target"); !ok {
// FightDebug.Error($"{PassiveConf.Id}参数配置错误Hpproless后面必须指定目标Target");
return false
} else {
var list = fight.FromByType(this.OwnerRole.GetFightBase().GetRoles(), this.OwnerRole, target)
conform := false
for _, v := range list {
var pre float32 = 0
if core.TryGetValue(v, int(core.PropertyType_NowHp_Per), &pre) && pre < float32(vint) {
conform = true
}
}
if !conform {
return false
}
}
break
case "EffID":
if afterSkill.GetAfterSkillConf().Type != cfg.GameSkillEffectType_AddBuff {
return false
}
if afterSkill.GetSkillArgs()[0] != vint {
return false
}
break
case "EffType":
if afterSkill.GetAfterSkillConf().Type != cfg.GameSkillEffectType_AddBuff {
return false
}
var buffId = afterSkill.GetSkillArgs()[0]
var buffConf = this.OwnerRole.GetFightBase().GetSkillConfig(buffId, 1).(*cfg.GameSkillBuffData)
if buffConf == nil {
// FightDebug.Error($"子技能{afterSkill.AfterSkillConf.Id}参数配置添加buffID={buffId}没有配置");
return false
}
if int(buffConf.BuffType) != vint {
return false
}
break
}
}
// FightDebug.Log("条件检测通过-++++++++++++");
return true
}
func (this *FightPassive) CurEvent() core.EventType {
switch this.PassiveConf.When {
// 全局事件
case "RouFro":
return core.EventType_OnRoundStart
case "RouEnd":
return core.EventType_OnRoundEnd
// 角色事件
case "EffFro":
return core.EventType_OnPreEffect
case "ImpEff":
return core.EventType_OnPostGiveEffect
case "SufEffFro":
return core.EventType_OnPreReceiveEffect
case "SufDmg":
return core.EventType_OnCalcDmgEffect
case "SufEff":
return core.EventType_OnPostReceiveEffect
case "CriCal":
return core.EventType_OnPostGiveCriCal
case "CovCriCal":
return core.EventType_OnPostReceiveCriCal
case "ActEndFro":
case "SkillStart":
return core.EventType_OnSkillStart
case "ActEnd":
return core.EventType_OnSkillEnd
case "ShieldBro":
return core.EventType_OnPostReceiveLostShield
case "BreShield":
return core.EventType_OnPostGiveLostShield
case "Damage":
return core.EventType_OnDamage
case "BeDamage":
return core.EventType_OnBeDamage
case "Kill":
return core.EventType_OnKill
case "TreStart":
return core.EventType_OnPreTre
case "TreEnd":
return core.EventType_OnTreEnd
case "PreBeTre":
return core.EventType_OnPreBeTre
case "BeTreEnd":
return core.EventType_OnBeTreEnd
case "RemoveBuffEnd":
return core.EventType_OnRemoveBuffEnd
case "AddBuff":
return core.EventType_OnAddBuff
}
// FightDebug.Log($"被动技能触发时机{PassiveConf.When}配置错误");
return core.EventType_None
} }
func (this *FightPassive) Clear() { func (this *FightPassive) Clear() {

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 修改目标行动值
/// </summary>
type FightAddActValueSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 添加buff
/// </summary>
type FightAddBuffSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,7 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
type FightAddPasSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,7 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
type FightAveTreSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// BUFF回合类操作
/// </summary>
type FightBuffCDSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,7 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
type FightDmgSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 添加buff(从之前技能的效果值中取参数)
/// </summary>
type FightDpsByAddBuffSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 吸收目标行动值
/// </summary>
type FightDrawActValueSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 随机buff
/// </summary>
type FightRandBuffSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,7 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
type FightRemoveDebuffSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 抢夺目标属性
/// </summary>
type FightRobProSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,10 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 立即获得回合
/// </summary>
type FightRoundSkill struct {
skill.FightAfterSkill
}

View File

@ -0,0 +1,17 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// 转嫁buff
/// </summary>
type FightShiftBuffSkill struct {
skill.FightAfterSkill
}
/// <summary>
/// 执行技能逻辑
/// </summary>
func (this *FightShiftBuffSkill) DoLogic() {
}

View File

@ -0,0 +1,17 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
/// <summary>
/// Skill回合类操作
/// </summary>
type FightSkillCDSkill struct {
skill.FightAfterSkill
}
/// <summary>
/// 执行技能逻辑
/// </summary>
func (this *FightSkillCDSkill) DoLogic() {
}

View File

@ -0,0 +1,19 @@
package afteratk
import "go_dreamfactory/modules/battle/fight/skill"
type FightTreSkill struct {
skill.FightlEffectSkill
}
/// <summary>
/// 执行技能逻辑
/// </summary>
func (this *FightTreSkill) DoLogic() {
}
func (this *FightTreSkill) Clear() {
this.FightlEffectSkill.Clear()
this.EffectValue = 0
}

View File

@ -1,10 +1,24 @@
package skill package skill
import "go_dreamfactory/modules/battle/fight/core"
type FightAfterSkill struct { type FightAfterSkill struct {
/// <summary> /// <summary>
/// 技能效果是否生效 /// 技能效果是否生效
/// </summary> /// </summary>
TakeEffect bool TakeEffect bool
/// <summary>
/// 子技能效果列表
/// </summary>
ComList []*core.ComEffectSkill
}
/// <summary>
/// 子技能增加战报日志
/// </summary>
func (this *FightAfterSkill) AddLog(pCom *core.ComEffectSkill) {
this.ComList = append(this.ComList, pCom)
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,11 @@
package skill
type FightlEffectSkill struct {
FightAfterSkill
EffectValue float32
}
func (this *FightlEffectSkill) Clear() {
this.FightAfterSkill.Clear()
this.EffectValue = 0
}