51 lines
824 B
Go
51 lines
824 B
Go
package input
|
||
|
||
import "blazing/logic/service/fight/info"
|
||
|
||
type LegacySides struct {
|
||
Our *Input // 兼容旧 effect:当前执行侧
|
||
|
||
Opp *Input // 兼容旧 effect:当前执行侧的对位
|
||
|
||
}
|
||
|
||
type EffectBinding struct {
|
||
Source *Input // effect 绑定的输入源,等价于 e.GetInput()
|
||
|
||
Carrier *Input // 当前持有该 effect 的输入源
|
||
|
||
Target *Input // 当前 effect 实际作用/挂载的输入源
|
||
}
|
||
|
||
type Ctx struct {
|
||
LegacySides
|
||
EffectBinding
|
||
|
||
*info.SkillEntity //action本身
|
||
|
||
// *info.DamageZone //伤害
|
||
}
|
||
|
||
func (c *Ctx) Self() *Input {
|
||
if c == nil {
|
||
return nil
|
||
}
|
||
if c.Source != nil {
|
||
return c.Source
|
||
}
|
||
return c.Our
|
||
}
|
||
|
||
func (c *Ctx) Receiver() *Input {
|
||
if c == nil {
|
||
return nil
|
||
}
|
||
if c.Target != nil {
|
||
return c.Target
|
||
}
|
||
if c.Carrier != nil {
|
||
return c.Carrier
|
||
}
|
||
return c.Our
|
||
}
|