修改支持镇魂歌效果

This commit is contained in:
1
2025-08-27 14:41:06 +00:00
parent a2fe2515d2
commit d5139816df
7 changed files with 61 additions and 69 deletions

View File

@@ -0,0 +1,41 @@
package effect
import (
"blazing/logic/service/fight/battle/node"
"blazing/logic/service/fight/info"
)
/**
* n回合内没有击败则对方死亡
*/
type Effect62 struct {
node.EffectNode
}
func init() {
info.NodeM.AddEffect(&Effect62{})
}
// 重写EFFectID
func (this *Effect62) ID() int {
this.EffectNode.ParamSize(1) //设置参数个数
return 62
}
// 激活,可以被断回合
func (this *Effect62) OnActive() bool {
this.Available = true
return true
}
func (this *Effect62) OnDamage() bool {
if this.Available { //如果本可用
//直接秒杀对方
}
return true
}

View File

@@ -6,6 +6,8 @@ func (this *EffectNode) PreActive() bool {
return true
}
// 激活回合,比如说镇魂歌秒杀
func (f *EffectNode) OnActive() bool {
panic("not implemented") // TODO: Implement
}

View File

@@ -16,7 +16,15 @@ func (this *EffectNode) PreTurnEnd() bool {
}
// 回合结束一次性effect清楚掉
// 如果是次数类的,那就相当于重写回合结束计数器
func (this *EffectNode) TurnEnd() bool {
this.duration--
// if this.duration > 0 {
// this.Duration(this.Duration(0) - 1) //回合数减1
// }
if this.duration != 0 { // 保留 (负数表示永久)
this.GetBattle().Effects.AddEffect(this) //重新添加buff到上下文
panic("not implemented") // TODO: Implement
}
return true
}

View File

@@ -1,26 +0,0 @@
package node
// 印记Mark相关触发 状态类
func (this *EffectNode) OnBeforeAddMark() bool {
panic("not implemented") // TODO: Implement
}
func (this *EffectNode) OnAnyMarkAdded() bool {
panic("not implemented") // TODO: Implement
}
func (this *EffectNode) OnMarkCreated() bool {
panic("not implemented") // TODO: Implement
}
func (this *EffectNode) OnMarkDurationEnd() bool {
panic("not implemented") // TODO: Implement
}
func (this *EffectNode) OnRemoveMark() bool {
panic("not implemented") // TODO: Implement
}
func (this *EffectNode) OnMarkDestroy() bool {
panic("not implemented") // TODO: Implement
}

View File

@@ -10,22 +10,16 @@ import (
type EffectNode struct {
//Turn int // 当前回合数 ,回合数其实从战斗的上下文中获取
//本质上ctx还要传入战斗双方数据来判断是否是本精灵切换
ctx context.Context //节点上下文
duration int // 默认为1 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久)
stacks int // 当前层数
paramSize int
maxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果
ctx context.Context //节点上下文
duration int // 默认为-1 持续回合/次0 = 即时生效,>0 = 回合数 ,负数是永久) 次数相当于重写回合
stacks int // 当前层数
paramSize int
maxStack int // 最大叠加层数 ,正常都是不允许叠加的,除了衰弱特殊效果 ,异常和能力的叠层
SideEffectArgs []int // 附加效果参数
Available bool // 是否可用 正常是命中就可用,镇魂歌是回合数到才可用
Success bool // 是否执行成功 成功XXX失败XXX
//LifeType EnumLifeType //回合效果 是否可持续 继承到下一直精灵 ,这个用重写事件来实现
// Parent string // 上下文来源(比如 "Skill"、"Buff"、"Passive"
// Trigger node.EnumEffectTrigger // 当前触发的节点
// Container *EffectContainer // 效果容器(通常挂在 Actor 身上)
// Effect *Effect // 当前正在执行的 Effect
// Available bool // 是否可用
// Success bool // 是否执行成功
// Done bool // 是否中止后续执行
}
func (this *EffectNode) ID() int {

View File

@@ -51,7 +51,7 @@ type BattlePetEntity struct {
// 状态条件(如中毒、烧伤等)
statusConditions sync.Map // key: StatusCondition, value: int (剩余回合)
UnitAttributes map[EnumAttrType]*Attribute //todo 待获取精灵信息然后映射
UnitAttributes map[EnumAttrType]*Attribute //todo 待获取精灵信息然后映射 本质上是叠层
skills [4]*BattleSkillEntity // 技能槽最多4个技能

View File

@@ -30,22 +30,9 @@ type Effect interface {
OnDefeat() bool // 精灵被击败时触发
// BeforeTransform EnumEffectTrigger enum:"19" // 变形 / 进化前触发
// OnTransform EnumEffectTrigger enum:"20" // 精灵变形 / 进化时触发
// AfterTransform EnumEffectTrigger enum:"21" // 变形 / 进化后触发
// OnTransformEnd EnumEffectTrigger enum:"22" // 变形 / 进化结束时触发
PreTurnEnd() bool // 回合结束前
TurnEnd() bool // 回合结束
// 印记Mark相关触发
OnBeforeAddMark() bool // 添加印记前触发
OnAnyMarkAdded() bool // 任何印记添加时触发
OnMarkCreated() bool // 印记创建时触发
OnMarkDurationEnd() bool // 印记持续回合结束时触发
OnRemoveMark() bool // 移除印记时触发
OnMarkDestroy() bool // 印记销毁时触发
// 堆叠Stack相关触发
OnStackBefore() bool // 堆叠效果前触发
OnStack() bool // 堆叠效果触发
@@ -109,20 +96,6 @@ func (c *NodeManager) AddEffect(e Effect) {
c.Effects = append(c.Effects, e)
}
// 每回合结束时调用,用于处理持续时间
func (c *NodeManager) Tick() {
var remain []Effect
for _, eff := range c.Effects {
if eff.Duration(0) > 0 {
eff.Duration(eff.Duration(0) - 1) //回合数减1
}
if eff.Duration(0) != 0 { // 保留 (负数表示永久)
remain = append(remain, eff)
}
}
c.Effects = remain
}
// 删除
func (c *NodeManager) RemoveEffect(e Effect) {
var remain []Effect