Files
bl/logic/service/fight/effect/896_900.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

144 lines
3.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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.CurPet[0].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.CurPet[0].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.CurPet[0].GetMaxHP().Div(e.Args()[0])
threshold := e.Ctx().Our.CurPet[0].GetMaxHP().Div(e.Args()[1])
if e.Ctx().Our.CurPet[0].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{})
}