Files
bl/logic/service/fight/effect/effect_38.go

76 lines
1.5 KiB
Go
Raw Normal View History

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 {
2025-11-17 19:31:51 +00:00
if e.BoolisFalse(t...) { //说明到了回合结束取消节点,那么就将变化过的属性变化回来
2025-11-17 19:31:51 +00:00
//还原属性
e.Ctx().Our.CurrentPet.Info.MaxHp = e.oldtype
}
2025-11-16 20:30:17 +00:00
return e.EffectNode.Alive(t...)
}
func init() {
ret := &Effect38{}
input.InitEffect(input.EffectType.Skill, 38, ret)
}