feat: 为NewSeIdx_403添加持续伤害效果实现
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

重构持续伤害效果逻辑,移除状态效果的创建与添加,改为直接使用remainingTurns字段记录剩余回合数
在ActionEndEx中处理伤害触发和回合数初始化
新增TurnEnd方法处理每回合剩余回合数递减
This commit is contained in:
xinian
2026-02-26 17:53:55 +08:00
committed by cnb
parent 3157c4d41a
commit fcba504618

View File

@@ -1,6 +1,7 @@
package effect
import (
"blazing/logic/service/fight/info"
"blazing/logic/service/fight/input"
)
@@ -8,6 +9,8 @@ import (
// TODO: 需要实现一个持续伤害的状态效果
type NewSel403 struct {
NewSel0
// 记录剩余减伤回合数
remainingTurns int
}
func (e *NewSel403) ActionEndEx() bool {
@@ -15,31 +18,28 @@ func (e *NewSel403) ActionEndEx() bool {
if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime {
return true
}
if e.remainingTurns > 0 {
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.Args()[2],
})
}
// n%几率触发
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
if !success {
return true
}
e.remainingTurns = int(e.Args()[1].IntPart())
// 创建持续伤害的状态效果
// 这里使用ID 0来创建自定义持续效果m回合
statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, 0)
if statusEffect == nil {
return true
}
// 设置参数:回合数=a2每回合扣血=a3
statusEffect.SetArgs(e.Ctx().Opp,
int(e.Args()[1].IntPart()), // 持续回合数
int(e.Args()[2].IntPart()), // 每回合减少的体力
)
// 给对手添加状态
e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect)
return true
}
func (e *NewSel403) TurnEnd() {
// 每回合减少减伤效果剩余回合数
if e.remainingTurns > 0 {
e.remainingTurns--
}
}
func init() {
input.InitEffect(input.EffectType.NewSel, 403, &NewSel403{})
}