Files
bl/logic/service/fight/effect/658_662.go
xinian 7a7fae05ea
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
feat: 新增战斗技能效果648-677
2026-03-30 12:11:44 +08:00

157 lines
3.8 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 658: 下次受到攻击伤害后于对手出手流程结束反馈伤害值{0}%的百分比伤害
type Effect658 struct {
node.EffectNode
}
func (e *Effect658) Skill_Use() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect658Sub{}, -1)
return true
}
type Effect658Sub struct {
FixedDurationNeg1Base
damageToReflect alpacadecimal.Decimal
}
func (e *Effect658Sub) SetArgs(t *input.Input, a ...int) {
setArgsWithFixedDuration(&e.EffectNode, t, -1, a...)
}
func (e *Effect658Sub) DamageSubEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red || e.damageToReflect.Cmp(alpacadecimal.Zero) > 0 {
return true
}
if zone.Damage.Cmp(alpacadecimal.Zero) <= 0 || len(e.Args()) == 0 {
return true
}
percent := e.Args()[0]
if percent.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.damageToReflect = zone.Damage.Mul(percent).Div(alpacadecimal.NewFromInt(100))
return true
}
func (e *Effect658Sub) Action_end_ex() bool {
if e.damageToReflect.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: e.damageToReflect,
})
e.damageToReflect = alpacadecimal.Zero
e.Alive(false)
return true
}
// Effect 659: {0}回合内若对手使用{1}攻击,则恢复{2}点体力
type Effect659 struct {
RoundEffectArg0Base
}
func (e *Effect659) Skill_Use_ex() bool {
if !matchSkillMode(e.Ctx().SkillEntity, int(e.Args()[1].IntPart())) {
return true
}
if e.Args()[2].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, e.Args()[2])
return true
}
// Effect 660: 消除{0}状态,消除成功恢复{1}%的体力
type Effect660 struct {
node.EffectNode
}
func (e *Effect660) Skill_Use() bool {
if !clearStatusEffects(e.Ctx().Our, int(e.Args()[0].IntPart())) {
return true
}
heal := e.Ctx().Our.CurrentPet.GetMaxHP().Mul(e.Args()[1]).Div(alpacadecimal.NewFromInt(100))
if heal.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, heal)
return true
}
// Effect 661: 消除{0}状态,消除成功{1}回合内受到{2}点固定伤害
type Effect661 struct {
node.EffectNode
}
func (e *Effect661) Skill_Use() bool {
if !clearStatusEffects(e.Ctx().Our, int(e.Args()[0].IntPart())) {
return true
}
subEffect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 661, int(e.Args()[1].IntPart()), int(e.Args()[2].IntPart()))
if subEffect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, subEffect)
}
return true
}
type Effect661Sub struct {
RoundEffectArg0Base
}
func (e *Effect661Sub) TurnEnd() {
damage := e.Args()[1]
if damage.Cmp(alpacadecimal.Zero) > 0 {
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
}
e.EffectNode.TurnEnd()
}
// Effect 662: {0}回合内免疫致命一击伤害
type Effect662 struct {
RoundEffectArg0Base
}
func (e *Effect662) DamageLockEx(zone *info.DamageZone) bool {
if zone == nil || zone.Type != info.DamageType.Red {
return true
}
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Crit == 0 {
return true
}
zone.Damage = alpacadecimal.Zero
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 658, &Effect658{})
input.InitEffect(input.EffectType.Sub, 658, &Effect658Sub{})
input.InitEffect(input.EffectType.Skill, 659, &Effect659{})
input.InitEffect(input.EffectType.Skill, 660, &Effect660{})
input.InitEffect(input.EffectType.Skill, 661, &Effect661{})
input.InitEffect(input.EffectType.Sub, 661, &Effect661Sub{})
input.InitEffect(input.EffectType.Skill, 662, &Effect662{})
}