Files
bl/logic/service/fight/effect/841_845.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

140 lines
3.6 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"
)
func addSkillPowerPercent(skill *info.SkillEntity, percent alpacadecimal.Decimal) {
if skill == nil || percent.Cmp(alpacadecimal.Zero) <= 0 {
return
}
bonus := alpacadecimal.NewFromInt(int64(skill.XML.Power)).Mul(percent).Div(alpacadecimal.NewFromInt(100))
skill.XML.Power += int(bonus.IntPart())
}
// Effect 841: 使对手和自身同时降低1/{0}最大体力
type Effect841 struct {
node.EffectNode
}
func (e *Effect841) Skill_Use() bool {
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
selfDamage := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Our.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: selfDamage,
})
return true
}
// Effect 842: 若自身处于能力提升状态则造成的攻击伤害额外提升{0}%
type Effect842 struct {
node.EffectNode
}
func (e *Effect842) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if len(e.Args()) == 0 {
return true
}
if !e.Ctx().Our.HasPropADD() {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[0])
return true
}
// Effect 843: 下{0}回合令自身所有技能先制+{1}
type Effect843 struct {
node.EffectNode
}
func (e *Effect843) Skill_Use() bool {
addSubEffect(e.Ctx().Our, e.Ctx().Our, &e.EffectNode, &Effect843Sub{}, -1)
return true
}
type Effect843Sub struct {
RoundEffectArg0Base
}
func (e *Effect843Sub) ComparePre(fattack, sattack *action.SelectSkillAction) bool {
if sattack == nil || sattack.PlayerID != e.Ctx().Our.UserID || sattack.SkillEntity == nil {
return true
}
sattack.SkillEntity.XML.Priority += int(e.Args()[1].IntPart())
return true
}
// Effect 844: 若攻击未打出致命一击则吸取对手最大体力的1/{0}
type Effect844 struct {
node.EffectNode
}
func (e *Effect844) Skill_Use() bool {
skill := e.Ctx().SkillEntity
if skill == nil || skill.Category() == info.Category.STATUS || skill.AttackTime == 0 || skill.Crit != 0 {
return true
}
if len(e.Args()) == 0 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
damage := e.Ctx().Opp.CurrentPet.GetMaxHP().Div(e.Args()[0])
e.Ctx().Opp.Damage(e.Ctx().Our, &info.DamageZone{
Type: info.DamageType.Percent,
Damage: damage,
})
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, damage)
return true
}
// Effect 845: 若自身当前体力高于最大体力的1/{0}则威力提升{1}%
type Effect845 struct {
node.EffectNode
}
func (e *Effect845) SkillHit() bool {
if e.Ctx().SkillEntity == nil || e.Ctx().SkillEntity.Category() == info.Category.STATUS {
return true
}
if len(e.Args()) < 2 || e.Args()[0].Cmp(alpacadecimal.Zero) <= 0 {
return true
}
threshold := e.Ctx().Our.CurrentPet.GetMaxHP().Div(e.Args()[0])
if e.Ctx().Our.CurrentPet.GetHP().Cmp(threshold) <= 0 {
return true
}
addSkillPowerPercent(e.Ctx().SkillEntity, e.Args()[1])
return true
}
func init() {
input.InitEffect(input.EffectType.Skill, 841, &Effect841{})
input.InitEffect(input.EffectType.Skill, 842, &Effect842{})
input.InitEffect(input.EffectType.Skill, 843, &Effect843{})
input.InitEffect(input.EffectType.Skill, 844, &Effect844{})
input.InitEffect(input.EffectType.Skill, 845, &Effect845{})
}