Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
实现1383-1387技能效果,包括自然祝福状态下的属性强化、自然祝福层数管理、护盾效果等
67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
package effect
|
|
|
|
import (
|
|
"blazing/logic/service/fight/info"
|
|
"blazing/logic/service/fight/input"
|
|
"blazing/logic/service/fight/node"
|
|
|
|
"github.com/alpacahq/alpacadecimal"
|
|
)
|
|
|
|
// Effect 1390: {0}%令对手{1},未触发则{2}回合内每回合{3}%闪避对手攻击
|
|
type Effect1390 struct{ node.EffectNode }
|
|
|
|
func (e *Effect1390) OnSkill() bool {
|
|
if len(e.Args()) < 4 || e.Ctx().Opp == nil || e.Ctx().SkillEntity == nil {
|
|
return true
|
|
}
|
|
if e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
success, _, _ := e.Input.Player.Roll(int(e.Args()[0].IntPart()), 100)
|
|
if success {
|
|
addStatusByID(e.Ctx().Our, e.Ctx().Opp, int(e.Args()[1].IntPart()))
|
|
return true
|
|
}
|
|
|
|
duration := int(e.Args()[2].IntPart())
|
|
if duration <= 0 || e.Args()[3].Cmp(alpacadecimal.Zero) <= 0 {
|
|
return true
|
|
}
|
|
|
|
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 1390, duration, int(e.Args()[3].IntPart()))
|
|
if sub != nil {
|
|
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
|
}
|
|
return true
|
|
}
|
|
|
|
type Effect1390Sub struct {
|
|
RoundEffectArg0Base
|
|
dodgePercent int
|
|
}
|
|
|
|
func (e *Effect1390Sub) SetArgs(t *input.Input, a ...int) {
|
|
e.RoundEffectArg0Base.SetArgs(t, a...)
|
|
if len(a) > 1 {
|
|
e.dodgePercent = a[1]
|
|
}
|
|
}
|
|
|
|
func (e *Effect1390Sub) SkillHit_ex() bool {
|
|
if e.dodgePercent <= 0 || e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
|
|
return true
|
|
}
|
|
|
|
if ok, _, _ := e.Input.Player.Roll(e.dodgePercent, 100); ok {
|
|
e.Ctx().SkillEntity.SetMiss()
|
|
}
|
|
return true
|
|
}
|
|
|
|
func init() {
|
|
input.InitEffect(input.EffectType.Skill, 1390, &Effect1390{})
|
|
input.InitEffect(input.EffectType.Sub, 1390, &Effect1390Sub{})
|
|
}
|