refactor: 重构效果系统中的上下文引用

This commit is contained in:
xinian
2026-04-04 07:22:28 +08:00
committed by cnb
parent 5a5a1db2a3
commit c89632b409
95 changed files with 221 additions and 207 deletions

View File

@@ -74,6 +74,15 @@ func (e *EffectNode) TargetInput() *input.Input {
func (e *EffectNode) OpponentInput() *input.Input {
return e.Ctx().Opp
}
// IsOwner reports whether the current phase's Our side owns this effect.
func (e *EffectNode) IsOwner() bool {
if e.Ctx().Our == nil || len(e.Ctx().Our.CurPet) == 0 || e.Ctx().Our.CurPet[0] == nil {
return false
}
return e.ID().GetCatchTime() == e.Ctx().Our.CurPet[0].Info.CatchTime
}
func (e *EffectNode) Ctx() *input.Ctx {
return &e.EffectContextHolder.Ctx