Files
bl/logic/service/fight/effect/668_672.go
xinian 66fdc3d189
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
feat: 实现技能效果 627-672 及 1011-1111
2026-03-29 19:00:08 +08:00

145 lines
3.2 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 668: 若对手处于能力提升状态则先制额外+1
type Effect668 struct {
node.EffectNode
}
func (e *Effect668) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.Ctx().Opp.HasPropADD() {
return true
}
if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil {
return true
}
sattack.SkillEntity.XML.Priority += 1
return true
}
// Effect 669: 当回合击败对手则下回合自身攻击先制+1
type Effect669 struct {
FixedDuration1Base
triggered bool
}
func (e *Effect669) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
return true
}
if in != e.Ctx().Opp {
return true
}
if e.Ctx().Opp.CurrentPet.Alive() {
e.Alive(false)
return true
}
e.triggered = true
return true
}
func (e *Effect669) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if !e.triggered || !shouldAdjustNextAttackPriority(e, fattack, sattack) {
return true
}
if sattack.SkillEntity.Category() == info.Category.STATUS {
return true
}
sattack.SkillEntity.XML.Priority += 1
return true
}
// Effect 670: {0}回合,每回合附加{1}的{2}值的{3}%的百分比伤害
type Effect670 struct {
RoundEffectArg0Base
}
func (e *Effect670) Skill_Use() bool {
target := e.Ctx().Our
if int(e.Args()[1].IntPart()) == 1 {
target = e.Ctx().Opp
}
propID := int(e.Args()[2].IntPart())
if propID < 0 || propID >= 6 {
return true
}
damage := target.GetProp(propID).Mul(e.Args()[3]).Div(alpacadecimal.NewFromInt(100))
if damage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Fixed,
Damage: damage,
})
return true
}
// Effect 671: 若对手处于异常状态则恢复造成伤害的{0}%的体力
type Effect671 struct {
node.EffectNode
}
func (e *Effect671) Skill_Use() bool {
if !e.Ctx().Opp.StatEffect_Exist_all() {
return true
}
if e.Ctx().Our.SumDamage.Cmp(alpacadecimal.Zero) <= 0 {
return true
}
heal := e.Ctx().Our.SumDamage.Mul(e.Args()[0]).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 672: 当回合击败对手则恢复自身全部体力
type Effect672 struct {
FixedDuration1Base
}
func (e *Effect672) SwitchOut(in *input.Input) bool {
if in == e.Ctx().Our {
e.Alive(false)
return true
}
if in != e.Ctx().Opp {
return true
}
if e.Ctx().Opp.CurrentPet.Alive() {
e.Alive(false)
return true
}
maxHp := e.Ctx().Our.CurrentPet.GetMaxHP()
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, maxHp)
e.Alive(false)
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 668, &Effect668{})
input.InitEffect(input.EffectType.Skill, 669, &Effect669{})
input.InitEffect(input.EffectType.Skill, 670, &Effect670{})
input.InitEffect(input.EffectType.Skill, 671, &Effect671{})
input.InitEffect(input.EffectType.Skill, 672, &Effect672{})
}