refactor: 重构战斗系统为统一动作包结构
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-06 00:58:23 +08:00
committed by cnb
parent 141ba67014
commit f433a26a6d
12 changed files with 683 additions and 158 deletions

View File

@@ -1,25 +1,31 @@
package effect
import (
"blazing/logic/service/fight/input"
)
import "blazing/logic/service/fight/input"
// 502. g2. 如果自身死亡, 恢复队友所有体力和PP值
// TODO: 实现恢复队友所有体力和PP值的核心逻辑
type NewSel502 struct {
NewSel0
}
// TODO: 需要找到精灵死亡时的回调接口
// SwitchOut 在拥有者死亡离场时触发;把仍在场的队友体力和 PP 恢复到满值。
func (e *NewSel502) SwitchOut(in *input.Input) bool {
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
owner := e.SourceInput()
if owner == nil || in != owner || !e.IsOwner() {
return true
}
currentPet := owner.CurrentPet()
if currentPet == nil || currentPet.Info.Hp > 0 {
return true
}
// TODO: 检查精灵是否死亡HP为0
// 如果死亡恢复队友所有体力和PP值
// 需要遍历队友的精灵并调用相应的方法
for _, teammate := range owner.LivingTeammates() {
pet := teammate.CurrentPet()
if pet == nil {
continue
}
pet.Info.Hp = pet.Info.MaxHp
teammate.HealPP(-1)
}
return true
}