docs(effects): 移除已完成的技能效果任务文档 移除 effects 956-1005、1263-1312、1695-1734 等范围内的未实现技能效果任务文档, 这些任务已经完成实现,相关文档不再需要维护。 ```
144 lines
3.5 KiB
Go
144 lines
3.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 896: 双倍反转自身的能力下降
|
||
type Effect896 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect896) Skill_Use() bool {
|
||
for i, v := range e.Ctx().Our.Prop[:] {
|
||
if v >= 0 {
|
||
continue
|
||
}
|
||
e.Ctx().Our.SetProp(e.Ctx().Our, int8(i), -v*2)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 897: 未击败对手则令自身下{0}次受到的攻击伤害额外减少{1}%
|
||
type Effect897 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect897) Skill_Use() bool {
|
||
if len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
if e.Ctx().Opp.CurrentPet.Info.Hp <= 0 {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 897, int(e.Args()[0].IntPart()), int(e.Args()[1].IntPart()))
|
||
if sub != nil {
|
||
e.Ctx().Our.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect897Sub struct {
|
||
node.EffectNode
|
||
remaining int
|
||
}
|
||
|
||
func (e *Effect897Sub) SetArgs(t *input.Input, a ...int) {
|
||
e.EffectNode.SetArgs(t, a...)
|
||
e.Duration(-1)
|
||
if len(a) > 0 {
|
||
e.remaining = a[0]
|
||
}
|
||
}
|
||
|
||
func (e *Effect897Sub) DamageLockEx(zone *info.DamageZone) bool {
|
||
if zone == nil || zone.Type != info.DamageType.Red || e.remaining <= 0 || len(e.Args()) < 2 {
|
||
return true
|
||
}
|
||
reduce := zone.Damage.Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
|
||
if reduce.Cmp(zone.Damage) >= 0 {
|
||
zone.Damage = alpacadecimal.Zero
|
||
} else {
|
||
zone.Damage = zone.Damage.Sub(reduce)
|
||
}
|
||
e.remaining--
|
||
if e.remaining <= 0 {
|
||
e.Alive(false)
|
||
}
|
||
return true
|
||
}
|
||
|
||
// Effect 898: 若对手不是雄性精灵,则恢复{0}点体力
|
||
type Effect898 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect898) OnSkill() bool {
|
||
if len(e.Args()) == 0 || e.Ctx().Opp.CurrentPet.Info.Gender == 1 {
|
||
return true
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[0])
|
||
return true
|
||
}
|
||
|
||
// Effect 899: 若自身先出手,则本回合对手释放的属性技能失效
|
||
type Effect899 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect899) Skill_Use() bool {
|
||
if !e.IsFirst() {
|
||
return true
|
||
}
|
||
sub := e.Ctx().Our.InitEffect(input.EffectType.Sub, 899)
|
||
if sub != nil {
|
||
e.Ctx().Opp.AddEffect(e.Ctx().Our, sub)
|
||
}
|
||
return true
|
||
}
|
||
|
||
type Effect899Sub struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect899Sub) ActionStart(a, b *action.SelectSkillAction) bool {
|
||
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() != info.Category.STATUS {
|
||
return true
|
||
}
|
||
e.Ctx().SkillEntity.SetMiss()
|
||
return true
|
||
}
|
||
|
||
// Effect 900: 恢复自身最大体力的1/{0},体力少于1/{1}时恢复效果翻倍
|
||
type Effect900 struct {
|
||
node.EffectNode
|
||
}
|
||
|
||
func (e *Effect900) OnSkill() bool {
|
||
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 || e.Args()[1].Cmp(alpacadecimal.Zero) <= 0 {
|
||
return true
|
||
}
|
||
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
|
||
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
|
||
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) < 0 {
|
||
heal = heal.Mul(alpacadecimal.NewFromInt(2))
|
||
}
|
||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
|
||
return true
|
||
}
|
||
|
||
func init() {
|
||
input.InitEffect(input.EffectType.Skill, 896, &Effect896{})
|
||
input.InitEffect(input.EffectType.Skill, 897, &Effect897{})
|
||
input.InitEffect(input.EffectType.Sub, 897, &Effect897Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 898, &Effect898{})
|
||
input.InitEffect(input.EffectType.Skill, 899, &Effect899{})
|
||
input.InitEffect(input.EffectType.Sub, 899, &Effect899Sub{})
|
||
input.InitEffect(input.EffectType.Skill, 900, &Effect900{})
|
||
}
|