75 lines
1.5 KiB
Go
75 lines
1.5 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/action"
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 1115: 解除自身能力下降状态,解除成功则令对手下{0}次使用的攻击技能无效
|
|
type Effect1115 struct {
|
|
node.EffectNode
|
|
}
|
|
|
|
func (e *Effect1115) Skill_Use() bool {
|
|
cleared := false
|
|
for i, v := range e.Ctx().Our.Prop[:] {
|
|
if v >= 0 {
|
|
continue
|
|
}
|
|
if e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), 0) {
|
|
cleared = true
|
|
}
|
|
}
|
|
if !cleared || len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1115, int(e.Args()[0].IntPart()))
|
|
if effect != nil {
|
|
e.Ctx().Opp.AddEffect(e.Ctx().Our, effect)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1115Sub struct {
|
|
node.EffectNode
|
|
remaining int
|
|
}
|
|
|
|
func (e *Effect1115Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.EffectNode.SetArgs(t, a...)
|
|
e.Duration(-1)
|
|
if len(a) > 0 {
|
|
e.remaining = a[0]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1115Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
e.remaining--
|
|
if e.remaining <= 0 {
|
|
e.Alive(false)
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1115, &Effect1115{})
|
|
input.InitEffect(input.EffectType.Sub, 1115, &Effect1115Sub{})
|
|
}
|