feat: 实现战斗效果逻辑和接口重构
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
xinian
2026-03-28 21:57:22 +08:00
committed by cnb
parent 0780eae582
commit 875ad668aa
332 changed files with 2062 additions and 1442 deletions

View File

@@ -1,13 +1,65 @@
package effect
import (
"blazing/logic/service/fight/action"
"blazing/logic/service/fight/input"
"github.com/alpacahq/alpacadecimal"
)
// 58. 按一定条件触发魔王的愤怒,触发时,战斗等级提升至一定状态,可以被消强化(SideEffect="33")恢复至正常状态(+6)a1-a6: atk/def/sp_atk/sp_def/spd/accuracy-1为不设置
// TODO: 实现按一定条件触发魔王的愤怒,触发时,战斗等级提升至一定状态,可以被消强化(SideEffect="33")恢复至正常状态(+6)a1-a6: atk/def/sp_atk/sp_def/spd/accuracy-1为不设置的核心逻辑
type NewSel58 struct {
NewSel0
active bool
used bool
}
func (e *NewSel58) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
if !e.IsOwner() || e.used {
return
}
currentHP := e.Ctx().Our.CurrentPet.GetHP()
maxHP := e.Ctx().Our.CurrentPet.GetMaxHP()
if maxHP.IntPart() == 0 {
return
}
// 当前仓库里没有更具体的触发参数,采用半血触发作为兜底实现。
if currentHP.Mul(alpacadecimal.NewFromInt(2)).Cmp(maxHP) == 1 {
return
}
e.used = true
e.active = true
for i, arg := range e.Args() {
if arg.IntPart() < 0 {
continue
}
target := int8(arg.IntPart())
if target > e.Ctx().Our.AttackValue.Prop[i] {
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), target-e.Ctx().Our.AttackValue.Prop[i])
}
}
}
func (e *NewSel58) TurnEnd() {
if !e.IsOwner() || !e.active {
return
}
hasPositive := false
for i, arg := range e.Args() {
if arg.IntPart() < 0 {
continue
}
if e.Ctx().Our.AttackValue.Prop[i] > 0 {
hasPositive = true
break
}
}
if !hasPositive {
e.active = false
}
}
func init() {