package effect import ( "blazing/logic/service/fight/action" "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" "sync" ) /** * 降低对方 n 点 btl_Max体力 */ type Effect38 struct { node.EffectNode } func (e *Effect38) OnSkill() bool { if !e.Hit() { return true } ee := &Effect38_sub{} ee.EffectNode.Duration(-1) //给对方挂3回合子buff //ee.ID(e.ID() + int(input.EffectType.Sub)) //子效果ID tt := e.ID() tt.SetEffectType(input.EffectType.Sub) ee.ID(tt) ee.SetArgs(e.Ctx().Our, e.SideEffectArgs...) e.Ctx().Opp.AddEffect(e.Ctx().Our, ee) return true } // 命中之后 func (e *Effect38_sub) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { if e.Args()[0].Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) == -1 { e.l.Do(func() { e.oldtype = e.Ctx().Our.CurrentPet.Info.MaxHp e.Ctx().Our.CurrentPet.GetMaxHP().Sub(e.Args()[0]) }) } } func (e *Effect38_sub) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool { return true } type Effect38_sub struct { node.EffectNode oldtype uint32 l sync.Once } func (e *Effect38_sub) Alive(t ...bool) bool { if e.BoolisFalse(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来 //还原属性 e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype } return e.EffectNode.Alive(t...) } func init() { ret := &Effect38{} input.InitEffect(input.EffectType.Skill, 38, ret) }