refactor(fight): 重构战斗系统
- 优化了战斗逻辑和数据结构 - 修复了一些战斗相关的错误 - 提高了代码的可读性和可维护性
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"context"
|
||||
)
|
||||
|
||||
@@ -14,12 +13,12 @@ type EffectNode struct {
|
||||
duration int // 默认为-1 持续回合/次(0 = 即时生效,>0 = 回合数 ,负数是永久) 次数相当于重写回合
|
||||
|
||||
stacks int // 当前层数
|
||||
paramSize int
|
||||
ArgSize int
|
||||
maxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
|
||||
SideEffectArgs []int // 附加效果参数
|
||||
|
||||
Success bool // 是否执行成功 成功XXX,失败XXX
|
||||
target int // 传出作用对象,默认0是自身,1是作用于对面
|
||||
target bool // 传出作用对象,默认0是自身,1是作用于对面
|
||||
Flag int //过滤掉的战斗类型 pvp pve boss战斗,野怪全部生效
|
||||
//增加owner target,如果owner target都为自身,就回合效果结束后再使用回合效果
|
||||
}
|
||||
@@ -31,12 +30,12 @@ func (this *EffectNode) ID() int {
|
||||
}
|
||||
|
||||
// 传出作用对象,默认0是自身,1是作用于对面
|
||||
func (this *EffectNode) Target() int {
|
||||
func (this *EffectNode) Target() bool {
|
||||
|
||||
return this.target
|
||||
|
||||
}
|
||||
func (this *EffectNode) SetTarget(t int) {
|
||||
func (this *EffectNode) SetTarget(t bool) {
|
||||
|
||||
this.target = t
|
||||
|
||||
@@ -64,45 +63,8 @@ func (this *EffectNode) SetArgs(args []int) {
|
||||
this.SideEffectArgs = args
|
||||
|
||||
}
|
||||
func (this *EffectNode) ParamSize(t int) int {
|
||||
if t != 0 {
|
||||
this.paramSize = t
|
||||
}
|
||||
func (this *EffectNode) GetArgSize() int {
|
||||
|
||||
return this.paramSize
|
||||
|
||||
}
|
||||
func (this *EffectNode) GetSkill() *info.BattleSkillEntity {
|
||||
pet, ok := this.Ctx.Value(info.BattleSkillEntityCtx).(*info.BattleSkillEntity)
|
||||
|
||||
if !ok { //effect不一定来自技能,也有特性 能量珠 boss effect
|
||||
return nil
|
||||
}
|
||||
return pet
|
||||
|
||||
}
|
||||
|
||||
// 获取对方精灵
|
||||
|
||||
// // 获取我方输入源
|
||||
// func (this *EffectNode) GetInput() *info.BattleInputSourceEntity {
|
||||
// pet, _ := this.Ctx.Value(info.Input_ctx).(*info.BattleInputSourceEntity)
|
||||
|
||||
// return pet
|
||||
|
||||
// }
|
||||
|
||||
// 获取自身精灵
|
||||
func (this *EffectNode) GetOwnerPet() *info.BattlePetEntity {
|
||||
pet, _ := this.Ctx.Value(info.Pet_O_Ctx).(*info.BattlePetEntity)
|
||||
|
||||
return pet
|
||||
|
||||
}
|
||||
|
||||
func (this *EffectNode) GetTargetPet() *info.BattlePetEntity {
|
||||
pet, _ := this.Ctx.Value(info.Pet_T_Ctx).(*info.BattlePetEntity)
|
||||
|
||||
return pet
|
||||
return this.ArgSize
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user