Files
bl/logic/service/fight/effect/704_708.go
xinian 023128be25
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 新增战斗效果实现
新增大量战斗效果逻辑实现,包括效果ID 678-708、734-743、744-748,并更新对应的效果描述映射。
2026-03-30 20:19:41 +08:00

140 lines
3.4 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/input"
"blazing/logic/service/fight/node"
"github.com/alpacahq/alpacadecimal"
)
// Effect 704: 恢复{0}点体力,若当前体力低于{1}则直接回满
type Effect704 struct {
node.EffectNode
}
func (e *Effect704) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
healAmount := e.Args()[0]
currentHP := e.Ctx().Our.CurrentPet.GetHP()
if currentHP.Cmp(e.Args()[1]) < 0 {
healAmount = e.Ctx().Our.CurrentPet.GetMaxHP().Sub(currentHP)
}
if healAmount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
// Effect 705: 与对手互换当前体力
type Effect705 struct {
node.EffectNode
}
func (e *Effect705) OnSkill() bool {
ourHP := e.Ctx().Our.CurrentPet.Info.Hp
oppHP := e.Ctx().Opp.CurrentPet.Info.Hp
e.Ctx().Our.CurrentPet.Info.Hp = 0
e.Ctx().Our.CurrentPet.Info.ModelHP(int64(oppHP))
e.Ctx().Opp.CurrentPet.Info.Hp = 0
e.Ctx().Opp.CurrentPet.Info.ModelHP(int64(ourHP))
return true
}
// Effect 706: 将自身的能力下降状态{0}倍返还给对手
type Effect706 struct {
node.EffectNode
}
func (e *Effect706) OnSkill() bool {
if len(e.Args()) == 0 {
return true
}
multiplier := int8(e.Args()[0].IntPart())
if multiplier <= 0 {
return true
}
for i, v := range e.Ctx().Our.Prop[:] {
if v >= 0 {
continue
}
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), v*multiplier)
}
return true
}
// Effect 707: {0}回合内每回合使用技能恢复自身最大体力的1/{1}恢复体力时若自身体力低于最大体力的1/{2}则恢复效果翻倍
type Effect707 struct {
node.EffectNode
}
func (e *Effect707) Skill_Use() bool {
effect := e.Ctx().Our.InitEffect(input.EffectType.Sub, 707, e.SideEffectArgs...)
if effect != nil {
e.Ctx().Our.AddEffect(e.Ctx().Our, effect)
}
return true
}
type Effect707Sub struct {
RoundEffectArg0Base
}
func (e *Effect707Sub) Skill_Use() bool {
if len(e.Args()) < 3 {
return true
}
healAmount := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[1])
if e.Args()[2].IntPart() > 0 &&
e.Ctx().Our.CurrentPet.GetHP().Mul(e.Args()[2]).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) < 0 {
healAmount = healAmount.Mul(alpacadecimal.NewFromInt(2))
}
if healAmount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
// Effect 708: 恢复自身{0}点体力自身体力少于1/{1}时恢复效果翻倍
type Effect708 struct {
node.EffectNode
}
func (e *Effect708) OnSkill() bool {
if len(e.Args()) < 2 {
return true
}
healAmount := e.Args()[0]
if e.Args()[1].IntPart() > 0 &&
e.Ctx().Our.CurrentPet.GetHP().Mul(e.Args()[1]).Cmp(e.Ctx().Our.CurrentPet.GetMaxHP()) < 0 {
healAmount = healAmount.Mul(alpacadecimal.NewFromInt(2))
}
if healAmount.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 704, &Effect704{})
input.InitEffect(input.EffectType.Skill, 705, &Effect705{})
input.InitEffect(input.EffectType.Skill, 706, &Effect706{})
input.InitEffect(input.EffectType.Skill, 707, &Effect707{})
input.InitEffect(input.EffectType.Sub, 707, &Effect707Sub{})
input.InitEffect(input.EffectType.Skill, 708, &Effect708{})
}